hi,
I change layer properties via script and I need current take override those layer processes. But when I changed a property via scripting current take can't see any changins and does not override any data.
How can I do that?
hi,
I change layer properties via script and I need current take override those layer processes. But when I changed a property via scripting current take can't see any changins and does not override any data.
How can I do that?
hi and welcome to our forum,
For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.
I've added the tags and marked this thread as a question so when you considered it as solved, please change the state :)
About your question the take system is not automatic for scripts.
You can have a look at our example in python
Using Autotake
Other example about takes
How to create layers
Based on those example i came with this test that is working as expected. Using AutoTake. You have to pass to the function two object that will be compared.
So before doing the change, make a clone of your object.
But you can also write parameter directly on the take itself. (see above links)
import c4d
def main():
rootLayers = doc.GetLayerObjectRoot()
if rootLayers is None:
raise RuntimeError("Failed to retrieve the Root Layer.")
layer = rootLayers.GetDown()
if layer is None:
raise ValueError("layer is None")
layerClone = layer.GetClone(c4d.COPYFLAGS_0)
# Changes the radius of the sphere in scene
layer[c4d.ID_LAYER_VIEW] = False
# Gets the TakeData from the active document (holds all information about Takes)
takeData = doc.GetTakeData()
if takeData is None:
raise RuntimeError("Failed to retrieve the take data.")
# Checks if there is some TakeData and the current mode is set to auto Take
if takeData and takeData.GetTakeMode() == c4d.TAKE_MODE_AUTO:
# Retrieves the active Take
currentTake = takeData.GetCurrentTake()
# If there is an active Take, automatically generate a Take based on the difference between op and undoObject
if currentTake:
currentTake.AutoTake(takeData, layer, layerClone)
# Pushes an update event to Cinema 4D
c4d.EventAdd()
if __name__ == '__main__':
main()
If you have any question, feel free to ask.
Cheers,
Manuel
MAXON SDK Specialist