Code: Select all
# Traceback (most recent call last):
# File "<Script Block >", line 38, in logText
# File "C:\Program Files\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'
Code: Select all
class NamedScriptAttribute:
"An explicitely named object in an objects namespace"
# Each named object holds a reference to one of these.
# Whenever a sub-item appears in a namespace, it is really one of these
# objects. Has a circular reference back to the item itself, which is
# closed via _Close_()
def __init__(self, scriptItem):
self.__dict__['_scriptItem_'] = scriptItem
def __repr__(self):
return "<NamedItemAttribute" + repr(self._scriptItem_) + ">"
def __getattr__(self, attr):
# If a known subitem, return it.
try:
return self._scriptItem_.subItems[attr.lower()].attributeObject
except KeyError:
# Otherwise see if the dispatch can give it to us
if self._scriptItem_.dispatchContainer:
return getattr(self._scriptItem_.dispatchContainer,attr)
raise AttributeError, attr
I've tried dynamic dispatch but it made no difference. I recently saw a post http://www.softimageblog.com/archives/245 which talks about "rebinding" a variable but I'm not sure how to go about this or if this is what i want to do.
Code: Select all
oDiffuse.disconnect()
xsi.logmessage( oDiffuse.parameters( 'red' ).value )
# ERROR : Traceback (most recent call last):
# File "", line 14, in ?
# xsi.logmessage( oDiffuse.parameters( 'red' ).value )
# AttributeError: 'NoneType' object has no attribute 'value'
# - [line 14]
Code: Select all
oDiffuse.disconnect()
# Rebind parameter and variable
oDiffuse = oDiffuse.parent.parameters( 'diffuse' )
xsi.logmessage( oDiffuse.parameters( 'red' ).value )
This is the script. I downloaded PyQt26 compiled against python 2.6, and the PyQtSI addon. It makes a window with a button on it and I get the error when I press the button.
http://www.riverbankcomputing.co.uk/sta ... .9.1-1.exe
https://github.com/caron/PyQtForSoftimage
I put the PyQt module and sip into "C:\Program Files\Autodesk\Softimage 2013\Application\python\Lib\site-packages"
http://pastebin.com/2YraLBtc
Code: Select all
from PyQt4.QtCore import Qt
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtGui import QDialog
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QLineEdit
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QMenu
from PyQt4.QtGui import QCursor
import sip
anchor = sip.wrapinstance(long(Application.getQtSoftimageAnchor()), QWidget)
class ExampleDialog(QDialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setGeometry( 100, 100, 200, 100 )
self.btn = QPushButton("Make Cube", self)
firstButton = self.btn
firstButton.clicked.connect(self.cubeMaker)
layout = 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 ExampleDialog_Execute():
dialog = ExampleDialog(anchor)
dialog.showAtMouse()
ExampleDialog_Execute()