PDA

View Full Version : Layout: Run Plug-In from an other plug-in



DartWeider
10-11-2007, 08:37 AM
Hi!

For example:
I have CustomObject Plug-in. Can I run MeshDataEdit Plug-in from Evaluate-function to modify some selected object?

Dodgy
10-11-2007, 09:10 AM
I think so, you can from a script.

Sensei
10-12-2007, 01:27 AM
I don't think so. Not to mention custom object evaluate() function is only called in viewport for redrawing, not in rendering time..

DartWeider
10-12-2007, 01:50 AM
Sensei, hmm..but can i run an other plug-in not from evaluate()-function?(CustomObject is just for example)

Dodgy, how can i do it in LScript?...

Thanks for answers;-)

Sensei
10-12-2007, 01:55 AM
In the most cases in Layout "running other plug-in" means calling command ApplyServer which adds handler to currently active item.. You can do it only from LayoutGeneric and LayoutMaster, the all other places are unsafe, might or might not work..

DartWeider
10-12-2007, 04:06 AM
Yes. You're right about Genetic and Master plugin types. But in SDK's documentation i've found this:
Layout makes available a global that allows plug-ins of any class, not just generics and masters, to issue commands.

#define LWCOMMANDFUNC_GLOBAL "LW Command Interface"
typedef int ( *LWCommandFunc )( const char *cmd );

LWCommandFunc *evaluate;
evaluate = global( LWCOMMANDFUNC_GLOBAL, GFUSE_TRANSIENT );

maybe it can help me:)

Sensei
10-12-2007, 05:55 AM
To be honest, each time I tried using it, LightWave was crashing..

Lightwolf
10-12-2007, 06:06 AM
Layout makes available a global that allows plug-ins of any class, not just generics and masters, to issue commands.

It works, but you need to be very, very, very careful when using it (did I mention you ought to be careful?).

If LW is in a state where it likely can't handle commands, forget it. And I assume "evaluate()" - for any kind of plugin - is one of this states.

Cheers,
Mike

DartWeider
10-12-2007, 07:35 AM
i use evaluate function via MasterHandler. BUT.

result of this command:

sprintf(command,"ApplyServer %s %s",LWMODCOMMAND_CLASS,"MeshEditTest");

is

"Cannot apply server MeshEditTest"

but when i change params of ApplyServer-command it works...
and if I apply this MeshEdit plug-in by buttons from tab it works...

Maybe there are an other CLASS value to MeshDataEdit plugins?:):):)

Lightwolf
10-12-2007, 07:50 AM
Erm, you don't "ApplyServer" modcommands if I'm not mistaken.
You can use them directly as a command. Saving the commands.txt list ( Probably in the Edit or Help menu, depending on the menu layout) from Layout for the exact naming.

Cheers,
Mike

DartWeider
10-12-2007, 07:59 AM
Yeh!) I'm stupid head. Already done all of this. ;-) Thanks

sprintf(command," CommandInput %s","ModCommand_MeshDataEdit");

It works...
Thanks for help;-)

Lightwolf
10-12-2007, 08:02 AM
Even this ought to work:

sprintf(command,"ModCommand_MeshDataEdit");
Basically, use ModCommand_MeshDataEdit as the direct command.

Cheers,
Mike