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

Function reload_scene_path

perro_editor/res/scripts/scene/editor_viewport.rs:693–733  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    scene_path: &str,
)

Source from the content-addressed store, hash-verified

691 state.scene_paths = scene_paths;
692 });
693 }
694
695 if changed_scenes.is_empty() {
696 if res_changed {
697 refresh_all(ctx);
698 } else {
699 refresh_status(ctx);
700 }
701 return;
702 }
703
704 let reload = with_state_mut!(ctx.run, EditorState, ctx.id, |state| {
705 let active = state.open_paths.get(state.active_open).cloned();
706 match project_scene_change(
707 &changed_scenes,
708 active.as_deref(),
709 state.dirty,
710 &state.preview_scene_paths,
711 &state.dirty_scene_paths,
712 ) {
713 ProjectSceneChange::Conflict(paths) => {
714 state.log = format!("external change pending\n{}", paths.join("\n"));
715 None
716 }
717 ProjectSceneChange::ReloadActive(path) => Some(path),
718 ProjectSceneChange::ReloadPreview => {
719 state.log = format!("reload preview deps\n{}", changed_scenes.join("\n"));
720 Some(String::new())
721 }
722 ProjectSceneChange::Notice => {
723 state.log = format!("project file change\n{}", changed_scenes.join("\n"));
724 None
725 }
726 }
727 })
728 .flatten();
729
730 match reload {
731 Some(path) if path.is_empty() => {
732 rebuild_preview(ctx);
733 refresh_all(ctx);
734 }
735 Some(path) => {
736 reload_scene_path(ctx, &path);

Callers 1

poll_project_diffsFunction · 0.85

Calls 9

set_logFunction · 0.85
root_viewport_modeFunction · 0.85
rebuild_previewFunction · 0.85
refresh_allFunction · 0.85
res_to_absFunction · 0.70
load_stringFunction · 0.50
parseFunction · 0.50
as_u32Method · 0.45
to_textMethod · 0.45

Tested by

no test coverage detected