Checking exist keyframe in scene


#1

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!


How to check if there is animation on an object?
#2

How about :


for itemKey in obj.position.controller.keys do 
(
 format "Key : %
" itemKey
format "Time : %
" itemKey.Time
)
 

#3

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


#4

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


#5

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

Thansks ! :slight_smile:


#6

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.