Hi, I've tried a around several hours to figure out how to load a other project. With no result.
I've found this block in the GP libs:
On run this block GP looks like this:
How could I get this to work?
Why does this not work and how can I make it work?
Moderator: MSandro
Re: Why does this not work and how can I make it work?
I'm just wondering how you are trying to implement this. The open project button triggers this function but the button itself is outside the script editor. When I played with this in the script editor it never got past the clearProject method in openProject because the block disappears I think. I also managed somehow to disappear the class methods in the ProjectEditor class browser and cause an Undefined function: blockSpecs error. Reloading fixed that. I tried setting it up in a class browser but that's not working for me either. I haven't tried loading an external file into the system browser.
Re: Why does this not work and how can I make it work?
Okay, so I have to find a way how to run a script in "background". So it'll not be stopped/removed on a clear.
Edit: I've tried around to solve this about several hours. I used tasks, broadcasts and more. I also tried to add some code to the GP backend, but with no result. I am not sure how to solve this.
I've already tried how to import a class with a small script/block successfully. This works fine because no code will be removed.
Edit: I've tried around to solve this about several hours. I used tasks, broadcasts and more. I also tried to add some code to the GP backend, but with no result. I am not sure how to solve this.
I've already tried how to import a class with a small script/block successfully. This works fine because no code will be removed.
Re: Why does this not work and how can I make it work?
I've now found a nice litle workaround:
This works:
This doesn't work:
Because I've found a "openProjectFromFile" in the "Stage" class, I've tried to replace "ProjectEditor" with "Stage" and ... it works!
It could look a bit glitchy but it works. This block only load the given project in the stage, not in the project editor, so all classes you've created are still there. But the project you've want is visible in the stage, GP will automaticaly go into presentation mode too. I think there are more advantages to this method than disadvantages. For example, you can easily add elements to a post-loaded project, such as a close button to return to another project, without having to make any changes in the loaded project.
Here is a example:
This works:
This doesn't work:
Because I've found a "openProjectFromFile" in the "Stage" class, I've tried to replace "ProjectEditor" with "Stage" and ... it works!
It could look a bit glitchy but it works. This block only load the given project in the stage, not in the project editor, so all classes you've created are still there. But the project you've want is visible in the stage, GP will automaticaly go into presentation mode too. I think there are more advantages to this method than disadvantages. For example, you can easily add elements to a post-loaded project, such as a close button to return to another project, without having to make any changes in the loaded project.
Here is a example: