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

    Animated user data for Python Generator - how?

    PYTHON Development
    0
    3
    1.7k
    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.
    • H
      Helper
      last edited by

      On 22/08/2018 at 13:39, xxxxxxxx wrote:

      I have a simple Python generator that creates some polys.

      In the Generator's User Data there is a Link for a texture tag, which gets cloned by the generator and assigned to the created polys.

      I want to allow the user to animate some of the parameters of the cloned texture tag (eg Offset and Length).

      I assume I need to create User Data elements for these parameters, so the user can animate them.

      But how do I link the User Data so that its changing values get propagated to the properties of the cloned tag created in the Generator?

      Or am I going about this the wrong way..?

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 23/08/2018 at 07:27, xxxxxxxx wrote:

        Hi,

        welcome to the Plugin Café forums 🙂

        You are basically on the right track.

        In the generator's main() function (which basically relates to an ObjectData plugin's Execute() function) you can simply read the user data and apply it to the clones texture tag. On every parameter change, the generator will be reevaluated automatically. The generator itself can be referenced with op.

        Simple example generating a cube with size defined by used data:

        def main() :
            cube = c4d.BaseObject(c4d.Ocube)
            if cube is None:
                return None
            size = op[c4d.ID_USERDATA, 1] # 1 is the ID of the user data
            cube[c4d.PRIM_CUBE_LEN] = c4d.Vector(size, size, size)
            return cube
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 23/08/2018 at 12:15, xxxxxxxx wrote:

          Thanks - I didn't realize the Generator would create everything anew for any parameter change!

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