Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    fieldlayer with variable tag

    Cinema 4D SDK
    windows python 2023
    1
    2
    375
    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
      datamilch
      last edited by

      hi there,

      I'm trying to achieve the following:
      A python generator that creates an object with a vertex map (A). vertex map (A) is then inserted in a second vertex map (B) to be able to blur (A) with the mode 'average'. (If there is another way to blur a vertex map directly in (A) this would be great, too) You can see my test-setup without the python generator in the screenshot and it works so far.

      Now with python I have to create fieldlayers with the correct type to make it work. But it looks like the Variable Tag is missing in the list of types. I hope it's not a limitation of of the api.

      test - py_generator displacer 01.JPG

      My test-file is attached. Here is the code of the generator:

      from typing import Optional
      import c4d
      
      doc: c4d.documents.BaseDocument # The document evaluating this python generator
      op: c4d.BaseObject # The python generator
      hh: Optional["PyCapsule"] # A HierarchyHelp object, only defined when main is executed
      
      def main() -> c4d.BaseObject:
      
          null = c4d.BaseObject( c4d.Onull )
      
          circle = c4d.BaseObject( c4d.Osplinecircle )
          circle[c4d.PRIM_CIRCLE_RADIUS] = 150
      
          cube = c4d.BaseObject( c4d.Ocube )
          cube[c4d.PRIM_CUBE_SUBX] = cube[c4d.PRIM_CUBE_SUBY] = cube[c4d.PRIM_CUBE_SUBZ] = 40
      
          vertex_tag = cube.MakeTag( c4d.Tvertexmap )
          vertex_tag[c4d.ID_TAGFIELD_ENABLE] = 1
      
          fields = c4d.FieldList()
          fields.Flush()
          f_layer_1 = c4d.modules.mograph.FieldLayer( c4d.FLspline )
          f_layer_1.SetLinkedObject( circle )
          f_layer_1[1009] = 1  # distance mode = radius
          f_layer_1[1003] = 50 # radius
          f_layer_1[1005007] = 99 # inner offset
          fields.InsertLayer( f_layer_1 )
          vertex_tag[c4d.ID_TAGFIELDS] = fields
      
          displacer = c4d.BaseObject( c4d.Odisplacer )
          shader = c4d.BaseShader( c4d.Xcolor )
          displacer.InsertShader( shader )
          displacer[c4d.ID_MG_SHADER_SHADER] = shader
      
          fields_displace = c4d.FieldList()
          fields_displace.Flush()
          f_layer_2 = c4d.modules.mograph.FieldLayer( c4d.FLpolygonobject ) # should be type variable tag
          f_layer_2.SetLinkedObject( vertex_tag )
          fields_displace.InsertLayer( f_layer_2 )
          displacer[c4d.FIELDS] = fields_displace
      
          circle.InsertUnderLast( null )
          cube.InsertUnderLast( null )
          displacer.InsertUnder( cube )
      
          return null
      

      test - py_generator displacer 01.c4d

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

        found the solution ... the corresponding type is called: FLweight

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