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
    1. Maxon Developers Forum
    2. JH23
    3. Posts
    • Profile
    • Following 7
    • Followers 0
    • Topics 12
    • Posts 46
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by JH23

    • RE: lhit from BaseVolumeData

      Hey @m_adam,
      Thanks for the reply! What you’re saying makes a lot of sense C++ is clearly the better option for this kind of stuff, especially when you need more control and better performance. I haven’t had much chance to dive into C++ yet, but I’m well aware it’s way more powerful than Python when it comes to working with the engine.
      It’s a bit of a shame that there’s no way to directly access polygon info from Python, since that’s exactly what I needed. But still, I really appreciate you taking the time to explain it.
      Cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • lhit from BaseVolumeData

      Hi,
      I've been trying to understand what type of structure I would need to be able to access what lhit offers, although I know what a PyCobject is, I still don't understand what structure I should use, or what data it affords me, I reviewed the C++ documentation but ended up with more questions than answers, I work in python in a simple sahder, I really don't plan anything elaborate and at this point I'm just testing what information I can get to identify what will be useful to me, I would appreciate it if someone could help me with this problem

      import ctypes
      import c4d
      
      PyCObject_AsVoidPtr = ctypes.pythonapi.PyCObject_AsVoidPtr 
      PyCObject_AsVoidPtr.restype = ctypes.c_void_p
      PyCObject_AsVoidPtr.argtypes = [ctypes.py_object]
      
      def Message(sh, msg, data):
          return True
       
      def InitRender(sh, irs, customdata): 
          return c4d.INITRENDERRESULT_OK
       
      def FreeRender(sh, customdata): 
          pass 
      once = True
      def Output(sh, cd, customdata):
          global once
          if not cd.vd: 
              return c4d.Vector(0) 
      
          pyco = cd.vd.lhit
          if not pyco:
              return c4d.Vector(0)
      
          if once:
              ptr = PyCObject_AsVoidPtr(pyco)
              
              print (ptr)
              
              once = False
              
                      
          return c4d.Vector(0) 
      

      I experimented with the PyCObjects of the PolygonObjects and managed to obtain information from the indices. It is not useful to me, but I wanted to know first if it was possible, but I require prior knowledge of the information I hope to obtain. In this case, I feel blind, I would appreciate it if someone would light my way.
      thanks in advance
      JH

      posted in Cinema 4D SDK r21 python windows
      JH23J
      JH23
    • RE: Change Icon Color parameter

      Hi @chuanzhen,
      I wanted to say that it is confusing that it fails to create an automatic color when defining the use of icons with custom colors, I suspect a reason why this happens but I am not at all sure, I am still happy that this solution works for you, even so I would like to know if this is something planned or some kind of bug.
      Cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: Change Icon Color parameter

      Hello chuanzhen,
      I tried this, you're right, it's strange, but curiously if a value is assigned to the color it manages to be created with the defined color without the need for interaction, this is a possible solution, even so I would like to know what could be happening.
      Cinema_4D_72OIMo0GEM.mp4
      Cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: update error?

      I want to finish with this in case someone reads it. Years ago, I asked about the outdated methods when using these techniques. I tried to adjust the depth of the IK spline controls with the actual length of the spline itself. Today, I understand my mistake, as I was trying something that didn’t make logical sense. At the time, I thought it was the best option for what I was looking for.

      In short, this was never a problem, and the low response time is normal because the length depends on the depth of the controls. I thought there would be a solution, but choosing this path was not useful.

      In conclusion, what eventually satisfied my requirements was directly referencing the angles of the controls, meaning identifying how oriented each control is to another. I took this angle and used it as a factor to multiply by the depth. This model is much more logical and doesn’t have any flaws. At the time, I couldn’t think of a direct solution, but I didn’t want to leave this post like that. Thanks anyway, Ferdinand, for trying to help me.
      Cheers
      JH

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: Transparency of GeDialog?

      Hi,
      I reviewed your proposal, it works, but I still feel that ending up using external libraries ends up being a somewhat more uncomfortable problem than not having transparent dialogs, it would be nice if in a future version these details were possible, I have more questions but I prefer to open another thread or investigate better, I appreciate your response.

      Cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: Transparency of GeDialog?

      Hi,
      I wanted to check if this is not already possible, and also ask if you have any ideas for a possible alternative, other than making this UI in the viewport.
      regards,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: Get the "Position" of a Polygon

      Hi,
      I wanted to ask, is there a way for this to be compatible with deformers or similar, I realized that the tag is not capable of drawing the location of the centers of each polygons altered by deformers, it is curious and I wonder if there is a way to solve it.
      Cheers
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: access the layers in the shader layer

      Hi @i_mazlov ,
      This solves my problem, for now I don't think I have another question, and I could consider my problem solved, thanks.
      cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: access the layers in the shader layer

      Hola @i_mazlov ,
      Yes, it is true, DESCFLAGS_SET_USERINTERACTION does not work with layers, any other contribution to the problem is appreciated, from this I have no other doubt related to this topic, I leave the file here as an example.
      example.c4d
      cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: access the layers in the shader layer

      Currently my problem would only be the issue of the lack of updating, because now I know that I can change the boolean of the layer with LAYER_S_PARAM_ALL_ACTIVE , but the lack of updating persists, I really don't know what could be causing it is causing.
      code example, using the booleans of the layer:

      
      import c4d
      def main():
          doc = c4d.documents.GetActiveDocument()
          obj = op.GetObject()
          F = obj[c4d.ID_USERDATA,1]
          FM = doc.GetFirstMaterial()
          shd = FM.GetFirstShader()
          layer = shd.GetFirstLayer()
          i = 0
          while True:
              if layer:
                  if i == F:
                      #layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,True)
                      layer.SetParameter(c4d.LAYER_S_PARAM_ALL_ACTIVE,True)
                  else:
                      #layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,False)
                      layer.SetParameter(c4d.LAYER_S_PARAM_ALL_ACTIVE,False)
                  layer = layer.GetNext()
              elif layer == None:
                  break
              i = i+1
          c4d.EventAdd()
      
      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: access the layers in the shader layer

      Hi @i_mazlov ,
      I have another question and I want to take advantage of this situation to consult, I really also want to be able to change the float that measures the mixing force, (I also wanted to know how to access the rounding) and I could, but now my problem is that it really takes too long, because not to say that it does not react until I manually move this float.
      Here is an example:

      here the code (python tag)

      import c4d
      def main():
          doc = c4d.documents.GetActiveDocument()
          obj = op.GetObject()
          F = obj[c4d.ID_USERDATA,1]
          FM = doc.GetFirstMaterial()
          shd = FM.GetFirstShader()
          layer = shd.GetFirstLayer()
          i = 0
          while True:
              if layer:
                  if i == F:
                      layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,1)
                  else:
                      layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,0)
                  layer = layer.GetNext()
              elif layer == None:
                  break
              i = i+1
          c4d.EventAdd()
      
      

      cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: access the layers in the shader layer

      Hi @i_mazlov ,
      Excuse me for the lack of research, if I usually check if there were similar cases but I don't think I was able to understand it well, thank you very much for showing me these examples, they were really helpful.
      the code you wanted:

      import c4d
      
      def ChangeTexturePathOfLayer(layer = c4d.LayerShaderLayer, Vector = c4d.Vector()):
          bmpShader = layer.GetParameter(c4d.LAYER_S_PARAM_SHADER_LINK)
          bmpShader[c4d.COLORSHADER_COLOR] = Vector
      def main():
          mat = doc.GetFirstMaterial()
          if not mat:
              return
          shd = mat.GetFirstShader()
          if shd.CheckType(c4d.Xlayer):
              ChangeTexturePathOfLayer(shd.GetFirstLayer(), c4d.Vector(0.458823, 0.278431, 0.164705))
              c4d.EventAdd()    
      if __name__ == '__main__':
          main()
      

      I still don't know what c4d.LAYER_S_PARAM_SHADER_LINK does specifically
      Well, within the documentation it is only mentioned that int is allowed as a parameter.
      Cheers,
      James H.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • access the layers in the shader layer

      Hi,
      Today I was trying to link or access the color within a sahder layer only with python, I know I can get it and change its parameter in the same sahder layer, but my question is more about how I can enter one of these and change its data , as in this case the color, or also the direction of a bitmap.

      posted in Cinema 4D SDK python
      JH23J
      JH23
    • RE: update error?

      Hello @jferdinand,
      Apologies for the delay, I examined your example some time ago and I suspect that it does not solve my problem, activating "frame-dependent" causes the update to stop, and it is present in animation again, my intention is to completely remove that delay, both in editor and in animation.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: update error?

      Any kind of help is appreciated.

      posted in Cinema 4D SDK
      JH23J
      JH23
    • RE: update error?

      I apologize, the translator does not help much, as I said, I created a spline chain, where the depth of its handles depends on the length of the spline, my problem was that when I did it with only xpresso, it showed errors when rotating, because it took time update.

      ezgif.com-gif-maker.gif

      thinking that the error was either hierarchy, the spline node, or how to order the xpresso I did the same thing but with a python tag, despite this the same problem was present.

      import c4d
      #Welcome to the world of Python
      def main():
           spline = op[c4d.ID_USERDATA,2] # spline object
           length = c4d.utils.SplineLengthData(spline)
           length.Init(spline)
           Long = length.GetLength()
           op[c4d.ID_USERDATA,1][10004] = Long /3.783
           #[10004] = control depth 1 iKsplinetag
           op[c4d.ID_USERDATA,1][10014] = Long /3.783
           #[10014] = control depth 2 iKsplinetag
           length.Free()
           c4d.EventAdd()
      

      And speaking of the number "3,783" I used it only for my purpose as it corrected the strength of the depth of the controls
      SplineL.c4d

      posted in Cinema 4D SDK
      JH23J
      JH23
    • update error?

      I was trying to include the login data inside the spline handlers but I had updating errors, I thought it was due to hierarchy but I ended up using python tags and still I had the same error, I don't know what's happening.

      SplineL.c4d

      posted in Cinema 4D SDK r20 python
      JH23J
      JH23