Jump to content

XML:TRAM: Difference between revisions

648 bytes added ,  2 September 2020
Further documentation of Blender Forward throw adjustment script
(Added a script for adjusting forward throw target anims in Blender. Snippet is pretty long; if you have a better idea of formatting it or putting it elsewhere let me know.)
(Further documentation of Blender Forward throw adjustment script)
Line 857: Line 857:


====Blender Forward throw adjustment script====
====Blender Forward throw adjustment script====
This is a Blender script for rotating -/+180° and adding PositionOffset to a forward throw Target animation. This will be documented soon.
This is a Blender script for rotating -/+180° and adding PositionOffset to a forward throw Target animation. This was made by one hero from Blender Discord named Danta. The add_object_offset_about_cursor_Z was written by Delano762.
 
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.
 
<pre>import bpy
<pre>import bpy
from math import pi, radians
from math import pi, radians
Line 893: Line 896:
bpy.types.Object.is_keyframe = is_keyframe  """
bpy.types.Object.is_keyframe = is_keyframe  """


 
#not really sure why those three lines are here, I think they can be left out
obj.keyframe_insert(data_path="location", frame = 0)
#obj.keyframe_insert(data_path="location", frame = 0)
obj.matrix_world.translation += Vector((-100, 0, 0)) #no idea what this is doing
#obj.matrix_world.translation += Vector((-100, 0, 0))  
obj.keyframe_insert(data_path="location", frame = 100)
#obj.keyframe_insert(data_path="location", frame = 100)


scene.frame_set(0) #set start frame
scene.frame_set(0) #set start frame
191

edits