Jump to content

[SOLVED] Custom FBX import problem


photo

Recommended Posts

Hello.

Is there an opportunity to customize fbx import in Editor?

I`m trying to process model materials that have multi texture layers that have references to files. Editor (by default) make new empty materials for those surfaces.

When my custom import "class FbxImporter : public Unigine::Importer" start processing fbx file, it runs FbxImporter::onInit function, and then FbxImporter::onImport function not called (why???). after that it invokes FbxImporter::onImportMesh and FbxImporter::onImportNode from internal (Unigine_double_x64.dll), and bool onImportMaterial never called.

here is debug func calls:

FbxImporter::FbxImporter
FbxImporter::onInit
Model up(Y) front(Z) name(fire_station).
Required up(None) front(None).
FbxImporter::process_node, new node(fire_station)
FbxImporter::process_node, new node(fire_station%lod0)
FbxImporter::process_node, new node(fire_station%lod0)
FbxImporter::process_mesh
FbxImporter::onImportMesh, mesh name(fire_station%lod0)
FbxImporter::create_mesh
`anonymous-namespace'::create_geometry
`anonymous-namespace'::create_surfaces
FbxImporter::onImportNode, node name(fire_station)
FbxImporter::~FbxImporter

I need to process materials - choose existing material from library, inherit it to needed place and assign to node when import

Link to comment

qwert_e

onImport() is not called inside Editor, use it only for realtime FBX import.
onImportMaterial should be calling if FBX contains some materials (maybe it will be required to manually enable 'Override materials').

FbxImporter::import_materials should be right place to look at.

A full source code of your modifications would be great to look at, right now it's not completely clear what is going on.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

In FbxImporter::import_materials it assigns String ImportMaterial.name and void* ImportMaterial.data as fbx::FbxSurfaceMaterial *. And i stucked, because i don`t know where it parse ImportMaterial.data and creates new materials (that are added to data/materials folder).

I need to get data from fbx multimap, and assign surface material to one i have in my material library

Edited by qwert_e
Link to comment
On 2/13/2019 at 1:01 PM, silent said:

(maybe it will be required to manually enable 'Override materials').

That helped. It named "Overwrite Assets" in Assets mode editor import gui window.
In Editor mode i can`t assign processor for material, so i swapped MaterialPtr &material in
bool FbxImporter::onImportMaterial(ImportProcessor *processor, MaterialPtr &material, ImportMaterial *import_material)

to material that i need according to data in ImportMaterial *import_material.

Thanks!

Link to comment
  • silent changed the title to [SOLVED] Custom FBX import problem
×
×
  • Create New...