Update timeline markers on user data slider input.
gsmetzer last edited by m_magalhaes
I have a python generator with two integers as user data. The two integer sliders control the start and length of a timeline marker. Currently the timeline markers only update to the new integer value on mouse-up. However I would like the timeline markers to update on each value change as the user slides the integer.
How is this possible? I have been trying different messaging and event add techniques but not finding a solution. Thank You for any help.
ferdinand last edited by ferdinand
you should show us some code, it is really hard to tell what you are doing otherwise.
Note that the Python Generator's
main()function is bound by threading limitations.
The appropriate choice to force a redraw of managers is usually
m_magalhaes last edited by m_magalhaes
On your generator you can create the Message function and react accordingly.
To check if the marker already exist, the most direct and easiest way is to use its name.
you can find other ids you can use on this page
This is a basic example, you may want to add some extra functionalities.
import c4d def FindMarker(timeOfMarker, name): # Retrieves the first marker of document fm = c4d.documents.GetFirstMarker(doc) # for each markers checks compare its name while fm: if fm.GetName() == name: return fm fm = fm.GetNext() return None def RemoveAndCreate(timeOfMarker, name): # Checks if marker alread exist (compare name) mark = FindMarker(timeOfMarker, name) # Removes the maker if it exist if mark is not None: mark.Remove() # Returns the exising marker return c4d.documents.AddMarker(doc, None, timeOfMarker, name) def message(id, data): # if User Data are changed if id == c4d.MSG_DESCRIPTION_VALIDATE: # Retrieves the User Data values fmt = op[c4d.ID_USERDATA,1] smt = op[c4d.ID_USERDATA,2] # Creates the Marker, Removes the existing ones first) RemoveAndCreate(fmt, "First Maker") RemoveAndCreate(smt, "Second Marker") c4d.EventAdd() return True def main(): pass
gsmetzer last edited by
Thank You @m_magalhaes and @zipit
Both your suggestions were very helpful. The controller works very well @m_magalhaes I just needed to convert my user data input to BaseTime and it works perfectly.
I was able to solve the updating issue to work how I want. I only needed to add:
Now my timeline markers update nicely as I change values.
This topic can be marked solved.