Blender 2.78a doesn't import user properties from FBX file #52029

Closed
opened 2017-07-11 17:19:15 +02:00 by Nik S · 6 comments

Hi,

I try to import FBX file with user props which created via 3d MAX but blender skips it.

test.FBX

I reviewed add-on code and found out possible issue:

File release/scripts/addons/io_scene_fbx/import_fbx.py contains function which process nodes: build_node. There is blen_read_custom_properties call with props of FBXElem with b'Properties70' id.

    def build_node(self, fbx_tmpl, settings):
        # create when linking since we need object data
        elem_name_utf8 = self.fbx_name

        # Object data must be created already
        self.bl_obj = obj = bpy.data.objects.new(name=elem_name_utf8, object_data=self.bl_data)

        fbx_props = (elem_find_first(self.fbx_elem, b'Properties70'),
                     elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil))
        assert(fbx_props[0] is not None)

        - ----
        - Misc Attributes

        obj.color[0:3] = elem_props_get_color_rgb(fbx_props, b'Color', (0.8, 0.8, 0.8))
        obj.hide = not bool(elem_props_get_visibility(fbx_props, b'Visibility', 1.0))

        obj.matrix_basis = self.get_matrix()

        if settings.use_custom_props:
            blen_read_custom_properties(fbx_props[0], obj, settings)

        return obj

However blen_read_custom_properties also try to find FBXElem with b'Properties70' and of course doesn't find it.

def blen_read_custom_properties(fbx_obj, blen_obj, settings):
    # There doesn't seem to be a way to put user properties into templates, so this only get the object properties:
    fbx_obj_props = elem_find_first(fbx_obj, b'Properties70')
    if fbx_obj_props:
        ...

I guess that blen_read_custom_properties(self.fbx_elem, obj, settings) call should solve issue.

Thank you.

Hi, I try to import FBX file with user props which created via 3d MAX but blender skips it. [test.FBX](https://archive.blender.org/developer/F658444/test.FBX) I reviewed add-on code and found out possible issue: File `release/scripts/addons/io_scene_fbx/import_fbx.py` contains function which process nodes: `build_node`. There is `blen_read_custom_properties` call with props of `FBXElem` with `b'Properties70'` id. ``` def build_node(self, fbx_tmpl, settings): # create when linking since we need object data elem_name_utf8 = self.fbx_name # Object data must be created already self.bl_obj = obj = bpy.data.objects.new(name=elem_name_utf8, object_data=self.bl_data) fbx_props = (elem_find_first(self.fbx_elem, b'Properties70'), elem_find_first(fbx_tmpl, b'Properties70', fbx_elem_nil)) assert(fbx_props[0] is not None) - ---- - Misc Attributes obj.color[0:3] = elem_props_get_color_rgb(fbx_props, b'Color', (0.8, 0.8, 0.8)) obj.hide = not bool(elem_props_get_visibility(fbx_props, b'Visibility', 1.0)) obj.matrix_basis = self.get_matrix() if settings.use_custom_props: blen_read_custom_properties(fbx_props[0], obj, settings) return obj ``` However `blen_read_custom_properties` also try to find `FBXElem` with `b'Properties70'` and of course doesn't find it. ``` def blen_read_custom_properties(fbx_obj, blen_obj, settings): # There doesn't seem to be a way to put user properties into templates, so this only get the object properties: fbx_obj_props = elem_find_first(fbx_obj, b'Properties70') if fbx_obj_props: ... ``` I guess that `blen_read_custom_properties(self.fbx_elem, obj, settings)` call should solve issue. Thank you.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @proteamer

Added subscriber: @proteamer

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2017-07-11 19:35:03 +02:00

Thanks, can confirm the bug and the solution, will commit now :)

Thanks, can confirm the bug and the solution, will commit now :)

This issue was referenced by 4e25de776a

This issue was referenced by 4e25de776a09e9d6bb6ccac9e935c32ea0952d95

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#52029
No description provided.