View Full Version : Some questions about writing plugins for LW 9.3 and greater
RTSchramm
12-31-2007, 06:12 PM
I like programming as well as 3D animation, and I have several questions about writing plug-ins for Lightwave before I decide if it would be worth the effort to learn it:
1. What language do the LW plug-ins use?
2. Is the plug in language complied or interpreted?
3. If complied, does it use LW complier, a standard Windows complier?
4. How easy is it to convert a 32 plug-in to a 64 bit for the 64 bit version of LW?
5. What is involve in writing plug-ins for both Windows and OS X?
6. And finally, what type of math would I need to know in order to write LW plug-ins.
Thanks,
Rich
Lightwolf
12-31-2007, 07:27 PM
1) Mostly C and C++, if you're talking about "real" plugins (.p files) - Otherwise LScript, a proprietary scripting language. I'll only refer to the real thing from now on. (Other languages are possible but need a lot of work to hook up to LW).
2) Compiled
3) Standard windows compiler, the express editions will do.
4) If you have a 64bit compiler it is usually just a re-compile... unless you didn't follow some obvious, basic rules that are bad coding style to start with (i.e. store a memory pointer in an integer variable)
5) A windows compiler and on the Mac XCode for the UB version (code warrior is needed for the CFM version, but is not sold anymore - it seems the CFM version is slowly phased out by NT anyhow). Also, machines to test (d'oh ;) ).
6) Vector math/matrices and trigonometry to start with. Anything beyond that depends on the type of plugin. Logical thinking is a big plus, also the ability to break down problems (as with any coding).
Cheers,
Mike
RTSchramm
12-31-2007, 07:34 PM
So basically, I can use either C or C++ if I import the correct header files. Do the header files should come with the LW SDK kit?
Rich
jameswillmott
12-31-2007, 11:48 PM
So basically, I can use either C or C++ if I import the correct header files. Do the header files should come with the LW SDK kit?
Rich
Yes.
RTSchramm
01-01-2008, 12:20 AM
Thanks for the information.
Rich
Sensei
01-01-2008, 05:40 AM
5) A windows compiler and on the Mac XCode for the UB version (code warrior is needed for the CFM version, but is not sold anymore - it seems the CFM version is slowly phased out by NT anyhow). Also, machines to test (d'oh ;) ).
Free Apple's MPW is able to compile old CFM PPC code.. ;)
But developing on it from scratch... only for hard-core masochists wearing black masks and skins.. ;)
Lightwolf
01-01-2008, 05:47 AM
Free Apple's MPW is able to compile old CFM PPC code.. ;)
But developing on it from scratch... only for hard-core masochists wearing black masks and skins.. ;)
And the C++ support is... weak to say the least.
Cheers,
Mike
Sensei
01-01-2008, 06:21 AM
And the C++ support is... weak to say the least.
Everything what I use in C++ is working.. Except obvious bug when C++ object is global variable - constructor and destructor are not called..
fyffe
01-02-2008, 01:42 PM
Everything what I use in C++ is working.. Except obvious bug when C++ object is global variable - constructor and destructor are not called..
You can use placement new in the plugin's Startup function to construct globals, and explicitly call the destructors in the plugin's Shutdown function to destroy globals. Of course, wrap that up in some #if statements so it only does it on the mac. Downside is that you have to remember to do it for all your globals... but it works!
Silly mac libraries :foreheads
Sensei
01-02-2008, 03:10 PM
Thanks Graham. Yes, I know it works, because when I found it (half year ago), used pointer to object instead of direct global object, and then when needed it, compared with NULL and if so called new.. What I don't know is whether such (or your) workaround is needed for Mac UB too?
fyffe
01-02-2008, 03:22 PM
Thanks Graham. Yes, I know it works, because when I found it (half year ago), used pointer to object instead of direct global object, and then when needed it, compared with NULL and if so called new.. What I don't know is whether such (or your) workaround is needed for Mac UB too?
Yeah, you've got to do it for UB too. Such is life on the mac :) I use the Startup / Shutdown method so I don't need to test any pointers later on.
Lightwolf
01-02-2008, 05:15 PM
Thanks Graham. Yes, I know it works, because when I found it (half year ago), used pointer to object instead of direct global object, and then when needed it, compared with NULL and if so called new..
I construct static objects and these in turn have static member variables. This work in Codewarrior, XCode/gcc and MSVC. Also remember that static variables within a function only get initialized the first time around.
Is MPW ISO compliant? I tend to be lazy and use templates, exceptions and the STL a lot...
Cheers,
Mike
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.