Jump to content

Muybridge

Regular Member
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Noble Beginner

Profile Information

  • First Name
    Nick
  • Last Name
    H.

Cinema 4D Information

  • C4D Version
    20.059 Studio
  1. Ok so let me explain it a little bit further. I need a script to bake all the posemorph tags in the scene to export animated characters to unity. The following script does that and while I'm sure that's a pretty dirty workaround it seems to fullfill its purpose. import c4d from c4d import gui layer_list = [] c4d.CallCommand(12113, 12113) # deselect All def prepareLayers(layer_root): layer = layer_root.GetDown() while layer: prepareLayers(layer) layer_list.append(layer) layer = layer.GetNext() print (layer_list) for x in layer_list: x.SetLayerData(doc, {'manager':True}) x.SetLayerData(doc, {'locked':False}) #print ("done") c4d.EventAdd() def recurse_hierarchy(op): while op: recurse_hierarchy(op.GetDown()) tag_list = op.GetTags() for tag in tag_list: if tag.GetType() == 1024237: # ID = PoseMorphTag doc.SetActiveTag(tag, mode=c4d.SELECTION_ADD) op = op.GetNext() c4d.EventAdd() def bakeIt(): c4d.CallCommand(465001542, 465001542) # Timeline (F-Curves)... c4d.CallCommand(465001191) # Dope Sheet if c4d.IsCommandChecked(465001037): pass else: c4d.CallCommand(465001037, 465001037) # Automatic-Mode if c4d.IsCommandChecked(465001052): pass else: c4d.CallCommand(465001052, 465001052) # Link View to Object Manager if c4d.IsCommandChecked(465001132): pass else: c4d.CallCommand(465001132, 465001132) # Link TL/OM Selection if c4d.IsCommandChecked(465001314): pass else: c4d.CallCommand(465001314, 465001314) # onedirectional Selection Link c4d.CallCommand(465001056, 465001056) # Make everything visible c4d.CallCommand(465001055, 465001055) # Hide deselected gui.MessageDialog('Make sure only "Bake Expressions" and "Animated Parameters" is checked in the next window.') c4d.CallCommand(465001219, 465001219) # Bake Objects c4d.EventAdd() if __name__=='__main__': prepareLayers(doc.GetLayerObjectRoot()) recurse_hierarchy(doc.GetFirstObject()) bakeIt() recurse_hierarchy(doc.GetFirstObject()) prepareLayers() makes sure all tags are available for the following operations. recurse_hirarchy() selects all the posemorph tags. bakeIt() prepares the timeline window so I can call the bake command and it's only applied to the posemorph tags. recurse_hirarchy() selects all the posemorph tags again so I see their tracks in the timeline. That's just checking if it worked. As I said before I wasn't able to write my own bake function and therefore most of the script is preparing the setup to use the built in bake command at the end. I think it's working for me while it will probably make you cry if you're a programming pro ;) So for learning purposes feel free to comment what I did here
  2. Thank you. I have to go trough your script step by step to really understand it and lern something I thing selecting the tags will be a part I need, because in the end I wan't to bake the animation that's on them and because of limited scripting skills I thought about using the bake objects command. That solution would depend on selected objects I guess. But step by step I'm right in the middle of it.
  3. Thank you for the hint. But I need the selection as part of a script so the om filter won't work for me. Still wishing for the magic word ;) Checking every object in the scene for a specific tag seems like the complicated way to do it but maybe you're right ;)
  4. Hi. Probably a pretty basic question: Is there a way to select all tags in a scene that are of the same type at once? Can't find the right python command Thanks Nick
×
×
  • Create New...

FORUMS INFO:

Dear members, we are aware of few more bugs that are still present withing the theme.We just wanted to let you know that we are working to fix them as soon as possible.
 

NEW MEMBERS:

Please be aware that we are manually approving all new registrations, due to spam prevention. Please be patient in case you cannot login right away, we will approve you within 12h or less if we decide you are not potential spammer. 

 

Thanks for understanding! :cowboypistol: