On 02/08/2014 at 19:00, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) :
---------
I can't open the gradient gizmo's options pallet when creating it with AddCustomGui() function.
SetLayoutMode(c4d.LAYOUTMODE_MAXIMIZED) does not work.
Example of the various things I've tried to maximize the gizmo:
import c4d,os,sys
from c4d import plugins, utils, bitmaps, gui, documents
Plugin_ID = 1000010 #Testing id ONLY!!!!!!!
MY_GRADIENT = 10001
class MyDialog_Gui(gui.GeDialog) :
myGradGizmo = None
gradient = c4d.Gradient()
def CreateLayout(self) :
#Create the gradient gui here
#We will change it's options in the InitValues() method
gSettings = c4d.BaseContainer()
#gSettings.SetBool(c4d.LAYOUTMODE_MAXIMIZED, True) #<---Wrong!!!
#gSettings.SetLong(c4d.LAYOUTMODE_MAXIMIZED, 2) #<---Wrong!!!
#gSettings.SetLayoutMode(c4d.LAYOUTMODE_MAXIMIZED) #<---Wrong!!!
self.myGradGizmo = self.AddCustomGui(MY_GRADIENT, c4d.CUSTOMGUI_GRADIENT, "", c4d.BFH_SCALEFIT|c4d.BFV_CENTER, 0, 0, gSettings)
return True
def InitValues(self) :
#To change the gradient gui we have to first create a gradient object and fill it with data
#Then we copy the settings to the CUSTOMGUI_GRADIENT we created in the CreateLayout() method
self.gradient.InsertKnot(col = c4d.Vector(0.0, 0.0, 0.0), pos = 0.0,index = 0)
self.gradient.InsertKnot(col = c4d.Vector(1.0, 1.0, 1.0), pos = 0.5,index = 1)
self.gradient.InsertKnot(col = c4d.Vector(1.0, 1.0, 1.0), pos = 1.0,index = 2)
self.gradient.SetData(c4d.GRADIENT_INTERPOLATION, c4d.GRADIENT_INTERPOLATION_NONE)
self.gradient.SetData(c4d.GRADIENT_MODE, c4d.GRADIENTMODE_COLOR)
#self.gradient.SetLayoutMode(c4d.LAYOUTMODE_MAXIMIZED) #<---Wrong!!!
#self.myGradGizmo.SetLayoutMode(c4d.LAYOUTMODE_MAXIMIZED) #<---Wrong!!!
self.myGradGizmo.SetGradient(self.gradient)
return True
def Command(self, id, msg) :
return True
def CoreMessage(self, id, msg) :
return True
#-------------------------------------------------------------------------
# MyDialog_Main --- Where the plugin stuff happens--Don't edit this part
#-------------------------------------------------------------------------
class myDialog_Main(plugins.CommandData) :
dialog = None
def Execute(self, doc) :
#Create the dialog
if self.dialog is None:
self.dialog = MyDialog_Gui()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=Plugin_ID, xpos=-1, ypos=-1)
def RestoreLayout(self, sec_ref) :
#Manage the async dialog so it can be docked in the UI
if self.dialog is None:
self.dialog = MyDialog_Gui()
return self.dialog.Restore(pluginid=Plugin_ID, secret=sec_ref)
if __name__ == "__main__":
path, fn = os.path.split(__file__)
#bmp = bitmaps.BaseBitmap()
#bmp.InitWith(os.path.join(path, "res/icons/", "None")) #Uses a folder called "icons" inside the "res" folder to hold the icon
plugins.RegisterCommandPlugin(Plugin_ID, "LinkBox Example", 0, None, "", myDialog_Main())
-ScottA