(
ctx: &mut ScriptContext<'_, API>,
kind: &str,
dir: isize,
)
| 690 | info.material_count, |
| 691 | info.animation_count, |
| 692 | info.skeleton_count, |
| 693 | info.texture_count, |
| 694 | 0, |
| 695 | 0, |
| 696 | 0, |
| 697 | ); |
| 698 | let _ = with_state_mut!(ctx.run, EditorState, ctx.id, |state| { |
| 699 | state.activity_mode = "glb".to_string(); |
| 700 | state.sidebar_mode = "files".to_string(); |
| 701 | state.anim_drawer_open = false; |
| 702 | state.active_anim_player_key = None; |
| 703 | state.active_anim_path.clear(); |
| 704 | state.active_asset_path = gltf_path.to_string(); |
| 705 | state.active_glb_path = gltf_path.to_string(); |
| 706 | state.active_glb_summary = summary; |
| 707 | state.active_glb_mesh_index = 0; |
| 708 | state.active_glb_mat_index = 0; |
| 709 | state.active_glb_anim_index = 0; |
| 710 | state.glb_viewer_isolate = false; |
| 711 | state.viewport_mode = "3D".to_string(); |
| 712 | reset_freecam(state); |
| 713 | state.log = format!( |
| 714 | "open glb\n{}\nmesh={} mat={} anim={}", |
| 715 | editor_files::rel_label(gltf_path), |
| 716 | info.mesh_count, |
| 717 | info.material_count, |
| 718 | info.animation_count |
| 719 | ); |
| 720 | }); |
| 721 | rebuild_preview(ctx); |
| 722 | auto_frame_glb_camera(ctx, gltf_path, info.mesh_count); |
| 723 | refresh_all(ctx); |
| 724 | } |
| 725 | |
| 726 | pub fn cycle_active_glb_ref<API: ScriptAPI + ?Sized>( |
| 727 | ctx: &mut ScriptContext<'_, API>, |
| 728 | kind: &str, |
| 729 | dir: isize, |
| 730 | ) { |
| 731 | let path = with_state!(ctx.run, EditorState, ctx.id, |state| { |
| 732 | if state.active_glb_path.is_empty() { |
| 733 | None |
| 734 | } else { |
| 735 | Some(state.active_glb_path.clone()) |
| 736 | } |
| 737 | }).unwrap_or_default(); |
| 738 | let Some(path) = path else { |
| 739 | return; |
| 740 | }; |
| 741 | let Some(info) = ctx.res.Glbs().inspect(&path) else { |
| 742 | set_log(ctx, &format!("glb ref fail\n{path}")); |
| 743 | return; |
| 744 | }; |
| 745 | let _ = with_state_mut!(ctx.run, EditorState, ctx.id, |state| { |
| 746 | let count = match kind { |
| 747 | "mesh" => info.mesh_count, |
| 748 | "mat" => info.material_count, |
| 749 | "animation" => info.animation_count, |
no test coverage detected