mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
copy-on-reload -- The datablock copy op, ":" is modified to copy on reload as well as on creation.
reload-reset -- adds virtual method that is called when a datablock is reloaded.
This commit is contained in:
parent
43815793d1
commit
bc90e97d35
2 changed files with 35 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||||
// Copyright (C) 2015 Faust Logic, Inc.
|
// Copyright (C) 2015 Faust Logic, Inc.
|
||||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "console/console.h"
|
#include "console/console.h"
|
||||||
|
|
||||||
|
|
@ -965,6 +966,38 @@ breakContinue:
|
||||||
currentNewObject->setModDynamicFields(true);
|
currentNewObject->setModDynamicFields(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentNewObject->reloadReset(); // AFX (reload-reset)
|
||||||
|
// Does it have a parent object? (ie, the copy constructor : syntax, not inheriance)
|
||||||
|
if(*objParent)
|
||||||
|
{
|
||||||
|
// Find it!
|
||||||
|
SimObject *parent;
|
||||||
|
if(Sim::findObject(objParent, parent))
|
||||||
|
{
|
||||||
|
// Con::printf(" - Parent object found: %s", parent->getClassName());
|
||||||
|
|
||||||
|
// temporarily block name change
|
||||||
|
SimObject::preventNameChanging = true;
|
||||||
|
currentNewObject->setCopySource( parent );
|
||||||
|
currentNewObject->assignFieldsFrom(parent);
|
||||||
|
// restore name changing
|
||||||
|
SimObject::preventNameChanging = false;
|
||||||
|
|
||||||
|
// copy any substitution statements
|
||||||
|
SimDataBlock* parent_db = dynamic_cast<SimDataBlock*>(parent);
|
||||||
|
if (parent_db)
|
||||||
|
{
|
||||||
|
SimDataBlock* currentNewObject_db = dynamic_cast<SimDataBlock*>(currentNewObject);
|
||||||
|
if (currentNewObject_db)
|
||||||
|
currentNewObject_db->copySubstitutionsFrom(parent_db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)callArgv[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Advance the IP past the create info...
|
// Advance the IP past the create info...
|
||||||
ip += 7;
|
ip += 7;
|
||||||
|
|
|
||||||
|
|
@ -980,6 +980,8 @@ public:
|
||||||
/*C*/ SimObject(const SimObject&, bool = false);
|
/*C*/ SimObject(const SimObject&, bool = false);
|
||||||
bool isTempClone() const { return is_temp_clone; }
|
bool isTempClone() const { return is_temp_clone; }
|
||||||
virtual bool allowSubstitutions() const { return false; }
|
virtual bool allowSubstitutions() const { return false; }
|
||||||
|
public:
|
||||||
|
virtual void reloadReset() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue