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

Function gizmo_view

perro_editor/res/scripts/scene/editor_gizmos.rs:22–48  ·  view source on GitHub ↗
(doc: &SceneDoc, selected_key: Option<u32>)

Source from the content-addressed store, hash-verified

20}
21
22pub fn gizmo_view(doc: &SceneDoc, selected_key: Option<u32>) -> GizmoView {
23 let Some(key) = selected_key else {
24 return GizmoView::default();
25 };
26 let Some(node) = doc.scene.nodes.iter().find(|node| node.key.as_u32() == key) else {
27 return GizmoView::default();
28 };
29 let type_name = node.data.type_name();
30 let mut out = GizmoView {
31 selected: true,
32 camera_2d: type_name == "Camera2D",
33 camera_3d: type_name == "Camera3D",
34 outline_size: (0.28, 0.24),
35 };
36 if type_name == "Camera2D" {
37 out.outline_size = (0.52, 0.38);
38 } else if type_name == "Camera3D" {
39 out.outline_size = (0.18, 0.14);
40 } else if type_name.starts_with("Ui") {
41 out.outline_size = (0.22, 0.14);
42 } else if type_name.ends_with("3D") {
43 out.outline_size = (0.18, 0.18);
44 } else if type_name.ends_with("2D") {
45 out.outline_size = (0.24, 0.18);
46 }
47 out
48}

Callers 1

from_stateMethod · 0.85

Calls 4

findMethod · 0.80
type_nameMethod · 0.80
iterMethod · 0.45
as_u32Method · 0.45

Tested by

no test coverage detected