PDA

View Full Version : how to set keyframe for an object with morpher


abyjoe
03-26-2008, 01:07 AM
ex:
I have a dummy with a keyframe on frame 10 and
I have an object with a morpher modifier...

I want to check what frame has the dummy been keyed on and then set up a keyframe for the object on the same frame and set its morph channel value to 100 at the frame.

how can i do this ?

3rd Dimentia
03-26-2008, 03:38 AM
morphMod = $geosphere01.modifiers["morpher"] --assigns a variable to the morpher modifier
pointObject = $point01 --this is your object that has the key that you grab the time from.

slidertime = pointObject.position.controller.keys[1].time -- changes the slider time to match the first position key on the point object

with animate on -- things done in here will be animated
(
WM3_MC_SetValue morphMod 1 100.0 --changes the value of the first morph channel to 100%
)

abyjoe
03-26-2008, 09:59 PM
thanks a lot... :)

abyjoe
03-29-2008, 01:04 AM
just before i set the morpher values I am adding a morpher modifer to the selected object....

i then use this code >>

WM3_MC_BuildFromNode morphmod 1 thisTarget

<< to assign a target to that modifier. it seems that the target it being assigned but its not loaded in the modifier channel. If i do a reload target manually it will show me the target

I have tried to rebuild the target using WM3_MC_Rebuild but still not loaded and shows empty in the channel.

I tried using WM3_MC_GetTarget morphmod 1 to print the target names to check if they were assigned and it returns the names fine.

anyone ???

Edit:
the target values are collected in an array. and then passed to the WM3_MC_BuildFromNode

3rd Dimentia
03-29-2008, 05:28 AM
I'm not really sure what is happening for oyu, but this is the script that I sent thru before, but with the top section that set up the scene as well. like making all the objects, assigning modifiers and targets... this might help you.

clearlistener()
/*
This just sets up the scene
*/
point1 = point()
slidertime = 10
with animate on
(
point1.pos=[100,0,0]
)
slidertime = 0
geo1 = geosphere()
geo2 = geosphere pos:[-100,0,0]
noiseMod = NoiseModifier strength:[40,40,40] seed:3 scale:50 fractal:true
addmodifier geo2 noisemod
MorphMod = morpher()
addmodifier geo1 MorphMod
Shpere1Morpher = geo1.modifiers[1]
WM3_MC_BuildFromNode Shpere1Morpher 1 geo2


/*
This is where the useful stuff happens
*/
morphMod = $geosphere01.modifiers["morpher"]
pointObject = $point01
slidertime = pointObject.position.controller.keys[2].time -- changes the slider time to match the second position key on the point object
with animate on
(
WM3_MC_SetValue morphMod 1 100.0 --sets the key of the first morph channel to 100%
)

abyjoe
03-29-2008, 06:06 PM
thanks dude. i will give this a try and try to find out whats happening with mine... will let u know how it goes

abyjoe
03-29-2008, 07:04 PM
ur script works fine. thats what i want to do. the only difference is that my objects and targets are stored in an array... strange issue. it does set the targets but does not show it in the channel info unless i manually do a reload target. it also sets all the keyframes and morpher channel values fine... just the target is causing problem. sad :(

3rd Dimentia
03-30-2008, 02:01 AM
That does indeed sounds strange. I've modified my script to use arrays to store the targets and the object before it does any of the assignments. See if this might help.

clearlistener()
/*
This just sets up the scene
*/

point1 = point()

slidertime = 10

with animate on
(
point1.pos=[100,0,0]
)

slidertime = 0

geo1 = geosphere readius:25

ObjArray = #()
append ObjArray geo1

TargetArray = #()

for i = 1 to 5 do
(
geo = geosphere pos:[(-50*i),0,0] radius:25
noisemod = NoiseModifier strength:[20,20,20] seed:(random 1 1000) scale:50 fractal:true
addmodifier geo noisemod
append TargetArray geo
)

MorphMod = morpher()
addmodifier ObjArray[1] MorphMod

Sphere1Morpher = ObjArray[1].modifiers[1]

for i = 1 to TargetArray.count do
(
WM3_MC_BuildFromNode Sphere1Morpher i TargetArray[i]
)



/*
This is where the useful stuff happens
*/

morphMod = ObjArray[1].modifiers["morpher"]
pointObject = $point01

slidertime = pointObject.position.controller.keys[2].time -- changes the slider time to match the second position key on the point object

with animate on
(
WM3_MC_SetValue morphMod 1 100.0 --sets the key of the first morph channel to 100%
)

abyjoe
03-30-2008, 02:59 AM
i have set the auto reload targets to true before setting the targets and the channel shows me the tragets now .... altough right after setting the target in the script if i check whether the channel is valid or not, it returns false...

so i assume after the script if finished and as soon as i click on the viewport it refreshes all the channel values and reloads them... this kind of solvs my problem but i still wonder why is the channel disabled in the first place... i will try to post a stripped down version of the script tomorrow and let u have a go with it. thanks for ur help

CGTalk Moderation
03-30-2008, 02:59 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.