Save Vertices on Bone Information

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
question

I was wondering if someone could code me a maxscript or point me in the correct direction. I want to save vertices on bones in a txt file in this format:

Code:
*SKIN_VERTEX_DATA 850 { *VERTEX 0 1 { *BONE "Bone03" 1.0000000 } *VERTEX 1 2 { *BONE "Bone03" 1.0000000 *BONE "Bone02" 0.0000000 }


It would be greatly appreciated.

Last edited by ayrphixa : 09 September 2013 at 11:05 PM.
 
Old 03 March 2013   #2
I had a script that did almost exactly this, I edited a little to give that output. You may need to edit it some more since you format was a little ambiguous.

Code:
( --BOOKMARK SOME FUNCTIONS GetVertexWeightCount = skinOps.GetVertexWeightCount GetVertexWeight = skinOps.GetVertexWeight GetVertexWeightBoneID = skinOps.GetVertexWeightBoneID GetBoneName = skinOps.GetBoneName --FUNCTION TO EXPORT SKIN WEIGHTS fn saveSkin obj = ( --SELECT THIS OBJECT objskin = obj.skin modPanel.setCurrentObject objskin --START A STREAM createms = "" as stringstream --GET NUMBER OF VERTS numVerts = getNumVerts obj.mesh format "*SKIN_VERTEX_DATA % {\n" numVerts to:createms --LOOP THROUGH VERTS for v = 1 to numVerts do ( --GET THE WEIGHTS weights = #() _bones = #() for b = 1 to GetVertexWeightCount objskin v do ( append weights (weight = GetVertexWeight objskin v b) append _bones (_bone = "$'" + (GetBoneName objskin (GetVertexWeightBoneID objskin v b) 1) + "'") ) --PRINT THE WEIGHTS numBones = _bones.count format "\t*VERTEX % % {\n" (v-1) numBones to:createms for n = 1 to numBones do ( format "\t\t*BONE \t\"%\" \t%\n" _bones[n] weights[n] to:createms ) format "\t}\n" to:createms ) format "}\n" numVerts to:createms --CREATE A FILE ON DISK AND SAVE IT skinFile = createFile ("$temp\\" + obj.name + ".txt") format "%" (createms as string) to:skinFile close skinFile ) for obj in selection do ( if isProperty obj #skin do saveSkin obj ) )
__________________
Juan Martinez | Blog | Animator
 
Old 03 March 2013   #3
I must thank you deeply, for it is perfect.
 
Old 03 March 2013   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:28 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.