Recording Object Animations with the Mouse
-
Uhmm another question, is it possible to export animations as gif by controlling the mouse directly and scipting a mouse sequence? Since there is no way to export as GIF using the SDK directly(from what i have learned in the docs), my client wants me to export as gif using scripted mouse inputs which go to the life view and then click save as quicktime(gif).
-
Hello @leon6498,
welcome to the Plugin Café and thank you for reaching out to us. Please make sure to place separate questions in separate threads in the future, so that we can maintain a relatively order structure on the forum. I would also recommend to have a look at out Fourm Guildelines, as they will inform you about the procedures used by the Maxon SDK Team to deliver developer support in this forum.
is it possible to export animations as gif by controlling the mouse directly and scripting a mouse sequence?
It is a bit unclear to me what you mean by that. You could either mean that you want to create a keyframe animation by moving an object in the viewport with the mouse (A), i.e., do what the builtin Cappuccino Tool does, and then render that keyframe animation into a file or set of files. Or you could mean the same but without the step of creating a keyframe animation (B) before storing that "animation".
A is possible, but not trivial to implement, because you will have handle the drag operation of the mouse while setting keyframes for the dragged object. The native solution would be writing a
ToolData
plugin for that. A similar scenario has been discussed in Is it possible to control Camera with keyboard WASD like a FPS game?.B is also possible, but much harder to do, since you would then have to grab the frame buffer of a viewport while dragging the mouse, there are ways to achieve that, but central methods are missing in the Python API to achieve that in a performant way. You could also take other approaches as I hinted at in the FPS game thread, as for example simply recording the transform of the object while it is being dragged and then after the drag has finished with this information create the animation. This would have the advantage that you would decouple recording from the rendering.
Since there is no way to export as GIF using the SDK directly(from what i have learned in the docs), my client wants me to export as gif using scripted mouse inputs which go to the life view and then click save as quicktime(gif).
Yes, Cinema 4D does not support the GIF format natively, but you can relatively easily write your own with a BitmapSaverData plugin. You could either write a simple GIF serialization from scratch yourself, or use one of the popular Python libraries as pillow within that
BitmapSaverData
to do all the heavy lifting. Doing this would allow you to render directly to GIF. You could also render to a native format as a BMP sequence or a video format and then simply usepillow
to convert that data into the GIF format once the rendering has finished and the file has been saved to disk.PS: I do not understand what you mean with "life view"? The Picture Viewer of Cinema 4D?
Cheers,
Ferdinand -
Hello @leon6498 ,
without any further questions and other postings, we will consider this topic as solved and flag it as such by Friday, 17/06/2022.
Thank you for your understanding,
Ferdinand