Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the dae2dts tool when compiled using VisualStudio 2012.
The first compilation issue is that the compiler cannot open
nfd.h. This is because${libDir}/nativeFileDialogs/includeis not added to the project include paths whenTORQUE_SDLis disabled. I fixed this by moving#include <nfd.h>to within the#if defined(TORQUE_SDL)preprocessor directive.The second compilation issue is that the compiler cannot open
al/al.h. This is becauseopenal/win32is added to the project include paths instead ofopenal-soft/include. I fixed this by updating the include paths in the core and T3D project generator modules.The last compilation issue is that
Component::setOwner(class Entity *)is undefined. This is because theT3D/componentsengine source directory is not included. I fixed this by adding it to the T3D project generator module.After getting the program to compile it then generates a fatal error
SimObject::object missing call to SimObject::onRemovewhen run without specifying a DAE file. This is because the program terminates without shutting down the platform. I fixed this by shutting down the platform before terminating.When you run the program again with a DAE file, it generates an error when
TSShapeLoaderinitializes theTSShape, as there is no GFX device to initialize the vertex buffers. I fixed this by settingTSShape::smInitOnReadtofalseand makingTSShapeLoaderadhere to this setting when initializing theTSShape.After fixing this the program converts DAE models to DTS shapes successfully, however generates a write access violation error when the program exits. This is because the
TSShaperesource is not unloaded until it goes out of scope, after the platform has shutdown. I fixed this by adding a block scope to theTSShaperesource to ensure it goes out of scope before the platform is shutdown.To generate the project files I am doing the following:
Open the dae2dts directory
Run generateProjects.bat
Open the buildFiles directory
Copy torque.ico and Torque.rc from VisualStudio 2008\projects to VisualStudio 2012\projects
Open VisualStudio 2012\dae2dts.sln
On the dae2dts project, go to it's properties, then:
Application (.exe)$(OutDir)dae2dts_DEBUG.exeI am not sure if this is the correct way to fix all of these issues so please let me know if you have any feedback.
...
I also had to modify
TSShapeLoaderto prevent clearing theTSShapesplit vertex lists whenTSShape::smInitOnReadis set tofalse, as the split vertex lists are not being stored in a vertex buffer and are still required.I tested this using teapot.dae and the
--compatcommand line argument and verified the model loaded correctly in Torque ShowTool Pro....
Looks like this solution only works when writing the shape in the old format because the new format depends on the vertex buffers and generates a "vertex size mismatch" error when loaded. Not really sure how to go about solving this.
Original PR from GarageGames repo:
GarageGames/Torque3D#1950