3. Adding and Removing Objects to a Scene

To display 3D and 2D objects, they must be added to the Scene object first. In the default Scene object, this happens automatically when an object (e.g. a NPart object) that can be rendered is created. Responsible for this is the automatic_add setting, which is enabled in the default Scene object. However, in any additional Scene object, it is not enabled by default. This setting can be changed in the GUI by first selecting the Scene object and then by toggling the respective check box on the "General" page of the editor. In Python, the same is achieved by setting

my_scene.automatic_add = True

To manually add an object to a Scene object, just drag and drop the object from the tree widget into the Scene window, or drop it on the Scene object in the tree widget. In Python, this is done by means of the "add" function:


When the first 3D object is added, the Scene object performs an automatic re-scale, so that the object becomes entirely visible. This re-scaling is not applied when more objects are added.

What happens when an object is added twice? The Scene object always checks if the object already has been added. If this is the case, nothing happens.

To remove an object from a Scene with the GUI, select the Scene object in the tree widget and expand it. Then, right-click on the child object to be removed to obtain its context menu. There, select Remove from Scene. In Python: