Dialog differs inCOFFEE/SCRIPT/PLUG?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 29/06/2006 at 12:38, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.6 
Platform:      Mac OSX  ; 
Language(s) :   C.O.F.F.E.E  ;

---------
I use a regular COFFEE tag or the ScriptManager to debug snippets of code.
When using the very same code for opening a OK dialog it works inconsistent...

This code works fine in ScriptManager and in a COFFE expression plugintag.
The dialog opens.
But -not- in a regular COFFEE tag. The dialoge doesn't open.
I can't find out why!

It is as simple as possible. If op is selected, open dialog and deselect op.

Cheers
Lennart

  
// ////test dialog  
var opselected = doc->GetActiveObject(); // Get a active object  
if (op != opselected) return; // if it is not op return  
  
if (op == opselected) //else run  
{  
var result = TextDialog("Hey", DLG_OK);  
if (result == DLG_R_OK) // when confirming clicking OK  
{  
op->DelBit(BIT_AOBJ); // deselect op  
return;  
}  
}  
  
// ////test dialog end  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 03/07/2006 at 10:56, xxxxxxxx wrote:

Stupid questions: Are you sure that op == opselected? Are you sure that the code is executed at all? Try putting in println() at strategic positions, to find out.
Also, you shouldn't use dialogs within expression plugins. They will potentially be executed within a thread where GUI functions are not allowed.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 03/07/2006 at 12:26, xxxxxxxx wrote:

Hi. Yes the code is executed. Any Code incl Println(); after the example is working. That is why i got stumped about it.

Expression plugins is all I can manage :) So I have no other choice...

Cheers
Lennart

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 03/07/2006 at 13:13, xxxxxxxx wrote:

Then I'd say it's a thread issue. Both expression tags and expression tag plugins would be unsafe places to call GUI functions, but it seems only the latter are called from a thread at the moment.