PDA

View Full Version : Plugin Coding Question


dead_eye
06-30-2003, 02:06 AM
I hope this is the right place to post this. I'd post these questions on the Yahoo! Lightwave Plugin group, but it seems pretty dead over there :scream:

I was wondering how on many plugins it detects what polygon was selected first and what polygons were selected afterwards. So I cruised through the SDK docs and found that there is pointScan and a polyScan function in the MeshEditOps were you can modify selected (or unselected) points and polys with the pntMove and other MeshEditOp functions.

My question is: If I select Poly #1 and then Poly #2 in Modeler and then run my plugin, will Poly #1 be passed to the polyScan callback function before Poly #2 will? There's nothing in the SDK that says the callback function maintains selection order, or creation order, or just throws points and polys in random order. Is this the right way to do such a thing?

Thanks,
steve

Joviex
06-30-2003, 02:57 AM
Originally posted by dead_eye
I hope this is the right place to post this. I'd post these questions on the Yahoo! Lightwave Plugin group, but it seems pretty dead over there :scream:

I was wondering how on many plugins it detects what polygon was selected first and what polygons were selected afterwards. So I cruised through the SDK docs and found that there is pointScan and a polyScan function in the MeshEditOps were you can modify selected (or unselected) points and polys with the pntMove and other MeshEditOp functions.

My question is: If I select Poly #1 and then Poly #2 in Modeler and then run my plugin, will Poly #1 be passed to the polyScan callback function before Poly #2 will? There's nothing in the SDK that says the callback function maintains selection order, or creation order, or just throws points and polys in random order. Is this the right way to do such a thing?

Thanks,
steve

EDIT: Oh BTW, in the Yahoo! Lightwave Plugin group, there was a post saying that NewTek was giving away free passes to SIGGRAPH 2003? That true? Was that post real? If so, I'm there :drool:

Yeah the post is true. The list is far from dead, it just takes some time to answer sometimes, especially since this is the weekend. Personally I get the list in digest format, so I don't get everything till the end of day anywho :)

As for the callbacks. I am pretty sure selection order is maintained, however, what difference would it make? Is there something you are trying to specifically do with the selection order?

And yes, the docs have much to be desired.

dead_eye
06-30-2003, 03:06 AM
Cool, thanks for the info. I'm going to write a little specialized rotation plugin like Modeler's Rotate Arbitrary for a sequence of connected triangles where you won't have to put a two-point polygon in a background layer for the rotation axis because it will be computed from the triangles. So the selection order is very important :). The rotation axis will be determined from the first 2 selected triangles.

I think the SDK docs are actually pretty good. Missing a few things, but within an hour of reading the docs I was already running the sample plugins and moving points and polys around. Now if only someone could make a C++ wrapper for all those plugin functions. Programming in C is a bit archaic :p.

Joviex
06-30-2003, 06:13 AM
Originally posted by dead_eye
Cool, thanks for the info. I'm going to write a little specialized rotation plugin like Modeler's Rotate Arbitrary for a sequence of connected triangles where you won't have to put a two-point polygon in a background layer for the rotation axis because it will be computed from the triangles. So the selection order is very important :). The rotation axis will be determined from the first 2 selected triangles.

I think the SDK docs are actually pretty good. Missing a few things, but within an hour of reading the docs I was already running the sample plugins and moving points and polys around. Now if only someone could make a C++ wrapper for all those plugin functions. Programming in C is a bit archaic :p.

C++ is easy to use with the SDK. There is a wrapper on the mailing list, just do a search through the archives.

If you want to do it yourself though, it is pretty easy.

First, extern "C" {} around all the LW headers you include. Although this step can sometimes be disregarded and will compile on certain compilers, though it is still good form.

And second, all user data types passed in any of the function callbacks must be passed as untyped (i.e. void). You can then upcast to whatever your types are supposed to be. Granted, more work, but very easy with smaller projects.

HTH.

dead_eye
06-30-2003, 07:40 AM
Cool, thanks. I will look for the wrapper. Yep, the extern "C" thingy works great :beer:.

mattc
06-30-2003, 07:47 AM
Try http://www.happy-digital.com/ I'm pretty sure it was HD who did the publically available C++ wrapper.

Regards
Matt

DarkLight
06-30-2003, 08:54 AM
mattc is right. The Happy digital site is what you want.
http://www.happy-digital.com/programming/happylib.html

dead_eye
06-30-2003, 10:44 AM
cool thanks, i'll check that out :).

CGTalk Moderation
01-15-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.