Manipulate extended GeDialog from ext methods.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/04/2011 at 10:14, xxxxxxxx wrote:
Hi franz. Thanks for your reply.
Unfortunatly, this is not the problem because the pointer passed is, in effect, related to my extended class (your mydialog example), simply is passed as base type (Gedialog).
Returning from thread, I'm able to call any method I want (with a cast to my type, in case...). In effect I'm interested to call only the base class methods, like 'Enable' or similar stuffs. So, even with the "specific" extended instance I've the same problem...sigh...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2011 at 07:54, xxxxxxxx wrote:
how you get the dialog pointer outside the plugin ?
with an extern variable?Franz
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2011 at 07:54, xxxxxxxx wrote:
I am not sure but if I remember correctly it's not allowed to call Cinema's GUI methods from a threading context.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2011 at 10:11, xxxxxxxx wrote:
Is my fear! it seems that the GeDialog pointer passed to thread is no longer "valid" in the called thread or in the callback called from thread (even if the address is correct and no runtime error happens).
Originally posted by xxxxxxxx
I am not sure but if I remember correctly it's not allowed to call Cinema's GUI methods from a threading context.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2011 at 10:41, xxxxxxxx wrote:
< ="-" ="text/; =utf-8">>Originally posted by xxxxxxxx
how you get the dialog pointer outside the plugin ?
with an extern variable?Franz
No. Sorry for my bad english and description, is difficult to explain correctly, I try to explicate the problem again:
Simply I have my plugin where I've extended the GeDialog class. So, in the overrided 'Command' method of this class, I have to call a Win Thread (I work under Windows) like this (I've omitted some code obviously) :
virtual Bool Command(LONG id, const BaseContainer &msg) {
...
switch (id) {
case(...) : {
...
break;
}case(DLG_BTN_X) : { struct st_thread_exec\* l_thread_exec = new st_thread_exec();
...
l_thread_exec->st_f_callback = C4DSceneCallback;
l_thread_exec->ref_dialog = this;HANDLE hThread = (HANDLE)\_beginthreadex(NULL, 0, &C4DSceneThreading, l_thread_exec, 0, NULL); break; }
}
....
DrawViews(DRAWFLAGS_NO_THREAD);
return TRUE;
....
}
};As you can see, I'm able to call the C4DSceneThreading function passing a struct (l_thread_exec) which old both the callback name function (C4DSceneCallback) and the pointer to the current my own dialog (ref_dialog = this).
Now, simply, under the C4DSceneThreading I have to call a callback when the (very long!) operations has been terminated inside the thread. The threaded function is declared and implemented like this:
unsigned __stdcall C4DSceneThreading(void* p_thread_exec) {
...
GeDialog* l_dialog = ((struct st_thread_exec* )p_thread_exec)->ref_dialog;
void (*l_st_f_callback)(GeDialog* ) = ((struct st_thread_exec* )p_thread_exec)->st_f_callback;
... Others long operations ...//NOW the thread end and I've to call the callback to work on the interface plugin: l_dialog pointer.
(void)(*l_st_f_callback)(l_res, l_dialog);
ExitThread(1);
}So, the callback is called and the code is like this:
void C4DSceneCallback(GeDialog* p_dialog) {
...
//Generic operations...
...//WORK ON MY GEDIALOG INTERFACE RETURNED AS POINTER!!
Bool one = p_dialog->Enable(DLG_BTN_UPLOAD_STOP, false);
Bool two = p_dialog->Enable(DLG_BTN_UPLOAD, true);
}Simply, 'one' and 'two' boolean return false!! NO static errors or runtime errors are reised, simply the interface (GeDialog pointer) prevents the properties setting!! This happens even I call the 'Enable' (or similar!) methods directly inside the 'C4DSceneThreading' function. Within 'classic' method all work fine. Again, passing trough a thread become impossible to set the GeDialog properties. This is a SDK limit? There is others solutions? I don't think that there is no thread call in C4D
Many many thanks FOR ANY HELP! Sorry for the long description.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/05/2011 at 03:31, xxxxxxxx wrote:
Hi
Then, I'm definitively desperate I've tried to use directly the thread SDK interface (I've seen just today the thread classes....) but the result is the same!
I've implemented the 'C4DThread' abstract class and inside the 'Main' method I've tried to set the GeDialog properties like this:
class C4DSS_C4DThread : public C4DThread {
private:
st_thread_exec* m_thread_params;public:
C4DSS_C4DThread() { }C4DSS_C4DThread(void\* p_thread_params) { m_thread_params = (st_thread_exec\* )p_thread_params; } void Main() { C4DSceneThreading(m_thread_params); Bool 'one' = m_thread_params->ref_dialog->Enable(DLG_BTN_STOP, false); Bool 'two' = m_thread_params->ref_dialog->Enable(DLG_BTN, true); } Bool TestDBreak(void) { return FALSE; } const CHAR \*GetThreadName(void) { return "\__my_Thread"; }
};
No luck!!! The Main thread method is called, 'C4DSceneThreading' is called, 'one' and 'two' boolean are still FALSE!!!! No chance to set the GeDialog interface button or something else!!! Obviously I've tried to move the 'Enable' calls within C4DSceneThreading and others desperates tests....nothing!
"I'm don't know what fish to catch..."
Thanks for any other suggestion!
Bye...
< ="-" ="text/; =utf-8"> -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/05/2011 at 06:26, xxxxxxxx wrote:
Changing dialogs is only allowed in Cinema's main thread, for instance in received messages.
Trying to change dialogs in own or external threads is strictly forbidden.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/05/2011 at 10:51, xxxxxxxx wrote:
Hi matthias. 'Nice', this is a fact now. But, what do you mean with "...in received messages."? You can suggest to me a way (a simple example...) to achive my goal?
Many thanks! Bye.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/05/2011 at 03:48, xxxxxxxx wrote:
With received messages I mean messages received in a plugin's Message method, for instance within CommandData::Message or GeDialog::Message.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/05/2011 at 11:18, xxxxxxxx wrote:
Hi Matthias, thanks for your suggestion. I've tried now to use the GeDialog::SendMessage call but I've a compile error like:
error C2039: 'SendMessageA' : is not a member of 'GeDialog'
1> c:\program files\maxon\cinema 4d r12\resource\_api\c4d_gui.h(249) : see declaration of 'GeDialog'
error C2660: 'SendMessageA' : function does not take 2 argumentsI'm not able to find the redefined method...and I don't know why the compiler try to call this method...What's wrong? Some include conflict can be generate this problem?
Many thanks!
Originally posted by xxxxxxxx
With received messages I mean messages received in a plugin's Message method, for instance within CommandData::Message or GeDialog::Message.
cheers,
Matthias