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

Function set_file_tree_list

perro_editor/res/scripts/ui/editor_ui.rs:4637–4728  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    view: &EditorView,
)

Source from the content-addressed store, hash-verified

4635 name: &str,
4636 selected: bool,
4637 indicator: RowIndicator,
4638) {
4639 set_button_fill(ctx, name, if selected { theme::ACCENT } else { "#00000000" });
4640 set_indicator_shape(ctx, &format!("{name}_indicator"), indicator);
4641}
4642
4643pub fn set_indicator_shape<API: ScriptAPI + ?Sized>(
4644 ctx: &mut ScriptContext<'_, API>,
4645 name: &str,
4646 indicator: RowIndicator,
4647) {
4648 let Some(id) = find_named(ctx, name) else {
4649 return;
4650 };
4651 let _ = with_node_mut!(ctx.run, UiShape, id, |node| {
4652 node.visible = indicator != RowIndicator::None;
4653 node.transform.rotation = match indicator {
4654 RowIndicator::Expanded => std::f32::consts::FRAC_PI_2,
4655 RowIndicator::Collapsed | RowIndicator::None => 0.0,
4656 };
4657 });
4658}
4659
4660pub fn apply_viewport_mode<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>, mode: &str) {
4661 let window_aspect = viewport_window_aspect(ctx);
4662 let stream_size = viewport_stream_size_ratio(window_aspect);
4663 set_grid_visible(ctx, "viewport_grid", false);
4664 set_ui_center_size(ctx, "viewport_stream_2d", stream_size);
4665 set_ui_center_size(ctx, "viewport_stream_3d", stream_size);
4666 set_ui_center_size(ctx, "viewport_click_layer", stream_size);
4667 set_camera_stream_visible(ctx, "viewport_stream_2d", mode == "2D");
4668 set_camera_stream_visible(ctx, "viewport_stream_3d", mode == "3D");
4669 set_panel_display(ctx, "viewport_canvas_overlay", mode == "UI" || mode == "2D");
4670 set_panel_display(ctx, "canvas_origin_x", mode == "2D");
4671 set_panel_display(ctx, "canvas_origin_y", mode == "2D");
4672 reapply_viewport_canvas(ctx);
4673}
4674
4675pub fn apply_editor_gizmos<API: ScriptAPI + ?Sized>(
4676 ctx: &mut ScriptContext<'_, API>,
4677 gizmo: &editor_gizmos::GizmoView,
4678 mode: &str,
4679) {
4680 let show_2d = mode == "2D";
4681 let show_3d = mode == "3D";
4682 set_panel_visible(ctx, "selected_outline", gizmo.selected && !show_3d);
4683 set_panel_visible(ctx, "camera2d_gizmo", gizmo.camera_2d && show_2d);
4684 set_panel_visible(ctx, "camera3d_gizmo", false);
4685 if gizmo.selected && !show_3d {
4686 set_panel_size(ctx, "selected_outline", gizmo.outline_size);
4687 }
4688}
4689
4690pub fn apply_selected_ui_overlay<API: ScriptAPI + ?Sized>(
4691 ctx: &mut ScriptContext<'_, API>,
4692 rect: Option<EditorUiRect>,
4693) {
4694 let Some(rect) = rect else {

Callers 1

refresh_files_viewFunction · 0.85

Calls 15

find_namedFunction · 0.85
file_path_depthFunction · 0.85
editor_tree_icon_textureFunction · 0.85
file_iconFunction · 0.85
with_iconMethod · 0.80
with_valueMethod · 0.80
with_idMethod · 0.80
iterMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45
popMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected