Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blender 4 Fixes #97

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions anim_offset/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def magnet(context, obj, fcurve):

k.co_ui.y = k.co_ui.y + (delta_y * factor)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()

return

Expand All @@ -147,7 +148,10 @@ def get_delta(context, obj, fcurve):
target = prop[fcurve.array_index]
except TypeError:
target = prop
return target - curve_value
try:
return target - curve_value
except TypeError:
return 0
else:
return 0

Expand Down
16 changes: 12 additions & 4 deletions curve_tools/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def set_shear_values(left, right):
# keys[2].co.y = 1
# keys[3].co.x = right_blend
# keys[3].co.y = 0
curve.update()
curve.keyframe_points.sort()
curve.keyframe_points.handles_recalc()


def shear(self, direction):
Expand All @@ -97,7 +98,8 @@ def shear(self, direction):

factor = utils.clamp(self.factor, self.min_value, self.max_value)
shear_curve.keyframe_points[direction].co_ui.y = local_y
shear_curve.update()
shear_curve.keyframe_points.sort()
shear_curve.keyframe_points.handles_recalc()

for index in self.selected_keys:
k = self.fcurve.keyframe_points[index]
Expand Down Expand Up @@ -169,7 +171,8 @@ def to_execute(self, context, function, *args):

function(*args)

self.fcurve.update()
self.fcurve.keyframe_points.sort()
self.fcurve.keyframe_points.handles_recalc()

return {'FINISHED'}

Expand Down Expand Up @@ -214,7 +217,8 @@ def reset_original():
k.handle_left.y = handles.get('l')
k.handle_right.y = handles.get('r')

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()

return

Expand Down Expand Up @@ -253,6 +257,10 @@ def get_globals(context):

global_curve_data = {}

# Allows selection in dope sheet to work in graph editor
for fcurve_index, fcurve in fcurves.items():
fcurve.select = True

for fcurve_index, fcurve in fcurves.items():
if not utils.curve.valid_fcurve(context, obj, fcurve, action_type=action_type):
continue
Expand Down
18 changes: 6 additions & 12 deletions curve_tools/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,10 @@ class ANIMAIDE_PT_frame_bookmarks_3d(Panel, ANIMAIDE_PT_frame_bookmarks):
bl_parent_id = 'ANIMAIDE_PT_curve_tools_3d'


# class ANIMAIDE_PT_frame_bookmarks_de(Panel, ANIMAIDE_PT_frame_bookmarks):
# bl_idname = 'ANIMAIDE_PT_frame_bookmarks_de'
# bl_space_type = 'DOPESHEET_EDITOR'
# # bl_parent_id = 'ANIMAIDE_PT_curve_tools_de'


# class ANIMAIDE_PT_frame_bookmarks_3d(Panel, ANIMAIDE_PT_frame_bookmarks):
# bl_idname = 'ANIMAIDE_PT_frame_bookmarks_3d'
# bl_space_type = 'VIEW_3D'
# bl_parent_id = 'ANIMAIDE_PT_curve_tools_3d'
class ANIMAIDE_PT_frame_bookmarks_de(Panel, ANIMAIDE_PT_frame_bookmarks):
bl_idname = 'ANIMAIDE_PT_frame_bookmarks_de'
bl_space_type = 'DOPESHEET_EDITOR'
bl_parent_id = 'ANIMAIDE_PT_curve_tools_de'


class ANIMAIDE_MT_curve_tools(Menu):
Expand Down Expand Up @@ -465,11 +459,11 @@ def draw_bookmarks(self, context):

classes = (
ANIMAIDE_PT_curve_tools_ge,
# ANIMAIDE_PT_curve_tools_de,
ANIMAIDE_PT_curve_tools_de,
ANIMAIDE_PT_curve_tools_3d,
ANIMAIDE_UL_frame_bookmarks,
ANIMAIDE_PT_frame_bookmarks_ge,
# ANIMAIDE_PT_frame_bookmarks_de,
ANIMAIDE_PT_frame_bookmarks_de,
ANIMAIDE_PT_frame_bookmarks_3d,
ANIMAIDE_MT_pie_curve_tools_a,
ANIMAIDE_MT_pie_curve_tools_b,
Expand Down
24 changes: 16 additions & 8 deletions key_manager/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def set_type(context, key_type):
else:
add_key_type(context, fcurve, key_type)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def add_key_type(context, fcurve, key_type):
Expand All @@ -89,7 +90,8 @@ def add_key_type(context, fcurve, key_type):
key.interpolation = interp
key.type = key_type

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def change_frame(context, amount, direction='RIGHT'):
Expand Down Expand Up @@ -145,7 +147,8 @@ def can_move(l_limit, r_limit, most_l, most_r):
for index in selected_keys:
key = fcurve.keyframe_points[index]
key.co.x += amount
fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()
frames = 0

elif not some_selected_key:
Expand All @@ -156,7 +159,8 @@ def can_move(l_limit, r_limit, most_l, most_r):
key = fcurve.keyframe_points[index]
key.co.x += amount
frames = amount
fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()

if lonely_cursor and not some_selected_key:
if direction == 'LEFT' and left_limit:
Expand Down Expand Up @@ -231,7 +235,8 @@ def displace_keys(anchor_frame):
return
displace_keys(current_frame)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def set_handles_type(context, act_on='SELECTION', handle_type='NONE', check_ui=True):
Expand Down Expand Up @@ -283,7 +288,8 @@ def set_handles_type(context, act_on='SELECTION', handle_type='NONE', check_ui=T
handle_type_asignment(last_key, **kwargs)
handle_type_asignment(first_key, **kwargs)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def select_key_parts(context, left=False, right=False, point=False):
Expand Down Expand Up @@ -369,7 +375,8 @@ def set_handles_interp(context, act_on='SELECTION', interp='NONE', easing='NONE'
for index, key in fcurve.keyframe_points.items():
assign_interp(key, interp, easing, strength)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def handle_buttons(context, key, left, point, right):
Expand Down Expand Up @@ -435,7 +442,8 @@ def delete_by_type(context, key_type):
frame=key.co_ui.x,
group=fcurve.group.name)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()

# utils.key.select_by_type(fcurve, kind)
# if context.area.type == 'GRAPH_EDITOR':
Expand Down
19 changes: 13 additions & 6 deletions utils/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def new(action_group_name, keys_to_add, key_interp='AUTO_CLAMPED', color=(1, 1,

blends_curve.lock = True
blends_curve.select = True
blends_curve.update() # check if I need to add irmita's key function
blends_curve.keyframe_points.sort()
blends_curve.keyframe_points.handles_recalc()
# utils.key.update_keyframe_points(context)

return blends_curve
Expand Down Expand Up @@ -213,7 +214,9 @@ def duplicate(fcurve, selected_keys=True, before='NONE', after='NONE', lock=Fals

add_cycle(dup, before=before, after=after)

dup.update()
dup.keyframe_points.sort()
dup.keyframe_points.handles_recalc()


return dup

Expand Down Expand Up @@ -247,7 +250,8 @@ def duplicate_from_data(fcurves, global_fcurve, new_data_path, before='NONE', af

add_cycle(dup, before=before, after=after)

dup.update()
dup.keyframe_points.sort()
dup.keyframe_points.handles_recalc()

return dup

Expand All @@ -267,7 +271,8 @@ def add_clone(objects, cycle_before='NONE', cycle_after="NONE", selected_keys=Fa

duplicate(fcurve, selected_keys=selected_keys, before=cycle_before, after=cycle_after)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def remove_clone(objects):
Expand Down Expand Up @@ -308,11 +313,13 @@ def move_clone(objects):
for key in clone.keyframe_points:
key.co.x = key.co.x + (amount * move_factor)

clone.update()
clone.keyframe_points.sort()
clone.keyframe_points.handles_recalc()

utils.key.attach_selection_to_fcurve(fcurve, clone, is_gradual=False)

fcurve.update()
fcurve.keyframe_points.sort()
fcurve.keyframe_points.handles_recalc()


def valid_anim(obj):
Expand Down
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def add_message(message):
def draw_text_callback(info):
font_id = 0
blf.position(font_id, 5, 80, 0)
blf.size(font_id, 30, 72)
blf.size(font_id, 30)
blf.color(font_id, 1, 1, 1, .5)
blf.draw(font_id, info)

Expand Down
6 changes: 3 additions & 3 deletions utils/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,12 @@ def update_keyframe_points(context):
if area != 'GRAPH_EDITOR':
context.area.type = 'GRAPH_EDITOR'

snap = context.space_data.auto_snap
context.space_data.auto_snap = 'NONE'
snap = context.scene.tool_settings.use_snap_anim
context.scene.tool_settings.use_snap_anim = False

bpy.ops.transform.transform()

context.space_data.auto_snap = snap
context.scene.tool_settings.use_snap_anim = snap
if area != 'GRAPH_EDITOR':
context.area.type = area

Expand Down