Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. Tudor
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 13
    • Best 1
    • Controversial 0
    • Groups 0

    Tudor

    @Tudor

    1
    Reputation
    86
    Profile views
    13
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Location Berlin

    Tudor Unfollow Follow

    Best posts made by Tudor

    • RE: Quaternion rotation

      I thought I can use this direction vector as Quaternion-Axis. The cam should point than to the target.
      But but it seems i need a different approach.

      import c4d, math
      
      cam = op.GetObject()
      target = op[c4d.ID_USERDATA,1]
      
      def main():
         tarPos = target.GetAbsPos()
         camPos = cam.GetAbsPos()
      
      
         direction = (tarPos - camPos).GetNormalized()
         angle = math.pi/2  #?
      
         q = c4d.Quaternion()
         q.SetAxis(direction, angle)
         b = q.GetMatrix()
         b.off = cam.GetAbsPos()
         cam.SetMg(b)
      
      posted in Cinema 4D SDK
      T
      Tudor

    Latest posts made by Tudor

    • RE: Correct Tangent Values

      Hallo Mazlov,
      lot of thanks for your explanation. I think I don't will get deeper in the math of generic Bezier and Cubic Hermite spline.
      But this is good to know how Ae and C4D interpret these tangent values.
      Meanwhile I finished my script that push every selected Ae-Shape direct to C4D. Works fine so far.
      Thanks for your help!
      Tudor

      posted in Cinema 4D SDK
      T
      Tudor
    • RE: Correct Tangent Values

      Hallo Mazlov,
      i have an example for this:
      This is the bezier data of a circle with 500px radius what I get from Ae:
      I get this values in Ae through:
      myPath = myLayer.content(i).content(j).path.value;
      vertices = myPath.vertices
      inTangents = myPath.inTangents
      outTangents = myPath.outTangents

      vertices: [[0,-500],[500,0],[0,500],[-500,0]]
      inTangents: [[-276.142364501953,0],[0,-276.142364501953],[276.142364501953,0],[0,276.142364501953]]
      outTangents: [[276.142364501953,0],[0,276.142364501953],[-276.142364501953,0],[0,-276.142364501953]]

      If I construct in cinema4D a spline with this values it looks like this
      Circel C4D.png

      spline = c4d.SplineObject(6, c4d.SPLINETYPE_BEZIER)
      points = [...]
      leftTangents = [...]
      rightTangents = [...]
      spline.SetAllPoints(points)
      spline.SetTangent(i, leftTangents, rightTangents).....
      doc.InsertObject(spline)

      I have correct all y values by -1 but in general all tangents appear to long.
      Somewhere in a forum I found that I just need to multiply them with 0.75 and yes indeed it works, but I'm still confused 😉

      posted in Cinema 4D SDK
      T
      Tudor
    • Correct Tangent Values

      Hello friends,
      I'm trying to draw some splines though a python script.
      I get the shape data from after effects where I extract the vertices and in/out tangents of a bezier shape.
      Then I use this bezier data to recreate the object in cinema 4d.
      So far so good, after some try and error and flipping the y-axis the object appear on the right place but the rounding not match really.
      Something is wrong with the tangent values.
      Does cinema interpret these tangent values from after effects different?

      Thanks for your help
      Tudor

      posted in Cinema 4D SDK python
      T
      Tudor
    • RE: pass Variable from After Effects to C4D

      @ferdinand I use the Script above myPythonScript
      It runs fine, I start it over:
      Extensions > user Script or
      File > open Project or
      Terminal on mac > open -a cinemaAppPath myPythonScriptPath
      and it works also on window over command line.

      posted in Cinema 4D SDK
      T
      Tudor
    • RE: pass Variable from After Effects to C4D

      @ferdinand Hey, lot thanks for your help and suggestions but i'm still confused.
      My first try to run my python script through the terminal still work for me.
      Cinema app starts, run the PythonScript and print the value. 🙂

      open -a cinemaAppPath myPythonScriptPath
      

      myPythonScript

      import c4d
      def main():
          print("Hello World")
      if __name__ == "__main__":
          main()
      

      But otherwise I don't get any output in the cinema console if I run that over c4dpy.
      I'm not sure but its also not very user-friendly to enter the license method and than it take some time for the process.

      posted in Cinema 4D SDK
      T
      Tudor
    • pass Variable from After Effects to C4D

      Hello friends,
      i have developed a script that should send some arguments from after effects to cinema4D. I tried over the terminal to open cinema and run my python script file.
      So far so good, but how I can pass to my c4d python script some arguments?

      open -a cinemaAppPath myPythonScriptPath
      

      Do have a idea or a reference this?
      Thanks for your help
      Cinema2024 / MacOS Ventura M1

      posted in Cinema 4D SDK python macos 2024
      T
      Tudor
    • RE: Object Target Expression in Python

      Does anyone have a suggestion how to work with Quaternions in my case to avoid the gimbal lock? I realy dont find any examples or approaches to this. Other APIs have different methods for this like SetFromToRotation, SetLookRotation, lookAt ....
      Maybe its possible to extend the Python Library with other classes? Don‘t have any idea and not very advanced in this.
      Thanks!

      posted in Cinema 4D SDK
      T
      Tudor
    • RE: Quaternion rotation

      I thought I can use this direction vector as Quaternion-Axis. The cam should point than to the target.
      But but it seems i need a different approach.

      import c4d, math
      
      cam = op.GetObject()
      target = op[c4d.ID_USERDATA,1]
      
      def main():
         tarPos = target.GetAbsPos()
         camPos = cam.GetAbsPos()
      
      
         direction = (tarPos - camPos).GetNormalized()
         angle = math.pi/2  #?
      
         q = c4d.Quaternion()
         q.SetAxis(direction, angle)
         b = q.GetMatrix()
         b.off = cam.GetAbsPos()
         cam.SetMg(b)
      
      posted in Cinema 4D SDK
      T
      Tudor
    • Quaternion rotation

      Hello friends,
      I'm trying to work with the Quaternion-Object.
      My cam-Object should align to the direction vector and pointed in this case in X-Direction.
      But if print the q.v value I get a zero vector and the rotation is not applied
      Does I misunderstood the Quaternion-Syntax? I can't find nothing about that.
      –
      Thanks

      import c4d
      
      cam = op.GetObject()
      
      def main():
          direction = c4d.Vector(10,0,0).GetNormalized()
          angle = 0
      
          q = c4d.Quaternion()
          q.SetAxis(direction, angle)
          b = q.GetMatrix()
          b.off = cam.GetAbsPos()
          cam.SetMg(b)
      
          print q.v
      
      posted in Cinema 4D SDK
      T
      Tudor
    • RE: Object Target Expression in Python

      Hi,
      thanks again.
      I really do not understand it yet but it works.
      There are some strange camera behaviors in the viewport but the system still stable.
      I have tried also the Quaternions-solution, but I don't know really now the syntax work.
      Do you have an idea?

      posted in Cinema 4D SDK
      T
      Tudor