On 27/02/2013 at 12:46, xxxxxxxx wrote:
I have following code, defining the custom SplineControl GUI.
It shows everything, but how to define and draw the spline?
self.spline_gui.MakeLinearSplineLinear(3) is not working?
import c4d
import os
import time
from c4d import gui, plugins, bitmaps, utils
PLUGIN_ID = 10281842 #test ID!
MY_HELPBUTTON = 11002
MY_SPLINE = 11003
class SettingsDialog(gui.SubDialog) :
def CreateLayout(self) :
self.AddButton (MY_HELPBUTTON, c4d.BFH_SCALEFIT, 0, 0, 'Help')
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
self.spline_gui = self.AddCustomGui(
MY_SPLINE, c4d.CUSTOMGUI_SPLINE, "Spline",
c4d.BFH_SCALEFIT|c4d.BFV_SCALEFIT, 0, 0, bc)
return True
def InitValues(self) :
return True
def Command(self, id, msg) :
if (id == MY_HELPBUTTON) :
gui.MessageDialog("Help")
return -1
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="Tab test",info=0, icon=bmp, help="Statusbar Text",dat=ASSP())
if (okyn) :
print "Tab Test Plugin V01 initialized."