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

Function apply_freecam

perro_editor/res/scripts/scene/editor_nav.rs:1378–1399  ·  view source on GitHub ↗
(ctx: &mut ScriptContext<'_, API>)

Source from the content-addressed store, hash-verified

1376 if !label.is_empty() {
1377 set_viewport_label(ctx, &label);
1378 }
1379}
1380
1381pub fn reset_freecam(state: &mut EditorState) {
1382 state.cam_x = 0.0;
1383 state.cam_y = 3.0;
1384 state.cam_z = 8.0;
1385 state.cam_yaw = 0.0;
1386 state.cam_pitch = -0.25;
1387}
1388
1389pub fn reset_freecam_2d(state: &mut EditorState) {
1390 state.cam2_x = 0.0;
1391 state.cam2_y = 0.0;
1392 state.cam2_zoom = 1.0;
1393}
1394
1395pub fn apply_freecam<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>) {
1396 let camera = with_state!(ctx.run, EditorState, ctx.id, |state| {
1397 (state.preview_camera_3d != 0).then(|| NodeID::from_u64(state.preview_camera_3d))
1398 }).unwrap_or_default()
1399 .or_else(|| find_named(ctx, "editor_camera_3d"));
1400 let Some(camera) = camera else {
1401 return;
1402 };

Callers 4

set_modeFunction · 0.85
load_preview_sceneFunction · 0.85
update_freecamFunction · 0.85
frame_selected_nodeFunction · 0.85

Calls 3

find_namedFunction · 0.85
NodesMethod · 0.80

Tested by

no test coverage detected