Coder Social home page Coder Social logo

fbx-extract's People

Contributors

sueda avatar ziyanxiong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fbx-extract's Issues

missing <cstring> library in main.cpp?

Running the make command in the build instructions produces an Error 2 in the make file, and the traceback suggests that you need to append #include to the header of main.cpp.

/usr/include/fbx-extract$ sudo make
[ 25%] Building CXX object CMakeFiles/fbx-extract.dir/src/main.cpp.o
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveSkin(const ofbx::IScene*)’:
/usr/include/fbx-extract/src/main.cpp:453:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
  453 |   fprintf(fp, "%d %d %d\n", vertex_count, limbVec.size(), mesh.maxInfluences);
      |                   ~^                      ~~~~~~~~~~~~~~
      |                    |                                  |
      |                    int                                std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                   %ld
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveAnim(const ofbx::IScene*)’:
/usr/include/fbx-extract/src/main.cpp:727:9: error: ‘strcmp’ was not declared in this scope
  727 |      if(strcmp(child->name, "R") == 0) {
      |         ^~~~~~
/usr/include/fbx-extract/src/main.cpp:18:1: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
   17 | #include <math.h>
  +++ |+#include <cstring>
   18 |
/usr/include/fbx-extract/src/main.cpp:828:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
  828 |  fprintf(fp, "%d %d\n", key_count_max, limbVec.size());
      |                  ~^                    ~~~~~~~~~~~~~~
      |                   |                                |
      |                   int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                  %ld
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveInputfile()’:
/usr/include/fbx-extract/src/main.cpp:878:33: warning: format not a string literal and no format arguments [-Wformat-security]
  878 |  fprintf(fp, TEXTURENAME.c_str());
      |                                 ^
/usr/include/fbx-extract/src/main.cpp:881:31: warning: format not a string literal and no format arguments [-Wformat-security]
  881 |  fprintf(fp, file_name.c_str());
      |                               ^
/usr/include/fbx-extract/src/main.cpp:887:33: warning: format not a string literal and no format arguments [-Wformat-security]
  887 |   fprintf(fp, input_line.c_str());
      |                                 ^
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveLocalTransfomfile()’:
/usr/include/fbx-extract/src/main.cpp:1022:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1022 |  fprintf(fp, "%d\n",limbVec.size());
      |               ~^    ~~~~~~~~~~~~~~
      |                |                |
      |                int              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |               %ld
/usr/include/fbx-extract/src/main.cpp:1035:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1035 |  fprintf(fp2, "%d %d\n", key_count_max, limbVec.size());
      |                   ~^                    ~~~~~~~~~~~~~~
      |                    |                                |
      |                    int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                   %ld
/usr/include/fbx-extract/src/main.cpp:1082:10: error: ‘strcmp’ was not declared in this scope
 1082 |      if (strcmp(child->name, "R") == 0) {
      |          ^~~~~~
/usr/include/fbx-extract/src/main.cpp:1082:10: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/usr/include/fbx-extract/src/main.cpp:1181:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1181 |  fprintf(fp, "%d\n", limbVec.size());
      |               ~^     ~~~~~~~~~~~~~~
      |                |                 |
      |                int               std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |               %ld
/usr/include/fbx-extract/src/main.cpp:1196:28: warning: format not a string literal and no format arguments [-Wformat-security]
 1196 |    fprintf(fp, limbVec[j]->name);
/usr/include/fbx-extract/src/main.cpp:1217:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1217 |  fprintf(fp, "%d %d\n", key_count_max, limbVec.size());
      |                  ~^                    ~~~~~~~~~~~~~~
      |                   |                                |
      |                   int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                  %ld
make[2]: *** [CMakeFiles/fbx-extract.dir/build.make:63: CMakeFiles/fbx-extract.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/fbx-extract.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
```/usr/include/fbx-extract$ sudo make
[ 25%] Building CXX object CMakeFiles/fbx-extract.dir/src/main.cpp.o
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveSkin(const ofbx::IScene*)’:
/usr/include/fbx-extract/src/main.cpp:453:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
  453 |   fprintf(fp, "%d %d %d\n", vertex_count, limbVec.size(), mesh.maxInfluences);
      |                   ~^                      ~~~~~~~~~~~~~~
      |                    |                                  |
      |                    int                                std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                   %ld
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveAnim(const ofbx::IScene*)’:
/usr/include/fbx-extract/src/main.cpp:727:9: error: ‘strcmp’ was not declared in this scope
  727 |      if(strcmp(child->name, "R") == 0) {
      |         ^~~~~~
/usr/include/fbx-extract/src/main.cpp:18:1: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
   17 | #include <math.h>
  +++ |+#include <cstring>
   18 |
/usr/include/fbx-extract/src/main.cpp:828:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
  828 |  fprintf(fp, "%d %d\n", key_count_max, limbVec.size());
      |                  ~^                    ~~~~~~~~~~~~~~
      |                   |                                |
      |                   int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                  %ld
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveInputfile()’:
/usr/include/fbx-extract/src/main.cpp:878:33: warning: format not a string literal and no format arguments [-Wformat-security]
  878 |  fprintf(fp, TEXTURENAME.c_str());
      |                                 ^
/usr/include/fbx-extract/src/main.cpp:881:31: warning: format not a string literal and no format arguments [-Wformat-security]
  881 |  fprintf(fp, file_name.c_str());
      |                               ^
/usr/include/fbx-extract/src/main.cpp:887:33: warning: format not a string literal and no format arguments [-Wformat-security]
  887 |   fprintf(fp, input_line.c_str());
      |                                 ^
/usr/include/fbx-extract/src/main.cpp: In function ‘bool saveLocalTransfomfile()’:
/usr/include/fbx-extract/src/main.cpp:1022:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1022 |  fprintf(fp, "%d\n",limbVec.size());
      |               ~^    ~~~~~~~~~~~~~~
      |                |                |
      |                int              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |               %ld
/usr/include/fbx-extract/src/main.cpp:1035:20: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1035 |  fprintf(fp2, "%d %d\n", key_count_max, limbVec.size());
      |                   ~^                    ~~~~~~~~~~~~~~
      |                    |                                |
      |                    int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                   %ld
/usr/include/fbx-extract/src/main.cpp:1082:10: error: ‘strcmp’ was not declared in this scope
 1082 |      if (strcmp(child->name, "R") == 0) {
      |          ^~~~~~
/usr/include/fbx-extract/src/main.cpp:1082:10: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/usr/include/fbx-extract/src/main.cpp:1181:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1181 |  fprintf(fp, "%d\n", limbVec.size());
      |               ~^     ~~~~~~~~~~~~~~
      |                |                 |
      |                int               std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |               %ld
/usr/include/fbx-extract/src/main.cpp:1196:28: warning: format not a string literal and no format arguments [-Wformat-security]
 1196 |    fprintf(fp, limbVec[j]->name);
/usr/include/fbx-extract/src/main.cpp:1217:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::vector<const ofbx::Object*>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
 1217 |  fprintf(fp, "%d %d\n", key_count_max, limbVec.size());
      |                  ~^                    ~~~~~~~~~~~~~~
      |                   |                                |
      |                   int                              std::vector<const ofbx::Object*>::size_type {aka long unsigned int}
      |                  %ld
make[2]: *** [CMakeFiles/fbx-extract.dir/build.make:63: CMakeFiles/fbx-extract.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/fbx-extract.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Texture extraction

  • If there are multiple texture files, the generated input.txt does not match the texture to the correct mesh.
  • The texture names may contain spaces, which may cause the parser to treat them as two separate entities.

run it on Linux

Hi, I would really like to try this out.

could you please give us more info how to make it run ?

I would like to run it on a Linux environment if that's possible.

Best,
Albion

Segmentation fault error

Hello, thank you for creating wonderful program.

I have a question.
I tried this program but segmentation fault error occurred.

My fbx file is simple.
My fbx file has 3d object data, skin and animation.

If you know this error, Please give me something suggests.

=== geometry ===
pSphere1: 2280 verts, 439 unique

pSphere2: 2280 verts, 439 unique
Saving to bone_pSphere1.obj
Saving to bone_pSphere2.obj
=== skin ===
pSphere1: 2280 vertices
pSphere2: 2280 vertices
Saving to bone_pSphere1_skin.txt
Saving to bone_pSphere2_skin.txt
=== skeleton ===
2 clusters
zsh: segmentation fault ./fbx-extract

Screen Shot 2022-01-09 at 0 55 52

Off-by-1 error due to Undefined Behavior

In fbx-extract on line 539 you have limbMap[limb] = (int)limbMap.size();
This has undefined behavior on which call (limbMap[limb] or limbMap.size()) gets evaluated first. This off-by-1 error causes a segfault error at line 807 if the order is not what is expected.
Fixing the code to look like:

int limbMapSize = (int)limbMap.size();
limbMap[limb] = limbMapSize;

solves the crashing problem with my machine and compiler.

how to use skeletal animation

Hi, I tried to visualize the extracted skeletal animation. For the rest pose (1st frame), directly visualizing the bone positions (x,y,z) gives me a rest pose skeleton. For the animation frames, visualizing the bone positions does not give any meaningful skeleton. I am curious how can I get the correct skeleton sequence from the extracted skeletal animation.

I tried to guess the meaning of per frame rotation and translation (e.g. joint coordinate to world coordinate transform, world coordinate to joint coordinate transform, product of transformation matrix and bind matrix etc) and compute the per frame skeleton accordingly, but none of it correct. Maybe I am missing something.

BTW, my fbx file is downloaded from mixamo.

CMake Error: Environment variable for GLM_INCLUDE_DIR

I git cloned the GLM library to the same directory that I've cloned fbx-extract. I went into the glm library and performed the cmake command:

/usr/include/glm/cmake$ cmake ..
-- GLM: Version 0.9.9.9
GLM: GCC - GNU compiler
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/include/glm/cmake

Following your instructions, I get a CMake error:

/usr/include/fbx-extract/build$ sudo cmake ..
CMake Error at CMakeLists.txt:31 (MESSAGE):
  Please point the environment variable GLM_INCLUDE_DIR to the root directory
  of your GLM installation.


-- Configuring incomplete, errors occurred!
See also "/usr/include/fbx-extract/build/CMakeFiles/CMakeOutput.log".

I'm using Ubuntu on Windows. Here is the end of my ~/.profile file:
export GLM_INCLUDE_DIR="/usr/include/glm"

And a sanity check:

/usr/include/fbx-extract/build$ echo $GLM_INCLUDE_DIR
/usr/include/glm

What have I done wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.