Browse Source

Merge remote-tracking branch 'monkeyfirst/hsv-color-wheel'

Lasse Öörni 10 years ago
parent
commit
5344d386b0

+ 64 - 0
bin/Data/EditorStrings.json

@@ -1079,5 +1079,69 @@
 		"en":"  CameraFlyMode: ",
 		"en":"  CameraFlyMode: ",
 		"ru": "  Камера в режиме полета: ",
 		"ru": "  Камера в режиме полета: ",
 		"fr": "  Mode vol caméra: "
 		"fr": "  Mode vol caméra: "
+	},
+	"Light color":{
+        "en":"Light color",
+        "ru":"Цвет источника света"
+	},
+    "Specular intensity":{
+        "en":"Specular intensity",
+        "ru":"Интенсивность бликов"
+	},
+    "Brightness multiplier":{
+        "en":"Brightness multiplier",
+        "ru":"Мультипликатор яркости"
+	},
+    "Ambient color":{
+        "en":"Ambient color",
+        "ru":"Цвет окружения"
+	},
+	"Fog color":{
+        "en":"Fog color",
+        "ru":"Цвет тумана"
+	},
+    "Move to layer":{
+        "en":"Move to layer",
+        "ru":"Переместить на слой"
+	},
+    "Smart Duplicate":{
+        "en":"Smart Duplicate",
+        "ru":"Дублирование со смещением"
+	},
+	"View closer":{
+        "en":"View closer",
+        "ru":"Показать поближе"
+	},
+    "Color wheel":{
+        "en":"Color wheel",
+        "ru":"Цветовое колесо"
+	},
+	"Diffuse color":{
+        "en":"Diffuse color",
+        "ru":"Диффузный цвет"
+	},
+	"Specular color":{
+        "en":"Specular color",
+        "ru":"Цвет бликов"
+	},
+    "Emissive color":{
+        "en":"Emissive color",
+        "ru":"Цвет самосвечения"
+	},
+	"Environment map color":{
+        "en":"Environment map color",
+        "ru":"Цвет карты окружения"
+	},
+	"Delete?":{
+        "en":"Delete?",
+        "ru":"Удалить?"
+	},
+	"Opacity":{
+        "en":"Opacity",
+        "ru":"Непрозрачность"
+	},
+	"Color":{
+        "en":"Color",
+        "ru":"Цвет"
 	}
 	}
 }
 }

+ 1 - 0
bin/Data/Scripts/Editor.as

@@ -18,6 +18,7 @@
 #include "Scripts/Editor/EditorSpawn.as"
 #include "Scripts/Editor/EditorSpawn.as"
 #include "Scripts/Editor/EditorSoundType.as"
 #include "Scripts/Editor/EditorSoundType.as"
 #include "Scripts/Editor/EditorLayers.as"
 #include "Scripts/Editor/EditorLayers.as"
+#include "Scripts/Editor/EditorColorWheel.as"
 
 
 
 
 String configFileName;
 String configFileName;

+ 466 - 0
bin/Data/Scripts/Editor/EditorColorWheel.as

@@ -0,0 +1,466 @@
+// HSV Color Wheel
+
+Window@ colorWheelWindow;
+UIElement@ colorCursor = null;
+UIElement@ colorWheel = null;
+
+UIElement@ closeButton = null;
+UIElement@ okButton = null;
+UIElement@ cancelButton = null;
+
+UIElement@ bwGradient = null;
+UIElement@ bwCursor = null;
+
+UIElement@ AGradient = null;
+UIElement@ ACursor = null;
+
+LineEdit@ rLineEdit = null;
+LineEdit@ gLineEdit = null;
+LineEdit@ bLineEdit = null;
+
+LineEdit@ hLineEdit = null;
+LineEdit@ sLineEdit = null;
+LineEdit@ vLineEdit = null;
+
+LineEdit@ aLineEdit = null;
+
+BorderImage@ colorCheck = null;
+Array<BorderImage@> colorFastItem;
+Array<Color> colorFast;
+int colorFastSelectedIndex = -1;
+int colorFastHoverIndex = -1;
+
+IntVector2 lastColorWheelWindowPosition;
+
+
+bool isColorWheelHovering = false;
+bool isBWGradientHovering = false;
+bool isAGradientHovering = false;
+
+Color wheelIncomingColor = Color(1,1,1,1);
+Color wheelColor = Color(1,1,1,1);
+float colorHValue = 1;
+float colorSValue = 1;
+float colorVValue = 1;
+float colorAValue = 0.5;
+float high = 0;
+float aValue = 1;
+
+const float IMAGE_SIZE = 256;
+const float HALF_IMAGE_SIZE = 128;
+const float MAX_ANGLE = 360;
+const float ROUND_VALUE_MAX = 0.99f;
+const float ROUND_VALUE_MIN = 0.01f;
+
+// for handlers outside
+String eventTypeWheelChangeColor = "WheelChangeColor";
+String eventTypeWheelSelectColor = "WheelSelectColor";
+String eventTypeWheelDiscardColor ="WheelDiscardColor";
+
+void CreateColorWheel()
+{
+    if (colorWheelWindow !is null)
+        return;
+
+    colorWheelWindow = LoadEditorUI("UI/EditorColorWheel.xml");
+    ui.root.AddChild(colorWheelWindow);
+    colorWheelWindow.opacity = uiMaxOpacity;
+    
+    colorWheel = colorWheelWindow.GetChild("ColorWheel", true);
+    colorCursor = colorWheelWindow.GetChild("ColorCursor", true);
+    
+    closeButton = colorWheelWindow.GetChild("CloseButton", true);
+    okButton = colorWheelWindow.GetChild("okButton", true);
+    cancelButton = colorWheelWindow.GetChild("cancelButton", true);
+    
+    colorCheck = colorWheelWindow.GetChild("ColorCheck", true);
+    bwGradient = colorWheelWindow.GetChild("BWGradient", true);
+    bwCursor = colorWheelWindow.GetChild("BWCursor", true);
+    
+    AGradient = colorWheelWindow.GetChild("AGradient", true);
+    ACursor = colorWheelWindow.GetChild("ACursor", true);
+       
+    rLineEdit = colorWheelWindow.GetChild("R", true);
+    gLineEdit = colorWheelWindow.GetChild("G", true);
+    bLineEdit = colorWheelWindow.GetChild("B", true);
+
+    hLineEdit = colorWheelWindow.GetChild("H", true);
+    sLineEdit = colorWheelWindow.GetChild("S", true);
+    vLineEdit = colorWheelWindow.GetChild("V", true);
+    
+    aLineEdit = colorWheelWindow.GetChild("A", true);
+    
+    colorFastItem.Resize(8);
+    colorFast.Resize(8);
+    
+    // init some gragient for fast colors palette
+    for (int i=0; i<8; i++) 
+    {
+        colorFastItem[i] = colorWheelWindow.GetChild("h"+String(i), true);
+        colorFast[i] = Color(i*0.125,i*0.125,i*0.125);
+        colorFastItem[i].color = colorFast[i]; 
+    }
+    
+    SubscribeToEvent("MouseMove", "HandleMouseMove");
+    SubscribeToEvent("MouseButtonDown", "HandleMouseButton");
+    
+    SubscribeToEvent("MouseWheel", "HandleMouseWheel");
+    SubscribeToEvent("KeyDown", "HandleKeyDownWheel");
+       
+    SubscribeToEvent(closeButton, "Pressed", "HandleWheelButtons");
+    SubscribeToEvent(okButton, "Pressed", "HandleWheelButtons");
+    SubscribeToEvent(cancelButton, "Pressed", "HandleWheelButtons");
+    
+    lastColorWheelWindowPosition = IntVector2(300,400);
+        
+    HideColorWheel();
+}
+
+bool ShowColorWheelWithColor(Color oldColor) 
+{
+    wheelIncomingColor = oldColor;
+    wheelColor = oldColor;
+    return ShowColorWheel();
+}
+
+bool ShowColorWheel()
+{
+    if (ui.focusElement !is null && colorWheelWindow.visible) 
+        return false;
+
+    colorFastSelectedIndex = -1;
+    colorFastHoverIndex = -1;
+            
+    EstablishColorWheelUIFromColor(wheelColor); 
+         
+    colorWheelWindow.opacity = 1;
+    colorWheelWindow.position = lastColorWheelWindowPosition;
+    colorWheelWindow.visible = true;
+    colorWheelWindow.BringToFront();
+    
+    return true;
+}
+
+void HideColorWheel()
+{
+    if (colorWheelWindow.visible) 
+    {
+        colorWheelWindow.visible = false;
+        lastColorWheelWindowPosition = colorWheelWindow.position;
+    }
+}
+
+void HandleWheelButtons(StringHash eventType, VariantMap& eventData) 
+{
+    UIElement@ edit = eventData["Element"].GetPtr();
+    
+    if (edit is null) return;
+    
+    if (edit is cancelButton) 
+    {
+        VariantMap eventData;
+        eventData["Color"] = wheelIncomingColor;
+        SendEvent(eventTypeWheelDiscardColor, eventData);
+        HideColorWheel();
+    }
+     
+    if (edit is closeButton) 
+    {   
+        VariantMap eventData;
+        eventData["Color"] = wheelIncomingColor;
+        SendEvent(eventTypeWheelDiscardColor, eventData);
+        HideColorWheel();
+    }
+    
+    if (edit is okButton) 
+    {
+        VariantMap eventData;
+        eventData["Color"] = wheelColor;
+        SendEvent(eventTypeWheelSelectColor, eventData);
+        HideColorWheel();
+    }
+}
+
+void HandleKeyDownWheel(StringHash eventType, VariantMap& eventData) 
+{
+    if (colorWheelWindow.visible == false) return;
+    int key = eventData["Key"].GetInt();
+    
+    
+    MessageBox(String(key));
+    if (key == KEY_ESC)
+        HideColorWheel();
+       
+}
+
+void HandleMouseButton(StringHash eventType, VariantMap& eventData) 
+{
+    if (colorWheelWindow.visible == false) return;
+    
+    int x = eventData["X"].GetInt();
+    int y = eventData["Y"].GetInt();
+    int button = eventData["Button"].GetInt();
+
+    /*
+    if (colorWheel.IsInside(IntVector2(x,y), true)) 
+    {
+    
+    }
+    else if (bwGradient.IsInside(IntVector2(x,y), true)) 
+    {
+    
+    }   
+    else if (AGradient.IsInside(IntVector2(x,y), true))
+    {
+    
+    }
+    */
+     
+    if (button == 1) 
+    {
+        // check for select
+        if (colorFastHoverIndex != -1)
+        {
+            
+            colorFastSelectedIndex = colorFastHoverIndex;
+            EstablishColorWheelUIFromColor(colorFast[colorFastSelectedIndex]);
+            SendEventChangeColor();    
+        }
+    }
+}
+
+// handler only for BWGradient
+void HandleMouseWheel(StringHash eventType, VariantMap& eventData) 
+{
+    if (colorWheelWindow.visible == false || !isBWGradientHovering ) return;
+    
+    int multipler = 16;
+    int wheelValue = eventData["Wheel"].GetInt();
+    
+    wheelValue = wheelValue * multipler;
+    
+    if (wheelValue != 0) 
+    {
+        if (wheelValue > 0) 
+        {   
+            high = high + wheelValue;
+            high = Min(high, IMAGE_SIZE); // limit BWGradietn by high 
+        }
+        else if (wheelValue < 0)
+        {      
+            high = high + wheelValue;
+            high = Max(high, 0.0f);
+        }
+        
+        bwCursor.SetPosition(bwCursor.position.x, high-7);
+        colorVValue = float((IMAGE_SIZE-high) / IMAGE_SIZE);
+        
+        UpdateColorInformation();
+            
+    }     
+}
+
+void HandleMouseMove(StringHash eventType, VariantMap& eventData) 
+{
+    if (colorWheelWindow.visible == false) return;
+        
+    int x = eventData["X"].GetInt();
+    int y = eventData["Y"].GetInt();
+    int button = eventData["Button"].GetInt();
+    
+    if (colorWheelWindow.IsInside(IntVector2(x,y), true))
+        colorWheelWindow.opacity = 1.0f;
+    
+    int cwx = 0;
+    int cwy = 0;
+    int cx = 0;
+    int cy = 0;
+    IntVector2 i;
+    bool inWheel = false;
+ 
+    isBWGradientHovering = false;
+    isColorWheelHovering = false;
+    
+    // if mouse cursor move on wheel rectangle    
+    if (colorWheel.IsInside(IntVector2(x,y), true)) 
+    {
+        isColorWheelHovering = true;
+        // get element pos win screen
+        IntVector2 ep = colorWheel.screenPosition;
+    
+        // math diff between mouse cursor & element pos = mouse pos on element
+        cwx = x - ep.x;
+        cwy = y - ep.y;
+        
+        // shift mouse pos to center of wheel 
+        cx = cwx - HALF_IMAGE_SIZE;
+        cy = cwy - HALF_IMAGE_SIZE;
+        
+        // get direction vector of H on circle
+        Vector2 d = Vector2(cx,cy);
+  
+        // if out  of circle place colorCurcor back to circle
+        if (d.length > HALF_IMAGE_SIZE) 
+        { 
+            d.Normalize();
+            d = d * HALF_IMAGE_SIZE;
+            
+            i = IntVector2(d.x, d.y);
+            inWheel = false;
+           
+        }
+        else 
+        {
+            inWheel = true;   
+        }
+                
+        if (isColorWheelHovering && inWheel && input.mouseButtonDown[MOUSEB_LEFT] || input.mouseButtonDown[MOUSEB_RIGHT]) 
+        {
+            Vector2 pointOnCircle = Vector2(cx,-cy);      
+            float angle = GetAngle(pointOnCircle);
+ 
+            i = i + IntVector2(cwx,cwy);
+            colorCursor.position = IntVector2(i.x-7, i.y-7);
+            
+            colorHValue = GetHueFromWheelDegAngle(angle);
+            
+            if (colorHValue < ROUND_VALUE_MIN) colorHValue = 0.0;
+            if (colorHValue > ROUND_VALUE_MAX) colorHValue = 1.0;
+             
+            colorSValue = d.length / HALF_IMAGE_SIZE;
+            
+            if (colorSValue < ROUND_VALUE_MIN) colorSValue = 0.0;
+            if (colorSValue > ROUND_VALUE_MAX) colorSValue = 1.0;
+    
+            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            SendEventChangeColor();
+            UpdateColorInformation();
+        }    
+    }
+    // if mouse cursor move on bwGradient rectangle   
+    else if (bwGradient.IsInside(IntVector2(x,y), true)) 
+    {
+        isBWGradientHovering = true;
+        IntVector2 ep = bwGradient.screenPosition; 
+        float high = y - ep.y;
+        
+        if (input.mouseButtonDown[MOUSEB_LEFT] || input.mouseButtonDown[MOUSEB_RIGHT]) 
+        {
+            bwCursor.SetPosition(bwCursor.position.x, high-7);
+            colorVValue = float((IMAGE_SIZE-high) / IMAGE_SIZE);
+            
+            if (colorVValue < 0.01) colorVValue = 0.0;
+            if (colorVValue > 0.99) colorVValue = 1.0;
+            
+            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            SendEventChangeColor();
+        }
+        
+        UpdateColorInformation();      
+    }
+    // if mouse cursor move on AlphaGradient rectangle 
+    else if (AGradient.IsInside(IntVector2(x,y), true))
+    {
+        IntVector2 ep = AGradient.screenPosition; 
+        float aValue = x - ep.x;
+        
+        if (input.mouseButtonDown[MOUSEB_LEFT] || input.mouseButtonDown[MOUSEB_RIGHT]) 
+        {
+            ACursor.SetPosition(aValue-7, ACursor.position.y);
+            colorAValue = float((aValue) / 200); // 200pix image
+            
+            // round values for min or max
+            if (colorAValue < 0.01) colorAValue = 0.0;
+            if (colorAValue > 0.99) colorAValue = 1.0;
+            
+            wheelColor.FromHSV(colorHValue,colorSValue,colorVValue, colorAValue);
+            SendEventChangeColor();
+        }
+        
+        UpdateColorInformation();
+    }
+    
+    // cheking for history select
+    for (int j=0; j<8; j++) 
+    {
+        if (colorFastItem[j].IsInside(IntVector2(x,y), true))
+            colorFastHoverIndex = j;
+    } 
+}
+
+void UpdateColorInformation() 
+{
+    // fill UI from current color
+    hLineEdit.text = String(colorHValue).Substring(0,5);
+    sLineEdit.text = String(colorSValue).Substring(0,5);
+    vLineEdit.text = String(colorVValue).Substring(0,5);
+       
+    rLineEdit.text = String(wheelColor.r).Substring(0,5);
+    gLineEdit.text = String(wheelColor.g).Substring(0,5);
+    bLineEdit.text = String(wheelColor.b).Substring(0,5);
+    
+    aLineEdit.text = String(colorAValue).Substring(0,5); 
+    
+    colorCheck.color = wheelColor;
+    colorWheel.color = Color(colorVValue,colorVValue,colorVValue);
+    AGradient.color = Color(wheelColor.r, wheelColor.g, wheelColor.b);
+    
+    // update selected fast-colors
+    if (colorFastSelectedIndex != -1) 
+    {
+        colorFastItem[colorFastSelectedIndex].color = wheelColor;
+        colorFast[colorFastSelectedIndex] = wheelColor; 
+    }   
+}
+
+void SendEventChangeColor()
+{
+    VariantMap eventData;
+    eventData["Color"] = wheelColor;
+    SendEvent("WheelChangeColor", eventData);
+}
+
+void EstablishColorWheelUIFromColor(Color c) 
+{
+    wheelColor = c;
+    colorHValue = c.Hue();
+    colorSValue = c.SaturationHSV();
+    colorVValue = c.Value();
+    colorAValue = c.a;
+    
+    // convert color value to BWGradient high
+    high = IMAGE_SIZE - colorVValue * IMAGE_SIZE;
+    bwCursor.SetPosition(bwCursor.position.x, high-7);
+    
+    // convert color alpha to shift on x-axis for ACursor
+    aValue = 200 * colorAValue;
+    ACursor.SetPosition(aValue-7 , ACursor.position.y);
+    
+    // rotate vector to H-angle with scale(shifting) by S to calculate final point position
+    Quaternion q(colorHValue * -MAX_ANGLE);
+    Vector3 pos = Vector3(1,0,0);
+    pos.Normalize();
+    pos = q * pos;
+    pos = pos * (colorSValue * HALF_IMAGE_SIZE);
+    pos = pos + Vector3(HALF_IMAGE_SIZE,HALF_IMAGE_SIZE);
+        
+    colorCursor.position = IntVector2(pos.x-7, pos.y-7);
+        
+    // Update information on UI about color
+    UpdateColorInformation();
+}
+
+float GetHueFromWheelDegAngle(float angle) 
+{
+    return angle / MAX_ANGLE;
+}
+
+float GetAngle(Vector2 point) 
+{   
+    float angle = Atan2( point.y, point.x ); 
+    
+    if (angle < 0) 
+        angle += MAX_ANGLE; 
+    
+    return angle;
+}

+ 7 - 0
bin/Data/Scripts/Editor/EditorHierarchyWindow.as

@@ -1536,6 +1536,8 @@ bool BlenderModeDelete()
     
     
     Array<UIElement@> actions;
     Array<UIElement@> actions;
     actions.Push(CreateContextMenuItem("Delete?", "HandleBlenderModeDelete"));
     actions.Push(CreateContextMenuItem("Delete?", "HandleBlenderModeDelete"));
+    actions.Push(CreateContextMenuItem("Cancel", "HandleEmpty"));
+    
     if (actions.length > 0) {
     if (actions.length > 0) {
         ActivateContextMenu(actions);
         ActivateContextMenu(actions);
         return true;
         return true;
@@ -1686,6 +1688,11 @@ void HandleBlenderModeDelete()
     Delete();
     Delete();
 }
 }
 
 
+void HandleEmpty() 
+{
+    //just doing nothing
+}
+
 void HandleHierarchyContextPaste()
 void HandleHierarchyContextPaste()
 {
 {
     Paste();
     Paste();

+ 101 - 0
bin/Data/Scripts/Editor/EditorScene.as

@@ -1371,3 +1371,104 @@ void CreateModelWithAnimatedModel(String filepath, Node@ parent)
     animatedModel.model = model;
     animatedModel.model = model;
     CreateLoadedComponent(animatedModel);
     CreateLoadedComponent(animatedModel);
 }
 }
+
+bool ColorWheelSetupBehaviorForColoring()
+{    
+    Menu@ menu = GetEventSender();
+    if (menu is null)
+        return false;
+    
+    coloringPropertyName = menu.name;
+    
+    if (coloringPropertyName == "menuCancel") return false;
+    
+    if (coloringComponent.typeName == "Light") 
+    {
+        Light@ light = cast<Light>(coloringComponent);
+        if (light !is null) 
+        {          
+            if (coloringPropertyName == "menuLightColor")
+            {
+                coloringOldColor = light.color;
+                ShowColorWheelWithColor(coloringOldColor);
+            }
+            else if (coloringPropertyName == "menuSpecularIntensity")
+            {
+               // ColorWheel have only 0-1 range output of V-value(BW), and for huge-range values we devide in and multiply out 
+               float scaledSpecular = light.specularIntensity * 0.1f; 
+               coloringOldScalar = scaledSpecular;
+               ShowColorWheelWithColor(Color(scaledSpecular,scaledSpecular,scaledSpecular));
+
+            }
+            else if (coloringPropertyName == "menuBrightnessMultiplier")
+            { 
+               float scaledBrightness = light.brightness * 0.1f;
+               coloringOldScalar = scaledBrightness;
+               ShowColorWheelWithColor(Color(scaledBrightness,scaledBrightness,scaledBrightness));
+            }   
+        }      
+    }
+    else if (coloringComponent.typeName == "StaticModel") 
+    {
+        StaticModel@ model  = cast<StaticModel>(coloringComponent);
+        if (model !is null) 
+        {            
+            Material@ mat = model.materials[0];
+            if (mat !is null) 
+            { 
+                if (coloringPropertyName == "menuDiffuseColor")
+                {
+                    Variant oldValue = mat.shaderParameters["MatDiffColor"];
+                    Array<String> values = oldValue.ToString().Split(' ');
+                    coloringOldColor = Color(values[0].ToFloat(),values[1].ToFloat(),values[2].ToFloat(),values[3].ToFloat()); //RGBA
+                    ShowColorWheelWithColor(coloringOldColor);
+                }
+                else if (coloringPropertyName == "menuSpecularColor")
+                {
+                    Variant oldValue = mat.shaderParameters["MatSpecColor"];
+                    Array<String> values = oldValue.ToString().Split(' ');
+                    coloringOldColor = Color(values[0].ToFloat(),values[1].ToFloat(),values[2].ToFloat());
+                    coloringOldScalar = values[3].ToFloat();
+                    ShowColorWheelWithColor(Color(coloringOldColor.r, coloringOldColor.g, coloringOldColor.b, coloringOldScalar/128.0f)); //RGB + shine
+                }
+                else if (coloringPropertyName == "menuEmissiveColor")
+                {
+                    Variant oldValue = mat.shaderParameters["MatEmissiveColor"];
+                    Array<String> values = oldValue.ToString().Split(' ');
+                    coloringOldColor = Color(values[0].ToFloat(),values[1].ToFloat(),values[2].ToFloat()); // RGB
+                    
+                    
+                    ShowColorWheelWithColor(coloringOldColor);
+                }
+                else if (coloringPropertyName == "menuEnvironmentMapColor")
+                {   
+                    Variant oldValue = mat.shaderParameters["MatEnvMapColor"];
+                    Array<String> values = oldValue.ToString().Split(' ');
+                    coloringOldColor = Color(values[0].ToFloat(),values[1].ToFloat(),values[2].ToFloat()); //RGB
+                    
+                    ShowColorWheelWithColor(coloringOldColor);
+                }      
+            }
+        }
+    }
+    else if (coloringComponent.typeName == "Zone") 
+    {
+        Zone@ zone  = cast<Zone>(coloringComponent);
+        if (zone !is null) 
+        {
+            if (coloringPropertyName == "menuAmbientColor")
+            {
+                coloringOldColor = zone.ambientColor;
+            }
+            else if (coloringPropertyName == "menuFogColor") 
+            {
+                coloringOldColor = zone.fogColor;
+            }
+            
+            ShowColorWheelWithColor(coloringOldColor);
+        }
+    }
+          
+    return true;
+}
+

+ 347 - 2
bin/Data/Scripts/Editor/EditorUI.as

@@ -10,6 +10,8 @@ Array<QuickMenuItem@> quickMenuItems;
 FileSelector@ uiFileSelector;
 FileSelector@ uiFileSelector;
 String consoleCommandInterpreter;
 String consoleCommandInterpreter;
 Window@ contextMenu;
 Window@ contextMenu;
+float stepColoringGroupUpdate = 100; // ms
+float timeToNextColoringGroupUpdate = 0;
 
 
 const StringHash UI_ELEMENT_TYPE("UIElement");
 const StringHash UI_ELEMENT_TYPE("UIElement");
 const StringHash WINDOW_TYPE("Window");
 const StringHash WINDOW_TYPE("Window");
@@ -87,6 +89,7 @@ void CreateUI()
     CreateResourceBrowser();
     CreateResourceBrowser();
     CreateCamera();
     CreateCamera();
     CreateLayerEditor();
     CreateLayerEditor();
+    CreateColorWheel();
 
 
     SubscribeToEvent("ScreenMode", "ResizeUI");
     SubscribeToEvent("ScreenMode", "ResizeUI");
     SubscribeToEvent("MenuSelected", "HandleMenuSelected");
     SubscribeToEvent("MenuSelected", "HandleMenuSelected");
@@ -94,6 +97,10 @@ void CreateUI()
     SubscribeToEvent("KeyUp", "UnfadeUI");
     SubscribeToEvent("KeyUp", "UnfadeUI");
     SubscribeToEvent("MouseButtonUp", "UnfadeUI");
     SubscribeToEvent("MouseButtonUp", "UnfadeUI");
     SubscribeToEvent("ChangeLanguage", "HandleChangeLanguage");
     SubscribeToEvent("ChangeLanguage", "HandleChangeLanguage");
+    
+    SubscribeToEvent("WheelChangeColor", "HandleWheelChangeColor" );
+    SubscribeToEvent("WheelSelectColor", "HandleWheelSelectColor" );
+    SubscribeToEvent("WheelDiscardColor", "HandleWheelDiscardColor" );
 }
 }
 
 
 void ResizeUI()
 void ResizeUI()
@@ -390,7 +397,8 @@ void CreateMenuBar()
         {
         {
              popup.AddChild(CreateMenuItem("Move to layer", @ShowLayerMover, 'M'));
              popup.AddChild(CreateMenuItem("Move to layer", @ShowLayerMover, 'M'));
              popup.AddChild(CreateMenuItem("Smart Duplicate", @SceneSmartDuplicateNode, 'D', QUAL_ALT));
              popup.AddChild(CreateMenuItem("Smart Duplicate", @SceneSmartDuplicateNode, 'D', QUAL_ALT));
-             popup.AddChild(CreateMenuItem("View closer", @ViewCloser, KEY_KP_PERIOD));                     
+             popup.AddChild(CreateMenuItem("View closer", @ViewCloser, KEY_KP_PERIOD));
+             popup.AddChild(CreateMenuItem("Color wheel", @ColorWheelBuildMenuSelectTypeColor, 'W', QUAL_ALT));                     
         }
         }
         
         
         CreateChildDivider(popup);
         CreateChildDivider(popup);
@@ -1710,16 +1718,18 @@ void ActivateContextMenu(Array<UIElement@> actions)
     OpenContextMenu();
     OpenContextMenu();
 }
 }
 
 
-Menu@ CreateContextMenuItem(String text, String handler)
+Menu@ CreateContextMenuItem(String text, String handler, String menuName = "", bool autoLocalize = true)
 {
 {
     Menu@ menu = Menu();
     Menu@ menu = Menu();
     menu.defaultStyle = uiStyle;
     menu.defaultStyle = uiStyle;
     menu.style = AUTO_STYLE;
     menu.style = AUTO_STYLE;
+    menu.name = menuName;
     menu.SetLayout(LM_HORIZONTAL, 0, IntRect(8, 2, 8, 2));
     menu.SetLayout(LM_HORIZONTAL, 0, IntRect(8, 2, 8, 2));
     Text@ menuText = Text();
     Text@ menuText = Text();
     menuText.style = "EditorMenuText";
     menuText.style = "EditorMenuText";
     menu.AddChild(menuText);
     menu.AddChild(menuText);
     menuText.text = text;
     menuText.text = text;
+    menuText.autoLocalizable = autoLocalize;
     menu.vars[VAR_CONTEXT_MENU_HANDLER] = handler;
     menu.vars[VAR_CONTEXT_MENU_HANDLER] = handler;
     SubscribeToEvent(menu, "Released", "ContextMenuEventWrapper");
     SubscribeToEvent(menu, "Released", "ContextMenuEventWrapper");
     return menu;
     return menu;
@@ -1775,3 +1785,338 @@ bool SetSplinePath()
 
 
     return SceneSetChildrenSplinePath(menu.name == "Cyclic");
     return SceneSetChildrenSplinePath(menu.name == "Cyclic");
 }
 }
+
+bool ColorWheelBuildMenuSelectTypeColor() 
+{
+    if (selectedNodes.empty && selectedComponents.empty) return false;
+    editMode = EDIT_SELECT;
+    
+    // do coloring only for single selected object
+    // start with trying to find single component
+    if (selectedComponents.length == 1) 
+    {
+        coloringComponent = selectedComponents[0];    
+    }
+    // else try to get first component from selected node
+    else if (selectedNodes.length == 1) 
+    {
+        Array<Component@> components = selectedNodes[0].GetComponents();
+        if (components.length > 0) 
+        {
+            coloringComponent = components[0];
+        }
+    }
+    else
+        return false;
+        
+    if (coloringComponent is null) return false;
+    
+    Array<UIElement@> actions;
+           
+    if (coloringComponent.typeName == "Light") 
+    {
+        actions.Push(CreateContextMenuItem("Light color", "HandleColorWheelMenu", "menuLightColor" ));
+        actions.Push(CreateContextMenuItem("Specular intensity", "HandleColorWheelMenu", "menuSpecularIntensity"));
+        actions.Push(CreateContextMenuItem("Brightness multiplier", "HandleColorWheelMenu", "menuBrightnessMultiplier" ));
+        
+        actions.Push(CreateContextMenuItem("Cancel", "HandleColorWheelMenu", "menuCancel"));
+        
+    }
+    else if (coloringComponent.typeName == "StaticModel") 
+    {
+        actions.Push(CreateContextMenuItem("Diffuse color", "HandleColorWheelMenu", "menuDiffuseColor"));
+        actions.Push(CreateContextMenuItem("Specular color", "HandleColorWheelMenu", "menuSpecularColor"));
+        actions.Push(CreateContextMenuItem("Emissive color", "HandleColorWheelMenu", "menuEmissiveColor"));
+        actions.Push(CreateContextMenuItem("Environment map color", "HandleColorWheelMenu", "menuEnvironmentMapColor"));
+        
+        actions.Push(CreateContextMenuItem("Cancel", "HandleColorWheelMenu", "menuCancel"));
+    }
+    else if (coloringComponent.typeName == "Zone")        
+    {
+        actions.Push(CreateContextMenuItem("Ambient color", "HandleColorWheelMenu", "menuAmbientColor"));
+        actions.Push(CreateContextMenuItem("Fog color", "HandleColorWheelMenu", "menuFogColor"));
+        
+        actions.Push(CreateContextMenuItem("Cancel", "HandleColorWheelMenu", "menuCancel"));
+    }
+    
+    if (actions.length > 0) {
+        ActivateContextMenu(actions);
+        return true;
+    }
+        
+    return false;
+}
+
+void HandleColorWheelMenu() 
+{
+    ColorWheelSetupBehaviorForColoring();
+}
+
+// color was changed, update color of all colorGroup for immediate preview;
+void HandleWheelChangeColor(StringHash eventType, VariantMap& eventData)
+{
+    if (timeToNextColoringGroupUpdate > time.systemTime) return;
+
+    if (coloringComponent !is null)
+    {
+        Color c = eventData["Color"].GetColor();  // current ColorWheel   
+        // preview new color
+        if (coloringComponent.typeName == "Light") 
+        {
+            Light@ light = cast<Light>(coloringComponent);
+            if (light !is null) 
+            {          
+                if (coloringPropertyName == "menuLightColor")
+                {
+                    light.color = c;
+                }
+                else if (coloringPropertyName == "menuSpecularIntensity")
+                {
+                   // multiply out 
+                   light.specularIntensity = c.Value() * 10.0f;
+
+                }
+                else if (coloringPropertyName == "menuBrightnessMultiplier")
+                {
+                   light.brightness = c.Value() * 10.0f;
+                   
+                }
+                
+                attributesDirty = true;   
+            }      
+        }
+        else if (coloringComponent.typeName == "StaticModel") 
+        {
+            StaticModel@ model  = cast<StaticModel>(coloringComponent);
+            if (model !is null) 
+            {            
+                Material@ mat = model.materials[0];
+                if (mat !is null) 
+                { 
+                    if (coloringPropertyName == "menuDiffuseColor")
+                    {   
+                        Variant oldValue = mat.shaderParameters["MatDiffColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(c.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatDiffColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuSpecularColor")
+                    { 
+                        Variant oldValue = mat.shaderParameters["MatSpecColor"];
+                        Variant newValue;
+                        String valueString;                        
+                        valueString += String(c.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.a * 128).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatSpecColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuEmissiveColor")
+                    {
+                        Variant oldValue = mat.shaderParameters["MatEmissiveColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(c.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatEmissiveColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuEnvironmentMapColor")
+                    {
+                        Variant oldValue = mat.shaderParameters["MatEnvMapColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(c.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(c.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatEnvMapColor"] = newValue;
+                    }                    
+                }
+            }
+        }
+        else if (coloringComponent.typeName == "Zone") 
+        {
+            Zone@ zone  = cast<Zone>(coloringComponent);
+            if (zone !is null) 
+            {
+                if (coloringPropertyName == "menuAmbientColor")
+                {
+                    zone.ambientColor = c;
+                }
+                else if (coloringPropertyName == "menuFogColor") 
+                {
+                    zone.fogColor = c;
+                }
+                
+                attributesDirty = true;
+            }
+        }        
+    }
+
+    timeToNextColoringGroupUpdate = time.systemTime + stepColoringGroupUpdate;
+}
+
+// Return old colors, wheel was closed or color discarded
+void HandleWheelDiscardColor(StringHash eventType, VariantMap& eventData)
+{
+    if (coloringComponent !is null)
+    {
+        //Color oldColor = eventData["Color"].GetColor(); //Old color from ColorWheel from ShowColorWheelWithColor(old)     
+        Color oldColor = coloringOldColor;
+        
+        // preview new color
+        if (coloringComponent.typeName == "Light") 
+        {
+            Light@ light = cast<Light>(coloringComponent);
+            if (light !is null) 
+            {          
+                if (coloringPropertyName == "menuLightColor")
+                {
+                    light.color = oldColor;
+                }
+                else if (coloringPropertyName == "menuSpecularIntensity")
+                {
+                   light.specularIntensity = coloringOldScalar * 10.0f;
+
+                }
+                else if (coloringPropertyName == "menuBrightnessMultiplier")
+                {
+                   light.brightness = coloringOldScalar * 10.0f;
+                   
+                }
+                
+                attributesDirty = true;   
+            }      
+        }
+        else if (coloringComponent.typeName == "StaticModel") 
+        {
+            StaticModel@ model  = cast<StaticModel>(coloringComponent);
+            if (model !is null) 
+            {            
+                Material@ mat = model.materials[0];
+                if (mat !is null) 
+                {                 
+                    if (coloringPropertyName == "menuDiffuseColor")
+                    {   
+                        Variant oldValue = mat.shaderParameters["MatDiffColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(oldColor.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatDiffColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuSpecularColor")
+                    { 
+                        Variant oldValue = mat.shaderParameters["MatSpecColor"];
+                        Variant newValue;
+                        String valueString;                        
+                        valueString += String(oldColor.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(coloringOldScalar).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatSpecColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuEmissiveColor")
+                    {
+                        Variant oldValue = mat.shaderParameters["MatEmissiveColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(oldColor.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatEmissiveColor"] = newValue;
+                    }
+                    else if (coloringPropertyName == "menuEnvironmentMapColor")
+                    {
+                        Variant oldValue = mat.shaderParameters["MatEnvMapColor"];
+                        Variant newValue;
+                        String valueString;
+                        valueString += String(oldColor.r).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.g).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.b).Substring(0,5);
+                        valueString += " ";
+                        valueString += String(oldColor.a).Substring(0,5);
+                        newValue.FromString(oldValue.type, valueString);    
+                        mat.shaderParameters["MatEnvMapColor"] = newValue;
+                    }                                        
+                }
+            }
+        }
+        else if (coloringComponent.typeName == "Zone") 
+        {
+            Zone@ zone  = cast<Zone>(coloringComponent);
+            if (zone !is null) 
+            {
+                if (coloringPropertyName == "menuAmbientColor")
+                {
+                    zone.ambientColor = oldColor;
+                }
+                else if (coloringPropertyName == "menuFogColor") 
+                {
+                    zone.fogColor = oldColor;
+                }
+                
+                attributesDirty = true;
+            }
+        }        
+    }
+}
+
+// Applying color wheel changes to material
+void HandleWheelSelectColor(StringHash eventType, VariantMap& eventData)
+{  
+    if (coloringComponent !is null)
+    if (coloringComponent.typeName == "StaticModel") 
+    {
+        Color c = eventData["Color"].GetColor(); //Selected color from ColorWheel
+        StaticModel@ model  = cast<StaticModel>(coloringComponent);
+        if (model !is null) 
+        {
+            Material@ mat = model.materials[0];
+            if (mat !is null) 
+            {
+                editMaterial = mat;
+                SaveMaterial();                       
+            }
+        }
+    }
+}

+ 5 - 0
bin/Data/Scripts/Editor/EditorView.as

@@ -26,6 +26,11 @@ WeakHandle lastSelectedNode = null;
 WeakHandle lastSelectedDrawable = null;
 WeakHandle lastSelectedDrawable = null;
 WeakHandle lastSelectedComponent = null;
 WeakHandle lastSelectedComponent = null;
 bool viewCloser = false;
 bool viewCloser = false;
+Component@ coloringComponent = null;
+String coloringTypeName;
+String coloringPropertyName;
+Color coloringOldColor;
+float coloringOldScalar;
 
 
 const uint VIEWPORT_BORDER_H     = 0x00000001;
 const uint VIEWPORT_BORDER_H     = 0x00000001;
 const uint VIEWPORT_BORDER_H1    = 0x00000002;
 const uint VIEWPORT_BORDER_H1    = 0x00000002;

BIN
bin/Data/Textures/Editor/BW.png


BIN
bin/Data/Textures/Editor/hsv20.png


BIN
bin/Data/Textures/UI.png


+ 375 - 0
bin/Data/UI/EditorColorWheel.xml

@@ -0,0 +1,375 @@
+<?xml version="1.0"?>
+<element type="Window">
+	<attribute name="Name" value="EditorColorWheel" />
+	<attribute name="Position" value="1026 364" />
+	<attribute name="Size" value="400 450" />
+	<attribute name="Is Movable" value="true" />
+	<element>
+		<attribute name="Name" value="ColorWheelBWGradient" />
+		<attribute name="Position" value="10 34" />
+		<attribute name="Size" value="256 256" />
+		<attribute name="Layout Mode" value="Vertical" />
+		<element>
+			<element type="BorderImage">
+				<attribute name="Name" value="ColorWheel" />
+				<attribute name="Size" value="256 256" />
+				<attribute name="Is Enabled" value="true" />
+				<attribute name="Texture" value="Texture2D;Textures/Editor/hsv20.png" />
+				<attribute name="Image Rect" value="0 0 256 256" />
+				<attribute name="Blend Mode" value="alpha" />
+				<element type="BorderImage">
+					<attribute name="Name" value="ColorCursor" />
+					<attribute name="Position" value="124 124" />
+					<attribute name="Size" value="16 16" />
+					<attribute name="Image Rect" value="63 84 15 15" />
+				</element>
+			</element>
+			<element type="BorderImage">
+				<attribute name="Name" value="BWGradient" />
+				<attribute name="Position" value="287 0" />
+				<attribute name="Size" value="64 256" />
+				<attribute name="Is Editable" value="false" />
+				<attribute name="Texture" value="Texture2D;Textures/Editor/BW.png" />
+				<attribute name="Image Rect" value="0 0 64 256" />
+				<attribute name="Blend Mode" value="alpha" />
+				<element type="BorderImage">
+					<attribute name="Name" value="BWCursor" />
+					<attribute name="Size" value="64 13" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Image Rect" value="2 84 59 98" />
+				</element>
+			</element>
+		</element>
+	</element>
+	<element>
+		<attribute name="Name" value="WindowTitle" />
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Is Editable" value="false" />
+		<element type="Text">
+			<attribute name="Position" value="8 6" />
+			<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+			<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+			<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+			<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+			<attribute name="Is Editable" value="false" />
+			<attribute name="Layout Mode" value="Vertical" />
+			<attribute name="Text" value="Color HSV Wheel" />
+		</element>
+		<element type="BorderImage" style="EditorDivider">
+			<attribute name="Position" value="4 21" />
+			<attribute name="Size" value="394 11" />
+		</element>
+		<element type="Button" style="CloseButton">
+			<attribute name="Name" value="CloseButton" />
+			<attribute name="Position" value="380 5" />
+			<attribute name="Is Editable" value="false" />
+			<attribute name="Is Selected" value="true" />
+			<attribute name="Focus Mode" value="FocusableDefocusable" />
+		</element>
+	</element>
+	<element>
+		<attribute name="Name" value="ViewValues" />
+		<attribute name="Position" value="0 300" />
+		<attribute name="Size" value="400 140" />
+		<attribute name="Layout Mode" value="Vertical" />
+		<element>
+			<attribute name="Name" value="ColorValues" />
+			<attribute name="Layout Mode" value="Horizontal" />
+			<element>
+				<attribute name="Layout Mode" value="Vertical" />
+				<element>
+					<attribute name="Name" value="RGBLine" />
+					<attribute name="Layout Mode" value="Horizontal" />
+					<element type="Text">
+						<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Text" value="RGB" />
+						<attribute name="Text Alignment" value="Center" />
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="R" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="G" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="B" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+				</element>
+				<element>
+					<attribute name="Name" value="HSVLine" />
+					<attribute name="Layout Mode" value="Horizontal" />
+					<element type="Text">
+						<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+						<attribute name="Text" value="HSV" />
+						<attribute name="Text Alignment" value="Center" />
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="H" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="S" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+					<element type="LineEdit">
+						<attribute name="Name" value="V" />
+						<attribute name="Max Length" value="4" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+				</element>
+			</element>
+			<element>
+				<attribute name="Clip Children" value="true" />
+				<element type="BorderImage">
+					<attribute name="Size" value="200 33" />
+					<attribute name="Image Rect" value="2 102 17 117" />
+					<attribute name="Tiled" value="true" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="ColorCheck" />
+					<attribute name="Size" value="200 33" />
+					<attribute name="Priority" value="1" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+			</element>
+		</element>
+		<element>
+			<attribute name="Name" value="AlphaValue" />
+			<attribute name="Layout Mode" value="Horizontal" />
+			<element>
+				<attribute name="Layout Mode" value="Horizontal" />
+				<element type="Text">
+					<attribute name="Vert Alignment" value="Center" />
+					<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Text" value="Opacity" />
+					<attribute name="Text Alignment" value="Center" />
+				</element>
+				<element>
+					<attribute name="Min Size" value="24 15" />
+					<element type="LineEdit">
+						<attribute name="Name" value="A" />
+						<attribute name="Size" value="70 18" />
+						<attribute name="Min Size" value="24 15" />
+						<attribute name="Horiz Alignment" value="Center" />
+						<attribute name="Vert Alignment" value="Center" />
+						<attribute name="Max Length" value="5" />
+						<element type="Text" internal="true" style="none">
+							<attribute name="Top Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Top Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Left Color" value="0.9 1 0.9 1" />
+							<attribute name="Bottom Right Color" value="0.9 1 0.9 1" />
+							<attribute name="Text" value="1.0" />
+						</element>
+						<element type="BorderImage" internal="true" style="none">
+							<attribute name="Size" value="4 15" />
+						</element>
+					</element>
+				</element>
+			</element>
+			<element>
+				<element type="BorderImage">
+					<attribute name="Size" value="200 27" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Image Rect" value="2 102 17 117" />
+					<attribute name="Tiled" value="true" />
+					<element type="BorderImage">
+						<attribute name="Name" value="AGradient" />
+						<attribute name="Size" value="200 27" />
+						<attribute name="Is Editable" value="false" />
+						<attribute name="Image Rect" value="0 120 199 128" />
+						<attribute name="Blend Mode" value="alpha" />
+						<element type="BorderImage">
+							<attribute name="Name" value="ACursor" />
+							<attribute name="Position" value="0 1" />
+							<attribute name="Size" value="14 25" />
+							<attribute name="Image Rect" value="131 87 143 111" />
+							<attribute name="Blend Mode" value="alpha" />
+						</element>
+					</element>
+				</element>
+			</element>
+		</element>
+		<element>
+			<attribute name="Name" value="History" />
+			<attribute name="Is Enabled" value="true" />
+			<attribute name="Is Editable" value="false" />
+			<attribute name="Layout Mode" value="Horizontal" />
+			<attribute name="Layout Spacing" value="5" />
+			<element type="BorderImage">
+				<attribute name="Layout Mode" value="Horizontal" />
+				<attribute name="Image Rect" value="2 102 17 117" />
+				<attribute name="Tiled" value="true" />
+				<element type="BorderImage">
+					<attribute name="Name" value="h0" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h1" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h2" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h3" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h4" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h5" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h6" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+				<element type="BorderImage">
+					<attribute name="Name" value="h7" />
+					<attribute name="Is Enabled" value="true" />
+					<attribute name="Is Editable" value="false" />
+					<attribute name="Is Selected" value="true" />
+					<attribute name="Image Rect" value="85 86 93 97" />
+					<attribute name="Blend Mode" value="alpha" />
+				</element>
+			</element>
+		</element>
+		<element />
+		<element>
+			<attribute name="Name" value="DialogButtons" />
+			<attribute name="Is Editable" value="false" />
+			<attribute name="Layout Mode" value="Horizontal" />
+			<attribute name="Layout Spacing" value="10" />
+			<element type="Button">
+				<attribute name="Name" value="okButton" />
+				<attribute name="Min Size" value="16 15" />
+				<attribute name="Vert Alignment" value="Center" />
+				<element type="Text">
+					<attribute name="Horiz Alignment" value="Center" />
+					<attribute name="Vert Alignment" value="Center" />
+					<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Text" value="OK" />
+					<attribute name="Text Alignment" value="Center" />
+				</element>
+			</element>
+			<element type="Button">
+				<attribute name="Name" value="cancelButton" />
+				<element type="Text">
+					<attribute name="Horiz Alignment" value="Center" />
+					<attribute name="Vert Alignment" value="Center" />
+					<attribute name="Top Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Top Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Left Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Bottom Right Color" value="0.85 0.85 0.85 1" />
+					<attribute name="Text" value="Cancel" />
+				</element>
+			</element>
+		</element>
+	</element>
+</element>