Closed dabruhce closed 9 years ago
I assume that you're executing that code as a global script or a properties editor based code (setting of scene names wont work on source plugins).
Theoretically, the xui framework should work even if you're using angular. I tried it on my side, and it does work perfectly.
Here's a gist for the code that I made to test it out (angular 1.4.4)
However, please do note that when you do execute Scene.setName() on a new presentation, it would only work on Scenes that are already loaded. This is by design/limitation of XBC client (conserving memory). What I mean is that if you load a presentation that has items until Scene 5, you can only modify Scenes upto Scene 5 using global script.
In order to modify scenes from 1 to 12, you'll have to manually select/activate Scene 12. That way, XBC would allow modifying all scenes from 1 to 12 using global script.
The code to do just that is:
var View = new xui.core.View();
View.setActiveScene(11); // Activate Scene 12
View.setActiveScene(0); // Revert to Scene 1
That's just a workaround, and there's a better way to do it, but it is not yet exposed on this current version of our framework.
So with that, once you already pre-loaded all the scenes, you can now start adding up items to those scenes using Scene.add() method.
As for the positioning of items, the framework currently has no way of initially setting the position of the item, but once you already added it to the scene, you can modify the coordinates of the item using the setPosition() method of Item class.
I wrapped some of this in angular for a few quick tests, also poked around some of the functional tests, and I'm getting various odd behavior. Essentially, not able to setname of a scene that is not the active scene after init of .run, however if I preselect a different scene then reexecute the Go() function if will rename the secondary scene. I'm probably simply not executing something correctly as this seemed to work when I mucked with it based on the functional tests. Probably need to digest or apply perhaps.
Also as far as I can tell you can't add an item to a nonactive scene, nor can you add coordinates/positions to an item. Which would be a nice to have feature.
This did seem to work prior to wrapping it in angular. Something like this...