delete old distance evaluation code
This commit is contained in:
		
							parent
							
								
									037f568a4b
								
							
						
					
					
						commit
						b05b0e2b6c
					
				@ -73,7 +73,7 @@ def anim_path_from_translate():
 | 
			
		||||
    # CHANGE - retiré le int de la frame
 | 
			
		||||
    # keyframes = [int(k.co[0]) for fcu in act.fcurves for k in fcu.keyframe_points]
 | 
			
		||||
    
 | 
			
		||||
    ## calculate offset from bones by evaluating distance at extreme distance
 | 
			
		||||
    ## calculate offset from bones by evaluating distance at extremes
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    # fcurve parsing:
 | 
			
		||||
@ -184,55 +184,6 @@ def anim_path_from_translate():
 | 
			
		||||
 | 
			
		||||
    print('end of set_follow_path_anim')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    """ ### old method using directly one axis
 | 
			
		||||
    axis = {'X':0, 'Y':1, 'Z':2}
 | 
			
		||||
    ## calculate offset from bones
 | 
			
		||||
    loc_fcu = None
 | 
			
		||||
    for fcu in act.fcurves:
 | 
			
		||||
        if fcu.data_path.split('"')[1] != b.bone.name:
 | 
			
		||||
            continue
 | 
			
		||||
        if fcu.data_path.split('.')[-1] == 'location' and fcu.array_index == axis['Y']:
 | 
			
		||||
            loc_fcu = fcu
 | 
			
		||||
    if not loc_fcu:
 | 
			
		||||
        return ('ERROR', 'Current bone, location.y animation not found')
 | 
			
		||||
 | 
			
		||||
    start = None
 | 
			
		||||
    end = None
 | 
			
		||||
 | 
			
		||||
    ## based on extreme
 | 
			
		||||
    for k in loc_fcu.keyframe_points:
 | 
			
		||||
        # if k.select_control_point: # based on selection
 | 
			
		||||
        if k.type == 'EXTREME': # using extreme keys.
 | 
			
		||||
            if start is None:
 | 
			
		||||
                start = k
 | 
			
		||||
            end = k
 | 
			
		||||
        else:
 | 
			
		||||
            if start is not None:
 | 
			
		||||
                ## means back to other frame type after passed breakdown we stop
 | 
			
		||||
                break
 | 
			
		||||
    
 | 
			
		||||
    if start and end:
 | 
			
		||||
        print(f'Offset from key range. start: {start.co.x} - end: {end.co.x}')
 | 
			
		||||
 | 
			
		||||
    if not start:
 | 
			
		||||
        return ('ERROR', f"No extreme marked frame was found on bone {b.bone.name}.{['x','y','z'][loc_fcu.array_index]}")
 | 
			
		||||
    if start == end:
 | 
			
		||||
       return ('ERROR', f'Only one key detected as extreme (at frame {start.co.x}) !\nNeed at least two chained marked keys')
 | 
			
		||||
    
 | 
			
		||||
    start_frame = start.co.x
 | 
			
		||||
    start_val = start.co.y
 | 
			
		||||
 | 
			
		||||
    end_frame = end.co.x
 | 
			
		||||
    end_val = end.co.y
 | 
			
		||||
 | 
			
		||||
    move_frame = end_frame - start_frame
 | 
			
		||||
 | 
			
		||||
    # Y positive value (forward) -> 
 | 
			
		||||
    move_val = abs(start_val - end_val)
 | 
			
		||||
    """
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
class UAC_OT_animate_path(bpy.types.Operator):
 | 
			
		||||
    bl_idname = "anim.animate_path"
 | 
			
		||||
    bl_label = "Animate Path"
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@ bl_info = {
 | 
			
		||||
    "name": "Unfold Anim Cycle",
 | 
			
		||||
    "description": "Anim tools to develop walk/run cycles along a curve",
 | 
			
		||||
    "author": "Samuel Bernou",
 | 
			
		||||
    "version": (0, 4, 2),
 | 
			
		||||
    "version": (0, 4, 3),
 | 
			
		||||
    "blender": (3, 0, 0),
 | 
			
		||||
    "location": "View3D",
 | 
			
		||||
    "warning": "WIP",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user