Skip to content

Commit

Permalink
Release 1.0.0-alpha.33; Export FBX scene info (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit committed Mar 23, 2022
1 parent 59a1b87 commit 20ff3f6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Core/Source/bee/Convert/SceneConverter.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "./fbxsdk/String.h"
#include <bee/Convert/ConvertError.h>
#include <bee/Convert/SceneConverter.h>
#include <bee/Convert/fbxsdk/Spreader.h>
Expand Down Expand Up @@ -189,6 +190,34 @@ SceneConverter::_convertFileName(const char *fbx_file_name_) {

GLTFBuilder::XXIndex
SceneConverter::_convertScene(fbxsdk::FbxScene &fbx_scene_) {
if (_options.export_fbx_file_header_info) {
const auto &fbxSceneInfo = *fbx_scene_.GetSceneInfo();

auto &extensionsAndExtras =
_glTFBuilder.get(&fx::gltf::Document::extensionsAndExtras);
auto &sceneInfo = extensionsAndExtras["extras"]["FBX-glTF-conv"]
["fbxFileHeaderInfo"]["sceneInfo"];

sceneInfo["url"] = fbx_string_to_utf8_checked(fbxSceneInfo.Url.Get());

auto &original = sceneInfo["original"];
original["applicationVendor"] = fbx_string_to_utf8_checked(
fbxSceneInfo.Original_ApplicationVendor.Get());
original["applicationName"] =
fbx_string_to_utf8_checked(fbxSceneInfo.Original_ApplicationName.Get());
original["applicationVersion"] = fbx_string_to_utf8_checked(
fbxSceneInfo.Original_ApplicationVersion.Get());
original["fileName"] =
fbx_string_to_utf8_checked(fbxSceneInfo.Original_FileName.Get());

sceneInfo["title"] = fbx_string_to_utf8_checked(fbxSceneInfo.mTitle);
sceneInfo["subject"] = fbx_string_to_utf8_checked(fbxSceneInfo.mSubject);
sceneInfo["author"] = fbx_string_to_utf8_checked(fbxSceneInfo.mAuthor);
sceneInfo["keywords"] = fbx_string_to_utf8_checked(fbxSceneInfo.mKeywords);
sceneInfo["revision"] = fbx_string_to_utf8_checked(fbxSceneInfo.mRevision);
sceneInfo["comment"] = fbx_string_to_utf8_checked(fbxSceneInfo.mComment);
}

auto sceneName = _convertName(fbx_scene_.GetName());

fx::gltf::Scene glTFScene;
Expand Down
18 changes: 18 additions & 0 deletions types/FBX-glTF-conv-extras.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface DocumentExtra {
*/
millisecond: number;
};

sceneInfo: FbxSceneInfo;
};
}

Expand Down Expand Up @@ -104,3 +106,19 @@ export type FbxMaterialProperty<T> = {
* Index to the glTF texture array.
*/
export type TextureReference = number;

export interface FbxSceneInfo {
url: string;
original: {
applicationVendor: string;
applicationName: string;
applicationVersion: string;
fileName: string;
};
title: string;
subject: string;
author: string;
keywords: string;
revision: string;
comment: string;
}

0 comments on commit 20ff3f6

Please sign in to comment.