#NEWLINE# def __assignToLamp( self , lampObj , action_name = None ) : #NEWLINE# #INDENT# mmdLamp = mmd_lamp . MMDLamp . convertToMMDLamp ( lampObj ) . object ( ) #NEWLINE# mmdLamp . scale = ( mathutils . Vector ( ( self . __scale , self . __scale , self . __scale ) ) * 4.0 ) #NEWLINE# for obj in mmdLamp . children : #NEWLINE# #INDENT# if ( obj . type == 'LAMP' ) : #NEWLINE# #INDENT# lamp = obj #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( obj . type == 'ARMATURE' ) : #NEWLINE# #INDENT# armature = obj #NEWLINE# bone = armature . pose . bones [ 0 ] #NEWLINE# bone_data_path = ( ( 'pose.bones["' + bone . name ) + '"].location' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( action_name is not None ) : #NEWLINE# #INDENT# act = bpy . data . actions . new ( name = ( action_name + '_color' ) ) #NEWLINE# a = lamp . data . animation_data_create ( ) #NEWLINE# a . action = act #NEWLINE# act = bpy . data . actions . new ( name = ( action_name + '_location' ) ) #NEWLINE# a = armature . animation_data_create ( ) #NEWLINE# a . action = act #NEWLINE# #UNINDENT# lampAnim = self . __vmdFile . lampAnimation #NEWLINE# for keyFrame in lampAnim : #NEWLINE# #INDENT# lamp . data . color = mathutils . Vector ( obj . color ) #NEWLINE# bone . location = ( - mathutils . Vector ( ( keyFrame . direction [ 0 ] , keyFrame . direction [ 2 ] , keyFrame . direction [ 1 ] ) ) ) #NEWLINE# lamp . data . keyframe_insert ( data_path = 'color' , frame = ( keyFrame . frame_number + self . __frame_margin ) ) #NEWLINE# bone . keyframe_insert ( data_path = 'location' , frame = ( keyFrame . frame_number + self . __frame_margin ) ) #NEWLINE# #UNINDENT# for fcurve in armature . animation_data . action . fcurves : #NEWLINE# #INDENT# if ( fcurve . data_path == bone_data_path ) : #NEWLINE# #INDENT# self . detectLampChange ( fcurve )