Exemplo n.º 1
0
            "material_search_location",
            getattr(MaterialSearchLocation,
                    jsonSetting["material_search_location"]))
        importOptions.set_editor_property("import_materials",
                                          jsonSetting["import_material"])
        importOptions.set_editor_property("import_textures",
                                          jsonSetting["import_texture"])
        importOptions.texture_import_data.set_editor_property(
            "invert_normal_maps", jsonSetting["invert_normal_maps"])
        importOptions.static_mesh_import_data.set_editor_property(
            "reorder_material_to_fbx_order",
            jsonSetting["reorder_material_to_fbx_order"])

        # Task

        importTask = AssetImportTask()
        importTask.set_editor_property("automated", True)
        importTask.set_editor_property("destination_name", "")
        importTask.set_editor_property("destination_path", targetFolder)
        importTask.set_editor_property("filename", sourceFile)
        importTask.set_editor_property("replace_existing",
                                       jsonSetting["overwrite_file"])
        importTask.set_editor_property("save", False)
        importTask.set_editor_property("options", importOptions)

        AssetToolsHelpers.get_asset_tools().import_asset_tasks([importTask])

        if jsonSetting["temporary"]:
            # when you try to export temporary and with create material setting, unreal engine can not handle remove file because still using for compiling material
            # https://github.com/anasrar/Blender-UE4-Workspace/issues/6
            try:
             ),
            (import_options, 'import_materials',
             unreal_engine_import_setting['import_materials']),
            (import_options, 'import_textures',
             unreal_engine_import_setting['import_textures']),
            (import_options.texture_import_data, 'invert_normal_maps',
             unreal_engine_import_setting['invert_normal_maps']),
            (import_options.skeletal_mesh_import_data,
             'reorder_material_to_fbx_order',
             unreal_engine_import_setting['reorder_material_to_fbx_order']),
        ]):
            option.set_editor_property(prop, value)

        # Task

        import_task = AssetImportTask()

        for prop, value in [
            ('automated', True),
            ('destination_name', ''),
            ('destination_path', target_path),
            ('filename', source_file),
            ('replace_existing',
             unreal_engine_import_setting['overwrite_file']),
            ('save', False),
            ('options', import_options),
        ]:
            import_task.set_editor_property(prop, value)

        AssetToolsHelpers.get_asset_tools().import_asset_tasks([import_task])