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
    1. Maxon Developers Forum
    2. karpique
    3. Posts
    K
    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 15
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by karpique

    • RE: Make Python Generator update on User Data change

      Thansk so much for the video, that was a deep dive! For my issue, I resolved it like this:

      def message(id, data):
          if(id==c4d.MSG_DESCRIPTION_POSTSETPARAMETER):
              userDataID = eval(str(data['descid']))[1][0]
              if userDataID in [2, 4, 5]:
                  c4d.CallButton(op, c4d.OPYTHON_MAKEDIRTY)
      

      so, if any user data touched (including fieldlist), the generator updates itself.

      posted in Cinema 4D SDK
      K
      karpique
    • Make Python Generator update on User Data change

      Hi, I have a Python Generator that uses fields with SampleListSimple() function. It should change the position of generated geometry based on provided field sample values. Fields are connected to Pyhton Generator with User Data -> Field List. It works good, I can tweak field values and Pyhon Generator updates accordingly, but if I try to turn off / turn on / add / remove field from field list, Generator is not updated accordingly to that event (however if I turn off field itself, not in user data but in objects tree, generator updates well).

      So far I managed to get that event:

      def message(id, data):
          if(id==c4d.MSG_DESCRIPTION_POSTSETPARAMETER):
              flId = eval(str(data['descid']))[1][0]
              if flId == 1:
                  myFieldList = op[c4d.ID_USERDATA, 1] #trying update global FieldList value, no sucess
      

      I've tried to push "force update" button on this event, but got error that says button execution should be only from main thread. So the question -- how to properly refresh Python Generator when parameters of fields in FieldList User Data (such as turn on/off, name, blending, opacity) are changed?

      posted in Cinema 4D SDK 2024 2025 python
      K
      karpique
    • RE: Set Ngons with Python

      @ferdinand thanks for answer, this solution works fine!
      Actually because of bug I thought that melt command only returns new object instead of changing current one. Thanks again!

      Is it 100% safe to select all polygons to melt at once? What if two or more Ngons are neighbours — will that worked out?

      posted in Cinema 4D SDK
      K
      karpique
    • Set Ngons with Python

      I got Ngons translation map and I'd like to change other Polygon object made of Cpolygons according to that map.

      Is there a way to do it without replacing polygon object with new one?

      posted in Cinema 4D SDK
      K
      karpique
    • RE: Copy mesh from one object to another with Python

      @ferdinand I get Ngon translation map and applied MCOMMAND_MELT but stuck again — as I understand SendModellingCommand only returns new object with melted ngons, but my goal is to correct object that already exists in scene...

      Is there any other ways of setting up Ngon translation map with python?

      posted in Cinema 4D SDK
      K
      karpique
    • RE: Copy mesh from one object to another with Python

      @ferdinand thanks! I have one more question: after replacing Tpoint and Tpolygon tags object seems to keep it's old bounding box parameters and disappear from viewport accordigly to them. Is there a way to update this property?

      posted in Cinema 4D SDK
      K
      karpique
    • Check C4D version for using Fields

      Since fields introduced in R20, is it correct statement to check before call them?

      if c4d.GetC4DVersion() > 20000:
         doFieldsStuff()
      
      posted in Cinema 4D SDK python
      K
      karpique
    • RE: Select custom tab with python

      @ferdinand thanks!
      My goal is to:

      1. Rename "User Data" tab of my tag
      2. Keep it opened by default (or make that tab opened with python) after tag placing in scene

      I tried to change DESC_NAME property of default user data group but didn't succeed, thats why I created parentless group with name needed, but as I see it cant be selected by default. Is there some other way of reaching my goal?

      posted in Cinema 4D SDK
      K
      karpique
    • RE: Select custom tab with python

      @fwilleke80 Thanks for answer! Unfortunately I'm dealing with python tag, not plugin

      posted in Cinema 4D SDK
      K
      karpique
    • Select custom tab with python

      I create Python Tag with custom group (tab), Tag has selected by default tab "Tag".
      How to set selected my newly created tab?

      posted in Cinema 4D SDK
      K
      karpique
    • RE: Is it possible to resize a c4d.VariableTag?

      @ferdinand thanks again, it’s more clear now!
      About my concept: I’m trying to make procedural “current state to object” where result base object remains the same and only thing that changes is it’s mesh. It will allow users to direct manipulate object that has procedural source - cloner, exturde, etc, and keep all lnks to that changing mesh valid. Manipulations can include utilizing vertex colors/weights with fields, attaching stuff to points with xpresso, using object where mesh is strictly needed (like collider in thinking particles, etc). Some of that tricks can be achieved with correction deformer, but not all of them.

      As far as I know c4d.utils.SendModelingCommand will create new object, so its not the case. Copying polygon and point tags is super fast so I hope there is some way to keep this operation in sync.

      For instance, how VertexColorTag being resized if MCOMMAND_DELETE applied? Does SendModelingCommand held that or something else?

      posted in Cinema 4D SDK
      K
      karpique
    • Is it possible to resize a c4d.VariableTag?

      And another question: Cinema 4D crashes if target object has Vertex Color Tag and after that get update of Tpoint & Tpolygon tags. Is there a way of resizing Vertex Color Tag?

      edit (Ferdinand): Forked from Copy mesh from one object to another with Python.

      posted in Cinema 4D SDK python
      K
      karpique
    • RE: Copy mesh from one object to another with Python

      @ferdinand thanks for qiuck answer and quality info! I went with copying Tpoint and Tpolygn tags, but now stuck with translating hidden Ngon edges — can you point the right way to do that?

      I feel like it sholud be some functions from c4d.PolygonObject class but stuck in here:

      bs = c4d.BaseSelect()
      bs.SetAll([0] * polyObj.GetPolygonCount() * 4)
      ng = c4d.utils.Neighbor()
      ng.Init(polyObj)
      #doesnt work as expected, hidden ngon edges are not showing up
      polyObj.SetSelectedEdges(ng, bs, c4d.EDGESELECTIONTYPE_HIDDEN) 
      
      posted in Cinema 4D SDK
      K
      karpique
    • Copy mesh from one object to another with Python

      Hi! I'm looking for quick way to copy all points, edges and polygons data from one poly object to another with Python tag.

      Right now i'm using this loops:

          for i in range(0, pointCount):
              targetObj.SetPoint(i, sourceObj.GetPoint(i))
      
          for i in range(0, polygonCount):
              poly = sourceObj.GetPolygon(i)
              if poly.IsTriangle():
                  targetObj.SetPolygon(i, c4d.CPolygon(poly.a, poly.b, poly.c))
              else:
                  targetObj.SetPolygon(i, c4d.CPolygon(poly.a, poly.b, poly.c, poly.d))
      

      It's missing hidden edges for Ngons feature but already really slow on 10k+ polygons. Is there way to do it faster?

      I'm looking into Edit->Copy & Edit->Paste commands but its really hacky way since its tag, not a single execution script.
      Also C4DAtom.CopyTo() looks promising but I have no idea what flag I should pass to copy only mesh, not every object property

      posted in Cinema 4D SDK
      K
      karpique