Hi All (its been a while :D: )
I’ve wanted to post about this for a while but other things kept coming up that were more important…
The problem:
I’ve got a script that edits a shelf icon when an event occurs. This works fine, however occasionally it would cause the script editor to print the "Objects Window not found: line 1 " error … but the icon was still edited and all seems well.
I haven’t really had time to dig further into this bug until recently and I’ve finally got a controlled reproduction for the issue. My impression is somethings failing inside of Maya as with the code inside a try statement, it fails to hit any exceptions. With echo all commands enabled on this is the output of the script editor just prior to the error.
string $parentPopupMenu = `popupMenu`;popupMenu -e -pmo 1 -pmc ( "shelfButtonPMO \"" + $parentPopupMenu + "\" 1 " + "\"MayaWindow|toolBar2|MainShelfLayout|formLayout14|ShelfLayout|MyTestShelf|shelfButton514\" \"/*dSBRMBMI*/\"" ) $parentPopupMenu;
// Error: line 1: Object's window not found. //
Replication steps:
To rule out our tech, i managed to make the error occur on a virgin Maya (2013) installation by doing this.
[INDENT]
- Run this snippet ( I’m using the Help button as an example )
import pymel.core as pm
import maya.mel
gShelfTopLevel = maya.mel.eval('$tmpVar=$gShelfTopLevel') # Get a list of current tab names currently loaded in Maya
currentShelfTabs = pm.shelfTabLayout(gShelfTopLevel, query=True, childArray=True)
for tab in currentShelfTabs:
if "General" in tab:
shelfContents = pm.shelfLayout((gShelfTopLevel+"|"+tab), query=True, childArray=True)
if shelfContents != None:
for item in shelfContents:
mItem = pm.uitypes.PyUI(item)
if mItem.getLabel() == "Help":
mItem.setEnable(False)
-
So that shouldn’t have errored. Now, open the main Maya preferences window and either close the dialog (“x”) or hit save. Hitting cancel will not cause this issue to occur.
-
Re-run the block of code above - you should now see the objects window error.
[/INDENT]
There are other ways you can cause the bug to occur other than opening / closing preferences - but that’s the simplest reproduction I’ve found so far.
As far as i know this is a completely benign error, but the little flash of red is annoying and it confuses some the users here as they think its something more important than it is, so any thoughts / advice would be very welcome!
Cheers!
~ Joe