diff --git a/CHANGELOG.md b/CHANGELOG.md index cb432c3..87b0be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,4 +5,7 @@ Initial release. ### v0.1.1 - Added ability to grouping copies from selected items as bundle group. -- Fixed issue in match transforms with some herarchies by forcing to use topnode only \ No newline at end of file +- Fixed issue in match transforms with some herarchies by forcing to use topnode only. + +### v0.1.2 +- Showing Maya icons in the items list. \ No newline at end of file diff --git a/README.md b/README.md index dcd2204..4491f0c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ **cloneReference** is a tool for Maya to clone or create multiple copies of external references keeping transforms from initial reference. - ## Setup diff --git a/cloneReference.png b/cloneReference.png index 1a1286c..01290e6 100644 Binary files a/cloneReference.png and b/cloneReference.png differ diff --git a/cloneReference.py b/cloneReference.py index 5592f4a..23b0a26 100644 --- a/cloneReference.py +++ b/cloneReference.py @@ -27,7 +27,7 @@ # GENERAL VARS -version = '0.1.1' +version = '0.1.2' about = 'by Alberto GZ' winWidth = 520 winHeight = 500 @@ -36,9 +36,14 @@ lightbrown = '#7d654b' lightpurple = '#604b69' lightgreen = '#5b694b' -lightblue = '#4e5357' +lightblue = '#3a3e42' itemSelected = [] +iconMesh = QtGui.QIcon(":/mesh.svg") +iconRef = QtGui.QIcon(":/reference.svg") +iconCurve = QtGui.QIcon(":/nurbsCurve.svg") +iconCam = QtGui.QIcon(":/camera.svg") +iconLight = QtGui.QIcon(":/ambientLight.svg") @@ -107,15 +112,19 @@ def __init__(self, parent=getMainWindow()): # Filter items self.itemFilterLabel = QtWidgets.QLabel('Show:') + self.itemFilterVisibleChk = QtWidgets.QCheckBox('Visible nodes only') self.itemFilterVisibleChk.setChecked(True) self.itemFilterVisibleChk.setStyleSheet('background-color:' + lightblue) self.itemFilterVisibleChk.stateChanged.connect(self.itemReload) + self.itemFilterRefNodesChk = QtWidgets.QCheckBox('Reference nodes only') self.itemFilterRefNodesChk.setChecked(True) self.itemFilterRefNodesChk.setStyleSheet('background-color:' + lightblue) self.itemFilterRefNodesChk.stateChanged.connect(self.itemReload) + self.itemFilterTopNodesChk = QtWidgets.QCheckBox('Top nodes only') + self.itemFilterTopNodesChk.setChecked(True) self.itemFilterTopNodesChk.setStyleSheet('background-color:' + lightblue) self.itemFilterTopNodesChk.stateChanged.connect(self.itemReload) @@ -209,7 +218,7 @@ def __init__(self, parent=getMainWindow()): self.cloneBtn = QtWidgets.QPushButton('Clone Reference') self.cloneBtn.setFixedHeight(85) self.cloneBtn.clicked.connect(self.clone) - + @@ -280,7 +289,26 @@ def itemGetSelected(self): self.statusBar.setStyleSheet('background-color:' + red) else: self.itemQList.clear() - self.itemQList.addItems(selection) + #self.itemQList.addItems(selection) + for item in selection: + parents = cmds.listRelatives(item) + + for p in parents: + itemType = cmds.nodeType(p) + print (itemType) + if itemType == 'mesh': + itemIcon = iconMesh + elif itemType == 'nurbsCurve': + itemIcon = iconCurve + elif itemType == 'camera': + itemIcon = iconCam + elif 'Light' in itemType: + itemIcon = iconLight + else: + itemIcon = iconRef + + self.itemQList.addItem(QtWidgets.QListWidgetItem(itemIcon, str(item))) + self.itemQList.selectAll() @@ -298,7 +326,7 @@ def itemFilter(self): def itemLoad(self): - itemType = 'transform' + #itemType = 'transform' dag = 1 itemTranforms = 1 global itemList @@ -322,13 +350,24 @@ def itemLoad(self): itemTranforms = 1 dag = 1 + + itemNode = cmds.ls(transforms=itemTranforms, dag=dag, v=itemVisible, rn=itemRefs, assemblies=itemTop) itemList = [] - itemList.append(cmds.ls(transforms=itemTranforms, dag=dag, v=itemVisible, rn=itemRefs, assemblies=itemTop)) + itemList.append(itemNode) for item in itemList: - # item = [w.replace('Shape', '') for w in item] - item.sort() - self.itemQList.addItems(item) + for n in range(len(item)): + + parents = cmds.listRelatives(item[n]) + for p in parents: + itemType = cmds.nodeType(p) + print (itemType) + if itemType == 'mesh': + itemIcon = iconMesh + else: + itemIcon = iconRef + + self.itemQList.addItem(QtWidgets.QListWidgetItem(itemIcon, str(item[n]))) ### Get selected items in itemQList diff --git a/cloneReference_outliner.png b/cloneReference_outliner.png deleted file mode 100644 index cb2eb30..0000000 Binary files a/cloneReference_outliner.png and /dev/null differ