Expression Editor buttons

On 05/02/2013 at 15:23, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13 
Platform:   Windows  ;   
Language(s) :     C++  ;   PYTHON  ;

---------
Hi,

I need to execute a python tag's "Execute" button with code.
The buttons that are found in the Expression Editor pallet that opens for the tag.

But all I could find is an r_expresssion.res file. With the button descriptions in it.
I can't even find an .h file with the ID#'s for these button.

How do we execute these buttons?

-ScottA

On 05/02/2013 at 16:16, xxxxxxxx wrote:

...\resource\modules\xtensions\res\c4d_symbols.h	  19,00 KB	23.08.2012 18:45:50
11	  IDS_CYCLE_EXPRESSION,
18	  IDS_FONT_BUTTON,
96		IDS_AM_COMMAND,
319		IDS_AM_COMMAND_LOCK,
466		//expression editor
468		IDD_EXPRESSION,
469		IDC_EXPRESSION_TEXT,
470		IDC_EXPRESSION_MESSAGE,
471		IDC_EXPRESSION_LINE,
472		IDC_EXPRESSION_POS,
473		IDC_EXPRESSION_FUNKTION,
474		IDC_EXPRESSION_LOAD,
475		IDC_EXPRESSION_SAVE,
476		IDC_EXPRESSION_COMPILE,
477		IDC_EXPRESSION_X1,
478		IDC_EXPRESSION_X2,
479		IDC_EXPRESSION_X3,
480		IDS_EXPRESSION_CLICKCOMPILE,
481		IDS_EXPRESSION_NOERROR,

not sure which are the right, one you'll have to find out for yourself 🙂 you might also look at
agent ransack, quite awesome program for text serach.

ps, its me littledevil, messed up my pw and the recoverry function is broken 🙂

On 05/02/2013 at 19:20, xxxxxxxx wrote:

I've actually been using Agent Ransak for a long time. Robert tipped me off to it a long time ago and I'd be lost without it.
But I'm afraid it's not helping me find what I need.

I can launch the python tag's Expression Editor.
But then I think I need to grab that window. Because it's hosting those buttons ( I think ).

#include "..\..\..\..\resource\modules\python\res\description	python.h"  
  
  
  BaseObject *obj = doc->GetActiveObject();  
  if(!obj) return FALSE;  
  BaseTag *ft = obj->GetFirstTag();               //The first tag should be the python tag  
  
  DescriptionCommand dc;  
  dc.id = DescID(DescLevel(TPYTHON_OPENEDITOR));  //Opens the tag's Expression Editor window  
  ft->Message(MSG_DESCRIPTION_COMMAND, &dc);      //Sends a message to execute the button

I don't know how grab that Expression Editor window and then execute those buttons on it.

-ScottA

On 05/02/2013 at 21:06, xxxxxxxx wrote:

Do a search for ID_PYTHONSCRIPT in the SDK Docs (Windows CHM).  This might be relevant to how you can execute a Python script from a C++ plugin.

On 06/02/2013 at 09:29, xxxxxxxx wrote:

MSG_SCRIPT_EXECUTE looks like it might do what I need.
But I can't figure out how to use it based on the rather wild example they provided.

-ScottA

On 06/02/2013 at 11:12, xxxxxxxx wrote:

Originally posted by xxxxxxxx

MSG_SCRIPT_EXECUTE looks like it might do what I need.
But I can't figure out how to use it based on the rather wild example they provided.

MSG_SCRIPT only works with plain scripts, not with expressions.
You could retrieve a Python expression's code with TPYTHON_CODE and create an ID_PYTHONSCRIPT node.
But an expression code isn't like a script code:
A script explicitly calls the main() function. An expression doesn't do that; CINEMA invokes it.

To execute an expression's code you just have to make the tag's data dirty, then call a global update:

expression->SetDirty(DIRTYFLAGS_DATA);
EventAdd();

On 06/02/2013 at 12:58, xxxxxxxx wrote:

Ok. Thanks Yannick.
Pretty much what I thought.

What I'm doing is writing code into the python tag from a script in the script manager( or through a command plugin).
And I needed a way to make the "Execute" or "Compile"  buttons occur in my script.
When you add text into a python tag remotely like this. The text is not recognized until one of these buttons is pressed.

I'll give SetDirty() & EventAdd() a shot.
But what If I wanted to execute the "Compile", "Load", or "Save" buttons?
Is there a way to execute these buttons through code?

-ScottA