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

    Setting Mograph Tracer Properties

    Cinema 4D SDK
    python 2024
    2
    3
    446
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dextrose
      last edited by ferdinand

      Dear friends,

      I'm wanting to generate a large number of splines to animate their form and shape.

      I'd like to do this with code so I have point-level control over all splines.

      I have been able to create the tracer object and connect to 3 nulls.

      However I can't see how I can set other properties such as the spline Type [Linear, Cubic...] and the Intermediate Points property.

      Many thanks
      Andy
      I'm an artist but can program a little.


      def main():
          # Create a MoGraph Tracer object
      
          tracer = c4d.BaseObject(1018655)
      
          # Insert the Tracer object into the document
          doc.InsertObject(tracer)
      
          # Create a cube to trace
          null_1 = c4d.BaseObject(c4d.Onull)
          null_2 = c4d.BaseObject(c4d.Onull)
          null_3 = c4d.BaseObject(c4d.Onull)
      
          null_1.SetName("pt1");
          null_2.SetName("pt2");
          null_3.SetName("pt3");
      
          newPos = c4d.Vector(100, 100, 0)
          null_1.SetRelPos(newPos);
      
      
          newPos = c4d.Vector(100, 200, 0)
          null_3.SetRelPos(newPos);
      
          # Insert the cube into the document
          doc.InsertObject(null_1)
          doc.InsertObject(null_2)
          doc.InsertObject(null_3)
      
      
          # Create an InExcludeData object and add the null objects to it
          in_ex_data = c4d.InExcludeData()
          in_ex_data.InsertObject(null_1, 1)
          in_ex_data.InsertObject(null_2, 1)
          in_ex_data.InsertObject(null_3, 1)
      
          tracer[c4d.MGTRACEROBJECT_OBJECTLIST] = in_ex_data
      
          tracer[c4d.MGTRACEROBJECT_MODE] = c4d.MGTRACEROBJECT_MODE_LINK
      
      
          c4d.EventAdd()
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @Dextrose
        last edited by ferdinand

        Hello @Dextrose,

        Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!

        Getting Started

        Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:

        • Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
        • Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
        • Forum Structure and Features: Lines out how the forum works.
        • Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.

        About your First Question

        The type of a spline is stored under the parameter c4d.SPLINEOBJECT_TYPE. So, changing the mode to cubic would be mySpline[c4d.SPLINEOBJECT_TYPE] = c4d.SPLINETYPE_CUBIC. Helpful might also be the following resources.

        • Spline Object Ressource: The parameter symbols for SplineObject in our parsed resources, you can just look up most scene elements and their symbols in this manner. The easiest way to use this is to combine it with the drag and drop feature. First drag and drop a parameter of the scene element you are interested in into the console. E.g., we discover SPLINEOBJECT_TYPE in this example, and then search for this symbol in the docs t find the associated description resource.
        • Spline Types: An overview of the spline types, this page is linked on the SplineObject itself.
        • Console Parameter Drag and Drop: Describes how to find out the symbols of parameters with the console. This is very handy to find out field symbols, but one cannot discover field value symbols - only their numeric value. So, we can discover SPLINEOBJECT_TYPE in this manner, but not SPLINETYPE_CUBIC, all we will see in the console is 1, the numeric value of SPLINETYPE_CUBIC.
        • geometry_splineobject_s26.py: The Python code example for the SplineObject which goes most features of the type, including interpolation types.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • D
          Dextrose
          last edited by

          Dear Ferdinand,

          Thank you so much. I've found it tricky to navigate the API reference. Being able to get a pointer to the object parameter through drag and drop is a game changer for me!!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post