PDA

View Full Version : Getting Bones in a Skin Modifier


Monopoli
02-15-2007, 09:42 PM
Hi all!

Do you know if there is a way to get all the bones inserted in a Skin Modifier?
Thank you :-)

Bye!
Alex

HalfVector
02-15-2007, 10:10 PM
Hi.

Take a look at the skinOps interface.

Anyway, should be something like this:

numBones = skinOps.getNumberBones skinMod

for b = 1 to numBones do
(
local boneName = skinOps.getBoneName skinMod b 1
local boneNode = getNodeByName boneName
)

skinMod is a reference to the skin modifier.

Monopoli
02-15-2007, 10:16 PM
Thank you HalfVector :) You are very kind answering my noob questions :)

I looked that interface, but I hoped into a more nice solution, because getbonename requests the mesh selected and the modifier panel open. Is there a way to get these prerequisites by script?

Thak you again!

Bye,
alex

HalfVector
02-15-2007, 10:37 PM
This is a snip of code from my Doom3's MD5 format exporter:

fn getSkinBones theNode = (

-- Bones list
local boneList = #()

-- Set modify mode
max modify mode

-- Reference to the skin modifier for this node
local skinMod = theNode.modifiers[#Skin]

-- Look if the skin modifier exists
if skinMod == undefined do (
messageBox ("ERROR!: no skin modifier for " + theNode.name) title: ".::MD5Exporter::."
return undefined
)

-- Set skin as current modifier
modPanel.setCurrentObject skinMod

-- Number of bones for the current node
local numBones = skinOps.getNumberBones skinMod

-- Loop through skin bones
for b = 1 to numBones do (
local boneName = skinOps.getBoneName skinMod b 1
local boneNode = getNodeByName boneName

-- Append the bone to the list
append boneList boneNode
)

return boneList
)

luigi
02-16-2007, 12:17 PM
just got a look on Paul Hormis script site

http://www.hyperent.com/


Create_Selection_Set_From_Bones.ms

this scripts does the job quite nicely :)

CGTalk Moderation
02-16-2007, 12:17 PM
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.