View Full Version : Coding your first Plug...What resources are available?

06-25-2004, 06:39 AM
Hi guys,
I am doing some research about plug-in development for Lightwave.
And I have a couple of questions for those who have done it in the past.

What should one use, L-Script or .p ?
Are there tutorials for either one of them?
If I go with .p should I use C#?
What have been your experiences coding for LW?

Looking forward to your comments,

06-25-2004, 06:57 AM
A .p has more rich possibilies.

It's all c. Some have written librariers to go to c++ and are easy to find.

Go to those who do: [email protected]

06-25-2004, 10:12 PM
If you're just getting started and aren't doing anything too complex, lscript isn't bad. As with all script vs. compiled comparisons, scripts are typically faster to create but run slower.

You can write .p (compiled) plugins in a number of languages. I have personally written them in C, C++ and Objective-C. And there are free compilers that can create LW plugins on both Mac and PC platforms - although due to LW being out of date on the Mac, only C is a real option there, even though Objective-C is now the prefered language for Mac development.

C# - dear God no.

One real plus about LW plugins is that they are quite consistent between the Mac and PC platform. The only reason some plugins aren't multiplatform is because the authors are either too lazy to do it themselves, or too lazy to ask someone to compile it on the alternate platform.

If you take the compiled approach, you'd better be up on you core graphics programming (matrix operations in particular), since LW doesn't really provide much assistance beyond the GUI and dumping a pile of either points or polygons to your plugin - i.e. you can't tap into any matrix operations built into LW itself, each plugin has to reinvent the wheel. On the other hand, there are some good examples provided as part of the SDK.

In summary, Lscript is an easy entry for those that aren't programmers. The C SDK works, but is slow and could (should) be better.

06-26-2004, 06:33 AM
Well i can only agree with blueagave...
heavy computations will run slower in LScripts, and not everything can be done with scripts, i.e. interactive tools (unless i missed something...haven't touched LScript since ages).

C#?? Er...no, i don't think this is a particularly good idea, if it works at all...
I write my plugins in "plain old" C, one day i'll dig more into C++, or perhaps i should look into objective C instead? Seems predestined for dlls...

Tutorials...the SDK "only" provides a tutorial for a box-tool in Modeler, however it is demonstrated with different plugin classes, and i find the SDK documentation a lot better than the LScript docu...but precondition is that you know some C.
Also the SDK comes with many source examples, so someone who knows C can just pick one of the desired plugin class and see how Newtek did it (although it's sometimes no good idea to do it like Newtek...;) )

@blueagave: What woule be a free compiler to create Mac plugins? Thought for MacOSX it only works with Codewarrior...
Or even better, is there something like a cross-compiler that runs on PC (Windows or Linux)? I don't like to annoy people like Richard Brak with compiling new versions...

06-26-2004, 07:43 AM
I've been using the Apple MPW 'environment'. It is free from Apple. It's quite lacking, but actually works OK for plugins.

I don't know of any PC cross-compilers that can build for the Mac. Codewarrior might, but I haven't used it. Once LW is shifted to Xcode, however, there is a reasonable chance that you could put together a gcc setup that would do it, as Xcode is built on gcc.

I've seen some free Mac emulators for the PC that would probably be sufficient for running MPW though. MPW is a pretty old app, and doesn't need OSX.

There is a tutorial here:

Lynx3d makes an important point, that knowledge of C is generally assumed in tutorials and the SDK.

06-29-2004, 06:12 PM
Codewarrior works if you don't mind paying for the dual compiler. Which is still $1000 cheaper than MS.

06-30-2004, 01:58 AM
I just got a book on C++.. is that a good or shoul it be in C?

06-30-2004, 07:16 AM
The answer to tutorials:


houses some, but there are really only 2 websites:


First one is for C++
Second is for LSC

There is also newteks resources:


that gives you links to some forums. The SDK Docs are also a little helpful. The only problem I really see you having with it is starting the coding which tells Lightwave what type of plugin you have. After that, it's a mater of calling the functions and hoping u have an up to date SDK doc and there are no mistakes. I ran into the problem where I was using the 6.5 SDK docs because I was making a plugin for 6.5 and the thing wouldn't compile right. Turns out the one of the commands I was giving didn't exist or didn't work like it said in the sdk. I got the 7.5 docs and they weren't the same.

06-30-2004, 09:03 AM
Im still learning how to write .p plugins. I know C/C++ , but turning the knowledge into useful LW plugin is another matter. I started with Lscript which appeared easy enough. Easier than creating .p for sure. As others said, C offers more possibilities. Sometimes, for simple(r) plugins, LScript is more than enough.At other times it is not.
The main reason I decided to take the pain and learn .p programming was to be able to write interactive tools.

I managed to write one semi-interactive lscript, but that was a based on "trick" (something like what JettoFillet does, i guess). C plugins offer a much more powerful solution for interactivity.

Oh, what resources are available? I guess some folks here already posted some links. I will look into it myself.
In my case I have read the SDK manual and went through sample plugins. Not the greatest resource IMHO, but better than nothing.

06-30-2004, 12:39 PM
On a side note i slightly updated my compiling-tutorial for Dev-C++ i recently wrote:

Don't know what you have to change to use C++ (.cpp) sources, if someone has a little tut on what to keep in mind when using the SDK with C++, i'd appreciate it.

06-30-2004, 05:53 PM
Another thing is that header files seem to be all screwy they point in a non exsitent directory. Also Anybody hear how that update is going to make it more accessible for developers?

06-30-2004, 11:53 PM
thanks for all of the resourses....