Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi! I have a basic question, but I haven't been able to find an answer on the forums or internet search.
How do you open an GeDialog to its default width and height? I've tried using integers, 0, and gui.SizePix() (though I believe that is for UI gadgets) with defaultw and defaulth.
gui.SizePix()
defaultw
defaulth
import c4d from c4d import gui class MyDialog(gui.GeDialog): def __init__(self): pass def main(): myDialog = MyDialog() myDialog.Open(c4d.DLG_TYPE_MODAL, xpos=-2, ypos=-2, defaultw=528, defaulth=228) if __name__=='__main__': main()
My dialog is opening as a square.
I found this post but it only mentions that DLG_TYPE_ASYNC types cannot have their sizes set.
How can I open a modal to its default width and height?
Thank you.
hi,
this is a knowed bug, please see this thread Combined with this thread
you can end up with this kind of sript
import c4d import os from c4d import gui class OptionsDialog(gui.GeDialog): @staticmethod def GetScriptIdByName(): """ this static function allow you to retrieve the id of the current script. the name, must be the filename, not a custom name. """ name = os.path.splitext(os.path.basename(__file__))[0] if name is None: return None pluginList = c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_COMMAND, True) for plugin in pluginList: if plugin.GetName() == name: return plugin.GetID() return None def CreateLayout(self): self.SetTitle('Dummy Dialog 700x200px') self.AddMultiLineEditText(1000, c4d.BFH_SCALEFIT, inith=50, initw=500, style=c4d.DR_MULTILINE_READONLY) self.SetString(1000, "Hello World!") if self.GroupBegin(1001, c4d.BFH_CENTER, 2, 1): self.AddDlgGroup(c4d.DLG_CANCEL|c4d.DLG_OK) self.GroupEnd() self.ok = False return True def Command(self, id, msg): if id==c4d.DLG_CANCEL: self.Close() return False elif id==c4d.DLG_OK: self.ok = True self.Close() return True def main(): pluginID = OptionsDialog.GetScriptIdByName() if pluginID is None: return dlg = OptionsDialog() dlg.Open(c4d.DLG_TYPE_MODAL, pluginid = pluginID , xpos=-2, ypos=-2, defaultw=700, defaulth=200) if __name__=='__main__': main()
Cheers, Manuel
Hi,
your script works fine for me (I am on Win R20 and get a rectangle shaped dialog). What is your environment?
Cheers, zipit
@zipit Thank you for checking.
I'm on a PC, Windows 10, Cinema 4D R21. I experienced this unpredictability in my Command Plugin, so then tried it again with this simple script in the Script Editor to the same results.
I'm wondering if window size preferences are getting set somehow. It's very bizarre (and frustrating!).
@m_magalhaes Thank you for this workaround. I hope to see that bug fixed soon! It seems like one that would affect many scripts & plugins.