mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
hook PrototypeClass(%objectName) on up to inspector
fix dialog close, fix dynamic variable gui element alignment
This commit is contained in:
parent
81b721c755
commit
c10808873d
3 changed files with 18 additions and 7 deletions
|
|
@ -40,6 +40,7 @@
|
||||||
#include "core/fileObject.h"
|
#include "core/fileObject.h"
|
||||||
#include "persistence/taml/tamlCustom.h"
|
#include "persistence/taml/tamlCustom.h"
|
||||||
#include "gui/editor/guiInspector.h"
|
#include "gui/editor/guiInspector.h"
|
||||||
|
#include "console/script.h"
|
||||||
|
|
||||||
#include "sim/netObject.h"
|
#include "sim/netObject.h"
|
||||||
|
|
||||||
|
|
@ -90,7 +91,7 @@ SimObject::SimObject()
|
||||||
mNameSpace = NULL;
|
mNameSpace = NULL;
|
||||||
mNotifyList = NULL;
|
mNotifyList = NULL;
|
||||||
mFlags.set( ModStaticFields | ModDynamicFields );
|
mFlags.set( ModStaticFields | ModDynamicFields );
|
||||||
|
mPrototype = true;
|
||||||
mProgenitorFile = StringTable->EmptyString();
|
mProgenitorFile = StringTable->EmptyString();
|
||||||
|
|
||||||
mFieldDictionary = NULL;
|
mFieldDictionary = NULL;
|
||||||
|
|
@ -160,6 +161,7 @@ void SimObject::initPersistFields()
|
||||||
addProtectedField("inheritFrom", TypeString, Offset(mInheritFrom, SimObject), &setInheritFrom, &defaultProtectedGetFn,
|
addProtectedField("inheritFrom", TypeString, Offset(mInheritFrom, SimObject), &setInheritFrom, &defaultProtectedGetFn,
|
||||||
"Optional Name of object to inherit from as a parent.");
|
"Optional Name of object to inherit from as a parent.");
|
||||||
|
|
||||||
|
addProtectedField("Prototype", TypeBool, Offset(mPrototype, SimObject), &_doPrototype, &defaultProtectedGetFn, "Prototype Methods", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors);
|
||||||
endGroup( "Ungrouped" );
|
endGroup( "Ungrouped" );
|
||||||
|
|
||||||
addGroup( "Object" );
|
addGroup( "Object" );
|
||||||
|
|
@ -212,6 +214,15 @@ void SimObject::initPersistFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
bool SimObject::_doPrototype(void* object, const char* index, const char* data)
|
||||||
|
{
|
||||||
|
if (!Con::isFunction("PrototypeClass")) return false;
|
||||||
|
if (dAtoi(data) != 1) return false;
|
||||||
|
SimObject* obj = reinterpret_cast<SimObject*>(object);
|
||||||
|
String command = String("PrototypeClass(") + (obj->getName()? String(obj->getName()) : String::ToString(obj->getId())) + ");";
|
||||||
|
Con::evaluate(command.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String SimObject::describeSelf() const
|
String SimObject::describeSelf() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
||||||
SimObject* nextIdObject;
|
SimObject* nextIdObject;
|
||||||
|
|
||||||
StringTableEntry mInheritFrom;
|
StringTableEntry mInheritFrom;
|
||||||
|
bool mPrototype;
|
||||||
/// SimGroup we're contained in, if any.
|
/// SimGroup we're contained in, if any.
|
||||||
SimGroup* mGroup;
|
SimGroup* mGroup;
|
||||||
|
|
||||||
|
|
@ -388,7 +388,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
||||||
public:
|
public:
|
||||||
inline void setProgenitorFile(const char* pFile) { mProgenitorFile = StringTable->insert(pFile); }
|
inline void setProgenitorFile(const char* pFile) { mProgenitorFile = StringTable->insert(pFile); }
|
||||||
inline StringTableEntry getProgenitorFile(void) const { return mProgenitorFile; }
|
inline StringTableEntry getProgenitorFile(void) const { return mProgenitorFile; }
|
||||||
|
static bool _doPrototype(void* object, const char* index, const char* data);
|
||||||
protected:
|
protected:
|
||||||
/// Taml callbacks.
|
/// Taml callbacks.
|
||||||
virtual void onTamlPreWrite(void) {}
|
virtual void onTamlPreWrite(void) {}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ $guiContent = new GuiControl(classPrototyping) {
|
||||||
vertSizing = "center";
|
vertSizing = "center";
|
||||||
profile = "ToolsGuiWindowProfile";
|
profile = "ToolsGuiWindowProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
closeCommand = "Canvas.popDialog(classPrototyping);";
|
||||||
new GuiScrollCtrl() {
|
new GuiScrollCtrl() {
|
||||||
lockVertScroll = "1";
|
lockVertScroll = "1";
|
||||||
position = "14 30";
|
position = "14 30";
|
||||||
|
|
@ -112,8 +112,8 @@ $guiContent = new GuiControl(classPrototyping) {
|
||||||
};
|
};
|
||||||
new GuiCheckBoxCtrl(ReportDynamicVariables) {
|
new GuiCheckBoxCtrl(ReportDynamicVariables) {
|
||||||
text = "Report Dynamic Variables";
|
text = "Report Dynamic Variables";
|
||||||
position = "250 420";
|
position = "300 420";
|
||||||
extent = "125 30";
|
extent = "150 30";
|
||||||
profile = "ToolsGuiCheckBoxProfile";
|
profile = "ToolsGuiCheckBoxProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue