Difference between revisions of "Render Frame Size"

From The Foundry MODO SDK wiki
Jump to: navigation, search
(Created page with "Code snippet that reads and sets the Render item's frame size channels - demonstrates reading and writing channels. [syntaxhighlight lang="python"] #Get render item: import l...")
 
 
Line 1: Line 1:
 
Code snippet that reads and sets the Render item's frame size channels - demonstrates reading and writing channels.
 
Code snippet that reads and sets the Render item's frame size channels - demonstrates reading and writing channels.
  
[syntaxhighlight lang="python"]
+
<syntaxhighlight lang="python">
 
#Get render item:
 
#Get render item:
 
import lxu.select
 
import lxu.select
Line 25: Line 25:
 
# double the render frame height channel
 
# double the render frame height channel
 
cout.Integer(rend, idx + 1, h * 2)
 
cout.Integer(rend, idx + 1, h * 2)
[/syntaxhighlight]
+
</syntaxhighlight>
  
 
[[Category: API Examples]]
 
[[Category: API Examples]]
 
[[Category: Python API]]
 
[[Category: Python API]]
 
[[Category: Channel Read and Write]]
 
[[Category: Channel Read and Write]]

Latest revision as of 08:07, 27 June 2013

Code snippet that reads and sets the Render item's frame size channels - demonstrates reading and writing channels.

#Get render item:
import lxu.select
scene = lxu.select.SceneSelection().current()
ss = lx.service.Scene()
rend = scene.AnyItemOfType(ss.ItemTypeLookup(lx.symbol.sITYPE_RENDER))
 
# Get a raw channel object
chan = scene.Channels(lx.symbol.s_ACTIONLAYER_EDIT, 0.0)
 
# Get the index of the Render Item's frame width channel
idx = rend.ChannelLookup(lx.symbol.sICHAN_POLYRENDER_RESX)
 
# Read the frame width channel
w = chan.Integer(rend, idx)
# Read the frame height channel
h = chan.Integer(rend, idx + 1)
 
# Get a channel write object
cout = lx.object.ChannelWrite(chan)
# double the render frame width channel
cout.Integer(rend, idx, w * 2)
# double the render frame height channel
cout.Integer(rend, idx + 1, h * 2)