THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/12/2012 at 03:29, xxxxxxxx wrote:
first of all, as a side note - you do not have to define doc. it is already predefined. there are always
some variables predefined as doc (current document) or tp t(he documents particle system).
dynamics baking seems to have some problems with multi-selections. the code of yours is perfectly
fine. however, if you fake the step by step selection, it works as expected (at least for me).
import c4d
def main() :
dc = {}
dc['id'] = c4d.DescID(c4d.RIGID_BODY_CACHE_BAKE)
tagSelection = doc.GetActiveTags()
for tag in tagSelection:
if tag.GetTypeName() == "Dynamics Body":
tag[c4d.RIGID_BODY_ENABLED]=False
else:
# remove unwanted tags from our selection
tagSelection.remove(tag)
for tag in tagSelection :
# set the active tag
doc.SetActiveTag(tag)
tag[c4d.RIGID_BODY_ENABLED]=True
tag.Message(c4d.MSG_DESCRIPTION_COMMAND, dc)
tag[c4d.RIGID_BODY_ENABLED]=False
for tag in tagSelection:
tag[c4d.RIGID_BODY_ENABLED] = True
if __name__=='__main__':
main()