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
    • Register
    • Login
    1. Home
    2. pyr
    3. Best
    P
    • Profile
    • Following 1
    • Followers 0
    • Topics 22
    • Posts 51
    • Best 6
    • Controversial 0
    • Groups 0

    Best posts made by pyr

    • RE: Python Autocomplete in Script Manger

      here you go:

      https://developers.maxon.net/forum/topic/10784/14228_autocomplete-for-pycharm/2

      posted in Cinema 4D SDK
      P
      pyr
    • RE: Negative Vertex Map values

      hey,

      found the error. works exactly as i had planned. my code was correct, but i forgot to switch off use fields on the new vertex i mapped.

      thanks for the help anyway!

      grafik.png

      posted in General Talk
      P
      pyr
    • RE: Close any C4D Window

      can't test it right now, but this should do the trick.

      you'll need to install these packages to your c4d installation to make it work

      import win32gui
      import win32ui
      import win32co
      from pynput.keyboard import Key, Controller
      handle = win32gui.FindWindow(0, "Texture Manager")
          try:
              if handle:
                  
                  keyboard = Controller()    
                  win32gui.SetForegroundWindow(handle)
                  keyboard.press(Key.ctrl)
                  keyboard.press(w)
      
                  keyboard.release(Key.ctrl)   
                  keyboard.press(w)
          except:
              pass
      
      
      posted in Cinema 4D SDK
      P
      pyr
    • RE: Python Generator: Getting polygon data from new generators

      The default python generator returns a parametric object (c4d.Ocube). So you have to convert it to a editable poly in the generator itself. So you don't need a cso in your script but in the generator when using parametric objects.

      Python Generator

      import c4d
      #Welcome to the world of Python
      
      
      def main():
          c = c4d.BaseObject(c4d.Ocube)
          return c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,list    = [c],
                                                       bc      = c4d.BaseContainer(),
                                                       mode    = c4d.MODELINGCOMMANDMODE_ALL,
                                                       doc     = doc,
                                                       flags   = 0)[0]
      

      script

      import c4d
      
      doc = c4d.documents.GetActiveDocument()
      gen =doc.GetActiveObject()
      print gen.GetCache()
      
      
      
      
      posted in Cinema 4D SDK
      P
      pyr
    • RE: How to remove generator childs when converting via "c"

      forget about it. i removed the c4d.OBJECT_INPUT flag during development and forgot to add it back.

      posted in Cinema 4D SDK
      P
      pyr
    • RE: Polygon Islands Convenience Method?

      this script breaks an poly object into island, colorized it by random, offset to center of bounding box and some noise. after that i connects all islands again.

      its super fast compared to my older "solution"

      import c4d
      from c4d import gui
      import random
      
      def AddVertexColor(s,center,rad):
      
          cnt = s.GetPointCount()
          tag = c4d.VariableTag(c4d.Tvertexcolor, cnt)
      
      
          data = tag.GetDataAddressW()
      
          bs = s.GetPointS()
          bs.SelectAll(cnt)
          done = []
      
          points = s.GetAllPoints()
      
      
          r = random.random()
      
      
      
          for i in range(cnt):
      
              g = (points[0]-center).GetLength()    / rad
              b = c4d.utils.noise.Noise(points[0]*0.01,rad)
              c = c4d.Vector(r,g,b)
      
              c4d.VertexColorTag.SetColor(data, None, None, i, c)
      
      
          s.InsertTag(tag)
      
      
      def main():
          random.seed(666)
      
      
          selection  = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE)
          for s in selection:
              center = s.GetMp()
              rad    = s.GetRad().GetLength()
              c4d.CallCommand(12298)
              c4d.CallCommand(17891)
              mesh = s.GetDown()
      
              while mesh:
      
                  AddVertexColor(mesh,center,rad)
                  mesh = mesh.GetNext()
      
              c4d.CallCommand(100004768)
              c4d.CallCommand(16768)
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      P
      pyr