On 12/12/2013 at 08:36, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R15
Platform: Windows ;
Language(s) : C++ ;
---------
I have defined a FilenameCustomGui to get the image filename.
Then I drag & drop a image to the field.
BaseContainer settings;
settings.SetBool(FILENAME_TEXTURE, true);
myHdrfile = (FilenameCustomGui* )AddCustomGui(1009, CUSTOMGUI_FILENAME, "", BFH_SCALEFIT, 0, 0, settings);
Then in the message part, I get the id and try to get the filename, but it is always empty?
The first part show how it is done in python (and working).
Also how to put the filename back into the FilenameCustomGui field?
Int32 MainDialog::Message(const BaseContainer& msg, BaseContainer& result)
{
// working python code
// def Message(self, msg, result) : #get filename drag&drop to MY_HDRFILE field
//
// #print "Message id: ", msg.GetId()
// if (msg.GetId() == c4d.BFM_ACTION) :
// cid = msg[c4d.BFM_ACTION_ID]
// val = msg[c4d.BFM_ACTION_VALUE]
// #print 'Msg ID:', cid, ' Val:', val
// if (cid == MY_HDRFILE) : self.SetString(cid, val)
// return gui.GeDialog.Message(self, msg, result)
switch (msg.GetId())
{
case BFM_ACTION:
Int32 actionId = msg.GetInt32(BFM_ACTION_ID);
//BaseContainer action(BFM_ACTION);
//String val = msg(action).GetString(BFM_ACTION_VALUE);
String val = msg.GetString(1009, "ABC");
GePrint ("Action ID + value: " + String::IntToString(actionId) + " - " + val);
break;
}
return GeDialog::Message(msg, result);
}