View Single Post
Old 01-26-2011, 08:22 AM   PM User | #1
chrisglasier
New Coder

 
Join Date: Dec 2009
Posts: 70
Thanks: 4
Thanked 0 Times in 0 Posts
chrisglasier is an unknown quantity at this point
Loopy problem - variable ignoring block

Code:
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!
__________________
glasier.hk

Last edited by chrisglasier; 01-27-2011 at 03:27 AM.. Reason: Resolved
chrisglasier is offline   Reply With Quote