THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/12/2012 at 13:35, xxxxxxxx wrote:
Info : Cinema 4D R14 Windows
Lang: Python
Hiho,
what are we supposed to return from a GeDialog.Message() method ? When i first wrote the
method i just returned a boolean True, causing C4D to crash pretty hard, so i red the c++ and
python sdk, which both state :
_<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_<__<_t_>_Returns:|
The return value depends on the message.
---|---
and that it should be long, which doesn't really help. So far i have tried :
# c4d crashes (dialog isn't drawn properly anymore plus constant error ding,
# c4d doesn't accept any input, i had to kill the process(with fire))
def Message (self, msg, result) :
return super(CSettingsGeDialog, self).Message(self, msg, result)
# same as the super call
def Message (self, msg, result) :
return GeDialog.Message(self, msg, result)
# c4d crashes, but in a different way than the parent calls. less colorfull :)
def Message (self, msg, result) :
return 1
# c4d doesn't crash, but all dialog content is gone
def Message (self, msg, result) :
return 0
I guess i am missing something important again ? I used the forum search, which came up
with some C++ examples, which used my second approach - a direct call to the GeDialog class,
which obviously doesn't work in python. The dialog is modal, created and opened from a
CommandData.Execute-OptionID() method. The layout is loaded from a ressource file.
a larger code snippet ...
class CSettingsGeDialog(gui.GeDialog) :
def __init__(self, documentPath) :
self.AddGadget(c4d.DIALOG_NOMENUBAR, 0) #disable menubar
self.DocumentPath = documentPath
self.RenderPath = ""
def Command(self, id, msg) :
return True
def CreateLayout(self) :
geRessource = plugins.GeResource()
geRessource.Init(dir)
return self.LoadDialogResource(10001, geRessource, 0)
def InitValues(self) :
return True
# Listen for keystrokes
def Message (self, msg, result) :
return 1
...........................................................................................................................................
def ExecuteOptionID(self, doc, plugid, subid) :
self.isActive = True
if self.settingsDialog is None:
self.settingsDialog = CSettingsGeDialog(doc.GetDocumentPath())
screen = gui.GeGetScreenDimensions(0, 0, True)
dialogResult = self.settingsDialog.Open(dlgtype = c4d.DLG_TYPE_MODAL,
pluginid = PLUGIN_ID,
xpos = int(screen['sx2']/2) - 300,
ypos = int(screen['sy2']/2) - 300)
...
edit : Just to be clear, what i want to achieve - I have got a Textbox in my dialog to hold
a folder path. The dialog accepts absolute and relative paths (relative to the location of
the active document). I want to listen to the key strokes made while the dialog is open,
so that when Enter is pressed that the current relative path is turned into an absolute
path. Maybe there is an easier way to do this, than to listen the to the BFM_INPUT_KEYBOARD
and BFM_INPUT_CHANNEL messages ?
thanks for your help in advance.