mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-23 14:20:57 +00:00
Merge pull request #665 from andr3wmac/multiformat
Support for large lists of shape formats.
This commit is contained in:
commit
cf5d48e6ef
10 changed files with 154 additions and 20 deletions
|
|
@ -764,8 +764,7 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
|
|||
|
||||
// Change filespec
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFilename(\"%s\", \"%d.apply\", %d.getData());",
|
||||
"DTS Files (*.dts)|*.dts|COLLADA Files (*.dae)|*.dae|(All Files (*.*)|*.*|", getId(), getId() );
|
||||
dSprintf( szBuffer, sizeof(szBuffer), "getLoadFormatFilename(\"%d.apply\", %d.getData());", getId(), getId() );
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
|
||||
// Create "Open in ShapeEditor" button
|
||||
|
|
|
|||
|
|
@ -50,6 +50,15 @@
|
|||
#include "core/util/zip/zipVolume.h"
|
||||
#include "gfx/bitmap/gBitmap.h"
|
||||
|
||||
MODULE_BEGIN( ColladaShapeLoader )
|
||||
MODULE_INIT_AFTER( ShapeLoader )
|
||||
MODULE_INIT
|
||||
{
|
||||
TSShapeLoader::addFormat("Collada", "dae");
|
||||
TSShapeLoader::addFormat("Google Earth", "kmz");
|
||||
}
|
||||
MODULE_END;
|
||||
|
||||
//
|
||||
static DAE sDAE; // Collada model database (holds the last loaded file)
|
||||
static Torque::Path sLastPath; // Path of the last loaded Collada file
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "ts/loader/tsShapeLoader.h"
|
||||
|
||||
#include "core/volume.h"
|
||||
|
|
@ -30,6 +31,14 @@
|
|||
#include "ts/tsShapeInstance.h"
|
||||
#include "ts/tsMaterialList.h"
|
||||
|
||||
MODULE_BEGIN( ShapeLoader )
|
||||
MODULE_INIT_AFTER( GFX )
|
||||
MODULE_INIT
|
||||
{
|
||||
TSShapeLoader::addFormat("Torque DTS", "dts");
|
||||
TSShapeLoader::addFormat("Torque DSQ", "dsq");
|
||||
}
|
||||
MODULE_END;
|
||||
|
||||
const F32 TSShapeLoader::DefaultTime = -1.0f;
|
||||
const F64 TSShapeLoader::MinFrameRate = 15.0f;
|
||||
|
|
@ -37,6 +46,8 @@ const F64 TSShapeLoader::MaxFrameRate = 60.0f;
|
|||
const F64 TSShapeLoader::AppGroundFrameRate = 10.0f;
|
||||
Torque::Path TSShapeLoader::shapePath;
|
||||
|
||||
Vector<TSShapeLoader::ShapeFormat> TSShapeLoader::smFormats;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Utility functions
|
||||
|
||||
|
|
@ -1270,3 +1281,53 @@ TSShapeLoader::~TSShapeLoader()
|
|||
delete appSequences[iSeq];
|
||||
appSequences.clear();
|
||||
}
|
||||
|
||||
// Static functions to handle supported formats for shape loader.
|
||||
void TSShapeLoader::addFormat(String name, String extension)
|
||||
{
|
||||
ShapeFormat newFormat;
|
||||
newFormat.mName = name;
|
||||
newFormat.mExtension = extension;
|
||||
smFormats.push_back(newFormat);
|
||||
}
|
||||
|
||||
String TSShapeLoader::getFormatExtensions()
|
||||
{
|
||||
// "*.dsq TAB *.dae TAB
|
||||
StringBuilder output;
|
||||
for(U32 n = 0; n < smFormats.size(); ++n)
|
||||
{
|
||||
output.append("*.");
|
||||
output.append(smFormats[n].mExtension);
|
||||
output.append("\t");
|
||||
}
|
||||
return output.end();
|
||||
}
|
||||
|
||||
String TSShapeLoader::getFormatFilters()
|
||||
{
|
||||
// "DSQ Files|*.dsq|COLLADA Files|*.dae|"
|
||||
StringBuilder output;
|
||||
for(U32 n = 0; n < smFormats.size(); ++n)
|
||||
{
|
||||
output.append(smFormats[n].mName);
|
||||
output.append("|*.");
|
||||
output.append(smFormats[n].mExtension);
|
||||
output.append("|");
|
||||
}
|
||||
return output.end();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFormatExtensions, const char*, ( ),,
|
||||
"Returns a list of supported shape format extensions separated by tabs."
|
||||
"Example output: *.dsq TAB *.dae TAB")
|
||||
{
|
||||
return Con::getReturnBuffer(TSShapeLoader::getFormatExtensions());
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFormatFilters, const char*, ( ),,
|
||||
"Returns a list of supported shape formats in filter form.\n"
|
||||
"Example output: DSQ Files|*.dsq|COLLADA Files|*.dae|")
|
||||
{
|
||||
return Con::getReturnBuffer(TSShapeLoader::getFormatFilters());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,19 @@
|
|||
class TSShapeLoader
|
||||
{
|
||||
|
||||
// Supported Format List
|
||||
protected:
|
||||
struct ShapeFormat
|
||||
{
|
||||
String mName;
|
||||
String mExtension;
|
||||
};
|
||||
static Vector<ShapeFormat> smFormats;
|
||||
public:
|
||||
static void addFormat(String name, String extension);
|
||||
static String getFormatExtensions();
|
||||
static String getFormatFilters();
|
||||
|
||||
public:
|
||||
enum eLoadPhases
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue