View Full Version : Connect Camera with Render Setting Script
Behrendt
03-17-2011, 02:27 AM
As requested I just wrote another small script.
How to use:
Should be fairly obvious Just drag your camera in one of the 5 camera slots and your render settings to the corresponding setting slot (Just go to the render-settings menu, from there you can drag&drop your settings out of the small list )
Have fun, let me know if you can use it, or if you have any other ideas ;)
stefan
03-17-2011, 10:41 AM
sounds great, thanks a lot chris!
cheers
stefan
bentreality
03-17-2011, 12:02 PM
doesnt open... is it r12 ?
Behrendt
03-17-2011, 01:44 PM
Yeah it is. But you can just create a Python Tag anywhere in your scene and drop the code in there. You have to create the User Data for yourself also. Just add 10 Objekt Links to your Python Tag. The first one should be for Camera 1, the second one for Setting 1, the third one for Camera 2 etc. - you can have up to 5 cameras and settings per tag. If you want more you can just duplicate the tag and create 5 more cameras. Or you can modify the code so one tag can hold more than 5 cameras - up to you ;)
import c4d
from c4d import documents
#Welcome to the world of Python
# Connects Cameras with Render Settings #
# Christian Behrendt - 17.03.2011 #
def main():
doc = documents.GetActiveDocument()
view = documents.BaseDocument.GetRenderBaseDraw(doc)
scene_cam = view.GetSceneCamera(doc)
cam1 = op[c4d.ID_USERDATA, 1]
cam2 = op[c4d.ID_USERDATA, 3]
cam3 = op[c4d.ID_USERDATA, 5]
cam4 = op[c4d.ID_USERDATA, 7]
cam5 = op[c4d.ID_USERDATA, 9]
setting1 = op[c4d.ID_USERDATA, 2]
setting2 = op[c4d.ID_USERDATA, 4]
setting3 = op[c4d.ID_USERDATA, 6]
setting4 = op[c4d.ID_USERDATA, 8]
setting5 = op[c4d.ID_USERDATA, 10]
if cam1 == scene_cam:
doc.SetActiveRenderData(setting1)
if cam2 == scene_cam:
doc.SetActiveRenderData(setting2)
if cam3 == scene_cam:
doc.SetActiveRenderData(setting3)
if cam4 == scene_cam:
doc.SetActiveRenderData(setting4)
if cam5 == scene_cam:
doc.SetActiveRenderData(setting5)
As I can't test on any older version than R12 I can give no guarantee that it works. Also don't know if there have been major changes to the API regarding Python ;(
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.