I’m using Blender 2.71.
Here’s the example Blend file:
remote_access.blend (429 KB)
Today I was working on a UI interface, things like healthbars, message logs etc… on a separate overlay scene. It makes sense to call a reference to this scene from the main scene (where all the info is, such as players, positions, health enemies etc…) and make changes using a controller in the main scene. This works fine for things which are on the active layer of the overlay scene, but when I try to add an object from the hidden layers of the overlay scene using ui_scene.addObject() I get errors.
The first type of error is that I can’t call hidden objects by name from the inactive layer:
ui_scene.addObject("cube",reference_object,0)
It says the object doesn’t exist in the scene, but it does! As can easily be proved by printing the inactive objects from that scene:
print(ui_scene.objectsInactive)
So, I tried using the objectsInactive list to add objects:
adding_object = ui_scene.objectsInactive['cube']
ui_scene.addObject(adding_object,reference_object,0)
This works, but results in some strange behavior. When adding a text object from the inactive scene it either crashes Blender, a straight crash to desktop with no explanation, or it adds the text with a weird orientation.
Usually when you use addObject it aligns the added object to the position and orientation of the reference object, in this case, a special object I’ve added to the overlay scene for this purpose. But in this case, the text seems to be aligned to the world position of the main scene, (see the image above, the camera in the overlay is looking straight down, the text should be flat, but is aligned to the floor of the main scene).
I’ve found a work around for now, but really there should be no problem using python to add an object in one active scene using a controller in another active scene. Or if there is, there should be something in the documentation saying why.