Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Detach Materials and Shaders in python script
  RSS 2.0 ATOM  

Detach Materials and Shaders in python script
Rate this thread
 
49788
 
Permlink of this thread  
avatar
  • Total Posts: 15
  • Joined: 09 August 2010 08:32 PM

I’m looking for a way to directly Detach a material or shader from an object, without deleting stuff or other workarounds.

I can append ..

charactersToAppendMattes = FBComponentList()
FBFindObjectsByNamespace( “Characters”, charactersToAppendMattes)
matteShaderToAppend = FBComponentList()
FBFindObjectsByNamespace( “matte”, matteShaderToAppend)

charactersToAppendMattes[0].Materials.append(matteShaderToAppend[0])

However there’s no similar method for Detach. Workaround currently is using ReplaceAll Function in FBShader. However that requires reconstructing other shaders that might already exist on the model.

-Kristian



Replies: 0
avatar

Since the shaders are stored as a list type,
found that I can use pop (remove from list) to detach shaders from an object

charactersToAppendMattes[0].Shaders.pop()



Replies: 0