A GetClone problem about takes
-
GetClone creates a take from a source take but its overrides are linked to source take. if I remove overrides from cloned take, original take's overrides also deleted. Is this a bug or GetClone produces a kind of instance object with linking to source object? How can I fix this? How can I break them from the source take?
- open attached c4d doc
- select Sphere take
- run this script
- script will clone sphare take under main take. Newly cloned take have 2 overrides: 1) for X location and 2) for layer properties.
- activate newly cloned Sphere take
- activate AutoTake and Lock Override buttons
- change Sphere's X location and/or sphare layer visibility values
- you will see that c4d will add another override lines under already existent overrides
import c4d # Script clones selected take to under Main Take # AliasTrans did not work #trans = c4d.AliasTrans() #if trans is None or trans.Init(doc) is False: # return False #clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0) #trans.Translate(False) def main(): takeData = doc.GetTakeData() mainTake=takeData.GetMainTake() selectedTake=takeData.GetTakeSelection(0) doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_CHANGE, mainTake) clonedTake=selectedTake[0].GetClone(c4d.COPYFLAGS_0) clonedTake.InsertUnder(mainTake) doc.EndUndo() c4d.EventAdd() #gui.MessageDialog('Hello World!') # Execute main() if __name__=='__main__': main()
-
This post is deleted! -
This post is deleted! -
Hi @delizade,
thank you for reaching out to us. There are two problems with your code:
- You are using
C4DAtom.GetClone()
andGeListNode.InsertUnder()
to add and clone a take. You should instead useTakeData.AddTake()
which also provides acloneFrom
argument (Link forAddTake
). - You are cloning and inserting the main take, which leads in Python to hiccups. Because even when you do it correctly, like discussed in this thread via
AddTake
, it will insert a second "main take" into a document. I.e., one which has no "inherit from parent" and "default cemara/rendersettings" icons.
According to one our devs, No. 2 seems to be a Python bug and not a limitation, we will investigate that. For now you would have to clone the two child takes under the main take manually in Python (and add a parent take beforehand if you want this structure). Because otherwise you will end up with two "root/main" takes in your document, confusing Cinema 4D
Cheers,
Ferdinand - You are using
-
Hi @delizade,
without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly.
Cheers,
Ferdinand