Skip to content

Instantly share code, notes, and snippets.

@mottosso
Last active February 10, 2021 14:20
Show Gist options
  • Save mottosso/4a9c4f64d3921acf40d86cbec4336c63 to your computer and use it in GitHub Desktop.
Save mottosso/4a9c4f64d3921acf40d86cbec4336c63 to your computer and use it in GitHub Desktop.
Editable Initial State - Attempt 6 - Internal Value

⬅️ Back

Setting an attribute to internal, without actually acting upon it, means we are notified whenever it changes.

There are two reasons to set an attribute as 'internal'. The first, and simplest, is when you want notification that the attribute has been set, or queried. - Reference

aInWorldMatrix = matFn.create("inWorldMatrix", "inwm");
matFn.setInternal(true);

...

bool initialStateNode::setInternalValue(const MPlug& plug, const MDataHandle& dataHandle) {
  Print() << "inWorldMatrix was set\n";
  return false;
}

So what if inWorldMatrix was internal? Would it notify us whenever pCube1.worldMatrix changed? No. It doesn't appear like it. It is called when the attribute is set, but not when a connection to it - like pCube1.worldMatrix - changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment