Blender: Difference between revisions

846 bytes added ,  9 September 2021
Added Script for enabling/disabling bone constraints in the selected object and amended
(ADDED subheader "Oni-specific issues with Blender header" and MOVED subheaders "Rotation order issue between Oni and Blender", "Broken alpha transparency and Textures on animated models" FROM article "Editing Creating an animation rig in Blender")
(Added Script for enabling/disabling bone constraints in the selected object and amended)
Line 104: Line 104:
==Scripts==
==Scripts==
===Script for enabling/disabling constraints in selected objects===
===Script for enabling/disabling constraints in selected objects===
This script allows the user to enable or disable constraints in currently selected objects, depending on whether con.mute is set to 0 (enable constraints) or 1 (disable). Usage is simple, just select your objects, set the value of con.mute and run the script.
This script allows the user to enable or disable constraints in the currently selected objects. This is done by checking the value of the first constraint in the first selected object, flipping it and setting it for all constraints in all objects. Usage is simple, just select your objects and run the script.
<pre>import bpy
<pre>#ObjectConstraintEnabler
obj = bpy.context.selected_pose_bones_from_active_object
import bpy
for bone in obj:
body_parts = bpy.context.selected_objects
if body_parts[0].constraints[0].mute==0:
    value=1
else:
    value=0
for body_part in obj:
    for con in body_part.constraints:
        con.mute = value</pre>
 
 
===Script for enabling/disabling bone constraints in the selected armature===
This script allows the user to enable or disable bone constraints in the currently selected armature. This is done by checking the value of the first bone constraint in the first bone of the selected armature, flipping it and setting it for all bone constraints in all bones. Usage is simple, just select your armature in the Object Mode and run the script.
<pre>#BoneConstraintEnabler
import bpy
body_part = bpy.context.selected_pose_bones_from_active_object
if body_part.bone[0].constraints[0].mute==0:
    value=1
else:
    value=0
for bone in body_part:
     for con in bone.constraints:
     for con in bone.constraints:
         con.mute = 1</pre>
         con.mute = value</pre>


===Blender forward throw adjustment script===
===Blender forward throw adjustment script===
Line 168: Line 187:
         bpy.ops.object.visual_transform_apply()
         bpy.ops.object.visual_transform_apply()
         bpy.ops.anim.keyframe_insert_menu(type='BUILTIN_KSI_LocRot')</pre>
         bpy.ops.anim.keyframe_insert_menu(type='BUILTIN_KSI_LocRot')</pre>


==Oni-specific issues with Blender==
==Oni-specific issues with Blender==
191

edits