PDA

View Full Version : Am I a real LScript Dummy?!?...



rmollame
08-01-2003, 05:35 PM
Hi everybody,

I'm beginning to use LScript in these days: I'm definitely not a programming rookie, nevertheless I'm pathetically failing again and again to accomplish a simple task as reading the points belonging to a polygon...

Here's the code fragment:

main
{
editbegin();
mypoly = polygons[1];
info(mypoly.pointCount);

// offending statement
info(mypoly.points[1]);
// error message: invalid object reference

editend();
}

where I tried to display the coordinates of the first point of the first polygon of the object on the current layer (a single square!)

Any help reeeeally appreciated.

Thanx

Lynx3d
08-01-2003, 06:46 PM
Uh, if it makes you feel better, i'm just as dumb...
"mypoly.layer" works, "mypoly.isCurve()" works, but not "mypoly.points" or "mypoly.points[]" or "mypoly.points[1]"...

Because i had those problems consistently i only use the SDK now...you get a LOT of examples with it and it's much clearer what it actually does, since it has to follow the C rules obviously...

rmollame
08-02-2003, 04:46 AM
Thanks Lynx3d,

that relieves me quite a bit...

Anyway, what do you mean with, er... SDK (I know it stands for software development kit: but attached to what and available where?...). You even mention tutorials: can you provide some links, plz?

Thanks again.

Lynx3d
08-02-2003, 06:46 AM
You can find it here:
http://www.newtek.com/products/lightwave/developer/index.html
(you haveto go to the community page -> developer, and not to the download page...)

Tutorials...there is one tutorial, it guides you through a modeler plugin starting from a simple command execution for making a box to an interactive tool for creating your own box (with UVs etc)
but that's pretty much it with tuts, for the rest you have to read the documentation and examine the mentioned example .c files (most of them have more or less usefull comments though)

It's a bit more code than just type "editbegin()" and start processing, you have to compile it and the compiled result is platform dependant, but it will run a lot faster and you have less limitations (however bob hood works hard to give LScript the same functionality)

richpr
08-02-2003, 01:46 PM
Check the examples in the LScript documentation... where the Weld and WeldAverage scripts are shown... They do a weld after looking for the last point and then moving all the other points there... and merging them...

Tom Speed
08-02-2003, 04:18 PM
Hi,

No you're not a dummy, you're just learning :)



main
{
selmode(USER);
editbegin();

mypoly=polygons[1]; // first selected Poly

data=polyinfo(mypoly);

// 'data' becomes an array of information about the Poly
// data[1] is always the name of the surface applied to this Poly
// data[2] to data[size(data)] contain the Point IDs this Poly is made of

for(n=2;n<=size(data);n++) // Point IDs start at [2]
info(pointinfo(data[n])); // display 'this' Points position

editend();
}



Cya!
Tom

rmollame
08-03-2003, 04:44 AM
Thanks to everybody,

you've been very supportive, I'm really grateful.
I'll practice your advices as soon as possible (I'm leaving for a few days vacation in Iceland): for the sake of information, I'm trying to figure out a "home made" hair generator so I need to control object cloning in a certain way.

All my best.

Riccardo


(by the the way, I'm modelling a certain big bad green giant you probably already heard about... Hope to show you soon something in the work in progress section. )