Jump to content

Anthony Cavel

Regular Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Noble Beginner

Profile Information

  • First Name
    Anthony
  • Last Name
    Cavel
  • C4D Version
    R20.026 Studio
  • Location
    FRANCE
  1. Hello everyone I'm trying to write a script that selects and merges the shaders wich have the same "MATERIAL_COLOR_SHADER" For the moment I have this, and it allows me to merge only manually selected shaders: import c4d def (): mats = doc.GetActiveMaterials () list_tags = list () for mat in mats: obj_link = mat [c4d.ID_MATERIALASSIGNMENTS] for i in xrange (obj_link.GetObjectCount ()): list_tags.append (obj_link.ObjectFromIndex (doc, i)) doc.StartUndo () for tag in list_tags: doc.AddUndo (c4d.UNDOTYPE_CHANGE, tag) tag [c4d.TEXTURETAG_MATERIAL] = mats [0] for mat in mats [1:]: doc.AddUndo (c4d.UNDOTYPE_DELETE, matt) mat.Remove () doc.EndUndo () c4d.EventAdd () if __name __ == '__ main__': main () Now I have no idea of what I could write more to find and select the duplicates materials. This scripts would be very useful when I import fbx characters from DAZ. There are always 1000 duplicated shaders to merge, and it takes time. Maybe a script already exists, but I have not found anything yet. Thanks, Anthony
  2. Hi everyone, It's been at least 6 hours I'm desperately looking for write a python script that select all the texture tags assigned to my objects, and change the "selection" value (called TEXTURETAG_RESTRICTION) to "off#". This would disable all the shaders in my scene, even in octane live viewport. Then I would can write the same code and change the "off#" to "", and obviously enable again all the materials For the moment, it took me ages to write and obtain this: import c4d from c4d import gui def main(): c4d.CallCommand(300001025) # Select All c4d.CallCommand(16370, 16370) # Select Texture Tags/Objects s = doc.GetActiveTags() for i in s: tag(i)[c4d.TEXTURETAG_RESTRICTION] = "off#" c4d.EventAdd() if __name__=='__main__': main() The execution of these lines selects all all the texture tags assigned to my objects, but it's impossible for the moment to change the "selection" value (called TEXTURETAG_RESTRICTION) to "off#" Does anyone have an idea to solve my issue ? Thanks, Antoka

Latest Topics

Latest Comments

×
×
  • Create New...