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

Function resize_doc_ui_node

perro_editor/res/scripts/scene/editor_viewport.rs:2309–2416  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    key: u32,
    handle: &str,
    root_delta: Vector2,
    snap: bool,
)

Source from the content-addressed store, hash-verified

2307 Vector3::new(0.0, hy, 0.0),
2308 ]
2309 }
2310 Shape3D::SquarePyramid { size } => {
2311 let hx = size.x.abs() * 0.5;
2312 let hy = size.y.abs() * 0.5;
2313 let hz = size.z.abs() * 0.5;
2314 vec![
2315 Vector3::new(-hx, -hy, -hz),
2316 Vector3::new(hx, -hy, -hz),
2317 Vector3::new(hx, -hy, hz),
2318 Vector3::new(-hx, -hy, hz),
2319 Vector3::new(0.0, hy, 0.0),
2320 ]
2321 }
2322 Shape3D::TriMesh { .. } => Vec::new(),
2323 }
2324}
2325
2326fn add_gizmo_ring<API: ScriptAPI + ?Sized>(
2327 ctx: &mut ScriptContext<'_, API>,
2328 parent: NodeID,
2329 material: MaterialID,
2330 plane: &str,
2331) {
2332 let segments = 24;
2333 let radius = 1.05;
2334 let len = 2.0 * std::f32::consts::PI * radius / segments as f32;
2335 for i in 0..segments {
2336 let a = i as f32 / segments as f32 * std::f32::consts::TAU;
2337 let (pos, rot) = match plane {
2338 "xy" => (
2339 Vector3::new(a.cos() * radius, a.sin() * radius, 0.0),
2340 Quaternion::from_euler_xyz(0.0, 0.0, a + std::f32::consts::FRAC_PI_2),
2341 ),
2342 "xz" => (
2343 Vector3::new(a.cos() * radius, 0.0, a.sin() * radius),
2344 Quaternion::from_euler_xyz(0.0, -a, 0.0),
2345 ),
2346 _ => (
2347 Vector3::new(0.0, a.cos() * radius, a.sin() * radius),
2348 Quaternion::from_euler_xyz(a, 0.0, 0.0),
2349 ),
2350 };
2351 add_axis_gizmo_mesh(
2352 ctx,
2353 parent,
2354 material,
2355 pos,
2356 Vector3::new(len, 0.018, 0.018),
2357 rot,
2358 );
2359 }
2360}
2361
2362pub fn pick_preview_3d<API: ScriptAPI + ?Sized>(
2363 ctx: &mut ScriptContext<'_, API>,
2364 ray: ViewportRay3D,
2365) -> Option<u32> {
2366 let (ids, keys) = with_state!(ctx.run, EditorState, ctx.id, |state| {

Callers 1

update_ui_dragFunction · 0.85

Calls 3

rebuild_previewFunction · 0.85
refresh_allFunction · 0.85

Tested by

no test coverage detected