Hi @m_magalhaes
Thanks for the response.
I tried your code. It does work with the keyed object.
The problem is it overrides the previous values.
For instance, Frame 0: Value 0
. Then key somethin in Frame 12: Value 20
The Frame 0
now has Value 20
You can see the problem here:
https://www.dropbox.com/s/fn7b1ti7s4f8sk9/c4d216_addeditnumberarrows_stops_working_on_keyed_object02.mp4?dl=0
I initially thought it was just Activating
the track again. So I added that snippet but I still have the same problem. You can check the working code here:
import c4d
import sys
from c4d import bitmaps, documents, gui, plugins, threading, utils
class MyDialog(c4d.gui.GeDialog):
def __init__(self):
doc = c4d.documents.GetActiveDocument()
self.finger_B_01_L_con = doc.SearchObject('Cylinder')
def DesactivateTracks(self, op):
# Retrieves the tracks.
tracks = op.GetCTracks()
# Track list that we want to desactivate.
trackListToDIsable = [c4d.ID_BASEOBJECT_POSITION, c4d.ID_BASEOBJECT_ROTATION, c4d.ID_BASEOBJECT_SCALE]
for track in tracks:
did = track.GetDescriptionID()
# If the Parameter ID of the current CTracks is not on the trackListToDIsable we go to the next one.
if not did[0].id in trackListToDIsable:
continue
track.SetBit(c4d.BIT_ANIM_OFF)
def ActivateTracks(self, op):
# Retrieves the tracks.
tracks = op.GetCTracks()
# Track list that we want to desactivate.
trackListToDIsable = [c4d.ID_BASEOBJECT_POSITION, c4d.ID_BASEOBJECT_ROTATION, c4d.ID_BASEOBJECT_SCALE]
for track in tracks:
did = track.GetDescriptionID()
# If the Parameter ID of the current CTracks is not on the trackListToDIsable we go to the next one.
if not did[0].id in trackListToDIsable:
continue
track.SetBit(c4d.BIT_ACTIVE)
def CreateLayout(self):
self.AddEditNumberArrows(id=404040, flags=c4d.BFH_LEFT, initw=100, inith=0)
return True
def InitValues(self):
val = self.finger_B_01_L_con[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_Z]
self.SetDegree(404040, val, min=-180, max=180, step=1, tristate=False)
return True
def Message(self, msg, result):
if msg.GetId() == c4d.BFM_ACTION:
self.DesactivateTracks(self.finger_B_01_L_con)
self.finger_B_01_L_con[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_Z] = self.GetFloat(404040)
self.ActivateTracks(self.finger_B_01_L_con)
c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW | c4d.DRAWFLAGS_NO_THREAD | c4d.DRAWFLAGS_NO_REDUCTION | c4d.DRAWFLAGS_STATICBREAK)
if msg.GetId() == c4d.BFM_INTERACTEND:
self.InitValues()
return True
return c4d.gui.GeDialog.Message(self, msg, result)
def Command (self, id, msg):
return True
if __name__ == "__main__":
dlg = MyDialog()
dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC)