Tag to modify a Camera in VideoPost [SOLVED]

On 10/04/2015 at 21:38, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:    Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;


I have a VideoPost plugin acting like a lens (VIDEOPOSTINFO_CUSTOMLENS), and I want to transfer the videpopost lens parameters to a tag that can be attached to a regular camera.
I understand how to create a tag plugin, but not how implement what I need.

How do I check my VideoPost render camera if it has the tag? Then how do I get it's parameters?

I want to draw my own custom camera on the viewports. Can I modify or replace the way the camera object is drawn?

On 11/04/2015 at 22:30, xxxxxxxx wrote:

I got the tag data from VideoPost, by iterating the cameras, quite easy...

	BaseObject *obj = doc->GetFirstObject();
	while ( obj )
		if ( obj->GetType() == Ocamera )
			BaseTag *tag = obj->GetTag(ID_BTAG);	// Tag register id
			if ( tag )
				mCamera = (CameraObject* ) obj;
				mTag = tag;
		obj = obj->GetNext();
	if ( mTag )
		BaseContainer* tagData = mTag->GetDataInstance();
		mFov	 = tagData->GetFloat(BTAG_FOV);

Now I just don't know how to replace the camera's viewport model.

And, btw, how do I open the Render Settings window to edit my videopost plugin settings?

On 13/04/2015 at 08:46, xxxxxxxx wrote:


you have quite a lot questions there.

First, your iteration is not quite correct. You only get the next object with GetNext(). But in the scene graph objects can also have child objects so you must also check GetDown(). You find information on how to iterate through all the objects in the scene on the developer blog on "Recursive hierarchy iteration" and "Non-recursive hierarchy iteration".

Also, you don't check if the found camera is indeed the active camera. In Cinema 4D there can be multiple camera objects in a scene. The active scene camera can easily be obtained from GetSceneCamera(), the proper BaseDraw can be accessed using GetRenderBaseDraw(). See the "Look at Camera" example.

But in a VideoPostData plugin you don't need to do this. When the VolumeData is available you can call GetRayCamera() to get the active camera. With the "link" property you get the actual camera object. With that object you can search for your tag.

You cannot change how the camera is drawn since the camera is drawing itself in the viewport. But since you already add a tag to the camera you can use that tag's Draw() function to draw additional elements in the viewport. You can find multiple examples on how to use the Draw() function  in the SDK example project.

To open the Render Settings dialog programmatically you just have to execute the command that opens that dialog. A command is executed with CallCommand(), the proper ID can be found in the "Customize Commands" dialog.

To make it easier for everyone to follow a topic and to search the forum please open a new thread for each new, unrelated question. Thanks.

Best wishes,

On 13/04/2015 at 21:43, xxxxxxxx wrote:

Hi Sebastian, and thank you for your reply.

I iterate thru the cameras because since the viewport never displays exactly what the camera sees (it distorts it), sometimes I want to render the tagged camera on the editor view, instead of the actual editor camera.

I'll try to keep different subjects on different topics, but since I've started it here, CallCommand() works fine, but I also need to select my VideoPost when it opens, and can't find a way to do it. I tought post->SetBit(BIT_ACTIVE); would do it, but it won't.


On 14/04/2015 at 01:48, xxxxxxxx wrote:


which VideoPost or multipass is currently selected in the Render Settings dialog is solely managed in this dialog and cannot be changed from the outside.

Best wishes,

On 23/04/2015 at 09:13, xxxxxxxx wrote:

Hello Roger,

was your question answered?

Best wishes,

On 23/04/2015 at 19:29, xxxxxxxx wrote:

Hi Sebastian,

Too bad I won't be able to send the user to edit my plugin on Render Settings from anywhere with a button :(

Can we issue a feature request? ;)
Use the second parameter of CallCommand() as the plugin ID

But all the rest is resolved, thanks!