I’ve been working on getting PyQt in softimage working for about a week with the PyQtSI plugin. I’ve been in touch with the author and he says that it works for him but for me even with a new (2 week old) installation of windows and a fresh install of softimage 2013 I get the following error after I try to use python to call a SI command after I press a button. It should make a cube. I have tried with another plugin by Blur which also gives PyQt functionality but the error is similar, saying that Application is not defined.
I tried compiling the plugin from source but there was no difference. I also asked si-community but no luck. I’ve spent a long time trying to get this to work because pyqt is so easy to use.
from PyQt4 import QtCore
from PyQt4 import QtGui
import sip
anchor = sip.wrapinstance(long(Application.getQtSoftimageAnchor()), QtGui.QWidget)
class ExampleCubeMaker(QtGui.QDialog):
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
self.setGeometry( 100, 100, 200, 100 )
self.btn = QtGui.QPushButton("Make Cube", self)
self.btn.clicked.connect(self.cubeMaker)
layout = QtGui.QVBoxLayout(self)
layout.addWidget(self.btn)
def cubeMaker(self):
Application.CreatePrim("Cube", "MeshSurface", "", "")
def showAtMouse(self):
self.show()
pos = QtGui.QCursor.pos()
self.move(pos.x(), pos.y())
def ExampleCubeMaker_Execute():
dialog = ExampleCubeMaker(anchor)
dialog.showAtMouse()
ExampleCubeMaker_Execute()
Traceback (most recent call last):
File “<Script Block >”, line 17, in cubeMaker
File “D:\Autodesk\Softimage 2013\Application\python\Lib\site-packages\win32comext\axscript\client\pyscript.py”, line 138, in getattr
return self.scriptItem.subItems[attr.lower()].attributeObject
AttributeError: ‘NoneType’ object has no attribute ‘subItems’
Basically I just downloaded PyQt and dropped it in the softimage lib/site-packages and then install the addon and run the script.
[B]Edit: Solved this problem by using the Blur pyQt and adding these lines to the top
import win32com.client
xsi = win32com.client.Dispatch( “XSI.Application” ).Application[/B]