Jelajahi Sumber

Shade the UI root element when it has a modal element set to make it more stands out.

Wei Tjong Yao 12 tahun lalu
induk
melakukan
80794575ad
2 mengubah file dengan 8 tambahan dan 2 penghapusan
  1. 0 1
      Bin/Data/Scripts/Editor/EditorNodeWindow.as
  2. 8 1
      Engine/UI/UI.cpp

+ 0 - 1
Bin/Data/Scripts/Editor/EditorNodeWindow.as

@@ -3,7 +3,6 @@
 
 Window@ attributeInspectorWindow;
 UIElement@ parentContainer;
-UIElement@ componentParentContainer;
 UIElement@ nodeContainer;
 XMLFile@ nodeXMLResource;
 XMLFile@ componentXMLResource;

+ 8 - 1
Engine/UI/UI.cpp

@@ -273,7 +273,14 @@ void UI::RenderUpdate()
     batches_.Clear();
     vertexData_.Clear();
     const IntVector2& rootSize = rootElement_->GetSize();
-    GetBatches(rootElement_, IntRect(0, 0, rootSize.x_, rootSize.y_));
+    IntRect currentScissor(0, 0, rootSize.x_, rootSize.y_);
+    if (modalElement_)
+    {
+        UIBatch batch(rootElement_, BLEND_ALPHA, currentScissor, 0, &vertexData_);
+        batch.AddQuad(0, 0, rootSize.x_, rootSize.y_, 0, 0, 0, 0, Color(0.0f, 0.0f, 0.0f, 0.25f));
+        UIBatch::AddOrMerge(batch, batches_);
+    }
+    GetBatches(rootElement_, currentScissor);
 
     // Restore UI cursor visibility state
     if (osCursorVisible && cursor_)