| 2585 | pub fn inspector_picker_rows(state: &EditorState) -> Vec<String> { |
| 2586 | inspector_picker_entries(state) |
| 2587 | .into_iter() |
| 2588 | .skip(state.inspector_picker_offset) |
| 2589 | .take(MAX_INSPECTOR_PICKER_ROWS) |
| 2590 | .map(|entry| entry.label) |
| 2591 | .collect() |
| 2592 | } |
| 2593 | |
| 2594 | pub fn inspector_picker_title(state: &EditorState) -> String { |
| 2595 | if state.inspector_picker_field.is_empty() { |
| 2596 | return "Pick".to_string(); |
| 2597 | } |
| 2598 | match state.inspector_picker_kind.as_str() { |
| 2599 | "node" => format!("Pick Node {}", state.inspector_picker_field), |
| 2600 | "script_node" | "value_node" => inspector_node_picker_title(state), |
| 2601 | "script_enum" | "value_enum" => "Pick Enum".to_string(), |
| 2602 | "value_asset" | "asset" => inspector_asset_picker_title(state), |
| 2603 | "anim_field" => "Add Track\npick property".to_string(), |
| 2604 | _ => "Pick".to_string(), |
| 2605 | } |
| 2606 | } |
| 2607 | |
| 2608 | fn inspector_node_picker_title(state: &EditorState) -> String { |
| 2609 | let refs = inspector_picker_node_ref_types(state); |
| 2610 | if refs.is_empty() { |
| 2611 | return "Select Node".to_string(); |
| 2612 | } |
| 2613 | format!("Select a\n{}", refs.join(", ")) |
| 2614 | } |
| 2615 | |
| 2616 | fn inspector_asset_picker_title(state: &EditorState) -> String { |
| 2617 | let Some(kind) = inspector_picker_asset_kind(state) else { |
| 2618 | return "Select Asset".to_string(); |
| 2619 | }; |
| 2620 | format!("Select a\n{kind:?}") |
| 2621 | } |
| 2622 | |
| 2623 | fn inspector_enum_picker_entries(state: &EditorState) -> Vec<InspectorPickerEntry> { |
| 2624 | let Ok(row_idx) = state.inspector_picker_field.parse::<usize>() else { |