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. x_nerve
    3. Posts
    X
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 35
    • Best 3
    • Controversial 0
    • Groups 0

    Posts made by x_nerve

    • RE: SnapTool for R2023?

      Hi:

      Graphic compilation C++ code process is herelink text, video compilation C++ code process is in the home @kbar page.

      As an expensive commercial software, C4D does not do a good job in how to compile the C++ SDK. If it is not for other C4D users to publish tutorials and only rely on the compilation instructions of the C++ SDK development document, it is true that even the first step of the compilation can not be successful. The SDK team should make a change.

      posted in General Talk
      X
      x_nerve
    • RE: how to create BaseList2D Renderer node : c++ to python

      Hi :

      I don't think you're going to get the answer you're looking for, the Octane renderer is not a Maxon product, so it's beyond the SDK team's technical support. Therefore, you should contact the Octane development team.

      Also, the code you give is incomplete, and partial translation is useless. The Octane renderer has an OSL node, which can be used to create custom nodes in the OSL language.

      Finally, it's important to point out that Python is a glue language, and the underlying core code is still written in C and C++. If the Octane renderer is installed, Python cannot drive the Octane renderer without the corresponding API parameters. However, you can use Python to simply change the Octane parameters, such as changing the rendering resolution.

      In summary, if the Octane renderer does not have open Python API parameters, then C++ is the only option.

      posted in General Talk
      X
      x_nerve
    • Forum email receiving delay

      Hi:

      There seems to be a delay in receiving emails for resetting passwords and registering accounts today, which is about 5 hours late. Here, I would like to ask two questions:

      • 1, the forum can not be searched without registration. However, when registering, even if the email address does not exist, you can still register successfully, but you can only search, not comment and post, because you did not click the email confirmation link.

        Is it possible to search as a visitor without logging in? After all, you don't have to verify the validity of your email address to sign up .

      1. "Maxon One" has fully promoted the subscription system, but Plugin Cafe forum and Redshift forum accounts cannot log in to each other.

        Whether can realize the account mutual login, at least can search each other's forum content ?

      posted in General Talk
      X
      x_nerve
    • RE: How to add Strengths of each Pose I set in Pose Morph as Ports into Xpresso?

      Hi:

      @PATPAT
      First of all, the point movement algorithm of attitude deformation label is not complicated.

      I've seen in some tutorials that you can add some data to a port with unconventional operations, but I forgot . So, I use Python nodes.

      The data control label object weight value for the input port, so you need to add a user data of type link to the Python node.

      Python is a dynamic language, and data types cannot be determined before compilation. There is no conditional right or wrong judgment in my code, so please add them by yourself.

      import c4d
      
      def main():
      
          obj = op[c4d.ID_USERDATA,1]
      
          Tags = obj.GetTags()
          
          Pose = [tag for tag in Tags if tag.GetRealType() == 1024237]
      
          #[4000,1101] is the ID of the strength value.  
       
          Pose[0][4000,1101] = Input1
      
          global Output1
          Output1 = Pose[0][4000,1101]
      

      17.jpg

      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: [Fork] Detailed C++ Plugin Development Process Tutorial

      Hello @ferdinand :

      In this transition period , can you make a small change and write a detailed C++ plug-in development process in the forum ? Collect the development details of the scattered generated compiled files into a post and place it at the top of the forum.

      posted in General Talk
      X
      x_nerve
    • [Fork] Detailed C++ Plugin Development Process Tutorial

      @kbar Thank you very much for your great work, because C++ development documentation has long lacked user education, and .XDL64 files cannot be generated smoothly even for novices who have the source files.You are really great to replace the SDK-team to complete the user education.

      Before you posted the video, many people posted C++ development videos for C4D, but after version R19, the API interface parameters changed, and these videos lost their user education significance.Thank you for your contribution to making more people learn how to generate .XDL64 files. This is the first and most important first step.

      @ferdinand Generating the .XDL64 file is the most important first step, but in the C++ development documentation, the Project Tool chapter is very professional and prevents novices from properly generating the .XDL64 file.

      Suggest additional development steps, such as 1,2,3,.....
      Such as:

          1:  Download the Project Tool.
      
          2:  Create a new .TXT file and write it to  ......\cinema4d_r23_project_tool_314356_win-macos\kernel_app_64bit.exe g_updateproject=......
      
          3:  .TXT file format changed to.bat.
      
          4:  ...
      
          5:  ...
      
         ......
      

      edit: This topic has been forked from C++ Plugin Development Tutorials [Ferdinand]

      posted in General Talk c++
      X
      x_nerve
    • RE: Copy mesh from one object to another with Python

      Hi:

      Do you want to make a complete copy of another polygon object from scratch using Python tags?Including n-gon edges.

      You hide edges incorrectly, it's still not an n-gon edge, it's just an edge selection.I have the full Python tag code, which is fast, but I won't post it here.However, this Python tag only runs in R23 and up.Since Python cannot directly create polygons with n-gon edges, it can only be done with the Model Elimination command in versions R23 and above.

      Your Python code isn't optimal, so it's not fast.The fastest way to do this is to use C++, which can create polygons with n-gon edges directly and at tens of times the speed of Python tags.Also, Python tags create n-gon polygons that don't have the same edge indexes as the n-gon polygons that copy objects, which is one of Python's flaws.

      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: How to use c4d.VertexColorTag in Python Generator?

      Hi:

      You can generate multiple cache items in the Python generator at the same time, such as polygon objects, material labels, standard material balls, and vector color labels, but you cannot add vector color labels to material balls. Base_Objects and Base_tag can be added to cached documents at this stage, while materials cannot be added to cached documents at this stage.The vector color tag exists in the cached document, and the material exists in the active document. The material cannot receive the vector color tag in the cached document, so this is not possible.

      Even though it might someday be possible to add a polygon object, a material label, a standard material ball, and a vector color label to a cached document, the renderer can only receive one document for rendering, so that's not possible.

      Please use Python tags, entities to generate various objects, this is to achieve the desired effect.If done through the Python generator, the final result simply returns None, remembering to insert various objects into the current document.

      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: How to use c4d.VertexColorTag in Python Generator?

      HI:

      Your problem is that the material ball is stored on the hard disk, while the polygon object generated by the Python generator is stored on the memory strip (cache).Only objects from the hard disk can be added to the cache. Cache objects must be instantiated (collapsed) to be added to the hard disk. To display shading, a material ball is required, but the vector color tag in the cache cannot be added to the material ball in the hard disk.
      There are two solutions:

      1. Generate polygon object, material label, standard material ball, vector color label in cache simultaneously.
      2. Use Python tags to generate solid polygon objects instead of in memory.
      posted in Cinema 4D SDK
      X
      x_nerve
    • Gets the point weight of the Field object.

      I want to get the point weights of non-Python Field objects . I looked carefully at the Python Effectors code that came with it and knew that FieldOutput was an instance . Suppose you create a new Plain effect and create a cube field . Is there a way to get the weight of the cube field points?

      The fieldOutput.getValue (Index) function cannot get the point weights of other Field objects. So , is there any way to get the weights?That seems difficult to achieve.

      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Data to Spline

      Hi:

      I think it might be faster to try to import the point location directly as an external library (.py). At the same time, C4D supports importing Illustrator files, and SVG can be processed in Illustrator before importing C4D. Here is a simple SplineObject code.

      import c4d
      
      def main():
          #The location of the point.
          Points = [c4d.Vector(0, 0, 0),c4d.Vector(0, 0, 2),c4d.Vector(0, 4, 4)]
          
          #Initializes the spline object.
          Spline = c4d.SplineObject(len(Points), c4d.SPLINETYPE_LINEAR
      )
          
          #Change the number of spline object segments, the number of points.
          Spline.ResizeObject(len(Points), 3)
          
          #Set the locations of all the points of the spline object.
          Spline.SetAllPoints(Points)
          
          #Set properties of the segment.
          Spline.SetSegment(0, len(Points), True)
          
          #Close the spline object.
          Spline[c4d.SPLINEOBJECT_CLOSED] = 1
          
          #Inserts the spline object into the current document.
          doc.InsertObject(Spline)
          
          #Update current document, routine code.
          c4d.EventAdd()
       
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: How to use/import another script file in Python tag correctly?

      Hi:

      @delizade

      I don't think it's necessary to import external libraries, because such simple code can be used directly.I have a suggestion that you should add data in Python tag, not in the object where the Python tag are located. As for the Python tag running repeatedly, it is because your code has no conditional comparisons.Here is the Python tag code, based on the file you provided, that will only run when the frame changes.

      import c4d
      
      def myFunction(getObj):
          obj=getObj.GetObject()
          var1=obj[c4d.ID_USERDATA,1]
          print (var1)
          print ("myFunction: "+str(var1))
          #c4d.EventAdd()
      
      def main():
          frame = doc.GetTime().GetFrame(doc.GetFps())
      
          obj  = op.GetObject()
          var1 = obj[c4d.ID_USERDATA,1]
          
          if frame * 0.01 != var1:
              
              print (var1)
              print ("myFunction: "+str(var1))
              
              obj[c4d.ID_USERDATA,1] = frame * 0.01
              c4d.EventAdd()
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: ZeroAxis R23 help

      Hi:

      @peXel

      Sorry, I was negligent. The reset code of rotation and zoom is as follows.

      import c4d
      
      #from c4d import Vector as V
      
      def main():
          
          if op.CheckType(c4d.Opolygon):
      
              #if op is None or not op.CheckType(c4d.Opoint):
                  #return False
          
              ObjMatrix = c4d.Matrix() #op.GetMg()
          
              #ObjPoints = op.GetAllPoints()
          
              #Pcount = op.GetPointCount()
          
              doc.StartUndo()
              doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
              #op.SetAbsRot(V(0))
              #op.SetAbsPos(V(0))
              op.Message(c4d.MSG_UPDATE)
              #NewMatrix = op.GetMg()
          
              point = [ op.GetAllPoints()[i] * op.GetMg() * ~ObjMatrix
                          for i in range(op.GetPointCount()) ]
          
              op.SetMg(ObjMatrix)
              op.SetAllPoints(point)
              op.Message(c4d.MSG_UPDATE)
              c4d.EventAdd()
              doc.EndUndo()
              
          else:
              doc.StartUndo()
              doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
      
              op.SetMg(c4d.Matrix())
      
              op.Message(c4d.MSG_UPDATE)
              c4d.EventAdd()
              doc.EndUndo()
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Python Effector not working with Fields

      Hi:

      @Motion4D @m_magalhaes

      The solution is very simple. The subset of the clone generator is set as a blank object.Create a new matrix generator, select the object mode, and put in the clone generator.Create a new clone generator, select the object mode, put in the matrix generator, and finally subset the original clone generator again as a subset.But this can lead to delays.

      1644.jpg

      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: ZeroAxis R23 help

      Hi:

      Your code should run in R23. The following provides additional reset axis code.Unless you're talking about point location resetting, which is non-destructive modeling, and if you want to implement it, you'll need to consider point deletion, etc. It's recommended to use the Python plug-in or the Python tag.

      import c4d
      
      #from c4d import Vector as V
      
      def main():
          #if op is None or not op.CheckType(c4d.Opoint):
              #return False
      
          ObjMatrix = op.GetMg()
          ObjMatrix.off = c4d.Vector(0, 0, 0)
      
          #ObjPoints = op.GetAllPoints()
      
          #Pcount = op.GetPointCount()
      
          doc.StartUndo()
          doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
          #op.SetAbsRot(V(0))
          #op.SetAbsPos(V(0))
          op.Message(c4d.MSG_UPDATE)
          #NewMatrix = op.GetMg()
      
          point = [ op.GetAllPoints()[i] * op.GetMg() * ~ObjMatrix
                      for i in range(op.GetPointCount()) ]
          
          op.SetMg(ObjMatrix)
          op.SetAllPoints(point)
          op.Message(c4d.MSG_UPDATE)
          c4d.EventAdd()
          doc.EndUndo()
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Help with Matrix Manipulation after c4d.MCOMMAND_JOIN

      Hi:

      @mogh

      The MCOMMAND_JOIN modeling command is now ready to execute properly.The merged object cannot be directly visible in the document, so the merged object must be inserted into the document.Also, the global matrix of the merged object is the same as the first object in the parent-child list.I also got it from the forum.

      import c4d
      from c4d import utils
      
      #e-mail : [email protected]
      
      def main():
      
          nodes = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
          if nodes == None : return
          Objects = [i for i in nodes
                  if i.GetType() == 5100]
      
          settings = c4d.BaseContainer()
          settings[c4d.MDATA_JOIN_MERGE_SELTAGS] = True
          
          result = c4d.utils.SendModelingCommand(
              c4d.MCOMMAND_JOIN, Objects ,
              c4d.MODELINGCOMMANDMODE_ALL, settings, doc)
      
          doc.InsertObject(result[0])
          c4d.EventAdd()
          
          points = []
      
          Number_One = 0
          while Number_One < len(Objects):
      
              for i in Objects[Number_One].GetAllPoints():
      
                  n = i * Objects[Number_One].GetMg()
                  points.append(n * ~result[0].GetMg())
      
              Number_One = Number_One + 1
      
          result[0].SetAllPoints(points)
      
          result[0].Message(c4d.MSG_UPDATE)
          c4d.EventAdd()
          
          print (result[0])
      
      if __name__=='__main__':
          main()
      
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Finding Control ID in ObjectData Plugin Message() Override

      Hi:

      Assuming that you are creating a Python plug-in instead of a C++ plug-in, there are two solutions.

      The first is to compare the variable data after the control is updated after the plug-in's name stores the previous variable data.If the data is not the same, it is executed to avoid repeated runs.

      The second is to create a polygon cache, for example by storing the previous variable data with the local coordinates of the first point, and comparing variable data after the control is updated.If the data is not the same, it is executed to avoid repeated runs.

      Python plug-ins actually update automatically, even with every click of the mouse, which often leads to very heavy delays.All dirty systems can be used to detect if an update has occurred.

      There should be a better solution to your problem.

      Here are examples of Python tags and links to examples : link text

      import c4d
      #e-mail: [email protected]
      
      def main():
             
          Name = op.GetName()
      
          Objects = op.GetObject()
          Changed = Objects.GetDirty(c4d.DIRTYFLAGS_SELECT)
      
          Text = ["xit" + str(Changed)[-1]]
          
          if str(Name).count(Text[0][:-1]) != 0 :
              
              if str(Name).find(Text[0][:-1]) != str(Name).rfind(Text[0][:-1]) :
                  
                  if str(Name)[str(Name).rfind(Text[0][:-1]):] == Text[0] :
                  
                      if str(Name).find(Text[0][:-1]) <= 0:
                          
                          #Do not execute, exit the program.
                          print ("Does not perform.")
                          op.SetName(str(Text[0]))
                          
                          return
                      
                      else:
                          #Do not execute, exit the program.
                          op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
                          print ("Does not perform.")
                          
                          return
                          
                  else:
                      if str(Name).find(Text[0][:-1]) <= 0:
                          
                          op.SetName(str(Text[0]))
                          print ("Perform.")
                          
                      else:
                          
                          op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
                          print ("Perform.")
      
              else:
                  
                  if str(Name)[str(Name).rfind(Text[0][:-1]):] == Text[0] :
                      #Do not execute, exit the program.
                  
                      print ("Does not perform.")
                      return
      
                  else:
      
                      op.SetName(str(Name)[:str(Name).find(Text[0][:-1])] + str(Text[0]))
                      print ("Perform.")
      
          else:
              print ("Perform.")
              op.SetName(str(Name) + str(Text[0]))
          
      
      
          print ("pass")
          #The next thing to execute.
      
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Help with Matrix Manipulation after c4d.MCOMMAND_JOIN

      Hi:

      The merge object simply generates a new polygon object, because the merge in the modeling command cannot be used, so it can be resolved in other ways.The answer to your question is, in fact, how the connection generator works.I've written it out, but I can't generate an N-gon face.Create a new blank object, the object to be connected as a subset of the blank object, and then click the middle key of the mouse to select all blank objects and all subsets to achieve the effect of connection generator.

      import c4d
      
      #e-mail : [email protected]
      
      def main():
          nodes = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
          if nodes == None : return
          Object = [i for i in nodes
                  if i.GetType() == 5100]
      
          node = c4d.BaseObject(5100)
          doc.InsertObject(node)
          c4d.EventAdd()
      
          points = []
      
          Number_One = 0
          while Number_One < len(Object):
      
              for i in Object[Number_One].GetAllPoints():
      
                  n = i * Object[Number_One].GetMg()
                  points.append(n * ~node.GetMg())
      
              Number_One = Number_One + 1
      
          Polygons = [i.GetAllPolygons() for i in Object]
      
          Cpolygons = Polygons[0]
      
          Polygon_Indexe = []
          if len(Object) > 1:
      
              Number_Two = 0
              while Number_Two < len(Object) - 1:
      
                  Point_Count = [ Object[0].GetPointCount() ]
                  if Number_Two > 0:
      
                      for i in Object[:-1 * (len(Object) - Number_Two )]:
                          Point_Count.append(Point_Count[-1] + i.GetPointCount())
      
                  for i in Polygons[Number_Two  + 1]:
      
                      if str(i).count("d") == 1:
      
                          Polygon_Indexe.append(c4d.CPolygon(i.a + Point_Count[-1] ,i.b +Point_Count[-1] ,i.c + Point_Count[-1] ,i.d + Point_Count[-1] ))
      
                      else:
      
                          Polygon_Indexe.append(c4d.CPolygon(i.a + Point_Count[-1] ,i.b + Point_Count[-1] ,i.c +Point_Count[-1] ))
      
                  Number_Two  = Number_Two + 1
      
          Cpolygons += Polygon_Indexe
      
          node.ResizeObject(len(points),len(Cpolygons))
          node.SetAllPoints(points)
      
          for i in range(len(Cpolygons)):
              node.SetPolygon(i,Cpolygons[i])
      
              node.Message(c4d.MSG_UPDATE)
              c4d.EventAdd()
      
          node.Message(c4d.MSG_UPDATE)
          c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Selecting Different components but in Different modes

      HI:

      The modeling axis cannot be restored to its default state using the following sample code.Create a new cube object, collapse, and select any point.The world coordinates of points are all 0.

      """Script Manager script.
      
      Swizzles the modeling axis of the selected polygon object when run. As a
      side effect the active tool is changed to the LiveSelection tool and set
      into "Free" mode. You will have to pretty up the script yourself if you
      want a more streamlined experience.
      """
      
      import c4d
      
      def swizzle_modelling_axis(doc, op):
          """Swizzles the modeling axis of the passed object.
          
          Args:
              doc (c4d.documents.BaseDocument): The active document.
              op (c4d.PolygonObject): A node in the active document.
          
          Raises:
              TypeError: When op is not a PolygonObject.
          """
          def swizzle_matrix(m):
              """Swizzles a matrix, pushing in numerical and looping order of 
              its components (e.g. v1, v2, v3 becomes v3, v1, v2).
              """
              return c4d.Matrix(off=m.off, v1=m.v3, v2=m.v1, v3=m.v2)
      
          # Sort out non-polygon-objects.
          if not isinstance(op, c4d.PolygonObject):
              msg = ("swizzle_modelling_axis() requires a polygon object. "
                    "Received: {type}.")
              raise TypeError(msg.format(type=type(op)))
      
          # We need the axis to be free in order to be able to modify the axis.
          # For that we select the live selection tool and set it to free mode.
          doc.SetAction(c4d.ID_MODELING_LIVESELECTION)
          plugin = c4d.plugins.FindPlugin(c4d.ID_MODELING_LIVESELECTION, 
                                          c4d.PLUGINTYPE_TOOL)
          if plugin is None:
              return
          else:
              plugin[c4d.MDATA_AXIS_MODE] = c4d.MDATA_AXIS_MODE_FREE
      
          # Get the modeling axis, swizzle it and write it back.
          axis = swizzle_matrix(op.GetModelingAxis(doc))
          op.SetModelingAxis(axis)
          op.Message(c4d.MSG_UPDATE)
      
      def main():
          """Entry point.
          """
          swizzle_modelling_axis(doc, op)
          c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      
      
      posted in Cinema 4D SDK
      X
      x_nerve
    • RE: Selecting Different components but in Different modes

      Hi:

      Unfortunately, once the modeling axis is set, there is no way to recover.If I click on any point, the coordinates are the same.Even if you create a new polygon object and click on any point, the coordinates are the same.The coordinates of the entire file will not be refreshed unless a new document is created, but the script will still be able to retrieve the coordinate data normally。

      874839.jpg
      Coordinates are no longer refreshed and are consistent.

      posted in Cinema 4D SDK
      X
      x_nerve