Closed ghost closed 12 years ago
i will look into this soon but no one else has encountered this issue before so i am not sure what it could be.
keep in mind softimage is an mfc app (i believe it is), what we are doing here isn't natively supported. what works in maya is of no relevance, since it is now a qt based app.
ok, this example doesn't run, can you please provide the 'softimageCubeTest.ui' file?
also what is QtGui.file? i do not know about the file property of the QtGui module.
this code runs fine for a simple button, it also doesn't 'move position' each time it is run from the script editor. (be aware there might be odd behavior when running from a script edtior, instead wrap it in a command)
from PyQt4.QtGui import QDialog
from PyQt4.QtGui import QWidget
from PyQt4.QtGui import QPushButton
import sip
sianchor = Application.getQtSoftimageAnchor()
sianchor = sip.wrapinstance( long(sianchor), QWidget )
dialog = QDialog(sianchor)
btn = QPushButton(dialog)
dialog.show()
i will try and make an example which uses .ui files and provide that in the source code.
Steve,
Thanks the feedback. That example I posted with loading the UI file is done in a way where you dont need to convert it to .py first. This works in Maya because you can set commands that get picked up in QtDesigner. However with Softimage this doesnt work and you must convert it to py first.
Having said that, while I was using PyQtForSI I ran into errors when I tried to use a command that was linked to a button including in the exampleDialog. This returns AttributeError: 'NoneType' object has no attribute 'subItems'. This seems to be an issue with parenting the window with sip to softimage??
After many hours of searching I found a way to get application.whatever() to work from a button but its not an ideal solution. This is just a modified, simplified version of the included exampleDialog to use the newer method of signals and slots and create a cube when you push the button.
Im using pyQt x64 compiled against py 2.6.4. I've had great difficulty in the past compiling pyqt so I use an installer found on nathanhorne.com (first post). That it works with the 2nd method leads me to believe that using 2.6.4 while I have read that you compiled it against 2.7.1 might not be the problem?
i can't comment on the second link, its not even using the functionality that PyQtForSoftimage provides...
i can get your example which creates a cube to work fine, and it behaves as it should when you wrap it in a command.
i have an example which loads a ui file using uic.loadUi() and the gui is parented properly. my only issue now is i get hard crashes when actually calling the CreatePrim command in Softimage. stay tuned...
ok i have committed a new example which loads a ui file and calls softimage command. 4e28cae
Steve,
Thanks for the example.
You are right, the second script I provided causes a pyQt window to run even without your plugin. However, its not ideal for what Im trying to do because you can only have one at a time.
I am still having the issue of not being able to run a cmd from a button. I have chalked this down to to me using 2.6 python while you are using 2.7 but I am not sure. I just reinstalled my system 2 weeks ago so there is little that could be interfering with it. I tried with beta 4 and beta 3.
I took the following steps to test this
I uninstalled all previous pyQt installs and then downloaded PyQt-Py2.7-x64-gpl-4.9.1-1 and python 2.7 and then I placed the PyQt lib and sip into the SI py site packages folder. I but got the error saying that it was using 2.7 py while it SI uses 2.6. I tried all the examples I could to get this to work including installing pywin32 for py2.7 and running runonce.bat. It doesn't work and doesnt let me recognize calling the 2.7 pyQt module.
I then tried making a version of your plugin built against 2.6 so I wouldnt have to switch out anything. I had to change the first line of
and
then I did a build in VS 2010 but it didnt output a .addon, just an empty log saying build started/succeeded
I dont have the a lot of experience building apps but I have built a few things.
So, I'm hoping that you could provide some insight and if the 2.7/2.6 really is the issue. Perhaps you could install of py 2.6 and pyqt 2.6 and swap your files out for the 2.6 pyqt lib and see if you get the same error when calling a command from a button.
lets not manipulate the softimage python install. use the system python instead... i have tested using python 2.6.x and 2.7.x... you shouldn't have to recompile the plugin from source either.
i will post my configuration of my machine soon, that way we can get synced and really compare apples to apples.
lastly, i need to update my cmake to support more softimage versions.
my machine is running python 2.6.6. i am not using built in softimage, i have a standard install of pyqt 4.8.5. i am using beta4 version of the plugin. i am also running softimage 2011.
i dont have access to a newer version of softimage at home yet, so it will need to wait until i try it at work. but from what i can tell this issue is isolated to you and your setup. do you have access to all of the items listed above? can you setup your machine and let me know how it works?
Steve,
I tried with a new install of SI 2011 and I got the same error. I also tried uninstalling and reinstalling 2011 and 2013 and I got the same thing. I dont understand why this is happening because like I said I just reinstalled my system, everything else in SI is working including other plugins and addons and all of my other Autodesk tools work fine as well as every other program.
Perhaps I can redirect you to a topic I started yesterday at si-community where I mention a similar case that I found on softimageblog.com with a similar error with a "NoneType' obj didnt have an attribute and then he had to "rebind" it by parenting it a higher class, but, Im not sure if that is what I want in this case or how to go about doing it. Thanks for your time.
http://www.si-community.com/community/viewtopic.php?f=16&t=2366
are you running the system installed python? and what version is it?
you closed the issue... was that on accident?
I'm running the python thats included with SI. I tried the method of unchecking 'use py installed with SI" and then uninstalling-reinstalling python26 and pywinAmd64py26 and runonce.bat after updating my system paths. After doing that I cant even do a command like print 'hi' and it seems like my new python install has not been added and the tab in the script editor is just the disabled si one.
Also, im not clear on the reasoning why I should be running python from a non-provided python knowing that for maya I can just drop pyqt and sip into "C:\Program Files\Autodesk\Maya2013\Python\Lib\site-packages" and be just fine. I find it hard to believe that this is a requirement for getting your pyqtSI to execute commands correctly when it is such a pain to even get an external py to even recognize and also that you didnt give explicit instructions that this had to be the way that it must be run. Again, I cant test this because it doesnt work for me.
I closed the issue because it seems like I'm the only one having this problem for some reason, making searching for solutions to the issue pointless at this time. Im giving up, I've spent a lot of time trying to troubleshoot the issue and tested every combo i can think of short of reinstalling windows which I dont want to do.
softimage shipped python as of 2011, so softimage users have been using python installed on the system for many many years. softimage DOES support python being installed on the system. you need to use pywin32 package so softimage can communicate with python. go here for help...
http://xsisupport.wordpress.com/2010/02/22/getting-python-to-show-up-in-softimage/ https://vimeo.com/12097088
i agree, you should be able to drop pyqt and sip into the softimage python site-packages directory but i personally haven't tried it. i opt to use system python for a few reasons... pyqt installs there by default and you have the ability to change the version of python you want to use instead of locking to a python softimage ships with.
i am reopening this issue until we resolve it. you shouldn't have to reinstall windows :)
install python 2.6.x install pyqt 4.8.x install beta 4 version of PyQtForSoftimage plugin to which ever version of softimage you choose
run all of the provided examples and verify they work, i provided a new example which creates a cube from a pyqt gui. if these examples work we need to go back to your code and identify what the issue is.
i will update the instructions in the repo soon.
Steve,
Those are websites and videos that I have already watched and followed the instructions as written.
I have recorded a vid where I show that I can run your exampleDialog unchanged as you wrote it in one very specific situation only and then I show how it doesnt run. Strange that it works like this.
ok i watched the video. i am quite busy so i haven't reproduced your exact issue but here are some notes...
-the pyqt_example.py is not to be run from the script editor like that. you can just call 'Application.ExampleDialog()' from the script editor though.
-wrap the starting of the gui in a softimage registered command, again just like the 'examples' provided.
-update your pyqt_example.py (and other .py files) from the current repo here on github. the one in your video is very old. i recently added a .ui loading example that creates a cube in the scene. i will need to make a new package (beta5) which includes the latest changes to the python scripts.
-remember what 'works' in maya isn't relevant, at least not how the application is created/parented to the host app. pyqt is the same and you can create an abstracted gui/application which could run on both maya and softimage.
feel free to send me an example maya pyqt app and .ui file and i will show it working in softimage.
Steve,
Thanks for your help. I moved on to using the Blur implementation and encountered the same problem. Lucky for me, I was able to fix it by examining one of their sample commands and adding the lines
import win32com.client xsi = win32com.client.Dispatch( "XSI.Application" ).Application
and setting my button to xsi.CreatePrim("Cube", "MeshSurface", "", "") made it work right away. I tried the same with pyQtSI but there was no change.
Thanks anyways.
hmm, ok.
i am not convinced there is anything wrong in the first place. i worked at blur and used the pyqt implementation there, this one is far lighter and should work the same. i am confused why my ExampleUIFile() included in the pyqt_example.py doesn't show you how to implement exactly what you need.
the reason the blur one didn't work right away has nothing in common with why the pyqtforsoftimage doesn't work for you. it was simiply needing to import the XSI application object. in my example code i dont use 'xsi' i call Application directly which is the same thing.
anyways, if its working for you, great! but it saddens me that you can't use our plugin because i think its better.
hey bergj
i just wanted to say i reproduced your issue but it is as i said already, there is nothing wrong with the system you simply cannot execute that function in that way. this is one advantage to the blur implementation currently, i believe it is keeping a global variable around of the qApp object which is why applications run from the script editor work.
first, you can't call the function directly like that, you must call the registered command "Application.ExampleDialog()". the "def ExampleDialog_Execute()" is softimage's function to call. i am not 100% sure whats happening, but i imagine softimage is taking care of many things to ensure the function is run correctly and persisted while the script is executing.
lastly, you must remember that maya's python and softimage's python are implemented differently. maya's behaves more like the standard cmd line interpreter, softimage's doesn't behave this way it sort of runs scripts from the editor then forgets.
so to review...
create a simple command which creates your pyqt application and softimage will take care to keep objects around while the pyqt app is still up.
My pyqt windows show for a very short time and then close automatically. If I execute the commands repeatedly from the script editor they also move position for some reason. Your 3 example windows stay up.
This happens with all of my windows, from the simplest ones to ones I try to use with pyuic. I use pyQt a lot in Maya and it works fine.