adobe / USD-Fileformat-plugins

A collection of USD fileformat plugins
298 stars 22 forks source link

Could NOT find FBXSDK (missing: FBXSDK_INCLUDE_DIRS) #26

Closed GenkuroFSI closed 2 months ago

GenkuroFSI commented 3 months ago

Hello. When I try to build the FBX plugin, I get the error Could NOT find FBXSDK (missing: FBXSDK_INCLUDE_DIRS).

Is there anything else I need to set up for this?

CMake 3.29.2 VisualStudio 2022 The above is each environment, and the CMake command is like this.

cmake -S . -B build -DCMAKE_INSTALL_PREFIX=bin -Dpxr_ROOT=C:\opt\usd2 -DFBXSDK_ROOT=C:\Program Files\Autodesk\FBX\FBX SDK\2020.3.7 -DUSD_FILEFORMATS_ENABLE_FBX=ON

image

kwblackstone commented 3 months ago

Hello, I see two issues, first the plugin currently supports FBXSDK v2020.2.1. I hope to update this soon, but 2020.3.7 has a different folder structure which causes issues in the current https://github.com/adobe/USD-Fileformat-plugins/blob/main/cmake/FindFBXSDK.cmake.

Second issue is I recommend wrapping your paths in quotes. With spaces in Program Files and FBX SDK not having quotes can cause an issue. The cmake command in the end should be something like this: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=bin -Dpxr_ROOT="C:\opt\usd2" -DFBXSDK_ROOT="C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1" -DUSD_FILEFORMATS_ENABLE_FBX=ON.

If you are still having issues, please reopen.

GenkuroFSI commented 3 months ago

@kwblackstone Thanks for the quick response. I was able to build it successfully.

I ran into another problem, I set the path of the plugin in Windows, set up OpenUSD and converted from FBX to USD, and I got the error. Since I was able to manipulate the USD file, it seems that the plugin has not been set up properly. Are there any settings I need to make when running in Visual Studio?

Error details Coding Error: in _OpenLayerAndUnlockRegistry at line 3345 of C:\Users\Documents\OpenUSD\pxr\usd\sdf\layer.cpp -- Cannot determine file format for @c:/Users/Desktop/ModoUsd-master/samples/dra.fbx:SDF_FORMAT_ARGS:target=usd@ Runtime Error: in Open at line 1059 of C:\Users\Documents\OpenUSD\pxr\usd\usd\stage.cpp -- Failed to open layer @C:/Users/Desktop/ModoUsd-master/samples/dra.fbx@

The pass was set with reference to this set PATH=%PATH%;.\USD-Fileformat-plugins\bin\bin;.\USD-Fileformat-plugins\bin\plugin\usd set PXR_PLUGINPATH_NAME=%PXR_PLUGINPATH_NAME%;.\USD-Fileformat-plugins\bin\plugin\usd

Sorry for the rough content. If you need any additional information, please contact us.

kwblackstone commented 3 months ago

Hey @GenkuroFSI,

Glad to hear its building. There isn't anything specific that needs to be configured in Visual Studio for the plugin itself beyond the usual environment setup. Let's try the following to ensure everything is configured correctly:

  1. Make sure your PATH also has your local USD build's bin and lib. Something like: set PATH=%PATH%;.\USD-Fileformat-plugins\bin\bin;.\USD-Fileformat-plugins\bin\plugin\usd;{LOCAL_USD_BUILD}\bin;{LOCAL_USD_BUILD}\lib

  2. Similarly, please make sure your PXR_PLUGINPATH_NAME contains both local USD build plugin\usd folder in addition to the fielformat plugin\usd folder. Something like: set PXR_PLUGINPATH_NAME=.\USD-Fileformat-plugins\bin\plugin\usd;{LOCAL_USD_BUILD}\plugin\usd

If all of that looks correct, please check if usdFbx.dll can be loaded properly and isn't missing any dependencies. I typically use dependency walker to verify.

If everything looks good and its till not working, let me know what version of USD and Visual Studio you are working with.

GenkuroFSI commented 3 months ago

@kwblackstone Thanks for the polite answer However, even though these settings are made, an error occurs at the time of execution.

If you set the path, you don't need to copy the plugins you installed on LocalUSD, right?

Copy the installed plugins and dependent shared libraries to the specified folder: mkdir -p ./LOCAL_USD_INSTALL/plugin/usd cp -r ./USD-Fileformat-plugins/bin/plugin/usd/ ./LOCAL_USD_INSTALL/plugin/usd/ cp ./USD-Fileformat-plugins/bin/bin/ ./LOCAL_USD_INSTALL/plugin/usd/

Here are the versions of each USD→24.05 VisualStudio→2022

kwblackstone commented 3 months ago

correct, you can either copy all the contents of USD-Fileformat-plugins/bin/bin and USD-Fileformat-plugins/bin/plugin/usd to the LocalUSD/plugin/usd or set PATH and PXR_PLUGINPATH_NAME accordingly.

Do you get the same error with any fbx asset? Have you tried loading any of the test assets (https://github.com/adobe/USD-Fileformat-plugins/tree/main/test/assets/fbx) with usdview or examining them with usdcat to see if you get the same error?

GenkuroFSI commented 3 months ago

Do you get the same error with any fbx asset?

Yes, all FBX files get the same error

Have you tried loading any of the test assets (https://github.com/adobe/USD-Fileformat-plugins/tree/main/test/assets/fbx) with usdview or examining them with usdcat to see if you get the same error?

When I tried to check with USDView, I got an error. Is this the cause? Traceback (most recent call last): File "C:\opt\usd2\bin\usdview", line 28, in <module> import pxr.Usdviewq as Usdviewq ModuleNotFoundError: No module named 'pxr'

kwblackstone commented 2 months ago

Traceback (most recent call last): File "C:\opt\usd2\bin\usdview", line 28, in import pxr.Usdviewq as Usdviewq ModuleNotFoundError: No module named 'pxr'

Ah, that error i've seen before when the PYTHONPATH environment variable isn't set. It should point to USD's python, so LOCAL_USD_INSTALL/lib/python

GenkuroFSI commented 2 months ago

I'm sorry, I made a mistake USDView worked fine. I checked the Path as a whole, but the content of the error still does not change.

kwblackstone commented 2 months ago

Ok, if usdview worked fine then the global environment is correct. This is a tricky one for me to help with. How exactly are you converting from FBX to USD, is it a console command, or an application for this process? It seems there might be a specific issue related to the environment settings where the conversion takes place.

kwblackstone commented 2 months ago

Initial issue is fixed, feel free to open a new ticket if you have more details on the environment which was failing.