Exemplo n.º 1
0
    def execute(self, context):
        utils.update_keyframe_points(context)

        for fc in context.editable_fcurves:
            if len(fc.keyframe_points) < 2:
                continue

            keys = list()

            for key in fc.keyframe_points:
                if keys:
                    if key.select_control_point:
                        keys = keys[1:]

                        if self.count >= len(keys):
                            for between in keys:
                                between.select_control_point = True
                        else:
                            fac = (len(keys) + 1) / (self.count + 1)
                            count = 1
                            index = round(fac) - 1
                            while index < len(keys):
                                keys[index].select_control_point = True
                                count += 1
                                index = round(fac * count) - 1
                        keys = [key]
                    else:
                        keys.append(key)
                elif key.select_control_point:
                    keys.append(key)

        return {'FINISHED'}
    def invoke(self, context, event):
        utils.update_keyframe_points(context)

        if event.alt:
            self.all_fcurves = True

        return self.execute(context)
Exemplo n.º 3
0
    def execute(self, context):
        utils.update_keyframe_points(context)

        for fc in context.editable_fcurves:
            for key in fc.keyframe_points:
                if key.select_control_point:
                    key.type = self.type

        return {'FINISHED'}
Exemplo n.º 4
0
 def execute(self, context):
     utils.update_keyframe_points(context)
     curve_datas = get_selected_keys_and_extents()
     for curve_data in curve_datas:
         slopeMaker = keyframe_calculator(curve_data[1], curve_data[2])
         for i, keyframe in enumerate(curve_data[0]):
             keyframe.co[1] = slopeMaker.linear_fit(keyframe.co[0])
             keyframe.handle_left[1] = slopeMaker.linear_fit(keyframe.handle_left[0])
             keyframe.handle_right[1] = slopeMaker.linear_fit(keyframe.handle_right[0])
     return {'FINISHED'}
Exemplo n.º 5
0
 def invoke(self, context, event):
     utils.update_keyframe_points(context)
     if context.space_data.type == 'GRAPH_EDITOR':
         self._auto_normalize = context.space_data.use_auto_normalization
         self._initial_mouse = event.mouse_x  # Vector((event.mouse_x, event.mouse_y, 0.0))
         self._curve_datas = get_selected_keys_and_extents()
         context.window_manager.modal_handler_add(self)
         return {'RUNNING_MODAL'}
     else:
         self.report({'WARNING'}, "Active space must be graph editor")
         return {'CANCELLED'}
Exemplo n.º 6
0
    def execute(self, context):
        from random import choice

        utils.update_keyframe_points(context)

        for fc in context.editable_fcurves:
            for key in fc.keyframe_points:
                if (self.deselect and not key.select_control_point) or \
                    (key.select_control_point and self.extend):
                    continue

                key.select_control_point = choice((True, False))

        return {'FINISHED'}
Exemplo n.º 7
0
    def invoke(self, context, event):
        utils.update_keyframe_points(context)

        for fc in context.editable_fcurves:
            fcu = self.fcurves[fc.id_data.name, fc.data_path,
                               fc.array_index] = dict()

            for (index, key) in enumerate(fc.keyframe_points):
                if key.select_control_point:
                    fcu[index] = dict(
                        base=[key.co.y, key.handle_left.y, key.handle_right.y])

        self.smooth(context)

        return self.execute(context)
    def execute(self, context):
        utils.update_keyframe_points(context)

        frames = set()
        markers = context.scene.timeline_markers

        for fc in context.editable_fcurves:
            for key in fc.keyframe_points:
                if key.select_control_point:
                    frames.add(int(key.co[0]))
        # TODO: calculate from tweak strips

        for mark in markers:
            if mark.frame in frames:
                frames.remove(mark.frame)
                mark.select = True

        for frame in frames:
            markers.new(str(frame), frame=frame)

        return {'FINISHED'}
Exemplo n.º 9
0
    def function(self, context, invoke):
        utils.update_keyframe_points(context)

        curves = dict()

        for fc in context.editable_fcurves:
            curves[fc] = dict()

            for key in fc.keyframe_points:
                if key.select_control_point:
                    curves[fc][tuple(key.co)] = key.type

        exit = self.op(invoke)
        if exit == {'CANCELLED'}:
            return exit

        for fc in context.editable_fcurves:
            for key in fc.keyframe_points:
                if key.select_control_point:
                    if tuple(key.co) not in curves[fc]:
                        key.type = 'JITTER'

        return exit
Exemplo n.º 10
0
 def invoke(self, context, event):
     utils.update_keyframe_points(context)
     return self.execute(context)