Lscript Question

Kryslin

Active member
Ok, I'm cobbling together an lscript that assigns weights symmetrically, (Given right and left tags for the weights and bones, it's actually pretty trivial) to bones in a rig. I would like to select the item I choose in my bones popup menu, and center it, so the user can see where the selected bone is in the rig, so as to aid weight map selection.

I'm using a ctlpopup for my list of bones, but nothing I'm reading in my documentation says anything about having a UDF attached to it to handle this...

Any suggestions?
 

RebelHill

Goes bump in the night
you wanna use the refresher...

mypopup = ctlpopup(blah);
ctlrefresh(mypopup,"callBackFunc");

callBackFunc:val
{
something = val;
}
 

Kryslin

Active member
I'll necro this thread, trying to keep my questions in 1 thread...

In lScript, is there any way to get the part name associated with a polygon?

Skelegons have their bone name in two locations; 1 is the part name, the other is a tag. I know you've got to use either python or the SDK to read the tag, but can lScript read a part name from an arbitrary polygon?

Hmm, a cheat would be parts to surfaces - changing all the skelegon surfaces from bone to <bonename>... but I'd rather not have to make such a change (easy enough to restore, though...)
 

Dodgy

Worms no more! Free fun!
There's no way to retrieve parts in Lscript. You can assign them, but not retrieve them. You'll have to Parts to Surface and back to find those.
 

Kryslin

Active member
That's the conclusion I came to as well, after reading through the lscript docs on your site.

cmdseq("Parts to Surf"); does the job, though it requires manual input of a "Y" or "N". I'll have to see if adding the Y/N as a parameter does anything.

If I leave the part name intact after a parts -> surfs command, all I have to do is restore the surface to the skelegon - usually Default or bone.
 

Kryslin

Active member
Another necro of this thread...

Has anyone else had trouble with LW2015 and the debug(); command? I mean the debugger works, but what I'm experiencing is not good behavior - when ever the debugger throws an error (while debugging an lscript, this is fairly common), it's crashing LW2015, with a critical error message, and going to the desk top. I've reported it, but I was curious if anyone else was experiencing this - It's even doing this with an error() statement!
 

Kryslin

Active member
And yet another question:

I'm going to assume that the only option I have to work with skelegons in a scripting environment with Lightwave is Python; I cannot find any skelegon related information beyond the options in selpolygon (BONE, SKELEGONPATCH). Any of the people who know lscript better than I care to confirm this, or point me in the right direction?

Here's the why: Someone upstairs released a nice little plugin for generating weight waps based on skelegons. Coolness. While DStorm has a bones -> skelegons updater, it currently requires editing of the scene file version number for it to work. So, I wrote my own bone exporter (since export rig has a minor issue that makes it unsuitable for reloading a hierarchy (and it has been reported, but I doubt anything will be done, since it's been around since 9.x). I can reload the information, and generate 2 pt. polygons that follow the structure of the bones exactly, including getting the last poly pointing in the right direction. However, once there... I'm stuck. I have no option to create a skelegon and/or rename it. Any clues?
 

ernpchan

Active member
You can create skelegons. I have a lscript that automatically converts polylines to skelegons. If memory serves you have to call the Modeler command. Doing stuff in Modeler is more based on invoking the command versus methods like in Layout.

When I return from visiting family I'll dig it up. Won't be for a few more days though.

Does that help?
 

Kryslin

Active member
Helps somewhat. It's not a big deal, I like seeing what I can get lscript to do... If I get a useful tool out of it, even better.
 

lino.grandi

TD/Animator
To rename a skelegon in Modeler, you need to access its polygon tags.

Try this:

main

{
name="custom_name";

cmdseq("SetTag", "PART "+name);
cmdseq("SetTag", "BONE "+name);
}

This will rename the currently selected skelegon as "custom_name". Hope this helps.
 

Kryslin

Active member
That is indeed useful, and it works wonderfully.

I think I've got a way to load skelegons back into modeler from a rig in layout. I just need to refine the 2 scripts a bit...

Oh, yes... they need refining, but I managed to get most of a rig from a Rhiggit2 rig into modeler as Skelegons!
(It would probably work better if I used the z-bones only rig, but I got all 78 skelegons from the joints rig, just not connected up right)
 

Attachments

  • importedskelegons.jpg
    importedskelegons.jpg
    51.7 KB · Views: 274
Last edited:

Sensei

TrueArt Support
There's no way to retrieve parts in Lscript. You can assign them, but not retrieve them. You'll have to Parts to Surface and back to find those.

But if we know names of parts in advance (f.e. let user enter it), we can use f.e.

cmd
SEL_POLYGON SET PART "[name]"

Then use mesh scanning to learn which polygons are selected (so they're in part), and which are not.
 

Kryslin

Active member
Well, my prototype rig writer & reader scripts will import some fairly complex stuff, and get things connected up correctly; It handles the standard humanoid from Rhiggit2 flawlessly, or at least good enough to work with Tischbein's weighting plug in.
I've got a whole bunch of these things I need to get refined - If I find them useful, someone else might as well...

You know, if the cmdseq("SetTag", "PART " + string); sets the part on a skelegon, it should set the part name on any polygon...
That makes something a bit easier to do in another tool... (Make hair - generates spline curves for hair guides, with the root below the scalp object, an optional point at the scalp, and the tip of the stubble. Along with either Sensei's Extend Spline, or my crude lScript version, you can pull hair guides along, and manipulate the CP's with any number of modeler tools...)
 

Kryslin

Active member
On to the next question...

It appears that LSID needs some attention (and I'll report the nastiness I just came across). Are there _any_ other options for generating a UI for an lscript besides LSID?
 

ernpchan

Active member
On to the next question...

It appears that LSID needs some attention (and I'll report the nastiness I just came across). Are there _any_ other options for generating a UI for an lscript besides LSID?

I make mine manually...prolly not the most efficient process...

If you save out templates or bits of code to recycle then it helps the process.
 

Kryslin

Active member
Something I came up with that might help... I'm a sucker for grid layouts. So, to make things much easier, I did the following:
1) Defined 3 global variables - GRID_SIZE, SKEW, and OFFSET
2) Added a UDF called gbox (x,y,h,w) - (x,y) being the grid coordinates, (h,w) being the height and width of the control. it returns an array of 4 numbers [1] & [2] being equal to (x,y) * GRID_SIZE + OFFSET, and [3] & [4] = (h,w) * GRID_SIZE.

3) those 4 numbers are fed into ctlposition(c1,[1],[2],[3],[4]);

4) Repeat many, many times, and you get this:
 

ernpchan

Active member
Hm interesting. Can you post example code? I'd be interested in finding a way to organize uis better. Manually plotting where the ctl items go gets old quickly.
 
Top Bottom