Exemplo n.º 1
0
    def solo_view(self, widget, solo):
        instancer = node_utils.get_instancer(widget.name)
        cmds.showHidden(instancer)

        for geo_wdg, spore_wdgs in self.wdg_tree.iteritems():
            for spore_wdg in spore_wdgs:
                if spore_wdg is not widget:
                    spore_wdg.view_buttons.solo_btn.setChecked(False)
                    instancer = node_utils.get_instancer(spore_wdg.name)
                    if solo:
                        cmds.hide(instancer)
                    else:
                        cmds.showHidden(instancer)
Exemplo n.º 2
0
    def toggle_view(self, widget, mode):
        """ triggered by one of the spore widget's display toggle buttons
        :param widget: the source of the signal
        :param mode: 1==geometry, 2==bounding box, 3==bounding boxes """

        node_name = widget.long_name
        if cmds.objExists(node_name):
            instancer = node_utils.get_instancer(node_name)
            if instancer:
                cmds.setAttr('{}.levelOfDetail'.format(instancer), mode)
Exemplo n.º 3
0
    def remove_instance(self):
        selection = cmds.textScrollList('instanceList', q=1, selectItem=True)
        instancer = node_utils.get_instancer(self._node)

        if selection:
            for item in selection:
                obj_name = item.split(' ')[-1]
                connections = cmds.listConnections(obj_name, instancer, p=True, d=True, s=False)
                connection = [c for c in connections if c.split('.')[0] == instancer]
                for connection in connections:
                    if connection.split('.')[0] == instancer.split('|')[-1]:
                        cmds.disconnectAttr('{}.matrix'.format(obj_name), connection)

        self.update_instance_list()
Exemplo n.º 4
0
    def name_changed(self, widget, name):
        """ triggered by one of the spore widgets when the user
        requests a name change
        :param widget: the source of the signal
        :param name: the new name """

        node_name = widget.long_name
        if cmds.objExists(node_name):
            if re.match('^[A-Za-z0-9_-]*$', name) and not name[0].isdigit():
                #  transform = cmds.listRelatives(node_name, p=True, f=True)[0]
                instancer = node_utils.get_instancer(node_name)
                cmds.rename(instancer, '{}Instancer'.format(name))
                cmds.rename(node_name, '{}Shape'.format(name))
                #  cmds.rename(transform, name)

            else:
                self.io.set_message('Invalid Name: Use only A-Z, a-z, 0-9, -, _', 2)
                return

        self.refresh_spore()
Exemplo n.º 5
0
    def context_request(self, widget, action):

        if action.text() == 'Delete':
            selection = cmds.ls(sl=1, typ='sporeNode')
            for geo_wdg, spore_wdgs in self.wdg_tree.iteritems():
                for spore_wdg in spore_wdgs:

                    spore_node = spore_wdg.name
                    print spore_node
                    if spore_wdg.is_selected and cmds.objExists(spore_node):
                        instancer = node_utils.get_instancer(spore_node)
                        transform = cmds.listRelatives(spore_node, p=True, f=True)

                        if len(cmds.listRelatives(transform, c=1)) == 1:
                            cmds.delete((spore_node, transform[0], instancer))
                        else:
                            cmds.delete((spore_node, instancer))

                        selection.remove(spore_node)
                        cmds.select(selection)

            self.refresh_spore()
Exemplo n.º 6
0
    def select_instancer(self):
        #  self._node = cmds.ls(sl=True, type='sporeNode')[-1]

        instancer = node_utils.get_instancer(self._node)
        cmds.select((instancer, self._node))