opening the Render Tree of the Current Pass

Discussions concerning programming of SOFTIMAGE©
User avatar
edschiffer
Posts: 21
Joined: 11 May 2011, 15:02
Location: Rio de Janeiro

opening the Render Tree of the Current Pass

Post by edschiffer » 31 Dec 2011, 16:08

Hi all,
I'm learning python and as an exercise, I'm trying to make a script that opens the Render Tree of the Current Pass, without losing the current selection. so far it goes:

Code: Select all

app = Application
sel = app.Selection

curSel = []
for obj in sel:
	curSel.append(obj)

app.SelectObj(app.GetCurrentPass())
app.OpenView("Render Tree", False)

app.SelectObj(curSel)
the strange thing is that when it opens the view, it says that "Update can't be done with two objects selected", as if it were reading the last line before the Render Tree is finally opened... (if I comment the last line it works, but doesn't get the selection back)

is it common?
should I be doing anything different, like XSI.Collection?
how to overcome this?

many thanks,

User avatar
xsisupport
Posts: 713
Joined: 09 Jun 2009, 09:02
Location: Montreal Canada

Re: opening the Render Tree of the Current Pass

Post by xsisupport » 31 Dec 2011, 20:10

The view is opened after the script finishes executing, that's why you get the message in the Render Tree.
Not sure that there's a way around this, except maybe using a timer event.
I'm pretty sure I've seen this before, but it's been a few years...

I didn't try putting that script into a custom command to see if that made any diff.
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage

User avatar
edschiffer
Posts: 21
Joined: 11 May 2011, 15:02
Location: Rio de Janeiro

Re: opening the Render Tree of the Current Pass

Post by edschiffer » 31 Dec 2011, 20:38

I tried time.sleep(), but it only slowed down the opening, as you mentioned...
tried putting the .OpenView under a loop too, but got the same results.

OK, at least it's good to know it's not only a slip of mine...