first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,118 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __FBXIMPORT__
#define __FBXIMPORT__
#define FBXSDK_NEW_API
#include "fbxsdk.h"
#include "import/import_interface.h"
#include "automation/automated_property_provider.h"
#include "core/resource_factory_event_interface.h"
#include "container/nlist.h"
namespace GS {
namespace Core {
class Motion;
class Geometry;
struct Material;
}
namespace S3D {
class MItem;
struct MObject;
/// Exported node cache.
struct ExportedNode
{
FbxNode *node;
MItem *item;
ExportedNode(FbxNode *n, MItem *i) : node(n), item(i) {}
};
/*!
@short Autodesk FBX Importer.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
class FBXImporter : public IImport
{
int current_node_index;
String input_path;
Scene *scene;
const Config *config;
FbxManager *sdk_manager;
FbxScene *fbx_scene;
List <Core::Geometry *> geometry_list;
List <ExportedNode *> node_list;
/// Save material.
String SaveMaterial(const Core::Material &, const char *);
/// Get the item corresponding to a node, if it has been exported already.
bool GetNodeItem(FbxNode *, MItem **);
/// Export motion channels.
void ExportMotionChannel(FbxNode *, FbxAnimCurve *, Core::Motion *, Core::MotionChannel::Type);
/// Bake transformation.
void BakeTransformation(FbxNode *, MItem *, Core::Motion *);
/// Export motions.
void ExportMotions(FbxNode *, MItem *);
/// Export mesh layer.
void ExportMeshLayer(FbxMesh *, Core::Geometry *, int layer_index = 0);
/// Export skin.
bool ExportDeformers(FbxMesh *, FbxNode *, Core::Geometry &, MObject *);
/// Export vertex color.
void ExportMeshVertexColor(FbxMesh *, Core::Geometry *);
/// Export tangent frame.
void ExportMeshTangentFrame(FbxMesh *, Core::Geometry *);
/// Export a geometry (topology and normals).
String ExportGeometry(FbxMesh *, FbxNode *, MObject *);
/// Export a file-based texture.
String ExportFileTexture(FbxFileTexture *);
/// Export a layered texture.
String ExportLayeredTexture(FbxLayeredTexture *);
/// Export a material.
String ExportMaterial(FbxSurfaceMaterial *, FbxMesh *, bool use_skin);
/// Export a camera.
MItem *ExportCamera(FbxNodeAttribute *, FbxNode * = 0);
/// Export a mesh.
MObject *ExportObject(FbxNodeAttribute *, FbxNode * = 0);
/// Export a light.
MItem *ExportLight(FbxNodeAttribute *, FbxNode * = 0);
/// Dispatch the node to the correct exporter.
MItem *ExportNode(FbxNode *pNode);
/// Create and import an FBX file to a native FBX scene.
FbxScene *LoadNativeScene(const char *fbx_path);
public:
/// Return the geometries created during import.
const List <Core::Geometry *> &GeometryList() const { return geometry_list; }
/// Test importer on a file.
virtual bool TestImport(const char *uri);
/// Import scene from file.
virtual bool ImportScene(Scene *, const char *uri, const Config &, Group ** = 0);
FBXImporter();
~FBXImporter();
};
} // S3D
} // GS
#endif // __FBXIMPORT__