Skip to content

Commit 5a3b1b9

Browse files
author
Keith Blackstone
authored
Merge pull request #31 from adobe/v1.0.6
v1.0.6
2 parents 154937f + 324e6be commit 5a3b1b9

File tree

24 files changed

+976
-116
lines changed

24 files changed

+976
-116
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ on:
77
branches: [main]
88
schedule:
99
# Cron runs at 16:00 UTC which corresponds to 09:00 AM PT
10-
- cron: '0 16 * * 1'
10+
- cron: "0 16 * * 1"
1111

1212
jobs:
1313
prepare-matrix:
1414
runs-on: ubuntu-latest
1515
outputs:
1616
matrix: ${{ steps.set-matrix.outputs.matrix }}
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v4
1919

20-
- name: Setup Matrix
21-
id: set-matrix
22-
run: |
23-
if [ "${{ github.event_name }}" == "schedule" ]; then
24-
MATRIX_FILE="${{ github.workspace }}/test/full_versions.json"
25-
else
26-
MATRIX_FILE="${{ github.workspace }}/test/pr_versions.json"
27-
fi
28-
JSON=$(jq -c . < "$MATRIX_FILE")
29-
MODIFIED_JSON='{"include":[]}'
30-
PLUGINS=("GLTF" "PLY" "OBJ" "STL" "FBX")
20+
- name: Setup Matrix
21+
id: set-matrix
22+
run: |
23+
if [ "${{ github.event_name }}" == "schedule" ]; then
24+
MATRIX_FILE="${{ github.workspace }}/test/full_versions.json"
25+
else
26+
MATRIX_FILE="${{ github.workspace }}/test/pr_versions.json"
27+
fi
28+
JSON=$(jq -c . < "$MATRIX_FILE")
29+
MODIFIED_JSON='{"include":[]}'
30+
PLUGINS=("GLTF" "PLY" "OBJ" "STL" "FBX")
3131
32-
for row in $(echo "${JSON}" | jq -c '.include[]'); do
33-
for plugin in "${PLUGINS[@]}"; do
34-
NEW_ROW=$(echo "$row" | jq '. + {"config":"'$plugin'"}')
35-
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$NEW_ROW"']')
32+
for row in $(echo "${JSON}" | jq -c '.include[]'); do
33+
for plugin in "${PLUGINS[@]}"; do
34+
NEW_ROW=$(echo "$row" | jq '. + {"config":"'$plugin'"}')
35+
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$NEW_ROW"']')
36+
done
37+
ALL_ON_ROW=$(echo "$row" | jq '. + {"config":"ALL"}')
38+
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$ALL_ON_ROW"']')
3639
done
37-
ALL_ON_ROW=$(echo "$row" | jq '. + {"config":"ALL"}')
38-
MODIFIED_JSON=$(echo "$MODIFIED_JSON" | jq '.include += ['"$ALL_ON_ROW"']')
39-
done
40-
echo "matrix=$(echo "$MODIFIED_JSON" | jq -c .)" >> $GITHUB_OUTPUT
40+
echo "matrix=$(echo "$MODIFIED_JSON" | jq -c .)" >> $GITHUB_OUTPUT
4141
4242
build:
4343
needs: prepare-matrix
@@ -52,7 +52,7 @@ jobs:
5252
- name: Setup Python
5353
uses: actions/setup-python@v5
5454
with:
55-
python-version: '3.10.11'
55+
python-version: "3.10.11"
5656
id: setup-python
5757

5858
- name: Install Ninja (Cross-platform)
@@ -149,11 +149,11 @@ jobs:
149149
FBX_FOLDER=$(echo "${{ github.workspace }}/FBXSDK" | sed 's|\\|/|g')
150150
echo "FBX_FOLDER=$FBX_FOLDER" >> $GITHUB_ENV
151151
if [ "${{ runner.os }}" == "Windows" ]; then
152-
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202021_fbxsdk_vs2019_win.exe" >> $GITHUB_ENV
152+
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_vs2022_win.exe" >> $GITHUB_ENV
153153
elif [ "${{ runner.os }}" == "macOS" ]; then
154-
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202021_fbxsdk_clang_mac.pkg" >> $GITHUB_ENV
154+
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_clang_mac.pkg" >> $GITHUB_ENV
155155
else
156-
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202021_fbxsdk_linux" >> $GITHUB_ENV
156+
echo "FBX_OUTFILE=$FBX_FOLDER/fbx202037_fbxsdk_gcc_linux" >> $GITHUB_ENV
157157
fi
158158
159159
- name: Install FBX SDK Windows
@@ -171,7 +171,7 @@ jobs:
171171
run: |
172172
mkdir -p ${{ env.FBX_FOLDER }}
173173
if [ "${{ runner.os }}" == "macOS" ]; then
174-
FBX_INSTALL_DIR="/Applications/Autodesk/FBXSDK/2020.2.1"
174+
FBX_INSTALL_DIR="/Applications/Autodesk/FBXSDK/2020.3.7"
175175
tar -xzf ${{ env.FBX_OUTFILE }}.tgz -C ${{ env.FBX_FOLDER }}
176176
FBX_OUTFILE_CORRECTED=$(echo "${{ env.FBX_OUTFILE }}" | sed 's/_mac.pkg/_macos.pkg/')
177177
sudo installer -pkg $FBX_OUTFILE_CORRECTED -target / -verboseR
@@ -181,7 +181,7 @@ jobs:
181181
chmod +r ${{ env.FBX_OUTFILE }}.tar.gz
182182
tar -xzf ${{ env.FBX_OUTFILE }}.tar.gz -C ${{ env.FBX_FOLDER }}
183183
mkdir -p ${{ github.workspace }}/FBX_SDK_INSTALL
184-
yes yes | ${{ env.FBX_OUTFILE }} ${{ github.workspace }}/FBX_SDK_INSTALL
184+
yes yes | ${{ env.FBX_FOLDER }}/fbx202037_fbxsdk_linux $FBX_INSTALL_DIR
185185
fi
186186
echo "FBX_INSTALL_DIR=$FBX_INSTALL_DIR" >> $GITHUB_ENV
187187

.github/workflows/fbx-sdk.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@ name: FBX SDK
33
on:
44
schedule:
55
# Runs at 00:00 every Sunday
6-
- cron: '0 0 * * 0'
6+
- cron: "0 0 * * 0"
77
workflow_dispatch:
88

99
jobs:
1010
download-and-upload:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
13+
- name: Checkout code
14+
uses: actions/checkout@v4
1515

16-
- name: Download SDKs
17-
run: |
18-
curl -L -o fbx202021_fbxsdk_vs2019_win.exe -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_win.exe"
19-
curl -L -o fbx202021_fbxsdk_clang_mac.pkg.tgz -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_clang_mac.pkg.tgz"
20-
curl -L -o fbx202021_fbxsdk_linux.tar.gz -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_linux.tar.gz"
16+
- name: Download SDKs
17+
run: |
18+
curl -L -o fbx202037_fbxsdk_vs2022_win.exe -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://damassets.autodesk.net/content/dam/autodesk/www/files/fbx202037_fbxsdk_vs2022_win.exe"
19+
curl -L -o fbx202037_fbxsdk_clang_mac.pkg.tgz -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://damassets.autodesk.net/content/dam/autodesk/www/files/fbx202037_fbxsdk_clang_mac.pkg.tgz"
20+
curl -L -o fbx202037_fbxsdk_gcc_linux.tar.gz -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "https://damassets.autodesk.net/content/dam/autodesk/www/files/fbx202037_fbxsdk_gcc_linux.tar.gz"
2121
22-
- name: Upload SDK for Windows
23-
uses: actions/upload-artifact@v4
24-
with:
25-
name: Windows-FBX-SDK
26-
path: fbx202021_fbxsdk_vs2019_win.exe
22+
- name: Upload SDK for Windows
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: Windows-FBX-SDK
26+
path: fbx202037_fbxsdk_vs2022_win.exe
2727

28-
- name: Upload SDK for macOS
29-
uses: actions/upload-artifact@v4
30-
with:
31-
name: macOS-FBX-SDK
32-
path: fbx202021_fbxsdk_clang_mac.pkg.tgz
28+
- name: Upload SDK for macOS
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: macOS-FBX-SDK
32+
path: fbx202037_fbxsdk_clang_mac.pkg.tgz
3333

34-
- name: Upload SDK for Linux
35-
uses: actions/upload-artifact@v4
36-
with:
37-
name: Linux-FBX-SDK
38-
path: fbx202021_fbxsdk_linux.tar.gz
34+
- name: Upload SDK for Linux
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: Linux-FBX-SDK
38+
path: fbx202037_fbxsdk_gcc_linux.tar.gz

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following dependencies are needed:
4141
|--|--|--|--|
4242
| [Pixar USD](https://github.com/PixarAnimationStudios/USD) | 23.08 | all | no |
4343
| [GTest](https://github.com/google/googletest.git) | 1.11.0 | all tests | yes |
44-
| [FBX SDK](https://aps.autodesk.com/developer/overview/fbx-sdk) | 2020.2.1 | usdfbx | no |
44+
| [FBX SDK](https://aps.autodesk.com/developer/overview/fbx-sdk) | 2020.3.7 | usdfbx | no |
4545
| [LibXml2](https://gitlab.gnome.org/GNOME/libxml2) | 2.10.0 | usdfbx | no |
4646
| [Zlib](https://github.com/madler/zlib.git) | 1.2.11 | usdfbx | no |
4747
| [TinyGltf](https://github.com/syoyo/tinygltf) | 2.8.21 | usdgltf | no |

changelog.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
v1.0.6 July 31st, 2024
2+
fbx:
3+
- update FBXSDK to 2020.3.7
4+
gltf:
5+
- add support for importing triangle strips and fans
6+
- export basic point, spot and directional lights
7+
obj:
8+
- export no longer modifies the scale to account for units
9+
- create a list of unique material names to be used for export
10+
sbsar:
11+
- device initialization fixes and increased logging
12+
- fix parsing of float2 arguments
13+
- add asm scatteringColor to map bindings
14+
- add ASM absorptionColor usage
15+
116
v1.0.5 June 26th, 2024
217
fbx:
318
- import/export linear/srgb option

cmake/FindFBXSDK.cmake

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,44 @@ include(FindPackageHandleStandardArgs)
3939
include(CheckTypeSize)
4040

4141
CHECK_TYPE_SIZE(void* SIZEOF_PTR)
42-
if(SIZEOF_PTR EQUAL 8)
43-
set(FBX_PLATFORM_SUFFIX "x64")
44-
else()
45-
set(FBX_PLATFORM_SUFFIX "x86")
42+
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
43+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
44+
set(FBX_PLATFORM_SUFFIX "x64")
45+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
46+
set(FBX_PLATFORM_SUFFIX "arm64")
47+
elseif (SIZEOF_PTR EQUAL 8)
48+
set(FBX_PLATFORM_SUFFIX "x64")
49+
else()
50+
set(FBX_PLATFORM_SUFFIX "x86")
51+
endif()
52+
else() # macOS and Linux
53+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
54+
set(FBX_PLATFORM_SUFFIX "x64")
55+
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
56+
set(FBX_PLATFORM_SUFFIX "arm64")
57+
else()
58+
set(FBX_PLATFORM_SUFFIX "x86")
59+
endif()
4660
endif()
4761

62+
# The FBX_COMPILER_SUFFIX variable is used to identify the subdirectory in the FBX SDK's library path.
4863
if (NOT (DEFINED FBX_COMPILER_SUFFIX))
4964
if(WIN32)
65+
# FBXSDK version 2020.3.2 and earlier contained a vsXXXX subdirectory
66+
# inside of the lib directory.
5067
set(VS_VERSIONS "vs2022" "vs2019" "vs2017" "vs2015")
5168
foreach(VS_VERSION IN LISTS VS_VERSIONS)
5269
if(EXISTS "${FBXSDK_ROOT}/lib/${VS_VERSION}")
53-
set(FBX_COMPILER_SUFFIX ${VS_VERSION})
54-
break()
70+
set(FBX_COMPILER_SUFFIX ${VS_VERSION})
71+
break()
5572
endif()
5673
endforeach()
5774

58-
# Fallback based on MSVC version if directory check fails
5975
if(NOT FBX_COMPILER_SUFFIX)
60-
if(MSVC_VERSION GREATER_EQUAL 1930)
76+
if(EXISTS "${FBXSDK_ROOT}/lib/${FBX_PLATFORM_SUFFIX}")
77+
set(FBX_COMPILER_SUFFIX ${FBX_PLATFORM_SUFFIX})
78+
# Fallback based on MSVC version if directory check fails
79+
elseif(MSVC_VERSION GREATER_EQUAL 1930)
6180
set(FBX_COMPILER_SUFFIX "vs2022")
6281
elseif(MSVC_VERSION GREATER_EQUAL 1920)
6382
set(FBX_COMPILER_SUFFIX "vs2019")
@@ -79,7 +98,7 @@ if (NOT (DEFINED FBX_COMPILER_SUFFIX))
7998
elseif(APPLE)
8099
set(FBX_COMPILER_SUFFIX "clang")
81100
else()
82-
set(FBX_COMPILER_SUFFIX "gcc")
101+
set(FBX_COMPILER_SUFFIX "lib")
83102
endif()
84103
endif ()
85104

fbx/src/fbx.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class FbxNode;
3333

3434
namespace adobe::usd {
3535

36+
// Scale between intensity of FBX lights and USD lights. This can easily be changed if the USD
37+
// lighting doesn't match
38+
constexpr float FBX_TO_USD_INTENSITY_SCALE_FACTOR = 1.0;
39+
3640
struct ExportFbxOptions
3741
{
3842
bool embedImages = false;

fbx/src/fbxImport.cpp

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,95 @@ importFbxPatch(ImportFbxContext& ctx, FbxNodeAttribute* attribute, int parent)
12021202
bool
12031203
importFbxLight(ImportFbxContext& ctx, FbxNodeAttribute* attribute, int parent)
12041204
{
1205+
FbxLight* fbxLight = FbxCast<FbxLight>(attribute);
1206+
if (!fbxLight) {
1207+
// FbxCast is safe, so if it fails, it returns a null pointer. If that happens, that means
1208+
// the attribute is not a light, even though this function should only be called on
1209+
// attributes with GetAttributeType() == FbxNodeAttribute::eLight
1210+
TF_WARN("importFbxLight: Non-light FBX node attribute cannot be processed as a light.");
1211+
return false;
1212+
}
1213+
1214+
std::string type;
1215+
LightType usdType;
1216+
float coneAngle = 0;
1217+
float coneFalloff = 0;
1218+
switch (fbxLight->LightType.Get()) {
1219+
case FbxLight::ePoint:
1220+
type = "sphere (from FBX point light)";
1221+
usdType = LightType::Sphere;
1222+
1223+
break;
1224+
case FbxLight::eDirectional:
1225+
type = "sun (from FBX directional light)";
1226+
usdType = LightType::Sun;
1227+
1228+
break;
1229+
case FbxLight::eSpot:
1230+
type = "disk (from FBX spot light)";
1231+
usdType = LightType::Disk;
1232+
1233+
// According to FBX specs, inner angle is "HotSpot". In USD, this translates to the
1234+
// USDLuxShapingAPI ConeAngleAttribute
1235+
coneAngle = fbxLight->InnerAngle.Get();
1236+
// According to FBX specs, outer angle is falloff. In USD, this translates to the
1237+
// USDLuxShapingAPI ConeSoftnessAttribute
1238+
coneFalloff = fbxLight->OuterAngle.Get();
1239+
1240+
break;
1241+
case FbxLight::eArea:
1242+
TF_WARN("importFbxLight: ignoring unsupported light of type \"area\"\n");
1243+
1244+
return false;
1245+
case FbxLight::eVolume:
1246+
TF_WARN("importFbxLight: ignoring unsupported light of type \"volume\"\n");
1247+
1248+
return false;
1249+
default:
1250+
TF_WARN("importFbxLight: ignoring light of unknown type\n");
1251+
1252+
return false;
1253+
}
1254+
1255+
auto [lightIndex, light] = ctx.usd->addLight();
1256+
auto [nodeIndex, node] = ctx.usd->getParent(parent);
1257+
node.light = lightIndex;
1258+
1259+
light.type = usdType;
1260+
light.coneAngle = coneAngle;
1261+
light.coneFalloff = coneFalloff;
1262+
1263+
light.name = fbxLight->GetName();
1264+
light.color = toVec3f(fbxLight->Color.Get());
1265+
light.intensity = fbxLight->Intensity.Get() * FBX_TO_USD_INTENSITY_SCALE_FACTOR;
1266+
1267+
// From testing, this appears to ensure FBX lights are properly oriented once imported
1268+
// TODO: Investigate why this is necessary
1269+
GfRotation rotationOffset = GfRotation(GfVec3d::XAxis(), -90.0);
1270+
1271+
auto reorientCamera = [rotationOffset](const GfQuatf rotation) {
1272+
return GfQuatf((rotationOffset * GfRotation(rotation)).GetQuat());
1273+
};
1274+
1275+
// Reorient the light's rotation. Usually, light animations are done by animating the
1276+
// parent of the light, but in case the light itself is animated, update those rotations
1277+
// as well
1278+
node.rotation = reorientCamera(node.rotation);
1279+
for (size_t rotationIdx = 0; rotationIdx < node.rotations.values.size(); ++rotationIdx) {
1280+
node.rotations.values[rotationIdx] = reorientCamera(node.rotations.values[rotationIdx]);
1281+
}
1282+
1283+
TF_DEBUG_MSG(FILE_FORMAT_FBX,
1284+
"importFbx: light[%d]{ %s } of type %s\n",
1285+
lightIndex,
1286+
light.name.c_str(),
1287+
type.c_str());
1288+
1289+
// TODO: Extract FBX light radius and replace this temporary dummy value with it. When this is
1290+
// updated, please update corresponding unit tests as well
1291+
light.radius = 0.5;
1292+
TF_WARN("importFbxLight: ignoring FBX light radius, setting radius=0.5\n");
1293+
12051294
return true;
12061295
}
12071296
bool
@@ -1216,6 +1305,13 @@ importFbxCamera(ImportFbxContext& ctx, FbxNodeAttribute* attribute, int parent)
12161305
{
12171306
std::string name = "";
12181307
FbxCamera* fbxCamera = FbxCast<FbxCamera>(attribute);
1308+
if (!fbxCamera) {
1309+
// FbxCast is safe, so if it fails, it returns a null pointer. If that happens, that means
1310+
// the attribute is not a camera, even though this function should only be called on
1311+
// attributes with GetAttributeType() == FbxNodeAttribute::eCamera
1312+
TF_WARN("importFbxCamera: Non-camera FBX node attribute cannot be processed as a camera.");
1313+
return false;
1314+
}
12191315
auto [cameraIndex, camera] = ctx.usd->addCamera();
12201316
auto [nodeIndex, node] = ctx.usd->getParent(parent);
12211317
node.camera = cameraIndex;

gltf/src/gltf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ governing permissions and limitations under the License.
1515

1616
namespace adobe::usd {
1717

18+
// Scale between intensity of USD lights and GLTF lights
19+
const float GLTF_TO_USD_INTENSITY_SCALE_FACTOR = 100.0;
20+
1821
struct WriteGltfOptions
1922
{
2023
bool embedImages = true;

0 commit comments

Comments
 (0)