Merge pull request #2182 from Areloch/AssetBrowser_Initial

Asset browser initial
This commit is contained in:
Areloch 2018-02-01 21:14:50 -06:00 committed by GitHub
commit 80c7dfcb6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
137 changed files with 14374 additions and 758 deletions

View file

@ -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();

View file

@ -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;
}

View file

@ -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 ));

View file

@ -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();*/
}
}

View file

@ -57,6 +57,7 @@ public:
protected:
StringTableEntry mVariableName;
StringTableEntry mSetCallbackName;
SimObject* mOwnerObject;
};

View file

@ -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()

View file

@ -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();
}