mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-05 05:20:31 +00:00
Merge pull request #2182 from Areloch/AssetBrowser_Initial
Asset browser initial
This commit is contained in:
commit
80c7dfcb6c
137 changed files with 14374 additions and 758 deletions
|
|
@ -152,14 +152,24 @@ ConsoleDocClass( GuiDragAndDropControl,
|
|||
"@ingroup GuiUtil"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK(GuiDragAndDropControl, onControlDragCancelled, void, (), (),
|
||||
"Called when the we cancel out of the drag and drop action.\n"
|
||||
"@see GuiDragAndDropControl::onControlDragCancelled");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
GuiDragAndDropControl::GuiDragAndDropControl() : mDeleteOnMouseUp(true), mUseWholeCanvas(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GuiDragAndDropControl::initPersistFields()
|
||||
{
|
||||
addField( "deleteOnMouseUp", TypeBool, Offset( mDeleteOnMouseUp, GuiDragAndDropControl ),
|
||||
"If true, the control deletes itself when the left mouse button is released.\n\n"
|
||||
"If at this point, the drag&drop control still contains its payload, it will be deleted along with the control." );
|
||||
|
||||
addField("useWholeCanvas", TypeBool, Offset(mUseWholeCanvas, GuiDragAndDropControl),
|
||||
"If true, the control can be tested against ANY control active on the canvas instead of just the direct parent.\n\n");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
|
@ -226,8 +236,10 @@ void GuiDragAndDropControl::onMouseUp(const GuiEvent& event)
|
|||
mouseUnlock();
|
||||
|
||||
GuiControl* target = findDragTarget( event.mousePoint, "onControlDropped" );
|
||||
if( target )
|
||||
target->onControlDropped_callback( dynamic_cast< GuiControl* >( at( 0 ) ), getDropPoint() );
|
||||
if (target)
|
||||
target->onControlDropped_callback(dynamic_cast<GuiControl*>(at(0)), getDropPoint());
|
||||
else
|
||||
onControlDragCancelled_callback();
|
||||
|
||||
if( mDeleteOnMouseUp )
|
||||
deleteObject();
|
||||
|
|
@ -239,6 +251,13 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha
|
|||
{
|
||||
// If there are any children and we have a parent.
|
||||
GuiControl* parent = getParent();
|
||||
|
||||
if (mUseWholeCanvas)
|
||||
{
|
||||
parent->setVisible(false);
|
||||
parent = getRoot();
|
||||
}
|
||||
|
||||
if (size() && parent)
|
||||
{
|
||||
mVisible = false;
|
||||
|
|
@ -252,6 +271,10 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha
|
|||
dropControl = dropControl->getParent();
|
||||
}
|
||||
}
|
||||
|
||||
if(mUseWholeCanvas)
|
||||
parent->setVisible(true);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ class GuiDragAndDropControl : public GuiControl
|
|||
/// If true, the control deletes itself when the left mouse button is released.
|
||||
bool mDeleteOnMouseUp;
|
||||
|
||||
bool mUseWholeCanvas;
|
||||
|
||||
/// Controls may want to react when they are dragged over, entered or exited.
|
||||
SimObjectPtr<GuiControl> mLastTarget;
|
||||
|
||||
|
|
@ -65,7 +67,7 @@ class GuiDragAndDropControl : public GuiControl
|
|||
|
||||
public:
|
||||
|
||||
GuiDragAndDropControl() {}
|
||||
GuiDragAndDropControl();
|
||||
|
||||
void startDragging(Point2I offset = Point2I(0, 0));
|
||||
|
||||
|
|
@ -81,6 +83,8 @@ class GuiDragAndDropControl : public GuiControl
|
|||
DECLARE_DESCRIPTION( "A special control that implements drag&drop behavior.\n"
|
||||
"The control will notify other controls as it moves across the canvas.\n"
|
||||
"Content can be attached through dynamic fields or child objects." );
|
||||
|
||||
DECLARE_CALLBACK(void, onControlDragCancelled, ());
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -2501,6 +2501,19 @@ const char * GuiTreeViewCtrl::getItemValue(S32 itemId)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 GuiTreeViewCtrl::getItemAtPosition(Point2I position)
|
||||
{
|
||||
BitSet32 hitFlags = 0;
|
||||
Item* item;
|
||||
|
||||
if (_hitTest(position, item, hitFlags))
|
||||
return item->mId;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool GuiTreeViewCtrl::editItem( S32 itemId, const char* newText, const char* newValue )
|
||||
{
|
||||
Item* item = getItem( itemId );
|
||||
|
|
@ -5550,3 +5563,11 @@ DefineEngineMethod( GuiTreeViewCtrl, clearFilterText, void, (),,
|
|||
{
|
||||
object->clearFilterText();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiTreeViewCtrl, getItemAtPosition, S32, (Point2I position), (Point2I::Zero),
|
||||
"Get the tree item at the passed in position.\n\n"
|
||||
"@param position The position to check for what item is below it.\n"
|
||||
"@return The id of the item under the position.")
|
||||
{
|
||||
return object->getItemAtPosition(position);
|
||||
}
|
||||
|
|
@ -513,6 +513,8 @@ class GuiTreeViewCtrl : public GuiArrayCtrl
|
|||
bool editItem( S32 itemId, const char* newText, const char* newValue );
|
||||
|
||||
bool markItem( S32 itemId, bool mark );
|
||||
|
||||
S32 getItemAtPosition(Point2I position);
|
||||
|
||||
bool isItemSelected( S32 itemId );
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ GuiInspector::GuiInspector()
|
|||
mOverDivider( false ),
|
||||
mMovingDivider( false ),
|
||||
mHLField( NULL ),
|
||||
mShowCustomFields( true )
|
||||
mShowCustomFields( true ),
|
||||
mComponentGroupTargetId(-1)
|
||||
{
|
||||
mPadding = 1;
|
||||
}
|
||||
|
|
@ -620,7 +621,10 @@ void GuiInspector::refresh()
|
|||
else
|
||||
compName = comp->getComponentName();
|
||||
|
||||
GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(compName, this, comp);
|
||||
StringBuilder captionString;
|
||||
captionString.format("%s [%i]", compName.c_str(), comp->getId());
|
||||
|
||||
GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(captionString.data(), this, comp);
|
||||
if (compGroup != NULL)
|
||||
{
|
||||
compGroup->registerObject();
|
||||
|
|
|
|||
|
|
@ -1472,6 +1472,17 @@ PopupMenu* GuiMenuBar::getMenu(U32 index)
|
|||
return mMenuList[index].popupMenu;
|
||||
}
|
||||
|
||||
PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle)
|
||||
{
|
||||
for (U32 i = 0; i < mMenuList.size(); i++)
|
||||
{
|
||||
if (mMenuList[i].text == barTitle)
|
||||
return mMenuList[i].popupMenu;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Console Methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1506,4 +1517,14 @@ DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)")
|
|||
DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType<SimObject*>(), -1), "(object, pos) insert object at position")
|
||||
{
|
||||
object->insert(pObject, pos);
|
||||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)")
|
||||
{
|
||||
PopupMenu* menu = object->findMenu(barTitle);
|
||||
|
||||
if (menu)
|
||||
return menu->getId();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public:
|
|||
U32 getMenuListCount() { return mMenuList.size(); }
|
||||
|
||||
PopupMenu* getMenu(U32 index);
|
||||
PopupMenu* findMenu(StringTableEntry barTitle);
|
||||
|
||||
DECLARE_CONOBJECT(GuiMenuBar);
|
||||
DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu ));
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event)
|
|||
|
||||
void GuiPopupMenuBackgroundCtrl::close()
|
||||
{
|
||||
getRoot()->removeObject(this);
|
||||
if(getRoot())
|
||||
getRoot()->removeObject(this);
|
||||
|
||||
mMenuBarCtrl = nullptr;
|
||||
}
|
||||
|
|
@ -151,16 +152,22 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s
|
|||
S32 bottom = top + 8;
|
||||
S32 middle = top + 4;
|
||||
|
||||
PrimBuild::begin(GFXTriangleList, 3);
|
||||
if (selected || mouseOver)
|
||||
PrimBuild::color(mProfile->mFontColorHL);
|
||||
else
|
||||
PrimBuild::color(mProfile->mFontColor);
|
||||
//PrimBuild::begin(GFXTriangleList, 3);
|
||||
|
||||
PrimBuild::vertex2i(left, top);
|
||||
ColorI color = ColorI::BLACK;
|
||||
if (selected || mouseOver)
|
||||
color = mProfile->mFontColorHL;
|
||||
else
|
||||
color = mProfile->mFontColor;
|
||||
|
||||
GFX->getDrawUtil()->drawLine(Point2I(left, top), Point2I(right, middle), color);
|
||||
GFX->getDrawUtil()->drawLine(Point2I(right, middle), Point2I(left, bottom), color);
|
||||
GFX->getDrawUtil()->drawLine(Point2I(left, bottom), Point2I(left, top), color);
|
||||
|
||||
/*PrimBuild::vertex2i(left, top);
|
||||
PrimBuild::vertex2i(right, middle);
|
||||
PrimBuild::vertex2i(left, bottom);
|
||||
PrimBuild::end();
|
||||
PrimBuild::end();*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public:
|
|||
|
||||
protected:
|
||||
StringTableEntry mVariableName;
|
||||
StringTableEntry mSetCallbackName;
|
||||
SimObject* mOwnerObject;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@ bool GuiInspectorVariableGroup::inspectGroup()
|
|||
fieldGui->setInspectorField(NULL, mFields[i]->mFieldLabel);
|
||||
fieldGui->setDocs(mFields[i]->mFieldDescription);
|
||||
|
||||
if(mFields[i]->mSetCallbackName != StringTable->EmptyString())
|
||||
fieldGui->setSpecialEditCallbackName(mFields[i]->mSetCallbackName);
|
||||
|
||||
/*if (mFields[i]->mSetCallbackName != StringTable->EmptyString())
|
||||
{
|
||||
fieldGui->on.notify()
|
||||
|
|
|
|||
|
|
@ -167,6 +167,10 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c
|
|||
fieldTypeMask = TypeColorF;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("ease"))
|
||||
fieldTypeMask = TypeEaseF;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("command"))
|
||||
fieldTypeMask = TypeCommand;
|
||||
else if (newField.mFieldTypeName == StringTable->insert("filename"))
|
||||
fieldTypeMask = TypeStringFilename;
|
||||
else
|
||||
fieldTypeMask = -1;
|
||||
|
||||
|
|
@ -191,7 +195,10 @@ void GuiVariableInspector::addCallbackField(const char* name, const char* label,
|
|||
|
||||
void GuiVariableInspector::clearFields()
|
||||
{
|
||||
mGroups.clear();
|
||||
mFields.clear();
|
||||
clear();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue