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

Function push_scene_tree_row

perro_editor/res/scripts/ui/editor_ui.rs:2913–2960  ·  view source on GitHub ↗
(
    doc: &SceneDoc,
    index: &SceneDocIndex,
    key: u32,
    depth: usize,
    selected_key: Option<u32>,
    collapsed_keys: &[u32],
    visited: &mut Vec<u32>,
    out: &mut SceneTreeRows,
)

Source from the content-addressed store, hash-verified

2911 SceneValue::UVec3 { x, y, z } => format!("({x}, {y}, {z})"),
2912 SceneValue::UVec4 { x, y, z, w } => format!("({x}, {y}, {z}, {w})"),
2913 SceneValue::Array(values) => {
2914 let values = values
2915 .iter()
2916 .map(scene_value_edit_text)
2917 .collect::<Vec<_>>()
2918 .join(", ");
2919 format!("[{values}]")
2920 }
2921 SceneValue::Object(fields) => {
2922 let fields = fields
2923 .iter()
2924 .map(|(name, value)| {
2925 format!("{} = {}", name.as_ref(), scene_value_edit_text(value))
2926 })
2927 .collect::<Vec<_>>()
2928 .join(", ");
2929 format!("{{ {fields} }}")
2930 }
2931 }
2932}
2933
2934pub fn inspector_node_ref_label(value: &str) -> String {
2935 let value = value.trim();
2936 let bare = value.trim_start_matches('@');
2937 if value.is_empty() || matches!(bare, "null" | "none" | "-") {
2938 "Select Node".to_string()
2939 } else {
2940 format!("Node {value}")
2941 }
2942}
2943
2944pub fn format_compact_f32(value: f32) -> String {
2945 let text = format!("{value:.4}");
2946 let text = text.trim_end_matches('0').trim_end_matches('.');
2947 if text.is_empty() || text == "-" {
2948 "0".to_string()
2949 } else {
2950 text.to_string()
2951 }
2952}
2953
2954pub fn asset_user_text(state: &EditorState, path: &str) -> String {
2955 if state.doc_text.is_empty() || path.ends_with('/') {
2956 return "users: -".to_string();
2957 }
2958 let doc = cached_scene_doc_shared(&state.doc_text);
2959 let mut users = Vec::new();
2960 for node in doc.scene.nodes.iter() {
2961 if !node_uses_asset_path(node, path) {
2962 continue;
2963 }

Callers 1

scene_tree_viewFunction · 0.85

Calls 14

scene_row_labelFunction · 0.85
scene_node_badgesFunction · 0.85
scene_node_iconFunction · 0.85
scene_row_disclosureFunction · 0.85
child_countMethod · 0.80
key_name_or_idMethod · 0.80
type_nameMethod · 0.80
child_keysMethod · 0.80
lenMethod · 0.45
containsMethod · 0.45
nodeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected