View Full Version : Acquiring Bone Weight Map Name

07-11-2012, 07:49 AM
How do I get the name of the bone weight map looping through selected bones in LScript?


for (i = 1; i <= selection.size(); i++)
sceneItem = selection[i];

name[i] = sceneItem.name; //bone name
//boneWeightMapName[i] = ????

In can see the name in the .lws file but I need to get hold of it via a script ... or write an external parsing tool. :|

07-11-2012, 10:07 AM
as far as I am aware there isnt a way to query it, unless its an undocumented command somewhere as I was not able to find it in the lscript docs.

07-12-2012, 04:24 AM
Hi, I've tried a little test with the following script and recieved an error stating BoneWeightMapName can only be used when editing bones.

@version 2.2
@name MeshObjectAgent
@script generic
// Create a Mesh Object from first object loaded.
mesh = Mesh() || error("No Object Loaded!");
// Data Members
info("name: ", mesh.name);
info("filename: ", mesh.filename);
// Methods
info("points: ", mesh.pointCount(1));
info("polygons: ", mesh.polygonCount(1));
bone = mesh.bone();
info("Bone name ", bone);
info("bone weight map name: ", BoneWeightMapName(bone.name);
bone = bone.next();

It may be possible to get the info via the SDK which would mean writing a dll specifically to get that info.

Regards, Iain

07-12-2012, 07:44 AM
error stating BoneWeightMapName can only be used when editing bones.

Hmm... let me risk demonstrating my ignorance again... Isnt the BoneWieghtMapName only for assigning a nmed weight to the currently selected bone?

07-12-2012, 08:57 AM
RH I believe you are correct, as that is what I have found in the docs. It only lets you assign the weightmap.

07-14-2012, 06:48 AM
Okay, I've written an extension for Lscript that gets the weightmap name for the bone, it's 64 bit so if you want 32 bit let me know.

There are four files, AquireGlobal.dll, BoneInfo.dll, BoneInfo.ls and generic.ls. You need to keep them all the same directory. Aquireglobal.dll is loaded into layout the same way as any other plugin, it has no interface. The BoneInfo.dll is loaded by the call in BoneInfo.ls, you don't run or load either of these.

The generic.ls script is my general test script and has the debug set so you can see how it calls and returns the values. Line 1 of the script creates the link to the library and line 9 creates the variable to be able to call the functions. There is only one function in the dll and it requires the letter "m" to be used, it's just the way it's coded, line 24 show haw to call the function.

The bone id is passed to the function in the dll which is what the SDK uses.

I've only done a test on the COD rig that comes with the contents and I've managed to get it to handle bones with and without weight maps. I've also only tested this on 9.6



12-07-2012, 04:49 PM
iain_r can you also make a 32bit version please? Some of my low-poly game rig plugins are only 32bit so it helps the workflow not to keep flipping back and forth between 64 & 32bit. I wish everything was 64 bit but alas it is not so if it's not too much trouble to recompile, that would be great. thanks!

12-08-2012, 02:07 PM
Hi Sami, let me have a look and see what I can come up with.


12-08-2012, 08:24 PM
thanks! :)

12-11-2012, 03:16 PM
Hi Sami,

Attached should be the 32 bit version of the BoneInfo files. One thing to watch out for if you have 32 bit and 64 bit installed on the same machine. The registry entry for HKEY_CURRENT_USER/Software/Newtek/Lscript/LibraryPath only holds one entry, make sure it points to the correct location for the version you are running on you will get an error returned about being unable to load oaBoneInfo as it cannot locate the correct version of the dll file. The same lscripts that I used to test the dll will work with this version as with the 64 bit zip file.



12-11-2012, 10:15 PM
That's awesome! Thanks - I'll check it out right now. :)