Render Frame Size

From The Foundry MODO SDK wiki
Revision as of 08:06, 27 June 2013 by GwynneR (Talk | contribs) (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...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

[syntaxhighlight lang="python"]

  1. Get render item:

import lxu.select scene = lxu.select.SceneSelection().current() ss = lx.service.Scene() rend = scene.AnyItemOfType(ss.ItemTypeLookup(lx.symbol.sITYPE_RENDER))

  1. Get a raw channel object

chan = scene.Channels(lx.symbol.s_ACTIONLAYER_EDIT, 0.0)

  1. Get the index of the Render Item's frame width channel

idx = rend.ChannelLookup(lx.symbol.sICHAN_POLYRENDER_RESX)

  1. Read the frame width channel

w = chan.Integer(rend, idx)

  1. Read the frame height channel

h = chan.Integer(rend, idx + 1)

  1. Get a channel write object

cout = lx.object.ChannelWrite(chan)

  1. double the render frame width channel

cout.Integer(rend, idx, w * 2)

  1. double the render frame height channel

cout.Integer(rend, idx + 1, h * 2) [/syntaxhighlight]