mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Merge remote-tracking branch 'devhead/Preview4_0' into tsneo
# Conflicts: # Templates/BaseGame/game/data/ui/guis/loadingGui.gui # Templates/BaseGame/game/data/ui/guis/mainMenu.gui # Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui # Templates/BaseGame/game/tools/assetBrowser/guis/assetPreviewButtonsTemplate.gui # Templates/BaseGame/game/tools/forestEditor/brushes.tscript
This commit is contained in:
commit
717c7acca9
2266 changed files with 48780 additions and 26034 deletions
|
|
@ -20,7 +20,7 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include "tinyxml/tinyxml2.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console implementation of STL map.
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
#include "console/consoleInternal.h"
|
||||
#include "console/SimXMLDocument.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "persistence/taml/fsTinyXml.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(SimXMLDocument);
|
||||
|
||||
|
|
@ -175,7 +176,7 @@ bool SimXMLDocument::onAdd()
|
|||
|
||||
if(!m_qDocument)
|
||||
{
|
||||
m_qDocument = new TiXmlDocument();
|
||||
m_qDocument = new VfsXMLDocument();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -252,7 +253,7 @@ bool SimXMLDocument::saveFile(const char* rFileName)
|
|||
// -----------------------------------------------------------------------------
|
||||
bool SimXMLDocument::saveToString(String& str)
|
||||
{
|
||||
TiXmlPrinter printer;
|
||||
tinyxml2::XMLPrinter printer;
|
||||
bool ret = m_qDocument->Accept( &printer );
|
||||
if (ret)
|
||||
str = printer.CStr();
|
||||
|
|
@ -312,7 +313,7 @@ const char* SimXMLDocument::getErrorDesc(void) const
|
|||
{
|
||||
return StringTable->insert("No document");
|
||||
}
|
||||
return m_qDocument->ErrorDesc();
|
||||
return m_qDocument->ErrorStr();
|
||||
}
|
||||
|
||||
DefineEngineMethod( SimXMLDocument, getErrorDesc, const char*, (),,
|
||||
|
|
@ -345,11 +346,11 @@ bool SimXMLDocument::pushFirstChildElement(const char* rName)
|
|||
m_CurrentAttribute = 0;
|
||||
|
||||
// Push the first element found under the current element of the given name
|
||||
TiXmlElement* pElement;
|
||||
tinyxml2::XMLElement* pElement;
|
||||
if(!m_paNode.empty())
|
||||
{
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -409,11 +410,11 @@ bool SimXMLDocument::pushChildElement(S32 index)
|
|||
m_CurrentAttribute = 0;
|
||||
|
||||
// Push the first element found under the current element of the given name
|
||||
TiXmlElement* pElement;
|
||||
tinyxml2::XMLElement* pElement;
|
||||
if(!m_paNode.empty())
|
||||
{
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -473,7 +474,7 @@ bool SimXMLDocument::nextSiblingElement(const char* rName)
|
|||
return false;
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement*& pElement = m_paNode[iLastElement];
|
||||
tinyxml2::XMLNode*& pElement = m_paNode[iLastElement];
|
||||
if(!pElement)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -507,7 +508,7 @@ const char* SimXMLDocument::elementValue()
|
|||
return StringTable->EmptyString();
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -548,7 +549,7 @@ const char* SimXMLDocument::attribute(const char* rAttribute)
|
|||
return StringTable->EmptyString();
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
|
||||
if(!pNode)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -599,7 +600,7 @@ bool SimXMLDocument::attributeExists(const char* rAttribute)
|
|||
return false;
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
|
||||
if(!pNode)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -632,7 +633,7 @@ const char* SimXMLDocument::firstAttribute()
|
|||
return StringTable->EmptyString();
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
|
||||
if(!pNode)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -669,14 +670,18 @@ const char* SimXMLDocument::lastAttribute()
|
|||
return StringTable->EmptyString();
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
|
||||
if(!pNode)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
// Gets its last attribute, if any
|
||||
m_CurrentAttribute = pNode->LastAttribute();
|
||||
m_CurrentAttribute = pNode->FirstAttribute();
|
||||
while (m_CurrentAttribute->Next() != NULL)
|
||||
{
|
||||
m_CurrentAttribute = m_CurrentAttribute->Next();
|
||||
}
|
||||
if(!m_CurrentAttribute)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -732,13 +737,29 @@ DefineEngineMethod( SimXMLDocument, nextAttribute, const char*, (),,
|
|||
// -----------------------------------------------------------------------------
|
||||
const char* SimXMLDocument::prevAttribute()
|
||||
{
|
||||
// Get the current element
|
||||
if (m_paNode.empty())
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement();
|
||||
if (!pNode)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
if(!m_CurrentAttribute)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
// Gets its next attribute, if any
|
||||
m_CurrentAttribute = m_CurrentAttribute->Previous();
|
||||
while (m_CurrentAttribute != NULL && m_CurrentAttribute->Next() != m_CurrentAttribute)
|
||||
{
|
||||
m_CurrentAttribute = m_CurrentAttribute->Next();
|
||||
}
|
||||
|
||||
if(!m_CurrentAttribute)
|
||||
{
|
||||
return StringTable->EmptyString();
|
||||
|
|
@ -768,7 +789,7 @@ void SimXMLDocument::setAttribute(const char* rAttribute, const char* rVal)
|
|||
}
|
||||
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pElement = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pElement = m_paNode[iLastElement]->ToElement();
|
||||
if(!pElement)
|
||||
{
|
||||
return;
|
||||
|
|
@ -800,13 +821,13 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
|
|||
return;
|
||||
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pElement = m_paNode[iLastElement];
|
||||
tinyxml2::XMLElement* pElement = m_paNode[iLastElement]->ToElement();
|
||||
if(!pElement)
|
||||
return;
|
||||
|
||||
char textbuf[1024];
|
||||
TiXmlElement field( "Field" );
|
||||
TiXmlElement group( "FieldGroup" );
|
||||
tinyxml2::XMLElement* field = m_qDocument->NewElement("Field");
|
||||
tinyxml2::XMLElement* group = m_qDocument->NewElement("FieldGroup");
|
||||
pElement->SetAttribute( "Name", pObject->getName() );
|
||||
|
||||
|
||||
|
|
@ -846,13 +867,13 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
|
|||
if( !pObject->writeField( itr->pFieldname, textbuf ) )
|
||||
continue;
|
||||
|
||||
field.SetValue( "Property" );
|
||||
field.SetAttribute( "name", itr->pFieldname );
|
||||
field->SetValue( "Property" );
|
||||
field->SetAttribute( "name", itr->pFieldname );
|
||||
if( cbt != NULL )
|
||||
field.SetAttribute( "type", cbt->getTypeName() );
|
||||
field->SetAttribute( "type", cbt->getTypeName() );
|
||||
else
|
||||
field.SetAttribute( "type", "TypeString" );
|
||||
field.SetAttribute( "data", textbuf );
|
||||
field->SetAttribute( "type", "TypeString" );
|
||||
field->SetAttribute( "data", textbuf );
|
||||
|
||||
pElement->InsertEndChild( field );
|
||||
|
||||
|
|
@ -917,23 +938,21 @@ DefineEngineMethod( SimXMLDocument, setObjectAttributes, void, ( const char* obj
|
|||
// -----------------------------------------------------------------------------
|
||||
void SimXMLDocument::pushNewElement(const char* rName)
|
||||
{
|
||||
TiXmlElement cElement( rName );
|
||||
TiXmlElement* pStackTop = 0;
|
||||
tinyxml2::XMLElement* cElement = m_qDocument->NewElement( rName );
|
||||
tinyxml2::XMLNode* pStackTop = 0;
|
||||
if(m_paNode.empty())
|
||||
{
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
(m_qDocument->InsertEndChild( cElement ) );
|
||||
pStackTop = m_qDocument->InsertEndChild(cElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode *pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
(pNode->InsertEndChild( cElement ));
|
||||
pStackTop = pNode->InsertEndChild( cElement );
|
||||
}
|
||||
if(!pStackTop)
|
||||
{
|
||||
|
|
@ -961,13 +980,12 @@ DefineEngineMethod( SimXMLDocument, pushNewElement, void, ( const char* name ),,
|
|||
// New element is placed on top of element stack.
|
||||
// -----------------------------------------------------------------------------
|
||||
void SimXMLDocument::addNewElement(const char* rName)
|
||||
{
|
||||
TiXmlElement cElement( rName );
|
||||
TiXmlElement* pStackTop = 0;
|
||||
{
|
||||
tinyxml2::XMLElement* cElement = m_qDocument->NewElement(rName);
|
||||
tinyxml2::XMLNode* pStackTop = 0;
|
||||
if(m_paNode.empty())
|
||||
{
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
(m_qDocument->InsertEndChild( cElement ));
|
||||
pStackTop = m_qDocument->InsertEndChild( cElement );
|
||||
if(!pStackTop)
|
||||
{
|
||||
return;
|
||||
|
|
@ -979,8 +997,7 @@ void SimXMLDocument::addNewElement(const char* rName)
|
|||
const S32 iParentElement = m_paNode.size() - 2;
|
||||
if(iParentElement < 0)
|
||||
{
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
(m_qDocument->InsertEndChild( cElement ));
|
||||
pStackTop = m_qDocument->InsertEndChild( cElement );
|
||||
if(!pStackTop)
|
||||
{
|
||||
return;
|
||||
|
|
@ -990,13 +1007,12 @@ void SimXMLDocument::addNewElement(const char* rName)
|
|||
}
|
||||
else
|
||||
{
|
||||
TiXmlElement* pNode = m_paNode[iParentElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iParentElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
(pNode->InsertEndChild( cElement ));
|
||||
pStackTop = pNode->InsertEndChild( cElement );
|
||||
if(!pStackTop)
|
||||
{
|
||||
return;
|
||||
|
|
@ -1029,7 +1045,7 @@ DefineEngineMethod( SimXMLDocument, addNewElement, void, ( const char* name ),,
|
|||
// -----------------------------------------------------------------------------
|
||||
void SimXMLDocument::addHeader(void)
|
||||
{
|
||||
TiXmlDeclaration cDeclaration("1.0", "utf-8", "yes");
|
||||
tinyxml2::XMLDeclaration* cDeclaration = m_qDocument->NewDeclaration("xml version=\"1.0\" encoding=\"UTF-8\" standalone =\"yes\"");
|
||||
m_qDocument->InsertEndChild(cDeclaration);
|
||||
}
|
||||
|
||||
|
|
@ -1057,8 +1073,8 @@ DefineEngineMethod( SimXMLDocument, addHeader, void, (),,
|
|||
|
||||
void SimXMLDocument::addComment(const char* comment)
|
||||
{
|
||||
TiXmlComment cComment;
|
||||
cComment.SetValue(comment);
|
||||
tinyxml2::XMLComment* cComment = m_qDocument->NewComment(comment);
|
||||
cComment->SetValue(comment);
|
||||
m_qDocument->InsertEndChild(cComment);
|
||||
}
|
||||
|
||||
|
|
@ -1093,12 +1109,12 @@ const char* SimXMLDocument::readComment( S32 index )
|
|||
if(!m_paNode.empty())
|
||||
{
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
TiXmlNode* node = pNode->FirstChild();
|
||||
tinyxml2::XMLNode* node = pNode->FirstChild();
|
||||
for( S32 i = 0; i < index; i++ )
|
||||
{
|
||||
if( !node )
|
||||
|
|
@ -1109,7 +1125,7 @@ const char* SimXMLDocument::readComment( S32 index )
|
|||
|
||||
if( node )
|
||||
{
|
||||
TiXmlComment* comment = node->ToComment();
|
||||
tinyxml2::XMLComment* comment = node->ToComment();
|
||||
if( comment )
|
||||
return comment->Value();
|
||||
}
|
||||
|
|
@ -1120,7 +1136,7 @@ const char* SimXMLDocument::readComment( S32 index )
|
|||
{
|
||||
return "";
|
||||
}
|
||||
TiXmlNode* node = m_qDocument->FirstChild();
|
||||
tinyxml2::XMLNode* node = m_qDocument->FirstChild();
|
||||
for( S32 i = 0; i < index; i++ )
|
||||
{
|
||||
if( !node )
|
||||
|
|
@ -1131,7 +1147,7 @@ const char* SimXMLDocument::readComment( S32 index )
|
|||
|
||||
if( node )
|
||||
{
|
||||
TiXmlComment* comment = node->ToComment();
|
||||
tinyxml2::XMLComment* comment = node->ToComment();
|
||||
if( comment )
|
||||
return comment->Value();
|
||||
}
|
||||
|
|
@ -1161,11 +1177,11 @@ void SimXMLDocument::addText(const char* text)
|
|||
return;
|
||||
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
||||
TiXmlText cText(text);
|
||||
tinyxml2::XMLText* cText = m_qDocument->NewText(text);
|
||||
pNode->InsertEndChild( cText );
|
||||
}
|
||||
|
||||
|
|
@ -1206,14 +1222,14 @@ const char* SimXMLDocument::getText()
|
|||
return "";
|
||||
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlNode* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return "";
|
||||
|
||||
if(!pNode->FirstChild())
|
||||
return "";
|
||||
|
||||
TiXmlText* text = pNode->FirstChild()->ToText();
|
||||
tinyxml2::XMLText* text = pNode->FirstChild()->ToText();
|
||||
if( !text )
|
||||
return "";
|
||||
|
||||
|
|
@ -1266,18 +1282,18 @@ void SimXMLDocument::removeText()
|
|||
return;
|
||||
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
||||
if( !pNode->FirstChild() )
|
||||
return;
|
||||
|
||||
TiXmlText* text = pNode->FirstChild()->ToText();
|
||||
tinyxml2::XMLText* text = pNode->FirstChild()->ToText();
|
||||
if( !text )
|
||||
return;
|
||||
|
||||
pNode->RemoveChild(text);
|
||||
pNode->DeleteChild(text);
|
||||
}
|
||||
|
||||
DefineEngineMethod( SimXMLDocument, removeText, void, (),,
|
||||
|
|
@ -1302,11 +1318,11 @@ void SimXMLDocument::addData(const char* text)
|
|||
return;
|
||||
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
||||
TiXmlText cText(text);
|
||||
tinyxml2::XMLText* cText = m_qDocument->NewText(text);
|
||||
pNode->InsertEndChild( cText );
|
||||
}
|
||||
|
||||
|
|
@ -1348,14 +1364,14 @@ const char* SimXMLDocument::getData()
|
|||
return "";
|
||||
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlNode* pNode = m_paNode[iFinalElement];
|
||||
tinyxml2::XMLNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return "";
|
||||
|
||||
if( !pNode->FirstChild() )
|
||||
return "";
|
||||
|
||||
TiXmlText* text = pNode->FirstChild()->ToText();
|
||||
tinyxml2::XMLText* text = pNode->FirstChild()->ToText();
|
||||
if( !text )
|
||||
return "";
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,10 @@
|
|||
#include "core/util/tVector.h"
|
||||
#endif // _TVECTOR_H_
|
||||
|
||||
|
||||
class TiXmlDocument;
|
||||
class TiXmlElement;
|
||||
class TiXmlAttribute;
|
||||
|
||||
#ifndef TINYXML2_INCLUDED
|
||||
#include <tinyxml2.h>
|
||||
#endif // TINYXML2_INCLUDED
|
||||
#include "persistence/taml/fsTinyXml.h"
|
||||
|
||||
class SimXMLDocument: public SimObject
|
||||
{
|
||||
|
|
@ -136,11 +135,11 @@ class SimXMLDocument: public SimObject
|
|||
|
||||
private:
|
||||
// Document.
|
||||
TiXmlDocument* m_qDocument;
|
||||
VfsXMLDocument* m_qDocument;
|
||||
// Stack of nodes.
|
||||
Vector<TiXmlElement*> m_paNode;
|
||||
Vector<tinyxml2::XMLNode*> m_paNode;
|
||||
// The current attribute
|
||||
TiXmlAttribute* m_CurrentAttribute;
|
||||
const tinyxml2::XMLAttribute* m_CurrentAttribute;
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(SimXMLDocument);
|
||||
|
|
|
|||
|
|
@ -2293,9 +2293,10 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor
|
|||
|
||||
bool isBasePath(const char* SrcPath, const char* pBasePath)
|
||||
{
|
||||
char expandBuffer[1024];
|
||||
char expandBuffer[1024], expandBaseBuffer[1024];
|
||||
Con::expandPath(expandBuffer, sizeof(expandBuffer), SrcPath);
|
||||
return dStrnicmp(pBasePath, expandBuffer, dStrlen(pBasePath)) == 0;
|
||||
Con::expandPath(expandBaseBuffer, sizeof(expandBaseBuffer), pBasePath);
|
||||
return dStrnicmp(expandBaseBuffer, expandBuffer, dStrlen(expandBaseBuffer)) == 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -2801,3 +2801,11 @@ DefineEngineFunction( getMaxDynamicVerts, S32, (),,
|
|||
{
|
||||
return GFX_MAX_DYNAMIC_VERTS / 2;
|
||||
}
|
||||
|
||||
DefineEngineFunction( getStringHash, S32, (const char* _inString, bool _sensitive), ("", true), "generate a hash from a string. foramt is (string, casesensitive). defaults to true")
|
||||
{
|
||||
if (_sensitive)
|
||||
return S32(String(_inString).getHashCaseSensitive());
|
||||
else
|
||||
return S32(String(_inString).getHashCaseInsensitive());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
#include "console/simObjectRef.h"
|
||||
#endif
|
||||
#ifndef TINYXML_INCLUDED
|
||||
#include "tinyxml.h"
|
||||
#include "tinyxml2.h"
|
||||
#endif
|
||||
|
||||
/// @file
|
||||
|
|
@ -208,7 +208,7 @@ public:
|
|||
typedef ConsoleBaseType Parent;
|
||||
|
||||
/// Allows the writing of a custom TAML schema.
|
||||
typedef void(*WriteCustomTamlSchema)(const AbstractClassRep* pClassRep, TiXmlElement* pParentElement);
|
||||
typedef void(*WriteCustomTamlSchema)(const AbstractClassRep* pClassRep, tinyxml2::XMLElement* pParentElement);
|
||||
|
||||
/// @name 'Tructors
|
||||
/// @{
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ ConsoleProcessData( TypeFilename )
|
|||
//-----------------------------------------------------------------------------
|
||||
// TypeStringFilename
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsolePrepType( filename, TypeStringFilename, String )
|
||||
ConsolePrepType( filename, TypeStringFilename, const char* )
|
||||
|
||||
ConsoleSetType( TypeStringFilename )
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ ConsoleSetType( TypeStringFilename )
|
|||
return;
|
||||
}
|
||||
|
||||
*((String*)dptr) = String(buffer);
|
||||
*((const char**)dptr) = StringTable->insert(buffer);
|
||||
}
|
||||
else
|
||||
Con::printf("(TypeStringFilename) Cannot set multiple args to a single filename.");
|
||||
|
|
@ -185,7 +185,7 @@ ConsoleSetType( TypeStringFilename )
|
|||
|
||||
ConsoleGetType( TypeStringFilename )
|
||||
{
|
||||
return *((String*)dptr);
|
||||
return *((const char**)(dptr));
|
||||
}
|
||||
|
||||
ConsoleProcessData( TypeStringFilename )
|
||||
|
|
@ -204,7 +204,7 @@ ConsoleProcessData( TypeStringFilename )
|
|||
//-----------------------------------------------------------------------------
|
||||
// TypePrefabFilename
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsolePrepType( filename, TypePrefabFilename, String )
|
||||
ConsolePrepType( filename, TypePrefabFilename, const char* )
|
||||
|
||||
ConsoleSetType( TypePrefabFilename )
|
||||
{
|
||||
|
|
@ -213,7 +213,7 @@ ConsoleSetType( TypePrefabFilename )
|
|||
|
||||
ConsoleGetType( TypePrefabFilename )
|
||||
{
|
||||
return *((String*)dptr);
|
||||
return *((const char**)(dptr));
|
||||
}
|
||||
|
||||
ConsoleProcessData( TypePrefabFilename )
|
||||
|
|
@ -232,16 +232,16 @@ ConsoleProcessData( TypePrefabFilename )
|
|||
//-----------------------------------------------------------------------------
|
||||
// TypeImageFilename
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsolePrepType( filename, TypeImageFilename, String )
|
||||
ConsolePrepType( filename, TypeImageFilename, const char* )
|
||||
|
||||
ConsoleSetType( TypeImageFilename )
|
||||
{
|
||||
Con::setData(TypeStringFilename, dptr, 0, argc, argv, tbl, flag);
|
||||
Con::setData(TypeFilename, dptr, 0, argc, argv, tbl, flag);
|
||||
}
|
||||
|
||||
ConsoleGetType( TypeImageFilename )
|
||||
{
|
||||
return *((String*)dptr);
|
||||
return *((const char**)(dptr));
|
||||
}
|
||||
|
||||
ConsoleProcessData( TypeImageFilename )
|
||||
|
|
@ -281,6 +281,33 @@ ConsoleProcessData( TypeShapeFilename )
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeSoundFilename
|
||||
//-----------------------------------------------------------------------------
|
||||
ConsolePrepType(filename, TypeSoundFilename, const char*)
|
||||
|
||||
ConsoleSetType(TypeSoundFilename)
|
||||
{
|
||||
Con::setData(TypeFilename, dptr, 0, argc, argv, tbl, flag);
|
||||
}
|
||||
|
||||
ConsoleGetType(TypeSoundFilename)
|
||||
{
|
||||
return *((const char **)(dptr));
|
||||
}
|
||||
|
||||
ConsoleProcessData(TypeSoundFilename)
|
||||
{
|
||||
if (Con::expandScriptFilename(buffer, bufferSz, data))
|
||||
return buffer;
|
||||
else
|
||||
{
|
||||
Con::warnf("(TypeSoundFilename) illegal filename detected: %s", data);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeS8
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -797,20 +824,17 @@ ConsoleSetType( TypeParticleParameterString )
|
|||
// TypeMaterialName
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleType(string, TypeMaterialName, String, "")
|
||||
ConsoleType(string, TypeMaterialName, const char*, "")
|
||||
|
||||
ConsoleGetType( TypeMaterialName )
|
||||
{
|
||||
const String *theString = static_cast<const String*>(dptr);
|
||||
return theString->c_str();
|
||||
return* ((const char**)(dptr));
|
||||
}
|
||||
|
||||
ConsoleSetType( TypeMaterialName )
|
||||
{
|
||||
String *theString = static_cast<String*>(dptr);
|
||||
|
||||
if(argc == 1)
|
||||
*theString = argv[0];
|
||||
*((const char**)dptr) = StringTable->insert(argv[0]);
|
||||
else
|
||||
Con::printf("(TypeMaterialName) Cannot set multiple args to a single string.");
|
||||
}
|
||||
|
|
@ -860,20 +884,17 @@ ConsoleSetType( TypeTerrainMaterialName )
|
|||
// TypeCubemapName
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleType(string, TypeCubemapName, String, "")
|
||||
ConsoleType(string, TypeCubemapName, const char*, "")
|
||||
|
||||
ConsoleGetType( TypeCubemapName )
|
||||
{
|
||||
const String *theString = static_cast<const String*>(dptr);
|
||||
return theString->c_str();
|
||||
return*((const char**)(dptr));
|
||||
}
|
||||
|
||||
ConsoleSetType( TypeCubemapName )
|
||||
{
|
||||
String *theString = static_cast<String*>(dptr);
|
||||
|
||||
if(argc == 1)
|
||||
*theString = argv[0];
|
||||
*((const char**)dptr) = StringTable->insert(argv[0]);
|
||||
else
|
||||
Con::printf("(TypeCubemapName) Cannot set multiple args to a single string.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ DefineConsoleType( TypeCaseString, const char * )
|
|||
DefineConsoleType( TypeRealString, String )
|
||||
DefineConsoleType( TypeCommand, String )
|
||||
DefineConsoleType( TypeFilename, const char * )
|
||||
DefineConsoleType( TypeStringFilename, String )
|
||||
DefineConsoleType( TypeStringFilename, const char*)
|
||||
|
||||
DefineConsoleType(TypeRotationF, RotationF)
|
||||
|
||||
|
|
@ -87,22 +87,27 @@ DefineUnmappedConsoleType( TypePID, SimPersistID* );
|
|||
/// TypeImageFilename is equivalent to TypeStringFilename in its usage,
|
||||
/// it exists for the benefit of GuiInspector, which will provide a custom
|
||||
/// InspectorField for this type that can display a texture preview.
|
||||
DefineConsoleType( TypeImageFilename, String )
|
||||
DefineConsoleType( TypeImageFilename, const char* )
|
||||
|
||||
/// TypePrefabFilename is equivalent to TypeStringFilename in its usage,
|
||||
/// it exists for the benefit of GuiInspector, which will provide a
|
||||
/// custom InspectorField for this type.
|
||||
DefineConsoleType( TypePrefabFilename, String )
|
||||
DefineConsoleType( TypePrefabFilename, const char*)
|
||||
|
||||
/// TypeShapeFilename is equivalent to TypeStringFilename in its usage,
|
||||
/// it exists for the benefit of GuiInspector, which will provide a
|
||||
/// custom InspectorField for this type.
|
||||
DefineConsoleType( TypeShapeFilename, String )
|
||||
DefineConsoleType( TypeShapeFilename, const char* )
|
||||
|
||||
/// TypeSoundFilename is exactly the same as TypeShapeFilename
|
||||
/// it exists for the benefit of GuiInspector, which will provide a
|
||||
/// custom InspectorField for this type.
|
||||
DefineConsoleType(TypeSoundFilename, const char*)
|
||||
|
||||
/// TypeMaterialName is equivalent to TypeRealString in its usage,
|
||||
/// it exists for the benefit of GuiInspector, which will provide a
|
||||
/// custom InspectorField for this type.
|
||||
DefineConsoleType( TypeMaterialName, String )
|
||||
DefineConsoleType( TypeMaterialName, const char*)
|
||||
|
||||
/// TypeTerrainMaterialIndex is equivalent to TypeS32 in its usage,
|
||||
/// it exists for the benefit of GuiInspector, which will provide a
|
||||
|
|
@ -116,7 +121,7 @@ DefineConsoleType( TypeTerrainMaterialName, const char * )
|
|||
|
||||
/// TypeCubemapName is equivalent to TypeRealString in its usage,
|
||||
/// but the Inspector will provide a drop-down list of CubemapData objects.
|
||||
DefineConsoleType( TypeCubemapName, String )
|
||||
DefineConsoleType( TypeCubemapName, const char*)
|
||||
|
||||
DefineConsoleType( TypeParticleParameterString, const char * )
|
||||
|
||||
|
|
|
|||
|
|
@ -398,6 +398,21 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),,
|
|||
return Torque::FS::IsFile(givenPath);
|
||||
}
|
||||
|
||||
DefineEngineFunction(isScriptFile, bool, (const char* fileName), ,
|
||||
"@brief Determines if the specified file exists or not\n\n"
|
||||
|
||||
"@param fileName The path to the file.\n"
|
||||
"@return Returns true if the file was found.\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String cleanfilename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), cleanfilename.c_str());
|
||||
|
||||
Torque::Path givenPath(Torque::Path::CompressPath(sgScriptFilenameBuffer));
|
||||
return Torque::FS::IsScriptFile(givenPath.getFullPath());
|
||||
}
|
||||
|
||||
DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
||||
"@brief Determines if a specified directory exists or not\n\n"
|
||||
|
||||
|
|
@ -565,6 +580,27 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
|
|||
return buffer;
|
||||
}
|
||||
|
||||
DefineEngineFunction(compareFileTimes, S32, (const char* fileA, const char* fileB), ("", ""),
|
||||
"@brief Compares 2 files' modified file times."
|
||||
|
||||
"@param fileName Name and path of first file to compare\n"
|
||||
"@param fileName Name and path of second file to compare\n"
|
||||
"@return S32. If value is 1, then fileA is newer. If value is -1, then fileB is newer. If value is 0, they are equal.\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileA);
|
||||
|
||||
FileTime fileATime = { 0 };
|
||||
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileATime);
|
||||
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileB);
|
||||
|
||||
FileTime fileBTime = { 0 };
|
||||
Platform::getFileTimes(sgScriptFilenameBuffer, NULL, &fileBTime);
|
||||
|
||||
return Platform::compareFileTimes(fileATime, fileBTime);
|
||||
}
|
||||
|
||||
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
||||
"@brief Delete a file from the hard drive\n\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -1254,17 +1254,7 @@ PersistenceManager::ParsedObject* PersistenceManager::writeNewObject(SimObject*
|
|||
dynamic_cast<TSShapeConstructor*>(object))
|
||||
dclToken = "singleton";
|
||||
else if( dynamic_cast< SimDataBlock* >( object ) )
|
||||
{
|
||||
SimDataBlock* db = static_cast<SimDataBlock*>(object);
|
||||
|
||||
if( db->isClientOnly() )
|
||||
{
|
||||
if( db->getName() && db->getName()[ 0 ] )
|
||||
dclToken = "singleton";
|
||||
}
|
||||
else
|
||||
dclToken = "datablock";
|
||||
}
|
||||
dclToken = "datablock";
|
||||
|
||||
char newLine[ 4096 ];
|
||||
dMemset(newLine, 0, sizeof( newLine));
|
||||
|
|
@ -1416,17 +1406,25 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
|
|||
{
|
||||
// TODO: This should be wrapped in a helper method... probably.
|
||||
// Detect and collapse relative path information
|
||||
if (f->type == TypeFilename ||
|
||||
f->type == TypeStringFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypePrefabFilename ||
|
||||
f->type == TypeShapeFilename)
|
||||
if (f->type == TypeFilename ||
|
||||
f->type == TypeStringFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypePrefabFilename ||
|
||||
f->type == TypeShapeFilename ||
|
||||
f->type == TypeSoundFilename )
|
||||
{
|
||||
char fnBuf[1024];
|
||||
Con::collapseScriptFilename(fnBuf, 1024, value);
|
||||
|
||||
updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, fnBuf, true);
|
||||
}
|
||||
else if (f->type == TypeCommand || f->type == TypeString || f->type == TypeRealString)
|
||||
{
|
||||
char cmdBuf[1024];
|
||||
expandEscape(cmdBuf, value);
|
||||
|
||||
updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, cmdBuf, true);
|
||||
}
|
||||
else
|
||||
updateToken(prop.valueLine, prop.valuePosition, prop.endPosition - prop.valuePosition, value, true);
|
||||
}
|
||||
|
|
@ -1495,17 +1493,25 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
|
|||
{
|
||||
// TODO: This should be wrapped in a helper method... probably.
|
||||
// Detect and collapse relative path information
|
||||
if (f->type == TypeFilename ||
|
||||
if (f->type == TypeFilename ||
|
||||
f->type == TypeStringFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypePrefabFilename ||
|
||||
f->type == TypeShapeFilename)
|
||||
f->type == TypeShapeFilename ||
|
||||
f->type == TypeSoundFilename )
|
||||
{
|
||||
char fnBuf[1024];
|
||||
Con::collapseScriptFilename(fnBuf, 1024, value);
|
||||
|
||||
newLines.push_back(createNewProperty(f->pFieldname, fnBuf, f->elementCount > 1, j));
|
||||
}
|
||||
else if (f->type == TypeCommand)
|
||||
{
|
||||
char cmdBuf[1024];
|
||||
expandEscape(cmdBuf, value);
|
||||
|
||||
newLines.push_back(createNewProperty(f->pFieldname, cmdBuf, f->elementCount > 1, j));
|
||||
}
|
||||
else
|
||||
newLines.push_back(createNewProperty(f->pFieldname, value, f->elementCount > 1, j));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,11 +339,12 @@ void SimObject::writeFields(Stream &stream, U32 tabStop)
|
|||
|
||||
// detect and collapse relative path information
|
||||
char fnBuf[1024];
|
||||
if (f->type == TypeFilename ||
|
||||
if (f->type == TypeFilename ||
|
||||
f->type == TypeStringFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypeImageFilename ||
|
||||
f->type == TypePrefabFilename ||
|
||||
f->type == TypeShapeFilename)
|
||||
f->type == TypeShapeFilename ||
|
||||
f->type == TypeSoundFilename )
|
||||
{
|
||||
Con::collapseScriptFilename(fnBuf, 1024, val);
|
||||
val = fnBuf;
|
||||
|
|
@ -919,7 +920,15 @@ void SimObject::assignFieldsFrom(SimObject *parent)
|
|||
dMemset( bufferSecure, 0, 2048 );
|
||||
dMemcpy( bufferSecure, szBuffer, dStrlen( szBuffer ) );
|
||||
|
||||
if((*f->setDataFn)( this, NULL, bufferSecure ) )
|
||||
//If we have an index worth mentioning, process it for pass-along as well to ensure we set stuff correctly
|
||||
char* elementIdxBuffer = nullptr;
|
||||
if (f->elementCount > 1)
|
||||
{
|
||||
elementIdxBuffer = Con::getArgBuffer(256);
|
||||
dSprintf(elementIdxBuffer, 256, "%i", j);
|
||||
}
|
||||
|
||||
if((*f->setDataFn)( this, elementIdxBuffer, bufferSecure ) )
|
||||
Con::setData(f->type, (void *) (((const char *)this) + f->offset), j, 1, &fieldVal, f->table);
|
||||
|
||||
if (f->networkMask != 0)
|
||||
|
|
@ -3176,6 +3185,31 @@ DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),,
|
|||
return "";
|
||||
}
|
||||
|
||||
DefineEngineFunction(getClassHierarchy, const char*, (const char* name), ,
|
||||
"Returns the inheritance hierarchy for a given class.")
|
||||
{
|
||||
AbstractClassRep* pRep = AbstractClassRep::findClassRep(name);
|
||||
if (!pRep)
|
||||
{
|
||||
//Con::errorf("%s does not exist", name);
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
StringBuilder buffer;
|
||||
|
||||
while (pRep != NULL)
|
||||
{
|
||||
StringTableEntry className = pRep->getClassName();
|
||||
buffer.append(className);
|
||||
buffer.append(" ");
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
|
||||
String result = buffer.end().trim();
|
||||
//Con::printf("getClassHierarchy for %s=%s", name, result.c_str());
|
||||
return Con::getReturnBuffer(result.c_str());
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
|
|
|
|||
|
|
@ -922,7 +922,7 @@ DefineEngineStringlyVariadicMethod( SimSet, add, void, 3, 0,
|
|||
if(obj)
|
||||
object->addObject( obj );
|
||||
else
|
||||
Con::printf("Set::add: Object \"%s\" doesn't exist", (const char*)argv[ i ] );
|
||||
Con::printf("Set::add: Object \"%s\" doesn't exist to add to %s", (const char*)argv[ i ], object->getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -939,7 +939,7 @@ DefineEngineStringlyVariadicMethod( SimSet, remove, void, 3, 0,
|
|||
if(obj && object->find(object->begin(),object->end(),obj) != object->end())
|
||||
object->removeObject(obj);
|
||||
else
|
||||
Con::printf("Set::remove: Object \"%s\" does not exist in set", (const char*)argv[i]);
|
||||
Con::printf("Set::remove: Object \"%s\" does not exist in set %s", (const char*)argv[i], object->getName());
|
||||
object->unlock();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue