def remove(self, removeObjects=False): """ \remarks implements the AbstractSceneObjectGroup.remove method to remove the layer from the scene (objects included when desired) \param removeObjects <bool> when true, the objects on the layer should be removed from the scene, otherwise only the layer should be removed \return <bool> success """ my_layer = self._nativePointer worldlayer = mxs.layerManager.getLayer(0) # cannot remove the world layer if (my_layer == worldlayer): return False # deactivate this layer since we cannot delete active layers self.setActive(False) # otherwise, collect the objects on this layer objects = mxs.pyhelper.getLayerNodes(my_layer) # determine what to do with the objects if (objects): # remove the objects from the scene if (removeObjects): mxs.delete(objects) # move the objects to the world layer else: addnode = worldlayer.addNode for obj in objects: addnode(obj) # remove this layer return mxs.layerManager.deleteLayerByName(my_layer.name)
def remove( self, removeObjects = False ): """ \remarks implements the AbstractSceneObjectGroup.remove method to remove the layer from the scene (objects included when desired) \param removeObjects <bool> when true, the objects on the layer should be removed from the scene, otherwise only the layer should be removed \return <bool> success """ my_layer = self._nativePointer worldlayer = mxs.layerManager.getLayer(0) # cannot remove the world layer if ( my_layer == worldlayer ): return False # deactivate this layer since we cannot delete active layers self.setActive(False) # otherwise, collect the objects on this layer objects = mxs.pyhelper.getLayerNodes( my_layer ) # determine what to do with the objects if ( objects ): # remove the objects from the scene if ( removeObjects ): mxs.delete( objects ) # move the objects to the world layer else: addnode = worldlayer.addNode for obj in objects: addnode(obj) # remove this layer return mxs.layerManager.deleteLayerByName( my_layer.name )
def delete_scene(): """ pydoc """ mxs.actionMan.executeAction(0, "40021") # Selection: Select All for i in mxs.selection: # use mxs.Teapot refer to Teapot keyword in maxscript, cause there is # no such type in python if mxs.classOf(i) == mxs.Teapot and i.wireColor.B < 210: mxs.delete(i)
def delete_unused_beam_objects(self): """Deletes all objects in a beam object set if they contain no beams. Done because beam objects are pregenerated without first finding out whether all combinations are actually are needed or not, so some non-useful ones are generated. """ for the_set in self.category_manager.categories.values(): for key, beam_object in the_set.items(): if mxs.numSplines(beam_object.max_object) == 0: mxs.delete(beam_object.max_object) del the_set[key] self._add_objects_to_object_holder(self.object_holder)
def setInterest(self, interest): if interest: if mxs.isproperty(self._nativePointer, "target"): self._nativePointer.Target = interest.nativePointer() if mxs.isproperty(self._nativePointer, 'targeted'): self._nativePointer.Targeted = True else: if mxs.isproperty(self._nativePointer, "targeted"): self._nativePointer.Targeted = False # Delete any orphaned targets for this camera. target = mxs.findObject(self._nativePointer.name + '.Target') while target: mxs.delete(target) target = mxs.findObject(self._nativePointer.name + '.Target')
def generate_default_cameras(cameras, nodes): try: map(lambda camera: mxs.delete(camera), cameras) except: pass GlobalCamera.Camera(0, nodes[0], nodes[1], nodes[2]) return "cameras\n0,1,2\n"
def delete_all(self): for obj in self.mxs_objects: try: mxs.delete(obj) except: print "failed to delete " + str(obj)