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. PdZ
    3. Topics
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 9
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by PdZ

    • P

      Saving & Loading User Preset

      Cinema 4D SDK
      • • • PdZ
      3
      0
      Votes
      3
      Posts
      626
      Views

      P

      Hi Maxime,

      thank you very much! Good to know. I would otherwise searched forever.

      Cheers,
      PdZ

    • P

      Cinema Gradient, weird behaviour

      Cinema 4D SDK
      • r20 sdk python • • PdZ
      7
      0
      Votes
      7
      Posts
      1.2k
      Views

      M

      Don't feel sorry yes this is the issue and since Knot ID are not ordered from right to left but from creation order its why it's confused you.
      Moreover, using a for loop will make way more sense and help you to avoid this kind of stuff.

      grad1 = shdr1[c4d.SLA_GRADIENT_GRADIENT] grad2 = shdr2[c4d.SLA_GRADIENT_GRADIENT] for knotId in xrange(grad1.GetKnotCount()): knot = grad1.GetKnot(knotId) grad2.InsertKnot(col=knot['col'], pos=knot['pos'],index=knot['index']) grad2.FlushKnots() shdr2[c4d.SLA_GRADIENT_GRADIENT] = grad2

      Finally, a BaseShader is derived from BaseList2D which is derived from C4DAtom that mean you can use GetClone to retrieves a clone of this shader so your code can look like.

      import c4d def main(): mat = doc.GetFirstMaterial() colorShader = mat[c4d.MATERIAL_COLOR_SHADER] if colorShader is None: return copyColor = colorShader.GetClone() mat[c4d.MATERIAL_DIFFUSION_SHADER] = copyColor mat.InsertShader(copyColor) mat.Message(c4d.MSG_UPDATE) mat.Update(True, True) c4d.EventAdd() # Execute main() if __name__=='__main__': main()

      Cheers,
      Maxime.

    • P

      Python - Cinema 4D R20.057 - Export to Alembic without Dialog

      Cinema 4D SDK
      • python r20 • • PdZ
      6
      0
      Votes
      6
      Posts
      1.5k
      Views

      P

      Yes it is! Thank you very much!