ScriptSpot

Forum topic · General Scripting

Explore a morpher

By mcoutinh · 2016-08-29

Description

Hi all,

i would like to know how can i do to explore a morpher and extract the name and value of each channels pls ?

For now i have that: (but it crash)


for obj in $ do
(
    if (isProperty obj #morpher) == true do
    (
        for chan in obj.morpher do
        (
             /* print name and value of chan */
        )
    )
)

Any help pls ?

Comments (1)

barigazy · 2016-09-01

In code below U have two fn's. One for finding modifieres by any class and second for printing Morpher channels data.

fn findModifier obj class: = if obj.modifiers.count > 0 do
(
BooleanClass = off ; modifier = undefined
for e in obj.modifiers while not BooleanClass where (BooleanClass = isKindOf e class) do modifier = e
modifier
)
fn printMorpherData = if selection.count > 0 do
(
for node in selection where canconvertto node Editable_mesh and node.modifiers.count > 0 do
(
if (modifier = findModifier node class:Morpher) != undefined do
(
number = for i = 1 to 100 where wm3_mc_hasdata modifier i collect
(
datapair name:(wm3_mc_getname modifier i) value:(wm3_mc_getvalue modifier i)
)
if number.count == 0 then format "Object: % --> No channels data\n" node.name else
(
format "Object: % --> Morpher channels data:\n" node.name
for c in number do
(
format "\tChannel Name: % | Channel Value: %\n" c.name c.value
)
)
)
)
)
printMorpherData()