View Full Version : Setting xform is not holding

04 April 2006, 01:09 AM
I am sure this question has been asked before, but I couldn't find anything. I am not new to programming or 3D scripting, but am very new to maya and mel. so here it goes...

I have got my view camera's position and rotation and I am doing some calculations and moving it to a new position and rotation. The problem is that as soon as I move that view in my viewport it snaps back to the original position. It seems as though a keyframe is not being made?

to get the current view camera I am using :string $editor=modelPanel ("-q", "-me", `getPanel -wf`);
string $currentCam=modelPanel ("-q", "-cam", `getPanel -wf`);
to get the camera pos and rot:float $myVec[] = `xform -q -t $currentCam`;// pos
$myVec = `xform -q -ro $currentCam`;// rot
to set the viewCamera pos and rot:xform -t -4.901924019 6.973366794 -5.247494302 $currentCam;
I even tried this to set the keyframe:setKeyframe -t 4 -v 1.5 ($currentCam+".translateX");
setKeyframe -t 4 -v 2.5 ($currentCam+".translatey");
setKeyframe -t 4 -v 3.5 ($currentCam+".translatez");
Can someone point me in the right direction please....

Chris Reid

maya 7.0

04 April 2006, 01:40 AM
Found this in the docs... looks like it worked on my last few test.
// Start remembering attributes that have changed
autoKeyframe -state on;

// For all attributes that have changed since the
// last "autoKeyframe -state on", set a keyframe

// Stop remembering attributes that have changed.
// Note that Subsequent "autoKeyframe" commands
// (with no flags) will have no effect until an
// "autoKeyframe-state on" command is executed.
autoKeyframe-state off;

// When auto-keying, key all character attributes, not just
// those that have changed.
autoKeyframe-characterOption all;

04 April 2006, 11:29 AM
What is your problem exactly? I didn't understand...Sorry...


04 April 2006, 02:03 PM
>>What is your problem exactly? I didn't understand...Sorry...

yeah, my Mel lingo is not up to par.

Basically I would set the position of the camera, but it wouldn't hold the position. As soon as I clicked in the view and panned or rotated etc.. it would pop back to the old position. Seemed like it wasn't setting the keyframe... well... that was it.

All fixed now... thanks.

Chris Reid

04 April 2006, 02:09 PM
ok dude. Take Care.


CGTalk Moderation
04 April 2006, 02:09 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.