Solved Timeline control via OSC and EventAdd doesnt update the scene

Hello!

I'm new to the forum so hopefully this is the right place to ask :)

I'm using the fOSC pluggin (https://github.com/fillmember/fOSC) to read an external timecode (basically, the frame number position of another program) in c4d.

This plugin stores the variable into a null object X position so I’ve written this code for it:

def main:
	obj = op.GetObject()
	frame = obj[c4d.ID_BASEOBJECT_REL_POSITION, c4d.VECTOR_X]
	fps = doc[c4d.DOCUMENT_FPS]
	time = c4d.BaseTime (frame, fps)
	doc.SetTime(time)
	c4d.EventAdd()

The thing is that the timeline cursor moves accordingly but the scene is not updated (EventAdd seems not to work) and moreover: this happens on a PC but on a MAC it works. And of course I have to use a PC :(

Someone has any idea on what’s going on?

Thank you very much in advance!

Zebru

Hi,

welcome to the Plugin Café forum :relaxed:

Before answering your question, I'd like to ask you to please read "Read Before Posting". No worries, I have turned this thread into a "question", added tags and moved it to the Cinema 4D Development category for you.

I'm a bit surprised it's supposed to work on Mac. The thing is, SetTime() just sets the time of the document, but it does not implicitly trigger a re-evaluation or execution of the scene. For this you need to use ExecutePasses() after calling SetTime().

There's some more information on this in our C++ SDK manuals. I know, we are talking Python here, but maybe it's interesting anyway: BaseDocument manual -Time.

Cheers,
Andreas