Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

isDirty [-connection] [-datablock] string...

isDirty is undoable, NOT queryable, and NOT editable.

The isDirty command is used to check if a plug is dirty. The return value is 0 if it is not and 1 if it is. If more than one plug is specified then the result is the logical "or" of all objects (ie. returns 1 if *any* of the plugs are dirty).

Return value

booleanIs the plug dirty? If more than one plug is given then it returns the logical "and" of all dirty states.

Related

attributeQuery, getClassification, isConnected, nodeType, objExists, objectType

Flags

connection, datablock
Long name (short name) Argument types Properties
-connection(-c) create
Check the connection of the plug (default).
-datablock(-d) create
Check the datablock entry for the plug.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// Create a plusMinusAverage node and a transform. We use the '-skipSelect'
// flag so that they are not displayed in the Attribute Editor because
// that would force an evaluation and cause the plugs to become clean.
createNode -n pma -skipSelect plusMinusAverage;
createNode -n t -skipSelect transform;

// Hide the transform so that Maya's draw won't force an evaluation which
// would clean its plugs.
hide t;

// Connect the transform's 'tx' to one of the plusMinusAverage node's
// inputs.
connectAttr t.tx pma.input1D[0];

// Set the value of the transform's 'tx' and check that the
// target of the connection has become dirty.
setAttr t.tx 13;
isDirty pma.input1D[0];
// Result: 1 //

// If we retrieve the value of the destination attribute
// then the connection becomes clean.
getAttr pma.input1D[0];
// Result: 13 //
isDirty pma.input1D[0];
// Result: 0 //

// A plusMinusAverage node's 'output1D' attribute depends
// upon the values in its 'input1D' array. Since we haven't
// retrieved its value yet, it should still be dirty. However,
// it seems to be clean:
isDirty pma.output1D;
// Result: 0 //

// The reason for this is that the 'isDirty' command
// by default only checks connections and 'output1D' has
// no connection to be dirty. If we instead check its
// value in the datablock, we get the expected result:
isDirty -d pma.output1D;
// Result: 1 //

// The output value will remain dirty until we
// force its evaluation by retrieving it.
getAttr pma.output1D;
// Result: 13 //
isDirty -d pma.output1D;
// Result: 0 //