Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow dynamic configuration of forces through blueprints #8278

Closed
Tracked by #7897
grtlr opened this issue Dec 2, 2024 · 1 comment · Fixed by #8299
Closed
Tracked by #7897

Allow dynamic configuration of forces through blueprints #8278

grtlr opened this issue Dec 2, 2024 · 1 comment · Fixed by #8299
Assignees
Labels
feat-graph-view Everything related to the graph view

Comments

@grtlr
Copy link
Contributor

grtlr commented Dec 2, 2024

No description provided.

@grtlr grtlr added the feat-graph-view Everything related to the graph view label Dec 2, 2024
@abey79
Copy link
Member

abey79 commented Dec 2, 2024

As discussed in today's huddle:

=============================================================================
PLAN C:


archetype LinkForce {
    link_force: component.LinkForce (datatype: datatype.LinkForce)
}


datatype LinkForce {
    enabled: ForceEnabled (datatype: Bool)
    strength: ForceStrength (datatype: Float)
    distance: Distance (datatype: Float)
}


TODO:

fn selection_ui() {
    view_property_ui::<LinkForce>(ctx, ui, view_id, self, state);
}

in re_component_ui: single and/or multiline editor for component.LinkForce

custom __init__ for `component.LinkForce`

(maybe optional?) custom native_to_pa_array for `datatype.LinkForce`
   - flexible python API input ==> NEEDED
   - custom serialization compared to the codegen'd one ===> NOT NEEDED
other plans
PLAN A:


archetype Forces {
    node_force: component.NodeForce
}


component NodeForce {
    force: datatype.NodeForce
}


datatype NodeForce {
    enabled: Bool
    strength: Float
    //....
}

-> multiline and single line edit for component.NodeForce


=============================================================================
PLAN B:



archetype LayoutMode {
    mode: component.LayoutMode (enum: None, Force, Tree)
} 

archetype LinkForce {
    enabled: ForceEnabled (datatype: Bool)
    strength: ForceStrength (datatype: Float)
    distance: Distance (datatype: Float)
}

archetype PositionForce {
    enabled: ForceEnabled (datatype: Bool)
    strength: ForceStrength (datatype: Float)
    position: Position2D
}


fn ui() {

    view_property_ui::<LayoutMode>(ctx, ui, view_id, self, state);
    let mode = ...; // manually read some view property
    
    
    switch mode {
    
        case LayoutMode::None => {
            // no additional properties
        }
        
        case LayoutMode::Force => {
            view_property_ui::<LinkForce>(ctx, ui, view_id, self, state);
            view_property_ui::<PositionForce>(ctx, ui, view_id, self, state);
        }
        
        case LayoutMode::Tree => {
            view_property_ui::<TreeLayout>(ctx, ui, view_id, self, state);
        }
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat-graph-view Everything related to the graph view
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants