191
edits
(Further documentation of Blender Forward throw adjustment script) |
(Added step-by-step guide on how to use the Blender throw script.) |
||
Line 860: | Line 860: | ||
What this script does is, for each frame of the range you specify, rotate the selected object by 180 degrees (or however many you want), and translate it by a given Position offset, that's available in the <TargetAdjustment> <Position> tag of the attacker's throw animation XML. It also has a frame checking functionality that's bugged; however, ultimately there is no real reason at the moment to use it - however, it may come in handy in the future, so it should be left in this snippet commented. | What this script does is, for each frame of the range you specify, rotate the selected object by 180 degrees (or however many you want), and translate it by a given Position offset, that's available in the <TargetAdjustment> <Position> tag of the attacker's throw animation XML. It also has a frame checking functionality that's bugged; however, ultimately there is no real reason at the moment to use it - however, it may come in handy in the future, so it should be left in this snippet commented. | ||
Step-by-step guide on using this script: | |||
'''Step 1:''' Import a throw animation and its target animation into Blender. | |||
'''Step 2:''' Open Scripting tab. | |||
'''Step 3:''' Create a new text, and name it however you want with .py extension, e.g. TRAMAdjuster.py | |||
'''Step 4:''' Paste the script. | |||
'''Step 5:''' In the following lines: | |||
<pre>scene.frame_set(start) | |||
for i in range(start, end):</pre> | |||
Set ''start'' and ''end'' to the start frame of the animation (always 0 for vanilla anims, but if you're animating and starting from 1, you'll want it set to 1) and the ''end'' to the end+1 frame of your animation, meaning, if you have a 99 frame animation, set ''end'' to 100. | |||
'''Step 6:''' In the following line: | |||
<pre>add_object_offset_about_cursor_Z(obj,x,-z,-y) #translate object</pre> | |||
Paste the values from the <Position> tag accordingly to the order in the arguments of the function. The minus means the value should be inverted in the function. As an example, assuming you have the following <Position> tag: | |||
<pre><Position>1 2 -3</Position></pre> | |||
The function should be following: | |||
<pre>add_object_offset_about_cursor_Z(obj,1,3,-2) #translate object</pre> | |||
'''Step 7:''' Select the pelvis of the target animation. | |||
'''Step 8:''' Press Shift + C to ensure your 3D cursor is in the center of the animation. | |||
'''Step 9:''' Set the Transform Pivot Point to 3D Cursor. | |||
'''Step 10:''' In the Scripting tab, run the script. | |||
'''Step 11:''' The target should be now adjusted as expected. | |||
'''Step 12:''' If you want to revert the target back to an exportable position and rotation, simply invert the z argument in the add_object_offset_about_cursor_Z function and run the script again. | |||
<pre>import bpy | <pre>import bpy | ||
Line 901: | Line 942: | ||
#obj.keyframe_insert(data_path="location", frame = 100) | #obj.keyframe_insert(data_path="location", frame = 100) | ||
scene.frame_set( | scene.frame_set(start) #set start frame | ||
for i in range( | for i in range(start, end): #loop for every frame | ||
#if obj.is_keyframe(i, obj.path_from_id("location")): Bugged keyframe-check | #if obj.is_keyframe(i, obj.path_from_id("location")): Bugged keyframe-check | ||
scene.frame_set(i) | scene.frame_set(i) | ||
rotate_object_about_cursor_Z(obj, 180) #rotate object | rotate_object_about_cursor_Z(obj, 180) #rotate object | ||
add_object_offset_about_cursor_Z(obj, | add_object_offset_about_cursor_Z(obj,x,-z,y) #translate object | ||
obj.keyframe_insert(data_path="rotation_euler", frame=i) #keyframe rotation | obj.keyframe_insert(data_path="rotation_euler", frame=i) #keyframe rotation | ||
obj.keyframe_insert(data_path="location", frame=i) #keyframe location | obj.keyframe_insert(data_path="location", frame=i) #keyframe location |
edits