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
    • Recent
    • Tags
    • Users
    • Login

    CreateLayout in ObjectPlugin without res file

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 450 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 06/08/2013 at 07:08, xxxxxxxx wrote:

      Hi. Probably silly question, but I cannot figure out how to create layout without res file:
      Am I missing something? Thank you.

        
      import c4d   
      from c4d import gui, plugins, utils   
      import os, random   
        
      PLUGIN_ID = 3333333   
      PLUGIN_NAME = "pluginname"   
      PLUGIN_DESCRIPTION = "Opluginname"   
        
      class MYPLUGIN(c4d.plugins.ObjectData) :   
          def CreateLayout(self) :   
              self.SetTitle("My Dialog")   
              self.GroupBegin(id=100010, flags=0, cols=1, rows=1)   
              self.AddGroupSpace(4, 4)   
              self.AddGroupBorderSpace(4, 4, 4, 4)   
              self.AddStaticText(id=100011, flags=0, name="Hello World!")   
              self.GroupEnd()   
              return True   
        
      if __name__ == '__main__':   
          bmp = c4d.bitmaps.BaseBitmap()   
          dir, file = os.path.split(__file__)   
          fn = os.path.join(dir, "res", "Icon.tif")   
          bmp.InitWith(fn)   
          result = plugins.RegisterObjectPlugin(   
              id=PLUGIN_ID, str=PLUGIN_NAME, g=MYPLUGIN, description="", info=c4d.OBJECT_GENERATOR, icon=bmp   
          )   
        
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 06/08/2013 at 07:24, xxxxxxxx wrote:

        Hi Tomas,

        There's no CreateLayout() for data plugins. You can only use .res files description.
        Do not confound descriptions and dialogs. CreateLayout() is only defined for dialogs.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 06/08/2013 at 07:25, xxxxxxxx wrote:

          I see. I thought so:)
          Thanks for clearing this out for me. Appreciate that.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 06/08/2013 at 08:53, xxxxxxxx wrote:

            On the other hand, if I build buy GUI in res file, can I make some elements greyed out, depending on what settings/buttons are pressed by user?

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 06/08/2013 at 08:59, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              On the other hand, if I build buy GUI in res file, can I make some elements greyed out, depending on what settings/buttons are pressed by user?

              Yes, you can override NodeData.GetDEnabling() and depending on the passed id return True to enable or False to disable the description parameter.
              Here's how it's implemented in Py-DoubleCircle example:

              def GetDEnabling(self, node, id, t_data, flags, itemdesc) :
                      data = node.GetDataInstance()
                      if data is None: return
                      
                      inter = data.GetLong(c4d.SPLINEOBJECT_INTERPOLATION)
                      if id[0].id==c4d.SPLINEOBJECT_SUB:
                          return inter==c4d.SPLINEOBJECT_INTERPOLATION_NATURAL or inter==c4d.SPLINEOBJECT_INTERPOLATION_UNIFORM
                      elif id[0].id==c4d.SPLINEOBJECT_ANGLE:
                          return inter==c4d.SPLINEOBJECT_INTERPOLATION_ADAPTIVE or inter==c4d.SPLINEOBJECT_INTERPOLATION_SUBDIV
                      elif id[0].id==c4d.SPLINEOBJECT_MAXIMUMLENGTH:
                          return inter==c4d.SPLINEOBJECT_INTERPOLATION_SUBDIV
                      
                      return True
              
              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 06/08/2013 at 09:02, xxxxxxxx wrote:

                Oh ok, that makes a lot of sense. Will investigate your code. Thanks for your input.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post