def unbuild(self, disconnect_attr=True): """ Call unbuild on each individual ctrls This allow the rig to save his ctrls appearance (shapes) and animation (animCurves). Note that this happen first so the rig can return to it's bind pose before anything else is done. :param disconnect_attr: Tell the unbuild if we want to disconnect the input translate, rotate, scale """ self.info("Un-building") # Ensure that there's no more connections in the input chain if disconnect_attr: for obj in self.input: if isinstance(obj, pymel.nodetypes.Transform): libAttr.disconnectAttr(obj.tx) libAttr.disconnectAttr(obj.ty) libAttr.disconnectAttr(obj.tz) libAttr.disconnectAttr(obj.rx) libAttr.disconnectAttr(obj.ry) libAttr.disconnectAttr(obj.rz) libAttr.disconnectAttr(obj.sx) libAttr.disconnectAttr(obj.sy) libAttr.disconnectAttr(obj.sz) # Delete the ctrls in reverse hyerarchy order. ctrls = self.get_ctrls() ctrls = filter(libPymel.is_valid_PyNode, ctrls) ctrls = reversed(sorted(ctrls, key=libPymel.get_num_parents)) for ctrl in ctrls: ctrl.unbuild() if self.grp_anm is not None and libPymel.is_valid_PyNode(self.grp_anm): pymel.delete(self.grp_anm) self.grp_anm = None if self.grp_rig is not None and libPymel.is_valid_PyNode(self.grp_rig): pymel.delete(self.grp_rig) self.grp_rig = None self.globalScale = None # Reset any cached properties # todo: ensure it's the best way if '_cache' in self.__dict__: self.__dict__.pop('_cache')
def unbuild(self): """ Call unbuild on each individual ctrls This allow the rig to save his ctrls appearance (shapes) and animation (animCurves). Note that this happen first so the rig can return to it's bind pose before anything else is done. """ # Ensure that there's no more connections in the input chain for obj in self.input: if isinstance(obj, pymel.nodetypes.Transform): libAttr.disconnectAttr(obj.tx) libAttr.disconnectAttr(obj.ty) libAttr.disconnectAttr(obj.tz) libAttr.disconnectAttr(obj.rx) libAttr.disconnectAttr(obj.ry) libAttr.disconnectAttr(obj.rz) libAttr.disconnectAttr(obj.sx) libAttr.disconnectAttr(obj.sy) libAttr.disconnectAttr(obj.sz) # Delete the ctrls in reverse hyerarchy order. ctrls = self.get_ctrls(recursive=True) ctrls = reversed(sorted(ctrls, key=libPymel.get_num_parents)) for ctrl in ctrls: ctrl.unbuild() if self.grp_anm is not None: pymel.delete(self.grp_anm) self.grp_anm = None if self.grp_rig is not None: pymel.delete(self.grp_rig) self.grp_rig = None self.globalScale = None # Reset any cached properties # todo: ensure it's the best way if '_cache' in self.__dict__: self.__dict__.pop('_cache')
def _disconnect_inputs(self): for obj in self.input: if isinstance(obj, pymel.nodetypes.Transform): libAttr.disconnectAttr(obj.tx) libAttr.disconnectAttr(obj.ty) libAttr.disconnectAttr(obj.tz) libAttr.disconnectAttr(obj.rx) libAttr.disconnectAttr(obj.ry) libAttr.disconnectAttr(obj.rz) libAttr.disconnectAttr(obj.sx) libAttr.disconnectAttr(obj.sy) libAttr.disconnectAttr(obj.sz)
def unbuild(self, disconnect_attr=True): """ Call unbuild on each individual ctrls This allow the rig to save his ctrls appearance (shapes) and animation (animCurves). Note that this happen first so the rig can return to it's bind pose before anything else is done. :param disconnect_attr: Tell the unbuild if we want to disconnect the input translate, rotate, scale """ self.info("Un-building") # Ensure that there's no more connections in the input chain if disconnect_attr: for obj in self.input: if isinstance(obj, pymel.nodetypes.Transform): libAttr.disconnectAttr(obj.tx) libAttr.disconnectAttr(obj.ty) libAttr.disconnectAttr(obj.tz) libAttr.disconnectAttr(obj.rx) libAttr.disconnectAttr(obj.ry) libAttr.disconnectAttr(obj.rz) libAttr.disconnectAttr(obj.sx) libAttr.disconnectAttr(obj.sy) libAttr.disconnectAttr(obj.sz) # Delete the ctrls in reverse hyerarchy order. ctrls = self.get_ctrls() ctrls = filter(libPymel.is_valid_PyNode, ctrls) ctrls = reversed(sorted(ctrls, key=libPymel.get_num_parents)) for ctrl in ctrls: ctrl.unbuild() if self.grp_anm is not None and libPymel.is_valid_PyNode(self.grp_anm): pymel.delete(self.grp_anm) self.grp_anm = None if self.grp_rig is not None and libPymel.is_valid_PyNode(self.grp_rig): pymel.delete(self.grp_rig) self.grp_rig = None self.globalScale = None # Reset any cached properties # todo: ensure it's the best way if "_cache" in self.__dict__: self.__dict__.pop("_cache")