Notifications
Clear all

[Closed] Checking exist keyframe in scene

I want a section script checking exist keyframes in scene or check animation keys in scene

I have a section script, this

for obj in $* do
(
ctrl = obj.position.controller -- just as an example
rot = obj.scale.controller
t = 0f
k = getKeyIndex ctrl t -- returns the index of the key at time t (if there is one)
l = getKeyIndex rot t
   if (k>0) or (l>0) then
   (
	   if queryBox "WARNING: The script found animation key and it willl clear them. Are you sure you want to continue?" beep:true then(
 	actionMan.executeAction 0 "18"
		)

	exit
		)
	
)

but it is not good, it can’t checking if object have keyframe is scale, rotation, color or visibility object

Who can help me ?
Thanks so much!

4 Replies

How about :


for itemKey in obj.position.controller.keys do 
(
 format "Key : %
" itemKey
format "Time : %
" itemKey.Time
)
 
1 Reply
(@baotd86)
Joined: 10 months ago

Posts: 0

Thanks Nysuatro
above script only checking with position, but when i run it to check on two file below then it is not right


clearlistener()
 
(
 local aCurrentSelection = getCurrentSelection()
 for itemNode in aCurrentSelection do
 (
  local aControllers = #itemNode.position.controller,itemNode.rotation.controller,itemNode.scale.controller)
  for itemController in aControllers do
  (
   for itemKey in itemController.keys do
   (
	format "Key : % 
" itemKey
	format "Time : % 
" itemKey.Time
   )
  )
 )
)
 

Thanks so much Nysuatro
Nysuatro, can you help me check again your script with 3 file that i attached in test2.zip

Thansks !