macroScript SkinWrapToInstance category:"RobG3D Scripts" ( --if there is a biped, we need to put it in figure mode, if not, it is a custom rig and we don't bipArr = $Bip* if (classOf bipArr[1] == Biped_Object) then bipArr[1].controller.figuremode = true selArr = selection as array for i in 1 to selection.count do ( select selArr[i] cnt = 0 if (($.modifiers.count == 0) or ($.modifiers[1].name != "Skin Wrap")) then (messageBox "Skin Wrap modifier must be at top of stack") else ( --we need to make sure a mesh target exists if $.modifiers[#Skin_Wrap].meshList[1] != undefined then ( --get the name of the mesh we are wrapped to targetObj = $.modifiers[#Skin_Wrap].meshList[1] --we also need to make sure the target has a skin assigned if targetObj.modifiers[#Skin] != undefined then ( $.modifiers[#Skin_Wrap].meshDeformOps.convertToSkin off --convert to skin skinOps.SaveEnvelope $.modifiers[#Skin] "C:\\tempScriptEnv.env" --Save out the skin weights deleteModifier $ 1 --delete the top modifier of the selection skinInst = targetObj.modifiers[#Skin] --copy the skin modifier from the target object addModifier $ (skinInst) --pastes instance of skin modifier --change settings to turn on verts and turn off envelopes, adjust however you like $.modifiers[#Skin].filter_vertices = on $.modifiers[#Skin].filter_envelopes = off $.modifiers[#Skin].filter_cross_sections = off $.modifiers[#Skin].showNoEnvelopes = on $.modifiers[#Skin].bone_limit = 4 $.modifiers[#Skin].clearZeroLimit = 0.02 --check if the weight tool is open, if not, open it skinToolBool = skinOps.isWeightToolOpen $.modifiers[#Skin] if ( skinToolBool == 0) then ( skinOps.weightTool $.modifiers[#Skin] ) --load up skin weights, and delete original file skinOps.LoadEnvelope $.modifiers[#Skin] "C:\\tempScriptEnv.env" cnt += 1 ) else messageBox "target mesh needs a skin modifier" ) else messageBox "No target mesh assigned" ) ) --Assuming we didn't fail to convert any skin wraps, we load the envelopes if (cnt == selArr.count) then ( skinOps.LoadEnvelope $.modifiers[#Skin] ) )