PDA

View Full Version : LScript crashing lightwave


art
10-20-2005, 09:22 AM
I am working on my first interactive script, but I either do something wrong or there is a problem with LScript. I have a requester with bunch of controls. Based on the numbers given by the user I create some geometry. Once the main geometry is created I need to select particular polygons and perform some additional functions on them. For that purpose I am trying to use selpolygons(SET,POLYNDX,x). I attached a stripped (for clarity etc) version of my plugin to illustrate my problem on a simple box. Once the box is created I try to select 1st and 6th polygon just as an example. Now this is what happens:

1) If you start the plugin in the poly selection mode everything seems to be working fine.
2) If you start the plugin in the point selection mode but DO NOT move any sliders, etc, and click OK, the geometry is created. Once you swith to poly selection mode you can see box with 1st and 6th polygons selected.
3) If you start the plugin in the point selection mode and move sliders, lightwave crashes, in my case at least.

So my questions are:

Does selpolygons in conjunction with POLYNDX work in point mode?
If it does not, there is no way to force lightwave into poly mode, is there?
Are there alternative ways for me to select specific polygons? To tell you the truth, I have not tried selecting by POLYID... I wonder if it will also crash LW.
Does the crash have something to do with interactivity or maybe a bug in my script?
Since this is my first attempt (well, first and a half :) ) at interactivity in LScript, please tell me if my approach is correct. I've seen people using multiple undos and other tricks, but the code was usually too complex for me to see what was really going on. I put a couple of "delete()" im my code which seems to work fine. At this point I assume working in empty layer anyway.

Any help would be appreciated.

EDIT: I tried selecting polygons using POLYID instead of POLYNDX. The same things happens. Works in polygon selection mode but it does not in point mode.

art
10-20-2005, 04:06 PM
I found the partial solution. I have to clear selected polygons before selecting them again, although they are deleted before reselecting. If I deselect them, LW does not crash.
My new problem is that althoug the polygons are selected, when I am in point mode LW works on all polygons, regardless of my polygon selection in poly mode.
Any thoughts?

EDIT: Nevermind!
I just have to use selmode(DIRECT);

And so I answered all my questions. In the end it was problem with my code, not LScript, althoug the reference guide could be more detailed in some cases. :)