PDA

View Full Version : [C,C++] plugin development



avogad
03-09-2007, 02:50 AM
Hello,

I'm currently doing a placement in an animation company in France. I have to develop plugins for Lightwave using C or C++. In order to do it, I'm developing under Visual Studio Express 2005 and have followed this topic http://www.splinecage.com/forums/showthread.php?t=649 to configure it. However, after building, i get that result:


1>empty.c
1>.\empty.c(33) : error C2061: erreur de syntaxe : identificateur 'NilCreate'
1>.\empty.c(33) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(33) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(39) : error C2061: erreur de syntaxe : identificateur 'NilDestroy'
1>.\empty.c(39) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(39) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(41) : error C2061: erreur de syntaxe : identificateur 'NilCopy'
1>.\empty.c(41) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(41) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(57) : warning C4042: 'unnamed-parameter' : classe de stockage incorrecte
1>.\empty.c(58) : error C2061: erreur de syntaxe : identificateur 'NegFlags'
1>.\empty.c(58) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(58) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(79) : warning C4042: 'unnamed-parameter' : classe de stockage incorrecte
1>.\empty.c(80) : error C2061: erreur de syntaxe : identificateur 'NegProcess'
1>.\empty.c(80) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(80) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(134) : error C2061: erreur de syntaxe : identificateur 'Activate'
1>.\empty.c(134) : error C2059: erreur de syntaxe : ';'
1>.\empty.c(134) : error C2059: erreur de syntaxe : 'type'
1>.\empty.c(164) : error C2065: 'Activate' : identificateur non déclaré
1>.\empty.c(164) : error C2099: l'initialiseur n'est pas une constante
1>servmain.c
1>.\servmain.c(21) : error C2065: 'MOD_MACHINE' : identificateur non déclaré
1>.\servmain.c(21) : error C2099: l'initialiseur n'est pas une constante
1>.\servmain.c(22) : warning C4047: 'initialisation' : 'unsigned long' diffère de 'void *(__cdecl *)(void)' dans les niveaux d'indirection
1>.\servmain.c(23) : warning C4028: paramètre formel 1 différent de la déclaration
1>.\servmain.c(23) : warning C4047: 'initialisation' : 'void *(__cdecl *)(void)' diffère de 'void (__cdecl *)(void *)' dans les niveaux d'indirection
1>.\servmain.c(25) : warning C4047: 'initialisation' : 'void (__cdecl *)(void *)' diffère de 'ServerRecord *' dans les niveaux d'indirection

The empty.c file contains the negative.c example.

Could anyone help me ?!...

Lightwolf
03-09-2007, 03:42 AM
Are you defining _MSWIN in your compiler settings? That would at least explain "error C2065: 'MOD_MACHINE' : identificateur non déclaré".

Cheers,
Mike

avogad
03-09-2007, 07:07 AM
Thx but i had already solved the problem...

Lightwolf
03-09-2007, 07:16 AM
Thx but i had already solved the problem...
Well... what was it? :D

Cheers,
Mike

avogad
03-09-2007, 07:20 AM
I just did few mistakes while configuring Visual and your answer was one of those!

Lightwolf
03-09-2007, 07:33 AM
I just did few mistakes while configuring Visual and your answer was one of those!
Ah, allright then. Well, if anything else comes up, you know where to ask ;)

Cheers,
Mike

avogad
03-09-2007, 07:42 AM
Thx a lot, so I'm asking !!!

I've just post a new topic on how to access objects properties:

http://www.newtek.com/forums/showthread.php?t=64950

Would u have any ideas?!

avogad
03-09-2007, 07:57 AM
Thx,

Would u have an example of a simple plugin writen in c ?! I mean, I don't really understand how plugins are executed, the XCALL_ macro,...

Lightwolf
03-09-2007, 08:09 AM
Thx,

Would u have an example of a simple plugin writen in c ?! I mean, I don't really understand how plugins are executed, the XCALL_ macro,...
Forget the XCALL_ macro, it is obsolete (it was basically only used for one or two _ancient_ compilers).

I suggest you read through the first three sections of the SDK.

Basically, LW calls your plugin with a struct to fill out (the struct depends on the plugin type). You fill out the struct with pointers to your functions which LW will then call when it needs to.

Cheers,
Mike

avogad
03-09-2007, 08:23 AM
Here is the box.c tutorial. As u see, they use XCALL_.


#include <lwserver.h>
#include <lwcmdseq.h>
#include <stdio.h>

XCALL_( int )
Activate( long version, GlobalFunc *global, LWModCommand *local,
void *serverData)
{
char cmd[ 128 ];

if ( version != LWMODCOMMAND_VERSION )
return AFUNC_BADVERSION;
sprintf( cmd, "MAKEBOX <%g %g %g> <%g %g %g> <%d %d %d>",
-0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 1, 1, 1 );
local->evaluate( local->data, cmd );
return AFUNC_OK;
}

ServerRecord ServerDesc[] = {
{ LWMODCOMMAND_CLASS, "Tutorial_Box1", Activate },
{ NULL }
};

Is there another way to write a plugin that would do exactly the same without using XCALL_ ?!

Lightwolf
03-09-2007, 08:30 AM
Is there another way to write a plugin that would do exactly the same without using XCALL_ ?!



int Activate( long version, GlobalFunc *global, LWModCommand *local,
void *serverData)
...

Works just as well.
If you check the SDK headers:


#define XCALL_(x) (x)

Cheers,
Mike

avogad
03-09-2007, 08:39 AM
OOO KKKKKKKKKK !!

Many thanks ! That could be something stupid but that answer is what i was expecting !!!!

And now the last but not the least question: Do u know how to create a plugin that would be available by doing Motions > Motion Options > Add Modifier ?!

Lightwolf
03-09-2007, 08:45 AM
And now the last but not the least question: Do u know how to create a plugin that would be available by doing Motions > Motion Options > Add Modifier ?!
That would be an ItemMotionHandler:
http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/classes.html

Cheers,
Mike

avogad
03-09-2007, 09:01 AM
Ok thanks!

I should be abble to work now !!!

Take care.

Cheers