From a2aaa2e0a83c368c17dc9fb8464a87cfb1297f60 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 21 Sep 2018 16:44:55 +0200 Subject: blender2.8 FBX IO: Fix basic dupli and anim. Now exporting duplis and animation shall work, at least in basic cases (still have to check more complex ones). --- io_scene_fbx/__init__.py | 2 +- io_scene_fbx/export_fbx_bin.py | 4 ++-- io_scene_fbx/fbx_utils.py | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'io_scene_fbx') diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index bbdcd9ef..9ab4d396 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier", - "version": (4, 10, 0), + "version": (4, 10, 1), "blender": (2, 80, 0), "location": "File > Import-Export", "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions", diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 3ed0d7a5..643ec9ea 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -2070,10 +2070,10 @@ def fbx_animations(scene_data): 'location', 'rotation_quaternion', 'rotation_axis_angle', 'rotation_euler', 'rotation_mode', 'scale', 'delta_location', 'delta_rotation_euler', 'delta_rotation_quaternion', 'delta_scale', 'lock_location', 'lock_rotation', 'lock_rotation_w', 'lock_rotations_4d', 'lock_scale', - 'tag', 'layers', 'select', 'track_axis', 'up_axis', 'active_material', 'active_material_index', + 'tag', 'track_axis', 'up_axis', 'active_material', 'active_material_index', 'matrix_parent_inverse', 'empty_display_type', 'empty_display_size', 'empty_image_offset', 'pass_index', 'color', 'hide_viewport', 'hide_select', 'hide_render', 'use_slow_parent', 'slow_parent_offset', - 'use_extra_recalc_object', 'use_extra_recalc_data', 'dupli_type', 'use_dupli_frames_speed', + 'dupli_type', 'use_dupli_frames_speed', 'use_dupli_vertices_rotation', 'use_dupli_faces_scale', 'dupli_faces_scale', 'dupli_group', 'dupli_frames_start', 'dupli_frames_end', 'dupli_frames_on', 'dupli_frames_off', 'display_type', 'show_bounds', 'display_bounds_type', 'show_name', 'show_axis', 'show_texture_space', diff --git a/io_scene_fbx/fbx_utils.py b/io_scene_fbx/fbx_utils.py index 8de8e8f8..8142f000 100644 --- a/io_scene_fbx/fbx_utils.py +++ b/io_scene_fbx/fbx_utils.py @@ -872,7 +872,7 @@ class MetaObjectWrapper(type): key = get_blenderID_key(bdata) elif isinstance(bdata, DepsgraphObjectInstance): if bdata.is_instance: - key = "|".join((get_blenderID_key((bdata.parent, bdata.object_instance)), cls._get_dup_num_id(bdata))) + key = "|".join((get_blenderID_key((bdata.parent, bdata.instance_object)), cls._get_dup_num_id(bdata))) dup_mat = bdata.matrix_world.copy() else: key = get_blenderID_key(bdata.object) @@ -948,14 +948,14 @@ class ObjectWrapper(metaclass=MetaObjectWrapper): if bdata.is_instance: # Note that dupli instance matrix is set by meta-class initialization. self._tag = 'DP' - self.name = "|".join((get_blenderID_name((bdata.parent, bdata.object)), + self.name = "|".join((get_blenderID_name((bdata.parent, bdata.instance_object)), "Dupli", self._get_dup_num_id(bdata))) - self.bdata = bdata.object + self.bdata = bdata.instance_object self._ref = bdata.parent else: self._tag = 'OB' self.name = get_blenderID_name(bdata) - self.bdata = bdata + self.bdata = bdata.object self._ref = None else: # isinstance(bdata, (Bone, PoseBone)): if isinstance(bdata, PoseBone): @@ -972,6 +972,9 @@ class ObjectWrapper(metaclass=MetaObjectWrapper): def __hash__(self): return hash(self.key) + def __repr__(self): + return self.key + # #### Common to all _tag values. def get_fbx_uuid(self): return get_fbx_uuid_from_key(self.key) @@ -1188,7 +1191,7 @@ class ObjectWrapper(metaclass=MetaObjectWrapper): # #### Duplis... def dupli_list_gen(self, depsgraph): if self._tag == 'OB' and self.bdata.is_duplicator: - return (ObjectWrapper(dup) for dup in depsgraph.object_instances if dup.parent == self.bdata) + return (ObjectWrapper(dup) for dup in depsgraph.object_instances if dup.parent and ObjectWrapper(dup.parent) == self) return () -- cgit v1.2.3