Jump to content

Eterea

Help translating this script to Python?

Recommended Posts

Hi guys!

 

I’m here trying to convert this small COFFEE script to Python, without luck… :-/

 

Could you give me a helping hand?

 

It’s an interesting script to toggle between Default Perspective and the linked camera(s) on Stage Object.

 

Specially useful for when you have, say, 10 different animated cameras (linked to a single animated Stage Object) and you need to frequently switch between those cameras view and the Default Perspective.

 

Here is the COFFEE script by B.Horgan:

 

// CamSwitch.CSC
// CamSwitch V1 B.Horgan 2010 - works with Stage Object to toggle between editor and and linked cameras in stage object
//     (just switches the stage on and off and refreshes the view )
// NB - rename the Stage Object to 'CamSwitch' for the script to work

var switcher,state;

switcher=doc->FindObject("CamSwitch");//Find the Stage object (searching by name)
if(switcher)//if the stage object exists - 
{
state = switcher#ID_BASEOBJECT_GENERATOR_FLAG;
if (state==0)
{
switcher#ID_BASEOBJECT_GENERATOR_FLAG=1;
CallCommand(12147);//redraw view to activate linked camera in Stage Object
}
else 
{
switcher#ID_BASEOBJECT_GENERATOR_FLAG=0;
CallCommand(12202); // Switch to the editor camera
}
}

}

Thank you so much in advance! :-)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

YOUTUBE CHANNEL:

ABOUT US:

C4D Cafe is the largest CINEMA 4D community. We provide facilities for discussion, showcasing and learning our favorite software :) Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, get your own private messenger, post status updates, manage your profile and much more. If you need to find solution to your problem or otherwise ask for help, Cafe is the right place.
×
×
  • Create New...