mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
add TypeHints for inspector viewing
typehints operate as an additional label for a given class in the inspector, allowing one to specify what class-entry to use as a tag examples: Prefab displays prefab filename TSStatic displays the used shape asset name SFXEmitter displays the played sound asset GameBase derivatives display the datablock used
This commit is contained in:
parent
0d981b62cf
commit
b1f118898e
9 changed files with 48 additions and 1 deletions
|
|
@ -275,6 +275,8 @@ public:
|
|||
/// Returns the datablock for this object.
|
||||
GameBaseData* getDataBlock() { return mDataBlock; }
|
||||
|
||||
/// returns the datablock name for this object
|
||||
StringTableEntry getTypeHint() const override { return (mDataBlock) ? mDataBlock->getName() : StringTable->EmptyString(); };
|
||||
/// Called when a new datablock is set. This allows subclasses to
|
||||
/// appropriately handle new datablocks.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ void Prefab::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
StringTableEntry Prefab::getTypeHint() const
|
||||
{
|
||||
return (mFilename != StringTable->EmptyString()) ? StringTable->insert(Torque::Path(mFilename).getFileName().c_str()) : StringTable->EmptyString();
|
||||
}
|
||||
extern bool gEditingMission;
|
||||
|
||||
bool Prefab::onAdd()
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ public:
|
|||
|
||||
static void initPersistFields();
|
||||
|
||||
/// returns the filename for this object
|
||||
StringTableEntry getTypeHint() const override;
|
||||
|
||||
// SimObject
|
||||
virtual bool onAdd();
|
||||
virtual void onRemove();
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ class SFXEmitter : public SceneObject
|
|||
|
||||
DECLARE_SOUNDASSET(SFXEmitter, Sound);
|
||||
DECLARE_ASSET_NET_SETGET(SFXEmitter, Sound, DirtyUpdateMask);
|
||||
/// returns the shape asset used for this object
|
||||
StringTableEntry getTypeHint() const override { return (getSoundAsset()) ? getSoundAsset()->getAssetName() : StringTable->EmptyString(); }
|
||||
|
||||
/// The sound source for the emitter.
|
||||
SFXSource *mSource;
|
||||
|
|
|
|||
|
|
@ -237,6 +237,8 @@ public:
|
|||
|
||||
DECLARE_CONOBJECT(TSStatic);
|
||||
static void initPersistFields();
|
||||
/// returns the shape asset used for this object
|
||||
StringTableEntry getTypeHint() const override { return (getShapeAsset()) ? getShapeAsset()->getAssetName(): StringTable->EmptyString(); }
|
||||
static void consoleInit();
|
||||
static bool _setFieldSkin(void* object, const char* index, const char* data);
|
||||
static const char* _getFieldSkin(void* object, const char* data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue