Not all your code is exposed – where is get_object() coming from? Is that your
own wrapper?
Might want to make a few tweaks to avoid commands and go strictly with the
scripting object model. When using commands you run the risk of triggering
events and other stuff that can interact with the GUI or cause unnecessary
scene refreshes killing your code in its tracks.
For example, instead of:
Pss = app.GetCurrentPass()
Try:
CurrentPass = Application.ActiveProject.ActiveScene.ActivePass;
Instead of using the PPG shortcut, try going through the custom property
formally via the Parameters collection. If you use the PPG shortcut and try to
access a parameter which shares the same name as a property or method of the
CustomProperty object, you’ll get side effects. For example, create a
parameter called “type” and add it to your custom property. When accessed as
PPG.type.value, you’ll get the value of CustomProperty.Type, not the ‘type’
parameter added to your custom property.
Try:
oCustomProperty = Dictionary.GetObject( “RenderUtilities”,
false );
if oCustomProperty :
Bake_active = oCustomProperty.Parameters(
“bake_active” ).value;
The problem you’re experiencing is likely in your custom events. I’d look
there first.
Matt
From: [email protected]
[mailto:[email protected]] On Behalf Of Jules Stevenson
Sent: Wednesday, June 11, 2014 11:48 AM
To: [email protected]
Subject: Re: Python: Limitations / Differences in xsibatch versus interactive
Hey Matt,
Some code, essentially all I'm pulling is data that's already residing in the
PPG. What's failing is setting: bake.input_object.value = ob.FullName +
".SItoA.1000", but it logs back out just fine. However something is screwy as
this information is not getting pulled to the shader at rendertime - works just
fine in interactive...
PPG = get_object("RenderUtilities")
bake_active = PPG.bake_active.Value
if bake_active:
GridData = PPG.bake_data.Value
bake = get_object(PPG.bake_shader.value)
pss = app.GetCurrentPass()
index = None
for i in range(0, GridData.RowCount):
if GridData.GetCell("Pass",i) ==
pss.FullName:
index = i
break
if index != 0:
ob =
get_object(GridData.GetCell("Object",index))
# set bake item to camera
bake.input_object_name = ob.FullName
bake.input_object.value = ob.FullName +
".SItoA.1000"
log(bake.input_object.value)
else:
bake_active = False
Cheers,
Jules
On Wed, Jun 11, 2014 at 7:43 PM, Matt Lind
<[email protected]<mailto:[email protected]>> wrote:
Don’t do anything that interacts with a GUI. That’ll crash XSIBatch as
XSIBatch is essentially XSI.exe without any GUI, or support for a GUI.
How are you getting information from your custom properties? That might be a
factor.
Matt
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Jules Stevenson
Sent: Wednesday, June 11, 2014 11:40 AM
To: [email protected]<mailto:[email protected]>
Subject: Python: Limitations / Differences in xsibatch versus interactive
Hey Gang,
We have a few custom properties and events which refuse to behave themselves in
batch, are there any common gotchas / workflows / things to avoid when using
XSIbatch.
Infuriatingly, all the logging I've been doing seems to suggest things are
running just fine, but then the script still fails (specifically I'm pulling a
value from a custom property and using this to change some parameters on a
custom lens shader).
Any thoughts / help much appreciated.
Jules