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

Function inspector_node_picker_entries

perro_editor/res/scripts/ui/editor_ui.rs:2126–2160  ·  view source on GitHub ↗
(state: &EditorState)

Source from the content-addressed store, hash-verified

2124 true
2125}
2126
2127pub fn inspector_value_fields_for_node(
2128 scene_fields: &[(SceneFieldName, SceneValue)],
2129 script_fields: &[(SceneFieldName, SceneValue)],
2130) -> Vec<(SceneFieldName, SceneValue)> {
2131 let mut out = Vec::new();
2132 if !script_fields.is_empty() {
2133 out.push((
2134 SceneFieldName::from_name("script_vars".to_string()),
2135 SceneValue::Object(Cow::Owned(script_fields.to_vec())),
2136 ));
2137 }
2138 out.extend_from_slice(scene_fields);
2139 out
2140}
2141
2142fn inspector_var_button_label(row: &InspectorValueRow) -> String {
2143 let value = row.value.trim();
2144 if row.kind.starts_with("Node") && matches!(value, "" | "null" | "none" | "-") {
2145 return node_ref_button_label(&row.kind);
2146 }
2147 if row.kind.starts_with("Asset(") && matches!(value, "" | "null" | "none" | "-") {
2148 let asset_ty = asset_ref_assign_label(&row.kind);
2149 return format!("Assign {asset_ty}");
2150 }
2151 row.value.clone()
2152}
2153
2154fn node_ref_button_label(kind: &str) -> String {
2155 format!("Assign {}", node_ref_assign_label(kind))
2156}
2157
2158fn node_ref_assign_label(kind: &str) -> String {
2159 let Some(refs) = node_ref_names_from_kind(kind) else {
2160 return "Node".to_string();
2161 };
2162 if refs.is_empty() {
2163 return "Node".to_string();

Callers 1

inspector_picker_entriesFunction · 0.85

Calls 10

cached_scene_doc_sharedFunction · 0.85
node_ref_type_allowsFunction · 0.85
scene_node_pathFunction · 0.85
key_name_or_idMethod · 0.80
parseFunction · 0.50
is_emptyMethod · 0.45
iterMethod · 0.45
allMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected