...

View Full Version : Resolved Loopy problem - variable ignoring block



chrisglasier
01-26-2011, 08:22 AM
def Skel_poser.run_frames(time,lframe)
keyframes = {}
model = Sketchup.active_model
d = model.attribute_dictionaries['kframes']
d.each_pair do | key,value |
a = 1
value.each do| v |
if v.nil?
v = [[1,0,0],0]
end
v << time * a
a += 1
end
keyframes[key] = value
end
return keyframes
end

This code runs fine if there are no empty elements in the value array. If there are puts v shows the change from nil to the new array but value shows the original nil.

What have I done wrongly ... please!

chrisglasier
01-27-2011, 03:25 AM
def Skel_poser.run_frames(time,lframe)
keyframes = {}
model = Sketchup.active_model
d = model.attribute_dictionaries['kframes']
d.each_pair do | key,value |
a = 1
new_value = []
value.each do| v |
if !v
v = [[1,0,0],0]
end
v << time * a
a += 1
new_value << v
end
keyframes[key] = new_value
end
#p keyframes
return keyframes
end



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum