Ejemplo n.º 1
0
 def delete_widget(self, widget):
     widget.setParent(None)
     self.scene_references_widget.remove(widget)
     if widget in self.selection_list:
         self.remove_selection(widget)
     references(self.asset).remove_reference(widget.asset, widget.count)
     self.refresh_references_label()
Ejemplo n.º 2
0
 def replace_reference(self,
                       asset,
                       count,
                       old_namespace=None,
                       proxy=0,
                       visible=1):
     references(self.asset).replace_reference(asset, count, old_namespace,
                                              proxy, visible)
     logger.info("Reference modified")
Ejemplo n.º 3
0
    def delete_asset(self, asset=None, count=None, item=None):
        if asset in self.scene_references:
            self.scene_references.remove(asset)

        print(asset)

        references(self.asset).remove_reference(asset, count)

        row = self.ui.reference_list_listWidget.row(item)
        self.ui.reference_list_listWidget.takeItem(row)
        self.refresh_references_label()
Ejemplo n.º 4
0
 def replace_reference(self,
                       widget,
                       asset,
                       count,
                       old_namespace=None,
                       proxy=0,
                       visible=1):
     self.scene_references_widget[self.scene_references_widget.index(
         widget)] = widget
     references(self.asset).replace_reference(asset, count, old_namespace,
                                              proxy, visible)
     logger.info("Reference modified")
Ejemplo n.º 5
0
def reference_asset_in_current_scene(string_asset):
    # Convert this ASSET_STRING string to a wizard asset object
    asset = asset_core.string_to_asset(string_asset)
    # Get the default export asset of the reference asset
    if not asset.export_asset or asset.export_asset == "None":
        asset.export_asset = prefs.asset(
            asset).export_root.default_export_asset
    # Get the last export version of the reference asset
    if not asset.export_version or asset.export_version == "None":
        asset.set_export_version()
    # Create the reference
    references(current_asset()).add_reference(asset, 0, 1)
    # Refresh the ui
    refresh_ui()
Ejemplo n.º 6
0
def duplicate_reference():
    sel = cmds.ls(sl=1, long=1)
    if len(sel) == 1:
        namespace = None
        relatives = cmds.listRelatives(sel[0], allDescendents=1)
        for relative in relatives:
            if cmds.referenceQuery(relative, isNodeReferenced=True):
                namespace = relative.split(':')[0]
                break
        if namespace:
            scene_asset = asset_core.string_to_asset(
                os.environ[defaults._asset_var_])
            references_list = prefs().asset(scene_asset).variant.references
            if namespace in references_list.keys():

                asset = asset_core.string_to_asset(
                    references_list[namespace][defaults._asset_key_])
                count = references(scene_asset).add_reference(asset, 1, 1)
                new_namespace = namespace.replace(
                    namespace.split('_')[-1], count)
                import_geo(new_namespace)

            else:
                logger.warning('This reference was not found in wizard')
    else:
        logger.warning('Please select only one asset')
Ejemplo n.º 7
0
    def add_sequence_camera(self, cam_asset):
        asset_references = references(self.asset)
        count = asset_references.add_reference(cam_asset, 0, 1)
        cam_asset_namespace = asset_references.get_name_space(cam_asset, count)
        item = QtWidgets.QListWidgetItem()
        item.setText(cam_asset_namespace)
        try:
            item.setIcon(QtGui.QIcon(defaults._stage_icon_[cam_asset.stage]))
        except:
            pass

        self.ui.export_ma_assets_listWidget.addItem(item)
        item.setSelected(True)
 def refresh_namespace(self):
     name_space = references(self.asset).get_name_space(self.asset, self.count)
     self.ui.namespace_label.setText(name_space)
Ejemplo n.º 9
0
 def add_grooming_reference(self):
     count = references(self.cfx_asset).add_reference(
         self.grooming_asset, 0, 1)
     self.hair_nspace = references(self.cfx_asset).get_name_space(
         self.grooming_asset, count)
Ejemplo n.º 10
0
 def add_anim_reference(self):
     references(self.cfx_asset).remove_all_references()
     count = references(self.cfx_asset).add_reference(
         self.export_asset, 0, 1)
     self.animation_namespace = references(self.cfx_asset).get_name_space(
         self.export_asset, count)
Ejemplo n.º 11
0
 def set_new_reference(self, asset, proxy, visible):
     count = references(self.asset).add_reference(asset, proxy, visible)
     self.add_reference([asset, count, proxy, visible], 1)
Ejemplo n.º 12
0
 def get_references(self, asset):
     self.scene_references = []
     assets_list = references(asset).references
     for asset in assets_list:
         #self.scene_references.append(asset)
         self.add_reference(asset)
Ejemplo n.º 13
0
 def get_references(self):
     self.scene_references = []
     ref_assets_list = references(self.asset).references
     for ref_asset in ref_assets_list:
         self.scene_references.append(ref_asset[0])
         self.add_reference(ref_asset)