what i the best way to do this. in python API? is there a solution for
this?
any ideas would be much appreciated
john
import maya.cmds as cmds
shapeNode = 'pSphere2|pSphereShape1'
shadingGroup = cmds.listConnections(shapeNode + '.instObjGroups')[0]
print shadingGroup
Particle instancing is simpler and doesn't cause these nodes and edits
to come into existence.
Assuming your object is at 0 0 0 when reffed in,
You can create a single particle at 0 0 0
Select your referenced in object, select you particle and choose
Particles > Instancer(replacement)
This creates a instancer node (and a single instance for each particle
- in this case 1).
The instancer node needs the particle and the transform input from
your reffed object.
The instancer can be transformed like a normal transform node, plus
there are some other attributes available.
You can do this as many times as you'd like with the same particle object.
I'm trying to get a Icon in my model view in a standard QListview
I am running the PumpThread in maya2008 on ubuntu linux but I'm now
testing this in Python Standalone and i still get the same error.
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setCompositionMode: Painter not active
QPainter::end: Painter not active, aborted
The UI runs but i get no icon showing, althroughi get the above error
when i select the item in the listview
As far as i know i'm know i'm doing everything correctly. I only have
one collum and the item is just text with a check box 'setCheckable' and
i just want an icon image in the same collum as part of the same item.
I have tried different formats gif, xpm and jpg and also standard images
etc but the same error occurs.
does anyone have sample code that is simple and works fine with pixmaps?
or if you can see anything in my code let me know
cheers
john
to run the below code just make a .ui file mainwindow with a single
listView named 'GroupList' and replace the UI_FILE Path name to point to it.
note...some lines are commented out for testing standard images and some
standard maya ones
## beginning Code##
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4 import uic
import os
import sys
win = None
UI_FILE = 'PATHTOMYUIFILE.ui'
#icon='/usr/autodesk/maya2008-x64/icons/out_mesh.xpm'
cacheGroups=['Shirt_dyn', 'Shirt_hi', 'shirt_dyn', 'shirt_hi']
class MainWindow(QMainWindow):
def __init__(self, *p):
QMainWindow.__init__(self, *p)
uic.loadUi(UI_FILE, self)
self.model = QStandardItemModel()
#pixmap = QPixmap(icon)
icon = QIcon ( self.style().standardPixmap(QStyle.SP_FileIcon) )
cacheGroups.sort()
for i in cacheGroups:
itm = QStandardItem(i)
#itm.setIcon(QIcon(pixmap))
itm.setIcon(icon)
itm.setCheckable(True) #adds checkbox
self.model.appendRow(itm)
self.GroupList.setModel(self.model)
def run():
app = qApp
win = MainWindow()
win.show()
if __name__ == '__main__': # runs them Main window
app = QApplication(sys.argv)
mw = MainWindow()
mw.show()
sys.exit(app.exec_())
print '%s done' % __file__
run()