I'm new in C4D Development, so please give right direction to learn.
I'm not a motion designer, I'm a professional python developer, therefore, some of the wording may be inaccurate.
I have a simple project with 1 camera and 2 static plane objects. Camera is flying over them.
This project is rendering to PNG sequence. On each PNG may be one or more plane objects, or maybe nothing.
So, I need to develop a Python script, to iterate over each frame and get 2D X- and Y-coordinate of plane's vertexes.
3D world uses inchs and centimmeters, and resulting PNG is pixels (1920x1080), I'm looking for some method to map 3D to 2D.
I learned how to iterate over frames and get objects and camera position and rotation at each frame, but when I try to map C4D World to Screen (may be I need something other?) I have identical results for each frame.
Here is my code:
import json import c4d from c4d import documents, plugins, storage, gui from pprint import pprint obj = doc.SearchObject('holder0') # object I need to track fps = doc.GetFps() minFrame = doc.GetMinTime().GetFrame(fps) maxFrame = doc.GetMaxTime().GetFrame(fps) for frame in range(minFrame, maxFrame+1): time = c4d.BaseTime(frame, fps) doc.SetTime(time) doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_INTERNALRENDERER) c4d.EventAdd() view = doc.GetActiveBaseDraw() pprint(view.WC_V(obj.GetAbsPos())) pprint(view.WC(obj.GetAbsPos())) pprint(view.CS(view.WC(obj.GetAbsPos()), False))
Output for every frame is the same:
Vector(14.111, 11.025, 18.698) Vector(39.784, 12.714, 44.158) Vector(1720.364, -2.065, 44.158) Vector(14.111, 11.025, 18.698) Vector(39.784, 12.714, 44.158) Vector(1720.364, -2.065, 44.158) Vector(14.111, 11.025, 18.698) Vector(39.784, 12.714, 44.158) Vector(1720.364, -2.065, 44.158)