Skip to content

Commit

Permalink
Fix for animations not being imported in Blender 2.8. (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobJames-Texas authored Oct 9, 2022
1 parent 623601b commit 2260ad3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 7 additions & 4 deletions addons/io_ogre_TL/OgreImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,16 +748,19 @@ def bCreateAnimations(meshData):
m = mat[target].transposed()
for i in range(0, len(data[0])):
v = Vector(data[0][i][1])
data[0][i][1] = m * v
if hasattr(bpy.app, "version") and bpy.app.version >= (2, 80):
data[0][i][1] = m @ v
else:
data[0][i][1] = m * v

# create fcurves
for i in range(3):
if data[i]:
path = bone.path_from_id(path_id[i])
for channel in range(len(data[i][0][1])):
curve = action.fcurves.new(path,
channel,
bone.name)
curve = action.fcurves.new(data_path=path,
index=channel,
action_group=bone.name)
for key in data[i]:
curve.keyframe_points.insert(key[0],
key[1][channel])
Expand Down
7 changes: 4 additions & 3 deletions addons/io_ogre_TL/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

"""
Name: 'OGRE for Torchlight 2(*.MESH)'
Blender: 2.63a, 2.77a, 2.79, 2.8+
Blender: 2.63a, 2.77a, 2.79, 2.8x
Group: 'Import/Export'
Tooltip: 'Import/Export Torchlight 2 OGRE mesh files'
Expand Down Expand Up @@ -51,7 +51,7 @@
import logging
import bpy
__author__ = "Rob James"
__version__ = "0.9.01 23-Oct-2021"
__version__ = "0.9.02 09-Oct-2022"

__bpydoc__ = """\
This script imports/exports Torchlight Ogre models into/from Blender.
Expand All @@ -74,6 +74,7 @@
to Blender when exported
History:<br>
* v0.9.02 (09-Oct-2022)- Fix for animations not being imported in Blender 2.8.
* v0.9.01 (23-Oct-2021)- Allow bones to be exported in alphabetical order.
* v0.9.00 (03-Apr-2021)- Initial support for Blender 2.8 and up
* v0.8.18 (02-Feb-2020)- Fix for very small bone lengths being rounded
Expand Down Expand Up @@ -141,7 +142,7 @@
"name": "Torchlight 2 MESH format",
"author": "Rob James",
"blender": (2, 80, 0),
"version": (0, 9, 0),
"version": (0, 9, 2),
"api": 35622,
"location": "File > Import-Export",
"description": ("Import-Export Torchlight 2 Model, Import MESH, UV's, "
Expand Down

0 comments on commit 2260ad3

Please sign in to comment.