On 04/07/2018 at 08:08, xxxxxxxx wrote:
I know this will come off as a newbie question - which it is.
However I'd love to get a short & clear summary (or to be pointed toward the resource, I've searched and couldn't find definite clear answers) of the important differences and uses of the various ways to use python in C4D (as per subject; tag, generator, user script & xpresso node).
I've stumbled across a great reply on CGtalk about python tags:
"It is a very common misunderstanding in the use of Python tags: many people think they can use them for just anything because Python is a general language. But there is one handicap: execution timeframe.
Tags are evaluated every time the object tree itself is evaluated. Which is very, very often (even during seemingly simple operations, like moving the view). Why is that done? Because potentially any change in the scene may have an effect on something and require a change. If your Python tag for example determines an object's color by the position of the camera... it needs to be executed at any movement of the camera"
This is great, concise and clear, and exactly what I'm looking for.
I would love to get an equivalent overview of the other ones - specifically as it relates to when NOT to use them.
My application requires a separate thread running at short intervals (10-20ms) to poll a serial port constantly, storing variables and affecting the rotations of several objects in the scene (based on the serial reception), as well as a user data / gui interface. So far it's working in a tag, but upon reading the above (execution timeframe) I'm thinking I should perhaps move it to a generator? Or a standalone script? But then scripts run only once - wouldn't work for my gui needs and constant polling...