Thanks! For whatever reason I couldn't get that particular code to work, but I eventually figured out a different method. I think my script is finished for now.
Latest posts made by curripod00
-
RE: Create a Redshift Camera with Python
-
Create a Redshift Camera with Python
Hi, I'm very close to finalizing a script I'm working on. I was wondering if anyone knows how to add a Redshift camera to a scene in C4D using Python? I understand the correct way to add a typical C4D camera to the scene, but I can't figure out how to properly define a Redshift camera without using call commands, and I'm not currently able to find this documentation on the web. If anyone knows how to do this please let me know, I'd love to see how you did it.
-
RE: Connecting Camera Focus Distance to Null Object with Python
@Cairyn Thanks for this fantastic resource, I will definitely use this summer to level up with Python.
-
RE: Connecting Camera Focus Distance to Null Object with Python
@zipit This is fantastic, thank you for going through and explaining why my code was lacking, I have a better understanding of this process now and my camera focus works perfectly using your method.
-
Connecting Camera Focus Distance to Null Object with Python
Hi there. I wonder if anyone would be able to help a not-very-savvy coder figure out a tiny bit of Python code. For this code, Iām trying to import and position a camera into my scene. I then want to connect the 'focus distance' field of the camera to a null object which I have also imported into the scene. I thought it would be as easy as adding some variation of "camera[c4d.CAMERAOBJECT_TARGETOBJECT] = null" into my code, but no amount of tweaking seems to work for this. I feel like I'm missing a step. If anyone knows the answer please let me know. My code can be viewed below.
import c4d from c4d import gui # Lighting Stage def main(): def tool(): return c4d.plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) def object(): return doc.GetActiveObject() def tag(): return doc.GetActiveTag() def renderdata(): return doc.GetActiveRenderData() def prefs(id): return c4d.plugins.FindPlugin(id, c4d.PLUGINTYPE_PREFS) c4d.CallCommand(5140) # Create Camera Targeting Null object()[c4d.NULLOBJECT_DISPLAY] = 13 object()[c4d.NULLOBJECT_RADIUS] = 80 object()[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] = 276 object()[c4d.ID_BASELIST_NAME] = "Camera_Target" c4d.CallCommand(5103) # Create Camera with Redshift Tag object()[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_X] = 0 object()[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_Y] = -0.175 object()[c4d.ID_BASEOBJECT_REL_ROTATION,c4d.VECTOR_Z] = 0 object()[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] = 0 object()[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] = 433 object()[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z] = -884 c4d.CallCommand(100004788, 50075) # New Tag tag()[c4d.REDSHIFT_POSTEFFECTS_DOF_OVERRIDE] = True tag()[c4d.REDSHIFT_POSTEFFECTS_DOF_ENABLED] = True tag()[c4d.REDSHIFT_POSTEFFECTS_DOF_RADIUS] = 8.5 camera[c4d.CAMERAOBJECT_TARGETOBJECT] = null if __name__=='__main__': main() c4d.EventAdd()