mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
fix for shape registration
The automatic global static was hitting a destructor on xcode, this seemed like it was being pedantic about name at first but then between runs the same issue would come back. With this change it is wrapped in a function to get the vector instead.
This commit is contained in:
parent
0c2aa5328c
commit
e83bab90d7
4 changed files with 23 additions and 14 deletions
|
|
@ -1302,9 +1302,9 @@ String TSShapeLoader::getFormatExtensions()
|
||||||
{
|
{
|
||||||
// "*.dsq TAB *.dae TAB
|
// "*.dsq TAB *.dae TAB
|
||||||
StringBuilder output;
|
StringBuilder output;
|
||||||
for(U32 n = 0; n < TSShape::sRegistrations.size(); ++n)
|
for(U32 n = 0; n < TSShape::getShapeRegistrations().size(); ++n)
|
||||||
{
|
{
|
||||||
TSShape::ShapeRegistration reg = TSShape::sRegistrations[n];
|
TSShape::ShapeRegistration reg = TSShape::getShapeRegistrations()[n];
|
||||||
for (U32 i = 0; i < reg.extensions.size(); i++)
|
for (U32 i = 0; i < reg.extensions.size(); i++)
|
||||||
{
|
{
|
||||||
TSShape::ShapeFormat format = reg.extensions[i];
|
TSShape::ShapeFormat format = reg.extensions[i];
|
||||||
|
|
@ -1320,9 +1320,9 @@ String TSShapeLoader::getFormatFilters()
|
||||||
{
|
{
|
||||||
// "DSQ Files|*.dsq|COLLADA Files|*.dae|"
|
// "DSQ Files|*.dsq|COLLADA Files|*.dae|"
|
||||||
StringBuilder output;
|
StringBuilder output;
|
||||||
for (U32 n = 0; n < TSShape::sRegistrations.size(); ++n)
|
for (U32 n = 0; n < TSShape::getShapeRegistrations().size(); ++n)
|
||||||
{
|
{
|
||||||
TSShape::ShapeRegistration reg = TSShape::sRegistrations[n];
|
TSShape::ShapeRegistration reg = TSShape::getShapeRegistrations()[n];
|
||||||
for (U32 i = 0; i < reg.extensions.size(); i++)
|
for (U32 i = 0; i < reg.extensions.size(); i++)
|
||||||
{
|
{
|
||||||
TSShape::ShapeFormat format = reg.extensions[i];
|
TSShape::ShapeFormat format = reg.extensions[i];
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,28 @@
|
||||||
#include "core/stream/fileStream.h"
|
#include "core/stream/fileStream.h"
|
||||||
#include "core/fileObject.h"
|
#include "core/fileObject.h"
|
||||||
|
|
||||||
Vector<TSShape::ShapeRegistration> TSShape::sRegistrations(__FILE__, __LINE__);
|
// Vector<TSShape::ShapeRegistration> TSShape::sShapeRegistrations(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
Vector<TSShape::ShapeRegistration>& TSShape::getShapeRegistrations()
|
||||||
|
{
|
||||||
|
static Vector<TSShape::ShapeRegistration>* regs =
|
||||||
|
new Vector<TSShape::ShapeRegistration>(__FILE__, __LINE__);
|
||||||
|
|
||||||
|
return *regs;
|
||||||
|
}
|
||||||
|
|
||||||
void TSShape::sRegisterFormat(const ShapeRegistration& reg)
|
void TSShape::sRegisterFormat(const ShapeRegistration& reg)
|
||||||
{
|
{
|
||||||
U32 insert = sRegistrations.size();
|
U32 insert = getShapeRegistrations().size();
|
||||||
sRegistrations.insert(insert, reg);
|
getShapeRegistrations().insert(insert, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TSShape::ShapeRegistration* TSShape::sFindRegInfo(const String& extension, bool exporting)
|
|
||||||
|
const TSShape::ShapeRegistration* TSShape::sFindShapeRegInfo(const String& extension, bool exporting)
|
||||||
{
|
{
|
||||||
for (U32 i = 0; i < TSShape::sRegistrations.size(); i++)
|
for (U32 i = 0; i < getShapeRegistrations().size(); i++)
|
||||||
{
|
{
|
||||||
const TSShape::ShapeRegistration& reg = TSShape::sRegistrations[i];
|
const TSShape::ShapeRegistration& reg = getShapeRegistrations()[i];
|
||||||
const Vector<ShapeFormat>& extensions = exporting ? reg.export_extensions : reg.extensions;
|
const Vector<ShapeFormat>& extensions = exporting ? reg.export_extensions : reg.extensions;
|
||||||
|
|
||||||
for (U32 j = 0; j < extensions.size(); j++)
|
for (U32 j = 0; j < extensions.size(); j++)
|
||||||
|
|
@ -2358,7 +2367,7 @@ template<> void *Resource<TSShape>::create(const Torque::Path &path)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const TSShape::ShapeRegistration* regInfo = TSShape::sFindRegInfo(extension);
|
const TSShape::ShapeRegistration* regInfo = TSShape::sFindShapeRegInfo(extension);
|
||||||
if (regInfo == NULL)
|
if (regInfo == NULL)
|
||||||
{
|
{
|
||||||
readSuccess = false;
|
readSuccess = false;
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sRegisterFormat(const ShapeRegistration& reg);
|
static void sRegisterFormat(const ShapeRegistration& reg);
|
||||||
static const ShapeRegistration* sFindRegInfo(const String& extension, bool exporting = false);
|
static const ShapeRegistration* sFindShapeRegInfo(const String& extension, bool exporting = false);
|
||||||
static Vector<ShapeRegistration> sRegistrations;
|
static Vector<ShapeRegistration>& getShapeRegistrations();
|
||||||
|
|
||||||
/// Nodes hold the transforms in the shape's tree. They are the bones of the skeleton.
|
/// Nodes hold the transforms in the shape's tree. They are the bones of the skeleton.
|
||||||
struct Node
|
struct Node
|
||||||
|
|
|
||||||
|
|
@ -1361,7 +1361,7 @@ bool TSShape::isShapeFileType(Torque::Path filePath)
|
||||||
{
|
{
|
||||||
String fileExt = filePath.getExtension();
|
String fileExt = filePath.getExtension();
|
||||||
|
|
||||||
if (TSShape::sFindRegInfo(fileExt))
|
if (TSShape::sFindShapeRegInfo(fileExt))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue