Temporarily Deleting Keys

How can I temporarily delete keys of the selected object and then restore them.

Example: You have a check button and when you click the button it deletes the keys of the selected object/s and when you uncheck it, it restores the keys of the selected object/s.

Comments

Comment viewing options

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

Budi G

Thanks again for the help man. This is great information and I appreciate it a lot. I'm going to work with the script you wrote and further develop it. It works great and is exactly what i needed. I was trying to write a similar script and it was not working the way i wanted it to. Its nice to see how you wrote yours and better understand it to see where I was going wrong with writing mine.
Talk to you later.
Thanks
JokerMartini

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Budi G's picture

ops,.. I forget about this

ops,.. I forget about this one ... and I've found copy without "instance". It's very simply :

usersel.transform.controller = (copy P.transform.controller)

Now you do not need "make unique" command ;)

ok, nice to meet you
see you later.

Budi

JokerMartini's picture

Key Hiding

First of all thank you a ton Budi G for helping out and coming up with a solution for this post. I was curious to know how exactly your script is working. If you could explain how its working that would be great. Thanks again for the help. It works great!

I'm going to see if I can get this working for a selection of objects and not just a single selected object.
Thanks

John Martini

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Budi G's picture

ok, you're welcome

ok, you're welcome JokerMartini ...

as we know there position_rotation_scale keys on the controller objects.
I try to copy the controller object that was selected to the other objects, because the results are "instance" controllers so I make unique. if you know to copy controller without "instance" on the first time it would be good without "make unique" command.

and then I think need output in between 2 objects by switcher.

-------------------------------------------------------------
Initially:

userSel = selection[1] --- a single selected object
 
p = point ishidden:true -- create new point

First command: -- switch 1

p.transform.controller = userSel .transform.controller -- copy controller usersel to p ( it's make instance controllers )
 
InstanceMgr.MakeControllersUnique #(userSel ,p) userSel .transform.controller #individual -- make unique 2 instance controllers.
 
 
 
sliderTime = 0f --- move time slider to 0 frame
 
deleteKeys userSel #allKeys -- delete all keys.

The other wish: -- switch 2

userSel.transform.controller = p.transform.controller -- copy controller p to usersel ( it's make instance controllers )
 
InstanceMgr.MakeControllersUnique #(p,userSel) p.transform.controller #individual -- make unique 2 instance controllers.

End operation:
 delete p -- delete point helper.
-------------------------------------------------------------

for the same command I make capsulation function on the start of script, like :

fn switcher_controll A B =
(
    A.transform.controller = B.transform.controller
 
    InstanceMgr.MakeControllersUnique #(B,A) B.transform.controller #individual
 
)

So we just change the A or B by any object we want.

If you need link object command just put in switch 1 and unlink to switch 2 .. or vice versa.

Yup, a sample script can changed to many object selection by looping command, like :

for i=1 to usersel.count do 
switcher_controll usersel[i] p[i] <-- or vice versa

I hope it's help you.

Budi

JokerMartini's picture

This is an alternative?

This is an alternative route that I came up with since I couldn't figure out how to store keys.
But for some reason this bugs out when I try to evaluate it. It works sometimes.

userSel = getCurrentSelection()
userSel = userSel[1]
 
if test == 1 then
(
	p = point()
	p.ishidden = true
	p.parent = userSel
	for k in userSel.position.x_position.controller.keys do appendKey p.position.x_position.controller.keys k
	for k in userSel.position.y_position.controller.keys do appendKey p.position.y_position.controller.keys k
	for k in userSel.position.z_position.controller.keys do appendKey p.position.z_position.controller.keys k
	for k in userSel.rotation.x_rotation.controller.keys do appendKey p.rotation.x_rotation.controller.keys k
	for k in userSel.rotation.y_rotation.controller.keys do appendKey p.rotation.y_rotation.controller.keys k
	for k in userSel.rotation.z_rotation.controller.keys do appendKey p.rotation.z_rotation.controller.keys k
 
	sliderTime = 0f
	deleteKeys usersel #allKeys
)
else if test == 5 then
(
	p = userSel.children[1]
	for k in p.position.x_position.controller.keys do appendKey userSel.position.x_position.controller.keys k
	for k in p.position.y_position.controller.keys do appendKey userSel.position.y_position.controller.keys k
	for k in p.position.z_position.controller.keys do appendKey userSel.position.z_position.controller.keys k
	for k in p.rotation.x_rotation.controller.keys do appendKey userSel.rotation.x_rotation.controller.keys k
	for k in p.rotation.y_rotation.controller.keys do appendKey userSel.rotation.y_rotation.controller.keys k
	for k in p.rotation.z_rotation.controller.keys do appendKey userSel.rotation.z_rotation.controller.keys k
	delete p
)

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Budi G's picture

I think, you can use

I think, you can use animation layer. :)

But if you do not use animation layer, see my attachments bellow.

in this case i have used object controllers method.

AttachmentSize
hidden_keys01.ms 1.54 KB

Comment viewing options

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