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

Function rename_value_row

perro_editor/res/scripts/ui/inspector_value_row.rs:419–443  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    root_id: NodeID,
    idx: usize,
)

Source from the content-addressed store, hash-verified

417 let cache = INSPECTOR_ROW_TEMPLATES.get_or_init(|| Mutex::new(Vec::new()));
418 let Ok(mut guard) = cache.lock() else {
419 return;
420 };
421 while guard.len() <= idx {
422 guard.push(None);
423 }
424 guard[idx] = template;
425}
426
427fn rename_value_row<API: ScriptAPI + ?Sized>(
428 ctx: &mut ScriptContext<'_, API>,
429 root_id: NodeID,
430 idx: usize,
431) {
432 let mut stack = vec![root_id];
433 while let Some(id) = stack.pop() {
434 if let Some(children) = ctx.run.Nodes().get_node_children_ids(id) {
435 stack.extend(children);
436 }
437 let Some(name) = ctx
438 .run
439 .Nodes()
440 .get_node_name(id)
441 .map(|name| name.to_string())
442 else {
443 continue;
444 };
445 let next = match value_row_instance_name(&name, idx) {
446 Some(next) => next,

Callers 1

Calls 7

value_row_instance_nameFunction · 0.85
NodesMethod · 0.80
extendMethod · 0.80
popMethod · 0.45
get_node_children_idsMethod · 0.45
get_node_nameMethod · 0.45
set_node_nameMethod · 0.45

Tested by

no test coverage detected