PDA

View Full Version : globalstore hates polygons id ?



.:Xk-Liber:.
06-30-2004, 04:09 AM
Hello,
Here is my 2nd Thread :)

It's for another script (modeler script) and it's almost achieved but I've a "little" problem (and I use another way to do what I want but if someone here knows how do this, please answer me ;) ).

I've read this Thread : "select polygons by id ", it's about that too but in another way.

So, I've got 3 plugs and I select polygons by Ids in the first one.
But... the globalstore function doesn't know the polygon id if I put it in its arguments (like : globalstore("my_current",current), where current = polygons[1]; , for example, in a MeshEdit I do before the storage).

The use of number(current), string(current) or others to cast my variable doesn't works well. (for example, current = 1645856 and number(current) will give me : 1).
But I really wanna store this "1645856" (note that it's not a "real" number") :(
I know that "current" is, in fact, a group of datas (see : polyinfo(current); which give the surface name of the current poly, and other stuff).

And thus I use another way to store my selected polygon in order to be able to re-select it, in the future, with one of my 2 other plugs : I store the poly surface name (and then I use : selpolygon(SET,SURFACE,the_surf_name_I_have_stored ); ). :mad:

Do you understand what I mean and want to do ? :)
My method works but it's a little annoying for what I really wanna do.

So, if someone can help me or give me others ideas.... :D

(Note that the polyinfo(current); is an array but doesn't give me what I want, and note too that globalstore doesn't like arrays .. so you have to break them up with loops to give simple string or integer/number ... to this function). -> for Modeler scripts !! It seems that globalstore like them in Layout scripts, I've seen that yesterday in a layout script of a friend ... strange uh?


I think it's possible to select the poly with its points by connecting them together... will my friend "globalstore" do like that ? :confused: ;)


.. I know it's a looong post but I think with it you'll be able to understand well what I try to do :) ...

thks in advance for answers.

.:Xk-Liber:.
07-01-2004, 03:01 AM
Any ideas guys ?

My 3 plugins are, in fact, a new way of Cut/Copy/Paste functions (with possibilities of cloning, flipping and rotating objects).

.:Xk-Liber:.
07-01-2004, 08:33 AM
Yeeeeeeeehaaaaa !!! :) :D :cool:

I've found a way to do what I want !!

-> I make a loop to count all polygons on the layer I want and compare each one's id with my first selected poly's id and when I found it, I go out of my loop ( break; ).
So, now I've got an simple variable (a number) I can store with the capricious globalstore function (niark niark niark :p :D )

And thus I can select this poly with another script of mine by a globalrecall and : selectpoly(SET,POLYNDX,the_stored_index); and do my other stuffs.

AH AH AH !! How life seems good when U find the answer of Ur problem ;) :D :)

(I hope my posts will help other guys who have to do the same... :) ).

Lynx3d
07-01-2004, 12:31 PM
Uh...and when you delete a polygon meanwhile, you may select the wrong one...?

I don't know how LScript handles such data types, all i know that the IDs inside Lightwave are just pointers.
They are only valid until you unload the object, so when you open the object next time they may (or most likely will) be different.

Unfortunately there is no such thing like polygon selection sets AFAIK (only parts, one polygon can only belong to one part).

.:Xk-Liber:.
07-01-2004, 01:55 PM
Uh...and when you delete a polygon meanwhile, you may select the wrong one...?

Yeah, Lynx3d, I understand what you mean.
And it's true. (Only if you want to clone it somewhere).

But as I said, I was re-creating Cut/Copy/Paste (so one plug for each basic function) but with other stuff added.

(I'm doing a 6 month placement/training in the society where TAIS works - he's a member of this forum too - and I work for him, developing plugins for LW)

Well, when you use the first or the second of my 3 plugs, you copy several informations of the polygon (and of the item it belongs to, and copy it).
Now when you use the "Paste" plugin, you may have deleted the poly : no pb, it will be pasted (if you've selected 3 polygons, there will be pasted, ...).
It's only if you want to clone it somewhere it won't work.
But it's logical .. you can't clone an object if it doesn't exist anymore, right?

I'll think about a way to pass through that.

But those plugs have a way of work quite logical so if you use it in an illogical way... that's your pb ;) LOL

I will think about it despite that. :rolleyes:

but now.. sssschhhhttt no more of my work secrets will be revealed :p ;)

GregMalick
07-20-2004, 05:18 PM
Here's a weird thought... can you just convert that integer-ID (or is it Long-ID) to a string... store it in the register... and convert it back to an integer when you need to use it from the register.


Kinda a hack................ but maybe a good hack.

.:Xk-Liber:.
07-21-2004, 01:43 AM
Thank you for your reply.
In fact, I've already tried this.
If you want to test it (use the "debug();" command to see what it does) you'll see that it's neither an int, nor a long.
To convert it in a string gives : nothing.
(The debugger shows that the variable is : "" ).

Perhaps Newtek's guys will show this thread and correct it in a "real" 8 version (not a "customers have to find the bugs for us" version ;-) ).

I've finnaly done what I want. You can find a demo (in video) of the plugs I've developped here :

http://underdeepwater.free.fr/creations/Programmation/Ligthwave_plugins_(LScript_et_C)/

(This work is done but if someone finds a trick about "store", "globalstore", "recall", "globalrecall" AND "POLYID", I'm still interested in :-) )