Bozar
04-03-2006, 05:48 PM
I am adding a custom attribute called shadersAttrib to a material using the following code:
fn addShaderAttrib material =
(
if isProperty material "mShaderList" == false AND classof(material) == Standardmaterial do
(
custAttributes.add material shadersAttrib
)
if isProperty material "mShaderList" == true AND classof(material) != Standardmaterial do
(
custAttributes.delete material shadersAttrib
)
)
callbacks.addScript #mtlRefAdded "addShaderAttrib(callbacks.notificationParam())"
The Problem i am having is this: Once a lot of materials have been created the custom attribute starts appearing as an attribute of the object the material is placed on!? I have no idea how this happens as I have added a pretty explicit check in the fn that adds the attribute. It gets worse as some objects begin having several copies of the attribute assigned and the property window fills up with several of the rollouts associated with the attribute. Once the object has the attribute calling:
custAttributes.delete obj shadersAttrib
does not remove it.
Is this a bug in maxscript or am I missing something?
Thanks in advance for any ideas!!:)
fn addShaderAttrib material =
(
if isProperty material "mShaderList" == false AND classof(material) == Standardmaterial do
(
custAttributes.add material shadersAttrib
)
if isProperty material "mShaderList" == true AND classof(material) != Standardmaterial do
(
custAttributes.delete material shadersAttrib
)
)
callbacks.addScript #mtlRefAdded "addShaderAttrib(callbacks.notificationParam())"
The Problem i am having is this: Once a lot of materials have been created the custom attribute starts appearing as an attribute of the object the material is placed on!? I have no idea how this happens as I have added a pretty explicit check in the fn that adds the attribute. It gets worse as some objects begin having several copies of the attribute assigned and the property window fills up with several of the rollouts associated with the attribute. Once the object has the attribute calling:
custAttributes.delete obj shadersAttrib
does not remove it.
Is this a bug in maxscript or am I missing something?
Thanks in advance for any ideas!!:)
