MCPcopy Create free account
hub / github.com/PerroEngine/Perro / select_node_slot

Function select_node_slot

perro_editor/res/scripts/scene/editor_nodes.rs:85–121  ·  view source on GitHub ↗
(ctx: &mut ScriptContext<'_, API>, idx: usize)

Source from the content-addressed store, hash-verified

83 }
84}
85pub fn select_node_slot<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>, idx: usize) {
86 let key = with_state!(ctx.run, EditorState, ctx.id, |state| {
87 if state.doc_text.is_empty() {
88 None
89 } else {
90 let doc = cached_scene_doc_shared(&state.doc_text);
91 scene_tree_view(
92 &doc,
93 state.selected_key,
94 &state.scene_filter,
95 &state.collapsed_scene_keys,
96 )
97 .keys
98 .get(idx)
99 .copied()
100 }
101 }).unwrap_or_default();
102 if let Some(key) = key {
103 let _ = with_state_mut!(ctx.run, EditorState, ctx.id, |state| {
104 state.selected_key = Some(key);
105 if let Some(mode) = selected_node_viewport_mode(&state.doc_text, key) {
106 state.viewport_mode = mode.to_string();
107 }
108 if selected_node_type_name(&state.doc_text, key).as_deref() == Some("AnimationPlayer") {
109 state.activity_mode = "scene".to_string();
110 state.anim_drawer_open = true;
111 state.active_anim_player_key = Some(key);
112 state.active_glb_path.clear();
113 state.active_glb_summary.clear();
114 if let Some(path) = selected_node_field_text(&state.doc_text, key, "animation") {
115 state.active_anim_path = path;
116 }
117 }
118 });
119 refresh_selection_panels(ctx);
120 }
121}
122
123pub fn click_scene_node_slot<API: ScriptAPI + ?Sized>(
124 ctx: &mut ScriptContext<'_, API>,

Callers 1

click_scene_node_slotFunction · 0.85

Calls 1

refresh_selection_panelsFunction · 0.85

Tested by

no test coverage detected