(ctx: &mut ScriptContext<'_, API>, gltf_path: &str)
| 649 | pub fn open_animation_path<API: ScriptAPI + ?Sized>( |
| 650 | ctx: &mut ScriptContext<'_, API>, |
| 651 | anim_path: &str, |
| 652 | ) { |
| 653 | let root = with_state!(ctx.run, EditorState, ctx.id, |state| { |
| 654 | state.project_root.clone() |
| 655 | }).unwrap_or_default(); |
| 656 | let abs = res_to_abs(&root, anim_path); |
| 657 | match FileMod::load_string(&abs) { |
| 658 | Ok(text) => { |
| 659 | let _ = with_state_mut!(ctx.run, EditorState, ctx.id, |state| { |
| 660 | state.activity_mode = "scene".to_string(); |
| 661 | state.anim_drawer_open = true; |
| 662 | state.bottom_dock_open = true; |
| 663 | state.active_anim_player_key = None; |
| 664 | state.active_anim_path = anim_path.to_string(); |
| 665 | state.active_asset_path = anim_path.to_string(); |
| 666 | state.active_glb_path.clear(); |
| 667 | state.active_glb_summary.clear(); |
| 668 | crate::scripts::scene::editor_animation::load_anim_text_into_state( |
| 669 | state, anim_path, text, |
| 670 | ); |
| 671 | state.log = format!( |
| 672 | "open animation\n{}", |
| 673 | editor_files::rel_label(anim_path) |
| 674 | ); |
| 675 | }); |
| 676 | refresh_all(ctx); |
| 677 | } |
| 678 | Err(err) => set_log(ctx, &format!("open animation fail\n{anim_path}\n{err}")), |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | pub fn open_gltf_path<API: ScriptAPI + ?Sized>(ctx: &mut ScriptContext<'_, API>, gltf_path: &str) { |
| 683 | let Some(info) = ctx.res.Glbs().inspect(gltf_path) else { |
| 684 | set_log(ctx, &format!("open glb fail\n{gltf_path}")); |
| 685 | return; |
| 686 | }; |
| 687 | let summary = gltf_summary( |
| 688 | gltf_path, |
| 689 | info.mesh_count, |
| 690 | info.material_count, |
| 691 | info.animation_count, |
| 692 | info.skeleton_count, |
| 693 | info.texture_count, |
no test coverage detected