Alembic camera properties
-
When an Alembic camera is merged into a scene, its Attributes panel has a Camera tab with all the usual camera properties. When I drag & drop the "Focal Length" property into the python console, I'm told that its value can be obtained with:
myCam[1028637,5103,500]
After a bit of digging around I was able to eliminate a couple of the magic numbers like so:
myCam[1028637,c4d.OBJECT_CAMERA,c4d.CAMERA_FOCUS]
But how was the number 1028637 obtained? It isn't a plugin ID and there is no constant in the c4d namespace with this value. I don't like hard-coded numbers in my code, so I'd rather have a procedural way of obtaining this value.
On a related note, how does C4D know that this is a camera? It's type is reported as BaseObject not CameraObject. I'd like some way of determining, in code, whether or not an object is an Alembic camera.
Thanks!
-
Hello,
Some symbols are not exposed to public. There's no particular reason for that.
There's no real place where all exposed symbols are. (and we agree it's could be nice)To know if a BaseObject is a camera (or something) you can use IsInstanceOf
You can also send a message using the ID MSG_GETREALCAMERADATA :
with an alembic generator you can use this code :
camera = doc.GetActiveObject() if camera is None: return if camera.IsInstanceOf(c4d.Oalembicgenerator) == False: return # This example tries to get the internal camera from a generator. # Typically used with the Alembic Generator camera. data = {} data["res"] = None res = camera.Message(c4d.MSG_GETREALCAMERADATA, data) if res: camera = data["res"] print("Camera: " + camera.GetName())
For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.
- Q&A New Functionality.
- How to Post Questions especially the tagging part.
I've marked this thread as a question so when you considered it as solved, please change the state
Cheers,
Manuel