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

Function asset_binding_for_node

perro_editor/res/scripts/scene/editor_nodes.rs:781–810  ·  view source on GitHub ↗
(
    path: &str,
    node_type: &str,
    glb_mesh_index: usize,
    _glb_mat_index: usize,
)

Source from the content-addressed store, hash-verified

779 set_scene_string(&mut data, field, value);
780 if field == "mesh" && is_gltf_path(&asset_path) {
781 set_scene_string(
782 &mut data,
783 "material",
784 format!("{asset_path}:mat[{}]", state.active_glb_mat_index),
785 );
786 }
787 }
788 }
789 apply_spawn_position(&mut data, state);
790 let parent = state.selected_key.map(SceneKey::new).or(doc.scene.root);
791 doc.scene.key_names.to_mut().push(Cow::Owned(name.clone()));
792 doc.scene.nodes.to_mut().push(SceneNodeEntry {
793 data,
794 has_data_override: true,
795 key,
796 name: None,
797 tags: Cow::Owned(Vec::new()),
798 children: Cow::Owned(Vec::new()),
799 parent,
800 script,
801 clear_script: false,
802 root_of,
803 script_vars: Cow::Owned(Vec::new()),
804 });
805 doc.normalize_links();
806 set_state_scene_doc(state, &doc);
807 state.selected_key = Some(next_id);
808 if let Some(mode) = viewport_mode_for_node_type(node_type) {
809 state.viewport_mode = mode.to_string();
810 }
811 state.dirty = true;
812 state.sidebar_mode = "scene".to_string();
813 state.activity_mode = "scene".to_string();

Callers

nothing calls this directly

Calls 4

asset_kind_for_pathFunction · 0.85
scene_node_asset_fieldsFunction · 0.85
asset_field_valueFunction · 0.85
okMethod · 0.80

Tested by

no test coverage detected