Skip to content

Commit

Permalink
Fix editor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Feb 18, 2025
1 parent 6827b87 commit 9bd806f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/editor/JulGameEditor/Editor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,15 @@ module Editor
if confirmation_dialog(currentDialog) == "ok" && currentSceneName != ""
if currentSceneMain === nothing
currentSceneMain = load_scene(currentScenePath, renderer)
gameCamera = currentSceneMain.scene.camera
cameraWindow.camera = gameCamera
else
JulGame.change_scene(String(currentSceneName))
end
if currentSceneMain !== nothing && !(currentSceneMain isa Ptr)
gameCamera = currentSceneMain.scene.camera
cameraWindow.camera = gameCamera
else
currentSceneMain = nothing
@error "Main not loaded properly"
end
end
elseif currentDialog[] == "New Scene"
Expand Down
9 changes: 6 additions & 3 deletions src/engine/SceneManagement/SceneBuilder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,12 @@ module SceneBuilderModule
end, filter(contains(r".jl$"), readdir(joinpath(path, "scripts"); join=true)))
end

scripts_mod = filter(x -> occursin(r"\.Scripts$", string(x)), ccall(:jl_module_usings, Any, (Any,), getfield(Main, Symbol("$(JulGame.ProjectModule)"))))
if scripts_mod !== nothing
JulGame.ScriptModule = scripts_mod[1]
if JulGame.ProjectModule != ""
@debug "Loading scripts from project module: $(JulGame.ProjectModule)"
scripts_mod = filter(x -> occursin(r"\.Scripts$", string(x)), ccall(:jl_module_usings, Any, (Any,), getfield(Main, Symbol("$(JulGame.ProjectModule)"))))
if scripts_mod !== nothing
JulGame.ScriptModule = scripts_mod[1]
end
end

for entity in MAIN.scene.entities
Expand Down

0 comments on commit 9bd806f

Please sign in to comment.