Explore a morpher

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

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() 

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.