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

    SplineGUI for plugin

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 434 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 02/11/2012 at 02:35, xxxxxxxx wrote:

      I'm trying to create a python plugin (not a tag) with a SplineGui in it.
      The result is a small square, but nothing else.
      I'm not able to initialize it.

      Here is the code:

      import c4d
      import os
      from c4d import gui, plugins, bitmaps, utils, documents

      PLUGIN_ID = 10281843    #Test ID!
      MY_SPLINE       = 40001

      class SettingsDialog(gui.SubDialog) :

      def CreateLayout(self) :
       
            self.GroupBegin(id=1002, flags=c4d.BFH_FIT)
           
            self.splineBox = self.AddCustomGui(MY_SPLINE, c4d.CUSTOMGUI_SPLINE, "", c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0)

      self.GroupEnd()
            return True
       
        def InitValues(self) :
       
            self.sd = c4d.SplineData()
            self.sd.MakeLinearSplineBezier(3)

      #data = doc.GetDataInstance()       #BaseContainer for the tag - for plugin???
            #data.SetData(MY_SPLINE, self.sd)   #Execute the splineGUI changes from memory

      return True

      def Command(self, id, msg) :
            return True

      class ASSP(plugins.ToolData) :

      def __init__(self) :
            self.data = dict()                  #container
           
        def AllocSubDialog(self, bc) :
            return SettingsDialog(self.data)    #always return new instance(self.data)

      if __name__ == "__main__":
        bmp = bitmaps.BaseBitmap()
        dir, file = os.path.split(__file__)
        fn = os.path.join(dir, "res", "Icon.tif")
        bmp.InitWith(fn)
       
        okyn = plugins.RegisterToolPlugin(id=PLUGIN_ID, str="SplineControl",info=0, icon=bmp, help="Statusbar Text",dat=ASSP())
        if (okyn) : print "SplineControl Plugin V09 initialized."

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 02/11/2012 at 02:38, xxxxxxxx wrote:

        Note: I do not want to use a res file.

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 05/11/2012 at 03:35, xxxxxxxx wrote:

          Hi pgroof,
          Take a closer look at the documentation of GeDialog.AddCustomGui() :
          > GeDialog.AddCustomGui( id , pluginid , name , flags , minw , minh [, customdata ])
          The last argument, customdata, can be a container that contains parameters for the
          custom-gui that is being added. You can find the symbols for the container in the
          documentation for SplineCustomGui class. Here's an example:

          bc = c4d.BaseContainer()  
          bc[c4d.SPLINECONTROL_GRID_H] = True  
          bc[c4d.SPLINECONTROL_GRID_V] = True  
          bc[c4d.SPLINECONTROL_VALUE_EDIT_H] = True  
          bc[c4d.SPLINECONTROL_VALUE_EDIT_V] = True  
          bc[c4d.SPLINECONTROL_VALUE_LABELS_H] = True  
          bc[c4d.SPLINECONTROL_VALUE_LABELS_V] = True  
          bc[c4d.SPLINECONTROL_X_MIN] = 0  
          bc[c4d.SPLINECONTROL_X_MAX] = 1  
          bc[c4d.SPLINECONTROL_X_STEPS] = 0.1  
          bc[c4d.SPLINECONTROL_Y_MIN] = 0  
          bc[c4d.SPLINECONTROL_Y_MAX] = 1  
          bc[c4d.SPLINECONTROL_Y_STEPS] = 0.1  
          bc[c4d.SPLINECONTROL_PRESET_BTN] = True  
          bc[c4d.SPLINECONTROL_ROUND_SLIDER] = True  
          self.spline_gui = self.AddCustomGui(  
          MY_SPLINE, c4d.CUSTOMGUI_SPLINE, "Spline",  
          c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0, bc  
          )
          

          Best,
          Niklas

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 05/11/2012 at 05:30, xxxxxxxx wrote:

            Ah, thanks.
            I read about this solution here on the forum, but I thought that the post stated it did not work.
            For me it is working, thanks again.

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