|
@@ -224,9 +224,9 @@ namespace BansheeEditor
|
|
|
{
|
|
{
|
|
|
if(updateElement.visible)
|
|
if(updateElement.visible)
|
|
|
{
|
|
{
|
|
|
|
|
+ HString name(toWString(current->mName));
|
|
|
if(current->mElement == nullptr)
|
|
if(current->mElement == nullptr)
|
|
|
{
|
|
{
|
|
|
- HString name(toWString(current->mName));
|
|
|
|
|
current->mElement = GUILabel::create(_getParentWidget(), name, mElementBtnStyle);
|
|
current->mElement = GUILabel::create(_getParentWidget(), name, mElementBtnStyle);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,6 +246,8 @@ namespace BansheeEditor
|
|
|
current->mFoldoutBtn = nullptr;
|
|
current->mFoldoutBtn = nullptr;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ current->mElement->setContent(GUIContent(name));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -319,16 +321,22 @@ namespace BansheeEditor
|
|
|
const TreeElement* current = currentUpdateElement.element;
|
|
const TreeElement* current = currentUpdateElement.element;
|
|
|
todo.pop();
|
|
todo.pop();
|
|
|
|
|
|
|
|
|
|
+ INT32 yOffset = 0;
|
|
|
if(current->mElement != nullptr)
|
|
if(current->mElement != nullptr)
|
|
|
{
|
|
{
|
|
|
Vector2I curOptimalSize = current->mElement->_getOptimalSize();
|
|
Vector2I curOptimalSize = current->mElement->_getOptimalSize();
|
|
|
optimalSize.x = std::max(optimalSize.x,
|
|
optimalSize.x = std::max(optimalSize.x,
|
|
|
(INT32)(INITIAL_INDENT_OFFSET + curOptimalSize.x + currentUpdateElement.indent * INDENT_SIZE));
|
|
(INT32)(INITIAL_INDENT_OFFSET + curOptimalSize.x + currentUpdateElement.indent * INDENT_SIZE));
|
|
|
- optimalSize.y += curOptimalSize.y + ELEMENT_EXTRA_SPACING;
|
|
|
|
|
|
|
+ yOffset = curOptimalSize.y + ELEMENT_EXTRA_SPACING;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ optimalSize.y += yOffset;
|
|
|
|
|
+
|
|
|
for(auto& child : current->mChildren)
|
|
for(auto& child : current->mChildren)
|
|
|
{
|
|
{
|
|
|
|
|
+ if(!child->mIsVisible)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
todo.push(UpdateTreeElement(child, currentUpdateElement.indent + 1));
|
|
todo.push(UpdateTreeElement(child, currentUpdateElement.indent + 1));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -394,53 +402,65 @@ namespace BansheeEditor
|
|
|
UINT32 indent = currentUpdateElement.indent;
|
|
UINT32 indent = currentUpdateElement.indent;
|
|
|
todo.pop();
|
|
todo.pop();
|
|
|
|
|
|
|
|
- tempOrderedElements.resize(current->mChildren.size(), nullptr);
|
|
|
|
|
- for(auto& child : current->mChildren)
|
|
|
|
|
|
|
+ INT32 btnHeight = 0;
|
|
|
|
|
+ INT32 yOffset = 0;
|
|
|
|
|
+ if(current->mElement != nullptr)
|
|
|
{
|
|
{
|
|
|
- tempOrderedElements[child->mSortedIdx] = child;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Vector2I elementSize = current->mElement->_getOptimalSize();
|
|
|
|
|
+ btnHeight = elementSize.y;
|
|
|
|
|
|
|
|
- for(auto& child : tempOrderedElements)
|
|
|
|
|
- {
|
|
|
|
|
- if(!child->mIsVisible)
|
|
|
|
|
- continue;
|
|
|
|
|
|
|
+ offset.x = INITIAL_INDENT_OFFSET + indent * INDENT_SIZE;
|
|
|
|
|
|
|
|
- INT32 yOffset = 0;
|
|
|
|
|
- if(child->mElement != nullptr)
|
|
|
|
|
- {
|
|
|
|
|
- Vector2I elementSize = child->mElement->_getOptimalSize();
|
|
|
|
|
|
|
+ current->mElement->_setOffset(offset);
|
|
|
|
|
+ current->mElement->_setWidth(elementSize.x);
|
|
|
|
|
+ current->mElement->_setHeight(elementSize.y);
|
|
|
|
|
+ current->mElement->_setAreaDepth(areaDepth);
|
|
|
|
|
+ current->mElement->_setWidgetDepth(widgetDepth);
|
|
|
|
|
|
|
|
- offset.x = INITIAL_INDENT_OFFSET + indent * INDENT_SIZE;
|
|
|
|
|
|
|
+ RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
|
|
|
|
|
+ current->mElement->_setClipRect(elemClipRect);
|
|
|
|
|
|
|
|
- child->mElement->_setOffset(offset);
|
|
|
|
|
- child->mElement->_setWidth(elementSize.x);
|
|
|
|
|
- child->mElement->_setHeight(elementSize.y);
|
|
|
|
|
- child->mElement->_setAreaDepth(areaDepth);
|
|
|
|
|
- child->mElement->_setWidgetDepth(widgetDepth);
|
|
|
|
|
|
|
+ yOffset = btnHeight + ELEMENT_EXTRA_SPACING;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
|
|
|
|
|
- child->mElement->_setClipRect(elemClipRect);
|
|
|
|
|
|
|
+ if(current->mFoldoutBtn != nullptr)
|
|
|
|
|
+ {
|
|
|
|
|
+ Vector2I elementSize = current->mFoldoutBtn->_getOptimalSize();
|
|
|
|
|
|
|
|
- yOffset = elementSize.y + ELEMENT_EXTRA_SPACING;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ offset.x -= std::min((INT32)INITIAL_INDENT_OFFSET, elementSize.y);
|
|
|
|
|
|
|
|
- if(child->mFoldoutBtn != nullptr)
|
|
|
|
|
|
|
+ Vector2I myOffset = offset;
|
|
|
|
|
+ if(elementSize.y > btnHeight)
|
|
|
{
|
|
{
|
|
|
- Vector2I elementSize = child->mFoldoutBtn->_getOptimalSize();
|
|
|
|
|
|
|
+ UINT32 diff = elementSize.y - btnHeight;
|
|
|
|
|
+ float half = diff * 0.5f;
|
|
|
|
|
+ myOffset.y -= Math::floorToInt(half);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- offset.x -= std::min((INT32)INITIAL_INDENT_OFFSET, elementSize.y);
|
|
|
|
|
|
|
+ current->mFoldoutBtn->_setOffset(myOffset);
|
|
|
|
|
+ current->mFoldoutBtn->_setWidth(elementSize.x);
|
|
|
|
|
+ current->mFoldoutBtn->_setHeight(elementSize.y);
|
|
|
|
|
+ current->mFoldoutBtn->_setAreaDepth(areaDepth);
|
|
|
|
|
+ current->mFoldoutBtn->_setWidgetDepth(widgetDepth);
|
|
|
|
|
|
|
|
- child->mFoldoutBtn->_setOffset(offset);
|
|
|
|
|
- child->mFoldoutBtn->_setWidth(elementSize.x);
|
|
|
|
|
- child->mFoldoutBtn->_setHeight(elementSize.y);
|
|
|
|
|
- child->mFoldoutBtn->_setAreaDepth(areaDepth);
|
|
|
|
|
- child->mFoldoutBtn->_setWidgetDepth(widgetDepth);
|
|
|
|
|
|
|
+ RectI elemClipRect(clipRect.x - myOffset.x, clipRect.y - myOffset.y, clipRect.width, clipRect.height);
|
|
|
|
|
+ current->mFoldoutBtn->_setClipRect(elemClipRect);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- RectI elemClipRect(clipRect.x - offset.x, clipRect.y - offset.y, clipRect.width, clipRect.height);
|
|
|
|
|
- child->mFoldoutBtn->_setClipRect(elemClipRect);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ offset.y += yOffset;
|
|
|
|
|
+
|
|
|
|
|
+ tempOrderedElements.resize(current->mChildren.size(), nullptr);
|
|
|
|
|
+ for(auto& child : current->mChildren)
|
|
|
|
|
+ {
|
|
|
|
|
+ tempOrderedElements[child->mSortedIdx] = child;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- offset.y += yOffset;
|
|
|
|
|
|
|
+ for(auto iter = tempOrderedElements.rbegin(); iter != tempOrderedElements.rend(); ++iter)
|
|
|
|
|
+ {
|
|
|
|
|
+ TreeElement* child = *iter;
|
|
|
|
|
+
|
|
|
|
|
+ if(!child->mIsVisible)
|
|
|
|
|
+ continue;
|
|
|
|
|
|
|
|
todo.push(UpdateTreeElement(child, indent + 1));
|
|
todo.push(UpdateTreeElement(child, indent + 1));
|
|
|
}
|
|
}
|