-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In _base, shortened function name run_script() to script() Added .py to the script() function, so that calling scripts now requires only their name, and not the file extension: Old Way: run_script('KeyframeActive.py') New Way: script('KeyframeActive') Scripts folder has 'KeyframeActive' and 'RotateActive' to facilitate the new 'active item' specific knobs: ie: the knob will rotate and keyframe a mesh, edge, face, vertex, armature, edit bone, pose bone, curve or bezier point automatically The old logic always targeted the active object, not any sub items of that object eg bones, vertices, which was not desirable behavior Page1 was updated to include the new rotation and keyframing functions
- Loading branch information
1 parent
30183a0
commit 210ee47
Showing
4 changed files
with
107 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import bpy | ||
|
||
context = bpy.context | ||
bmp = context.scene.bmp | ||
mode = context.mode | ||
object = context.object | ||
type = object.type | ||
data = object.data | ||
|
||
axis = bmp.Axis | ||
|
||
if type == 'MESH': | ||
if mode == 'EDIT_MESH': | ||
bpy.ops.addon.messagebox('INVOKE_DEFAULT', Message='You cannot keyframe mesh data!') | ||
else: | ||
object.keyframe_insert(data_path='rotation_euler', index=axis) | ||
|
||
elif type == 'ARMATURE': | ||
if mode == 'POSE': | ||
bone = context.selected_pose_bones[0] | ||
bone.rotation_mode = 'XYZ' | ||
bone.keyframe_insert(data_path='rotation_euler', index=axis) | ||
|
||
elif mode == 'EDIT_ARMATURE': | ||
bpy.ops.addon.messagebox('INVOKE_DEFAULT', Message='You cannot keyframe edit bones!') | ||
|
||
else: | ||
object.keyframe_insert(data_path='rotation_euler', index=axis) | ||
|
||
elif type == 'CURVE': | ||
if mode == 'EDIT_CURVE': | ||
bpy.ops.addon.messagebox('INVOKE_DEFAULT', Message='You cannot keyframe bezier points!') | ||
|
||
else: | ||
object.keyframe_insert(data_path='rotation_euler', index=axis) | ||
|
||
else: | ||
object.keyframe_insert(data_path='rotation_euler', index=axis) | ||
|
||
object.hide_render = object.hide_render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import bpy | ||
|
||
context = bpy.context | ||
bmp = context.scene.bmp | ||
mode = context.mode | ||
object = context.object | ||
type = object.type | ||
data = object.data | ||
|
||
direction = bmp.Direction | ||
value = bmp.Value | ||
axis = bmp.Axis | ||
|
||
_axis = { | ||
'0':(True,False,False), | ||
'1':(False,True,False), | ||
'2':(False,False,True), | ||
} | ||
|
||
if type == 'MESH': | ||
if mode == 'EDIT_MESH': | ||
bpy.ops.transform.rotate(value=value*direction, constraint_axis=_axis[str(axis)]) | ||
else: | ||
object.rotation_euler[axis] += value*direction | ||
|
||
elif type == 'ARMATURE': | ||
if mode == 'POSE': | ||
bone = context.selected_pose_bones[0] | ||
bone.rotation_mode = 'XYZ' | ||
bone.rotation_euler[axis] += value*direction | ||
|
||
elif mode == 'EDIT_ARMATURE': | ||
bpy.ops.transform.rotate(value=value*direction, constraint_axis=_axis[str(axis)]) | ||
|
||
else: | ||
object.rotation_euler[axis] += value*direction | ||
|
||
elif type == 'CURVE': | ||
if mode == 'EDIT_CURVE': | ||
bpy.ops.transform.rotate(value=value*direction, constraint_axis=_axis[str(axis)]) | ||
|
||
else: | ||
object.rotation_euler[axis] += value*direction | ||
|
||
else: | ||
object.rotation_euler[axis] += value*direction |