PDA

View Full Version : Rigging Un-weighted Bones Equally to an Attatched Object?


Opifex
04-04-2012, 02:05 AM
Hey, I'm completely new to maxscript and pretty much new to scripting completely.

Need to know how I can weight, all unweighted bones from a name specific list, to an object attatched to another object.
---------------------------------------------------------------------------
Legend so far:
(A = selected objects with skin modifier at top of stack)
(B = new mesh object)
(C = custom named Edit Poly modifier)
(D = copy of new mesh object)
---------------------------------------------------------------------------
Script Funtionality so far:
1. Creates (B) with 1 face, 3 sides, 3 verts, where all the verts are placed at the same exact place.
2. Then adds (C) to (A) under the Skin modifier
3. Then creates (D) and centers it to (A)'s center
4. Then within (C) attaches (D), and deletes (B)
5. Then Selects all (A) if they have (C).
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Legend needed:
(E = un-weighted bones out of 26 specifically named bones)
(F = D within C of A)
---------------------------------------------------------------------------
Script Funtionality needed:
1. Find and Select (E) then Rigg (F) with (E) using the existing Skin[1] modifier, distributing the skin weights evenly and fully weighting (F)
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Script so far: (Please feel free to modify it and please, please help me finish this)

fn addfixes =
(
max create mode
b = mesh vertices:#([0,0,0],[0,0,0],[0,0,0]) tverts:#([0,0,0],[0,0,0],[0,0,0]) faces:#([1,2,3])
b.name = "unriggedfixtri"
unriggedfixtri = b.mesh
buildTVFaces unriggedfixtri
for i = 1 to unriggedfixtri.numfaces do(setTVFace unriggedfixtri i (getFace unriggedfixtri i))
for a in selection do
(
if (ClassOf a.modifiers[1]) != Skin then
(
messageBox "A Selected Mesh Prim Is Not Rigged Properly And It Wont Be Fixed"
)
else
(
parent = a.parent
if (parent != undefined) then (a.parent = undefined)
c = Edit_Poly ()
c.name = "Un-Rigged Bone Fix"
addModifier a c before:1
if (parent != undefined) then (a.parent = parent)
)
)
)

fn selectfixed =
(
messageBox "Your Fixed Rigged Mesh Prim(s) Will Now Be Selected"
for fixedones in objects do
(
for x = 1 to fixedones.modifiers.count do
(
if fixedones.modifiers[x].name == "Un-Rigged Bone Fix" do
(
selectmore fixedones
)
)
)
)
-- End Of Funtions
(
on fixbones1 pressed do
(
undo "Undo Fix Selected" on
(
g = $
if g == undefined then
(
messageBox "Select All of Your Rigged Mesh Prim(s)!"
)
else
(
addfixes()
disablesceneredraw()
theObj = $unriggedfixtri
copyObj = undefined
for obj in objects do
(
for x = 1 to obj.modifiers.count do
(
if (classof obj.modifiers[x]) == Edit_Poly do
(
if obj.modifiers[x].name == "Un-Rigged Bone Fix" do
(
copyObj = copy theObj
copyObj.center = obj.center
max modify mode
select obj
modPanel.setCurrentObject obj.modifiers[#Un_Rigged_Bone_Fix]
obj.modifiers[#Un_Rigged_Bone_Fix].attach copyObj
)
)
)
)
enablesceneredraw()
delete theObj
selectfixed()
)
)
)
)

---------------------------------------------------------------------------
Edited:
Updated the script to work with multiple selected objects.

Still cant figure out how to rigg the newly attatched object with the unweighted bones from a named list, with even skin weights that total 1 (attatched object fully weighted) :banghead:

CGTalk Moderation
04-04-2012, 02:05 AM
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.