Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2020-01-19 18:41:16 +0300
committerSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2020-01-19 18:41:16 +0300
commit9eddf664d68a2ed6be1bf17b0b26d6d66d81c0eb (patch)
tree9bb9dd49d70af6d64dfe9efea2e03c57d06f1727 /io_scene_fbx
parent946ad9c4fa5c0351b5cf1d7733cd28410513b97e (diff)
FBX Import: corrected import camera. Added setting camera (invert or not invert).
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/__init__.py8
-rw-r--r--io_scene_fbx/fbx_utils.py1
-rw-r--r--io_scene_fbx/import_fbx.py12
3 files changed, 17 insertions, 4 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 6678e1eb..96a75199 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -193,12 +193,17 @@ class ImportFBX(bpy.types.Operator, ImportHelper):
),
default='X',
)
-
+
use_prepost_rot: BoolProperty(
name="Use Pre/Post Rotation",
description="Use pre/post rotation from FBX transform (you may have to disable that in some cases)",
default=True,
)
+ camera_invert: BoolProperty(
+ name="Camera Invert",
+ description="import inverted camera or not",
+ default=False,
+ )
def draw(self, context):
pass
@@ -309,6 +314,7 @@ class FBX_PT_import_transform_manual_orientation(bpy.types.Panel):
layout.prop(operator, "axis_forward")
layout.prop(operator, "axis_up")
+ layout.prop(operator, "camera_invert")
class FBX_PT_import_animation(bpy.types.Panel):
diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py
index c35399b2..94356435 100644
--- a/io_scene_fbx/fbx_utils.py
+++ b/io_scene_fbx/fbx_utils.py
@@ -1259,4 +1259,5 @@ FBXImportSettings = namedtuple("FBXImportSettings", (
"nodal_material_wrap_map", "image_cache",
"ignore_leaf_bones", "force_connect_children", "automatic_bone_orientation", "bone_correction_matrix",
"use_prepost_rot",
+ "camera_invert",
))
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 32b887c1..e6918e40 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -61,7 +61,7 @@ convert_deg_to_rad_iter = units_convertor_iter("degree", "radian")
MAT_CONVERT_BONE = fbx_utils.MAT_CONVERT_BONE.inverted()
MAT_CONVERT_LIGHT = fbx_utils.MAT_CONVERT_LIGHT.inverted()
-MAT_CONVERT_CAMERA = fbx_utils.MAT_CONVERT_CAMERA.inverted()
+MAT_CONVERT_CAMERA = fbx_utils.MAT_CONVERT_CAMERA
def validate_blend_names(name):
@@ -1769,7 +1769,10 @@ class FbxImportHelperNode:
else:
# camera and light can be hard wired
if self.fbx_type == b'Camera':
- correction_matrix = MAT_CONVERT_CAMERA
+ if settings.camera_invert:
+ correction_matrix = MAT_CONVERT_CAMERA.inverted()
+ else:
+ correction_matrix = MAT_CONVERT_CAMERA
elif self.fbx_type == b'Light':
correction_matrix = MAT_CONVERT_LIGHT
@@ -2327,7 +2330,9 @@ def load(operator, context, filepath="",
automatic_bone_orientation=False,
primary_bone_axis='Y',
secondary_bone_axis='X',
- use_prepost_rot=True):
+ use_prepost_rot=True,
+ camera_invert=False,
+ ):
global fbx_elem_nil
fbx_elem_nil = FBXElem('', (), (), ())
@@ -2467,6 +2472,7 @@ def load(operator, context, filepath="",
nodal_material_wrap_map, image_cache,
ignore_leaf_bones, force_connect_children, automatic_bone_orientation, bone_correction_matrix,
use_prepost_rot,
+ camera_invert,
)
# #### And now, the "real" data.