Skip to content

Commit

Permalink
Added show icons in items list
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoGZ-dev committed May 16, 2023
1 parent 45988ae commit 7123f86
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- Fixed issue in match transforms with some herarchies by forcing to use topnode only.

### v0.1.2
- Showing Maya icons in the items list.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
**cloneReference** is a tool for Maya to clone or create multiple copies of external references keeping transforms from initial reference.

<img src="https://github.com/AlbertoGZ-dev/cloneReference/blob/main/cloneReference.png"></img>
<img src="https://github.com/AlbertoGZ-dev/cloneReference/blob/main/cloneReference_outliner.png"></img>

## Setup

Expand Down
Binary file modified cloneReference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 48 additions & 9 deletions cloneReference.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


# GENERAL VARS
version = '0.1.1'
version = '0.1.2'
about = 'by Alberto GZ'
winWidth = 520
winHeight = 500
Expand All @@ -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")



Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)




Expand Down Expand Up @@ -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()


Expand All @@ -298,7 +326,7 @@ def itemFilter(self):


def itemLoad(self):
itemType = 'transform'
#itemType = 'transform'
dag = 1
itemTranforms = 1
global itemList
Expand All @@ -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
Expand Down
Binary file removed cloneReference_outliner.png
Binary file not shown.

0 comments on commit 7123f86

Please sign in to comment.