API : scene load ignores array elements with default value

API : scene load ignores array elements with default value

BurkhardRammner
Collaborator Collaborator
741 Views
3 Replies
Message 1 of 4

API : scene load ignores array elements with default value

BurkhardRammner
Collaborator
Collaborator

Hi, first post here : }

the title says it all. All elements with default value are not even created when the scene is loaded. Obviously, this is the way it's meant to be.

But that's rather unfortunate. So, may there be a way to make Maya create those elements?

 

thanks!

0 Likes
742 Views
3 Replies
Replies (3)
Message 2 of 4

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

I think you could try to create them in MPxNode:postConstructor. You may want to test it against MFileIO to check if it is constructing during a loading or other operations.

 

Yours,

Li

0 Likes
Message 3 of 4

BurkhardRammner
Collaborator
Collaborator

Hi Cheng,

 

thanks for your answer.

The idea looks like it may work.

However, I did come up with another alternative:

1. set default values which never can be reached

2. Upon construction of the respective element, give it the 'true' default value

This way, Maya thinks the value is not defalut and thus nicely creates it when reloading the scene : )

 

Anyway, thank you!

Message 4 of 4

Anonymous
Not applicable

Have been looking for a solution to this problem and so far yours is the only one that works for me. In my case I need to keep array attributes of zero-valued weights for my custom deformer node. 

 

Fortunately it is designed in such a way that it does not support negative weights so I got away with setting the default value to -1.0. I wonder how it is done in for example the native Maya blendShape node though. I can't imagine they set the default value to something like 1e+6.

 

Would be nice to get this clarified by someone from Autodesk?

 

Thanks for your post!

0 Likes