Notifications
Clear all

[Closed] Copy Material with custom data

Hello, I have a Material/Animatable in 3ds max that I have added some custom data to. I am using the 3ds Max SDK to accomplish this but I have also made a easy to reproduce example below. I have a cube with a material on it. I select it and run:

mat = selectedNode.GetMaterial()
mat.SetAppData(0, “Test”)

This works great. I can then call the following to print the app data.

mat = selectedNode.GetMaterial()
appData = mat.GetAppData(0)
print appData

(Code based off: http://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__py_ref_demo_app_chunk_8py_example_html )

This works great to. The problem is that when I copy the Material in the material editor the custom data that I have set on it does not copy across. It has the same visual appearance however. I had the same problem with nodes but I solved it by registering for the “NOTIFY_POST_NODES_CLONED” operation and copying the custom data over there. However this does not get called for materials and I can not find anything on the Notify codes that would do what I want.

I could write my own function that does it properly, however I want it to work in the normal UI. Any ideas of how I could accomplish this?

Thanks