Posts Tagged ‘LScript’

Set 100% to weight map

Written by MentalFish. Posted in Computer Graphics

This is a really simple script, the only thing it does is to set the weight of the currently selected points to 100%.

main {
selmode(DIRECT);
editbegin();
vmap = VMap(VMWEIGHT,0) || error(“Please select a weight map first.”);
foreach(sp, points) {
vmap.setValue(sp, 1.0);
}
editend();
}

http://vimeo.com/moogaloop.swf?clip_id=8276292&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=ff9933&fullscreen=1

Download LScript

Incremental save plugin for LightWave

Written by MentalFish. Posted in Computer Graphics

This is an old and I think my first LScript I made. It keeps things tidy.

Saves increments in a folder and does not overwrite any existing files. If you incremental save your file “myModel.lwo”, this script creates folder “myModel_incr” and adds the file “myModel_001.lwo” to it.

At the next incremental save it will add “myModel_002.lwo”, but you will still be working on the original “myModel.lwo”.

IncrementalSaveScreenshot

This helps in having a clean incremental history of your work as well as you will always know that “myModel.lwo” is
the actual latest save together with the highest number in the “myModel_incr” folder.

The script looks for the highest numbered file in the _incr folder, and creates a new file, one number higher.

If the file has not been saved yet, it will provide a file requester to specify a destination file.

Download

Motion baker… that works

Written by MentalFish. Posted in Computer Graphics

My latest LScript is a motion baker script for LightWave that bakes such things as items animated through Denis Pontonnier’s DP Kit + Node Item Motion and other “non standard” ways of animating in LW.

It also bakes all selected items, and on a test of 100 nulls, it took about 12 seconds to bake them over 100 frames, so 10.000 keys set in total. To make sure that it bakes the correct value, it runs through the timeline once, extracting the values from each selected item, and then afterwards applies those values to the respective channels: position, rotation and scale.

Once it is done baking, it goes back to the frame you were at when triggering the script, nothing grand, but just a little extra touch to make it a nicer workflow. As far as I can tell, this script will bake other tricky animations such as expression based animations and the like. Give it a spin and see if it works in your projects.

Thanks to Mikael Burman for suggesting and testing the script!

Edit: updated the script to have a GUI so you can specify the range of frames to bake.

Download MFMotionBaker

LightWave to After Effects

Written by MentalFish. Posted in Computer Graphics

This is an LScript for transferring animation data from LightWave to After Effects. It is done by exporting the position and rotation of the selected item in LW into a .ma file (ASCII Maya file). At the same time, After Effects is either launched or brought to front and told to open that specific file. This makes it feel like you have a direct connection between the two applications.

It always exports it as a camera so that AE does not create a whole bunch of solids for the models inside the .ma file. Think of it as exporting a null that just so happens to look like a camera :)

What do you think, should the script also export scale as well, or is it not needed?

Something weird happens with the sound in the end. I might re-record it, but it works for now:

Download LScript

Stranded on an island

Written by MentalFish. Posted in Computer Graphics

I came across an issue the other day while doodling on a 3D model of a car wheel. The nuts, or bolts if you will, were too small and I found it strange that there was no tool inside LightWave to scale them individually as separate entities as they were inside the same layer (mesh) in Modeler. This would mean I had to manually select each island and scale them one by one. Not a giant task by any means as it was only a few items, but still annoying.

http://vimeo.com/moogaloop.swf?clip_id=5802071&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=ff9933&fullscreen=1

So I went to the NewTek forums and posted a question on whether or not there is a solution for this, either hidden somewhere in LW or some sort of plugin. I got some suggestions on plugins to use and a script to try. They weren’t exactly what I was after, but it gave me a starting point and idea of how to get this functionality working as I wanted it to.

I studied the suggested LScript (LightWave Script), got the grasps of what was going on, analyzing why it wasn’t working, and after a couple of iterations came up with a solution that worked. This was in turn taken by someone else, new to the discussion, and improved to yet another level.

At this point the script was doing what I wanted in terms of scaling each “island” of selected polygons, but in a very try-and-see-what-happens kind of way, as there was no interactive feedback of the end result while changing the scale value. So I added an interactive update to it as well as the next step.

From this it was a couple of lines extra and we had “island-rotation” as well. The only problem here is that it happens on world-coordinate axis, so if your island of selected polygons were on differently slanted angles, it could mess them up. If they were aligned flat on the same plane, they were fine.

Now this LScript is in a stage of adding scaling around each polygon-selection’s average normal (its local “up” axis) and if this works then… woohoo! Anyone with some 1337 LScript and/or 3D math knowledge is welcome to contribute.

I would not have found these solutions as fast if it was not for the community and the general attitude of sharing and contributing.

That’s it for now, check out the forum thread and follow the continued development of this:

http://www.newtek.com/forums/showthread.php?t=100587

Download LScript