LightWave Modeler Plugin – LScript
Tested in: LightWave 11.6.1 64bit & 32bit for Windows & Mac (for older versions look here)
download Morphs2OBJs v1.0 for all platforms Win 32bit, 64bit, & Mac
build date: 07-Feb-2014
terms & conditions of download & use
v1.0
This script was designed to enable the ease of exporting all of a Lightwave object’s endomorph morph maps / vertex maps as individual OBJ files. This is often useful to use these individual files in other morphing applications such as the Mega-Fiers mesh modifier 3rd-party product for the Unity 3D game engine. However, this script can be used by itself to just dump out all the morphs of a given LWO model as separate OBJs in just one click. Though this plugin is generic in nature and its OBJ output can be used in any other application as well such as Poser, 3DCoat, etc. where you would need an individual morph or morphs from your Lightwave object.
known issues:
- This version contains a Preset Tab intended to set Modeler’s General Options OBJ settings correctly for the target application you intend to use your exported OBJs in, however, a current Modeler bug in 11.6.1 prevents this from working correctly, so it is disabled at present, and you will have to make sure to manually set your Modeler’s OBJ settings correctly before running this script. – This will be fixed in a future version as soon as possible.
how to use it:
- Close all Objects in Lightwave Modeler (just as a precaution to make things easier)
- Load an object which contains Endomorphs / morph maps into Lightwave Modeler
- Go to the Utilities Tab and select LScript/RT (to run a compiled LScript file) – OR if you use this a lot, go to the Edit > Menu Layout and add this as a button in your interface
- Select the pw_Morphs2OBJs_v1_0.lsc script
- The script will warn you if there are things with your object it can’t handle otherwise it will continue
- Select the morph maps you want to export to OBJs by Ctrl-clicking on them in the listbox – or click the “SELECT ALL” button (if you are sure all of the morphs listed are contained in your currently loaded object)
- Check “Export additional OBJ of base map” to export the neutral morph base vertex map (this is loaded as “Base Mapping” in Mega-fiers)
- Enter a Filename Prefix which will be pre-pended to the files exported. The Base file (if selected) will be named as so: “Prefix_ObjectName_Base.obj” and the morphs like: “Prefix_ObjectName_Morph1.obj” and “Prefix_ObjectName_Morph2.obj” etc.
- Select an output folder where you would like your exported OBJs to be saved.
- Click (and highlight) “Detailed feedback mode” to make this script give you more feedback on what it is doing and why. This is recommended until you are used to it. You can turn this switch off and it will NOT give you message box dialogs with additional information unless the message is critical – this may speed things up and save you a few confirmation clicks.
- Click OK to run the Exporter or Cancel to abort and do nothing.
additional notes:
- This script remembers its basic settings between runs of it.
- BACKUP YOUR OBJECTS!! – This script is tested and does not directly modify your source object run against this, HOWEVER, it is better to be safe than sorry in case an unlikely bug happens or you accidentally in a dialog decide to overwrite your object.
- The script works pretty well and is mostly bulletproof, but I haven’t *exhaustively* tested it for all wacky permutations. But it makes going from LW to Mega-fiers / Unity a piece of cake and saves alot of tedious steps in the workflow.
- This is designed to work with one layer only – I can’t get LW Modeler’s OBJ Exporter to handle multiple layers. You may wish to collapse your objects to one layer before export or export separately for each layer
- TO BE SAFE, ONLY RUN THIS WITH ONE OBJECT LOADED WITH MORPHS. Otherwise it may crash if you try to export a morph of the non-selected object. You should be sure to only select Morphs in the listbox that apply to the currently open object or else the script might exit inelegantly. If you have multiple morphable objects loaded into LW and select to export a morph that is not in the current object when you run the script, it might crash — there is a limitation(perhaps by design) of LW LScript that gives you ALL loaded morphs (not just the morphs for the current object) and the only way to determine which morphs belong to which object, is to iterate through each point of every vertex map, which obviously slows down the script a great deal, so I opted to leave that safety check out of the script for speed’s sake.
- This script was originally intended for use with Unity 3D and the Mega-Fiers mesh modifier morphing system by West Racing (I highly recommend this excellent product – see the Unity Asset Store for it). However, this is a fairly generic script which could be useful for getting LW Endomorphs into other apps such as Poser or DAZ.
- This ZIP file also contains a sample set of objects to test this script with. It contains:
– TestBox.lwo – the original Lightwave object containing 4 vertex maps (morph maps)
– TestBox.fbx – the same Lightwave object exported as FBX format for ease of import as an Asset into Unity 3D
– Megafier_TestBox_Base.obj – the base morph map of this .lwo exported by this script to be used as the “Base Mapping” in Mega-fiers
– Megafier_TestBox_BallMorph.obj – these are all examples of exported Endomorphs from that .lwo to show that loading these into
– Megafier_TestBox_FaceMorph.obj Megafiers will work. See the documents about morphing at http://www.west-racing.com/megadoc/
– Megafier_TestBox_ThingMorph.obj to see how Megafiers works once you’ve exported your OBJs.
– Megafier_TestBox_TwistMorph.obj
Hi Photon –
I would really love to get this script working, but it always gives me a “Line 219, illegal arithmetic operation on data type” error, even when run on the included demo model.
I’m using Lightwave 11.6 on OSX – any ideas?
Hi Steve,
The Morphs2OBJs script here has only been tested in LW up to version 11.03, but I’ve just downloaded 11.6.1, so I’ll install it and then test the script and upload a fix if I can within a few days once I figure out the issue you are having. I’ll email you with the fix when I’ve sorted it out. I don’t expect it to be a big deal to fix, but I can’t say for sure until I’ve had a close look at it…. 🙂
This plugin is now fixed for Mac users and should work for everyone in LW 11.6.1