Over at Mayastation Annick Harmel-Tourneur demonstrates a little example of how to create a window to catch a user’s input in Autodesk Maya 2011, in this case the Render Settings startFrame, endFrame and byFrameStep values.

“Here is a little example on how to create a window to catch a user’s input, in this case the Render Settings startFrame, endFrame and byFrameStep values. The second step is to update those values in the Render Settings window with a global procedure.  The global proc is called with the -changeCommand (-cc) flag that is executing when the value of the field changes.

Here I am using these attributes as an example but really you can use most attributes that are integers.  Also note that I am using the control intFieldGrp even if there is only one field, this is because the intFieldGrp  has a label flag and the inField does not.”

this is the proc that updates the values:

global proc updateRenderSettings()
{
int $updatedSF = `intFieldGrp -q -value1 int1Items`;
setAttr defaultRenderGlobals.startFrame  $updatedSF;

int $updatedEF = `intFieldGrp-q -value1 int2Items`;
setAttr defaultRenderGlobals.endFrame  $updatedEF;

int $updatedBF = `intFieldGrp -q -value1 int3Items`;
setAttr defaultRenderGlobals.byFrameStep  $updatedBF;
}

this creates the window:

string $window = `window`;
columnLayout;
intFieldGrp -label “StartFrame” -value1 (`getAttr defaultRenderGlobals.startFrame`) -cc updateRenderSettings int1Items;
intFieldGrp -label “EndFrame” -value1 (`getAttr defaultRenderGlobals.endFrame`) -cc updateRenderSettings int2Items;
intFieldGrp -label “ByFrame” -value1 (`getAttr defaultRenderGlobals.byFrameStep`) -cc updateRenderSettings int3Items;
showWindow $window;

2 comments

  1. Craig Miller

    Lester,
    An interesting example though I’m not sure how you might use this to alter, for example, the intensity of the current selection of lights?

  2. Craig Miller

    oops … offset their intensity rather than setting it at a value. 🙂

Comments are closed.