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

Function animation_drawer_text

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

Source from the content-addressed store, hash-verified

2520 } else {
2521 0.001
2522 },
2523 0.0,
2524 0.0,
2525 0.0,
2526 );
2527 set_ui_display(ctx, &children_name, child_total > 0.0);
2528}
2529
2530#[derive(Clone)]
2531pub struct InspectorPickerEntry {
2532 pub value: String,
2533 pub label: String,
2534}
2535
2536pub fn inspector_picker_entries(state: &EditorState) -> Vec<InspectorPickerEntry> {
2537 match state.inspector_picker_kind.as_str() {
2538 "node" | "script_node" | "value_node" => inspector_node_picker_entries(state),
2539 "script_enum" | "value_enum" => inspector_enum_picker_entries(state),
2540 "asset" | "value_asset" => inspector_asset_picker_entries(state),
2541 "anim_field" => inspector_anim_field_picker_entries(state),
2542 _ => Vec::new(),
2543 }
2544}
2545
2546fn inspector_anim_field_picker_entries(state: &EditorState) -> Vec<InspectorPickerEntry> {
2547 let Some(key) = state.selected_key else {
2548 return Vec::new();
2549 };
2550 let Some(node) = cached_scene_node(&state.doc_text, key) else {
2551 return Vec::new();
2552 };
2553 let filter = state.inspector_picker_filter.to_ascii_lowercase();
2554 let mut entries: Vec<InspectorPickerEntry> = Vec::new();
2555 // When a skeleton bone is selected, offer its pose sub-fields as bone-path
2556 // tracks in addition to the node's flat animatable fields.
2557 let is_skeleton = node.data.node_type.is_a(perro_scene::NodeType::Skeleton2D)
2558 || node.data.node_type.is_a(perro_scene::NodeType::Skeleton3D);
2559 if is_skeleton && !state.anim_selected_bone_name.is_empty() {
2560 for sub in crate::scripts::scene::editor_panim::BONE_TRACK_SUBFIELDS {
2561 let field = crate::scripts::scene::editor_panim::bone_track_field(
2562 &state.anim_selected_bone_name,
2563 sub,
2564 );
2565 entries.push(InspectorPickerEntry {
2566 value: field.clone(),
2567 label: field,
2568 });
2569 }
2570 }
2571 entries.extend(
2572 crate::scripts::scene::editor_panim::animatable_fields(node.data.type_name())
2573 .into_iter()
2574 .map(|field| InspectorPickerEntry {
2575 value: field.to_string(),
2576 label: field.to_string(),
2577 }),
2578 );
2579 entries

Callers 1

from_stateMethod · 0.85

Calls 9

panim_summaryFunction · 0.85
cached_scene_doc_sharedFunction · 0.85
selected_node_field_textFunction · 0.85
cloneMethod · 0.80
findMethod · 0.80
key_name_or_idMethod · 0.80
is_emptyMethod · 0.45
iterMethod · 0.45
as_u32Method · 0.45

Tested by

no test coverage detected