From 5ca1c37fe9c5e312a13b12f20594bd4d7ce90cc8 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Wed, 22 Jan 2025 19:14:40 +0000 Subject: [PATCH] more fixes for hsb conversion and gui updated --- Engine/source/console/consoleFunctions.cpp | 6 +- Engine/source/core/color.h | 24 +- .../game/tools/gui/colorPicker.ed.gui | 1312 +++++------------ 3 files changed, 346 insertions(+), 996 deletions(-) diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index cff1d87b2..aeb98067d 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -1095,7 +1095,7 @@ DefineEngineFunction(ColorRGBToHEX, const char*, (ColorI color), , return Con::getReturnBuffer(color.getHex()); } -DefineEngineFunction(ColorRGBToHSB, const char*, (ColorI color), , +DefineEngineFunction(ColorRGBToHSB, Point3I, (ColorI color), , "Convert from a integer RGB (red, green, blue) color to HSB (hue, saturation, brightness). HSB is also know as HSL or HSV as well, with the last letter standing for lightness or value.\n" "@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. It excepts an alpha, but keep in mind this will not be converted.\n" "@return HSB color value, alpha isn't handled/converted so it is only the RGB value\n\n" @@ -1105,8 +1105,8 @@ DefineEngineFunction(ColorRGBToHSB, const char*, (ColorI color), , "@ingroup Strings") { ColorI::Hsb hsb(color.getHSB()); - String s(String::ToString(hsb.hue) + " " + String::ToString(hsb.sat) + " " + String::ToString(hsb.brightness)); - return Con::getReturnBuffer(s); + Point3I hsbPoint(hsb.hue, hsb.sat, hsb.brightness); + return hsbPoint; } DefineEngineFunction(ColorHEXToRGB, ColorI, (const char* hex), , diff --git a/Engine/source/core/color.h b/Engine/source/core/color.h index dbae2eb8e..d4c3b3b65 100644 --- a/Engine/source/core/color.h +++ b/Engine/source/core/color.h @@ -725,9 +725,9 @@ inline ColorI::Hsb ColorI::getHSB() const F64 gPercent = (F64)green / 255.0; F64 bPercent = (F64)blue / 255.0; - // Find the min and max values among the normalized RGB values - F64 maxColor = mMax( rPercent, mMax(gPercent, bPercent)); - F64 minColor = mMin( rPercent, mMin(gPercent, bPercent)); + // Find the max and min values among the normalized RGB values + F64 maxColor = mMax(rPercent, mMax(gPercent, bPercent)); + F64 minColor = mMin(rPercent, mMin(gPercent, bPercent)); // Initialize H, S, B F64 H = 0.0, S = 0.0, B = maxColor; @@ -739,29 +739,25 @@ inline ColorI::Hsb ColorI::getHSB() const S = delta / maxColor; // Saturation // Compute hue - if (maxColor == rPercent) + if (fabs(maxColor - rPercent) < 1e-6) { - H = 60.0 * mFmodD(((gPercent - bPercent) / delta), 6.0); + H = 60.0 * ((gPercent - bPercent) / delta); } - else if (maxColor == gPercent) + else if (fabs(maxColor - gPercent) < 1e-6) { H = 60.0 * (((bPercent - rPercent) / delta) + 2.0); } - else if (maxColor == bPercent) + else if (fabs(maxColor - bPercent) < 1e-6) { H = 60.0 * (((rPercent - gPercent) / delta) + 4.0); } } - // Normalize hue to [0, 360) - if (H < 0.0) - H += 360.0; - // Prepare the output HSB struct ColorI::Hsb val; - val.hue = static_cast(H); - val.sat = static_cast(S * 100.0); // Saturation as percentage - val.brightness = static_cast(B * 100.0); // Brightness as percentage + val.hue = static_cast(H + 0.5); // Round to nearest integer + val.sat = static_cast(S * 100.0 + 0.5); // Convert to percentage + val.brightness = static_cast(B * 100.0 + 0.5); // Convert to percentage return val; } diff --git a/Templates/BaseGame/game/tools/gui/colorPicker.ed.gui b/Templates/BaseGame/game/tools/gui/colorPicker.ed.gui index d99ce01eb..4c92f0ec9 100644 --- a/Templates/BaseGame/game/tools/gui/colorPicker.ed.gui +++ b/Templates/BaseGame/game/tools/gui/colorPicker.ed.gui @@ -18,705 +18,288 @@ $guiContent = new GuiColorPickerCtrl(ColorPickerDlg,EditorGuiGroup) { canSave = "1"; canSaveDynamicFields = "0"; - new GuiWindowCtrl(GuiPickerDlg) { - text = ":: Color Picker"; - resizeWidth = "0"; - resizeHeight = "0"; - canMove = "1"; - canClose = "1"; - canMinimize = "0"; - canMaximize = "0"; - canCollapse = "0"; - closeCommand = "DoColorPickerCancelCallback(); ColorPickerDlg.getRoot().popDialog(ColorPickerDlg);"; - position = "170 100"; - extent = "439 317"; - minExtent = "8 2"; - horizSizing = "windowRelative"; - vertSizing = "windowRelative"; - profile = "ToolsGuiWindowProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; + new GuiWindowCtrl() { + text = " "; + resizeWidth = "0"; + resizeHeight = "0"; + canMinimize = "0"; + canMaximize = "0"; + closeCommand = "DoColorPickerCancelCallback(); ColorPickerDlg.getRoot().popDialog(ColorPickerDlg);"; + position = "33 33"; + extent = "271 574"; + horizSizing = "windowRelative"; + vertSizing = "windowRelative"; + profile = "ToolsGuiWindowProfile"; + tooltipProfile = "ToolsGuiToolTipProfile"; - new GuiBitmapBorderCtrl(){ // color blend - position = "3 25"; - extent = "260 260"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiGroupBorderProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; + new GuiStackControl() { + padding = "5"; + changeChildSizeToFit = "0"; + changeChildPosition = "0"; + position = "0 24"; + extent = "271 481"; + profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - new GuiColorPickerCtrl(ColorBlendSelect) { - baseColor = "1 0 0 1"; - pickColor = "0 0 0 1"; - selectorGap = "1"; - displayMode = "BlendColor"; - actionOnMove = "1"; - position = "1 1"; - extent = "255 255"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - command = "updateRGBValues(1);"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiBitmapBorderCtrl(){ // Hue - position = "265 25"; - extent = "25 260"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiGroupBorderProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiColorPickerCtrl(ColorRangeSelect) { - baseColor = "1 0 0 1"; - pickColor = "1 0 0 1"; - selectorGap = "1"; - displayMode = "VertColor"; - actionOnMove = "1"; - position = "1 1"; - extent = "20 255"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - command = "updatePickerBaseColor(1);"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiTextCtrl() { - text = "New"; - position = "305 22"; - extent = "26 14"; - profile = "ToolsGuiTextProfile"; - }; - new GuiBitmapBorderCtrl(){ // new old color - position = "292 37"; - extent = "52 99"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiGroupBorderProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiSwatchButtonCtrl(myColor){ // New Color // - position = "1 1"; - extent = "50 50"; - profile = "GuiDefaultProfile"; - }; - new GuiSwatchButtonCtrl(oldColor){ // Old Color // - position = "1 48"; - extent = "50 50"; - profile = "GuiDefaultProfile"; - }; - }; - new GuiTextCtrl() { - text = "Old"; - position = "307 137"; - extent = "26 14"; - profile = "ToolsGuiTextProfile"; - }; - new GuiBitmapBorderCtrl(){ // Color Text Fields - position = "291 165"; - extent = "141 118"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiGroupBorderProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiControl() { // rgb - position = "4 0"; - extent = "52 80"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTextCtrl() { - text = "R"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 6"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Red Channel color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_R_Val) { // Red Channal - text = "0"; - maxLength = "6"; - position = "14 6"; - extent = "34 28"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerRGBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Red Channel color value."; - }; - new GuiTextCtrl() { - text = "G"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 29"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Green Channel color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_G_Val) { // Green Channal - text = "0"; - maxLength = "6"; - position = "14 29"; - extent = "34 28"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerRGBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Green Channel color value."; - }; - new GuiTextCtrl() { - text = "B"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 52"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Blue Channel color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_B_Val) { // Blue Channal - text = "0"; - maxLength = "6"; - position = "14 52"; - extent = "34 28"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerRGBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Blue Channel color value."; - }; - }; - new GuiControl() { - position = "71 0"; - extent = "61 75"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTextCtrl() { - text = "H"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 6"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Hue Channel color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_H_Val) { // Hue Channal - text = "0"; - maxLength = "4"; - position = "14 6"; - extent = "34 18"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerHSBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Hue Channel color value."; - }; - new GuiTextCtrl() { - text = "o"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "51 2"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "S"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 29"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Saturation Channel color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_S_Val) { // Saturation Channal - text = "0"; - maxLength = "4"; - position = "14 29"; - extent = "34 18"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerHSBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Saturation Channel color value."; - }; - new GuiTextCtrl() { - text = "%"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "51 29"; - extent = "10 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "B"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 52"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Brightness Channel color value. Aka value or lightness."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_Br_Val) { // Brightness Channal - text = "0"; - maxLength = "4"; - position = "14 52"; - extent = "34 18"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - class = "ColorPickerHSBClass"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Brightness Channel color value. Aka value or lightness."; - }; - new GuiTextCtrl() { - text = "%"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "51 52"; - extent = "10 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiControl() { - position = "3 87"; - extent = "138 24"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiTextCtrl() { - text = "#"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "3 5"; - extent = "8 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Hex representation of Red, Green, Blue Color value."; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(HexColor_Val) { // Hex Color Field - text = "0"; - maxLength = "6"; - position = "13 5"; - extent = "116 18"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - tooltipProfile = "GuiToolTipProfile"; - tooltip = "Hex representation of Red, Green, Blue Color value."; - command = "$thisControl.onKeyDown();"; - }; - }; - }; - new GuiBitmapBorderCtrl(){ // alpha - position = "3 287"; - extent = "429 24"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiGroupBorderProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiControl() { - position = "-1 3"; - extent = "428 18"; - minExtent = "8 2"; + new GuiRolloutCtrl() { + caption = ":: Color Picker"; + extent = "271 440"; horizSizing = "width"; - vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; + profile = "GuiRolloutProfile"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - class = "AggregateControl"; - canSave = "1"; - canSaveDynamicFields = "0"; - new GuiSliderCtrl(ColorAlphaSelect) { - range = "0 1"; - ticks = "0"; - value = "1"; - position = "5 3"; - extent = "341 13"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiSliderProfile"; - visible = "1"; - active = "1"; - altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); updateColorPickerAlpha( $ThisControl.getValue() );"; - Clickable = "1"; - AffectChildren = "1"; + new GuiStackControl() { + padding = "1"; + changeChildSizeToFit = "0"; + changeChildPosition = "0"; + position = "0 17"; + extent = "271 420"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiControl() { + extent = "267 260"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + + new GuiColorPickerCtrl(ColorBlendRange) { + selectorGap = "8"; + displayMode = "BlendRange"; + position = "7 0"; + extent = "255 255"; + profile = "GuiDefaultProfile"; + command = "\n%selSat = ColorBlendRange.getSelectedSaturation();\n%selBright = ColorBlendRange.getSelectedBrightness();\n\nColorNewSelected.setSelectedBrightness(%selBright);\nColorNewSelected.setSelectedSaturation(%selSat);\nColorNewSelected.executeUpdate();"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiControl() { + position = "0 261"; + extent = "267 62"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + + new GuiBitmapCtrl() { + BitmapAsset = "ToolsModule:gridTiny2_image"; + color = "125 125 125 255"; + wrap = "1"; + position = "7 32"; + extent = "199 19"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiBitmapCtrl() { + BitmapAsset = "ToolsModule:gridTiny2_image"; + color = "125 125 125 255"; + wrap = "1"; + position = "213 3"; + extent = "49 49"; + profile = "ToolsGuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiColorPickerCtrl(ColorHueRange) { + selectorGap = "4"; + displayMode = "HueRange"; + position = "7 4"; + extent = "200 20"; + profile = "GuiDefaultProfile"; + command = "%hueSel = ColorHueRange.getSelectedHue();\nColorBlendRange.setSelectedHue(%hueSel);\nColorAlphaRange.setSelectedHue(%hueSel );\n\nColorNewSelected.setSelectedHue(%hueSel);\nColorNewSelected.executeUpdate();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiColorPickerCtrl(ColorAlphaRange) { + selectorGap = "4"; + displayMode = "AlphaRange"; + position = "7 32"; + extent = "200 20"; + profile = "GuiDefaultProfile"; + command = "ColorNewSelected.setSelectedAlpha(ColorAlphaRange.getSelectedAlpha());\nColorNewSelected.executeUpdate();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiColorPickerCtrl(ColorNewSelected) { + position = "213 3"; + extent = "50 25"; + profile = "GuiDefaultProfile"; + command = "%selHue = ColorNewSelected.getSelectedHue();\n%selSat = ColorNewSelected.getSelectedSaturation();\n%selBright = ColorNewSelected.getSelectedBrightness();\n\nHueTextEditor.setText(%selHue);\nSatTextEditor.setText(%selSat);\nBrightTextEditor.setText(%selBright);\n\n%color = ColorNewSelected.getSelectedColorI();\nRedTextEdit.setText(getWord(%color, 0));\nGreenTextEdit.setText(getWord(%color, 1));\nBlueTextEdit.setText(getWord(%color, 2));\nAlphaTextEdit.setText(getWord(%color, 3));\n\n%hex = ColorRGBToHEX(%color);\nHexTextEditor.setText(%hex);"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiColorPickerCtrl(ColorOld) { + position = "213 27"; + extent = "50 25"; + profile = "GuiDefaultProfile"; + command = "%selHue = ColorOld.getSelectedHue();\n%selSat = ColorOld.getSelectedSaturation();\n%selBright = ColorOld.getSelectedBrightness();\n%selAlpha = ColorOld.getSelectedAlpha();\n\nColorHueRange.setSelectedHue(%selHue);\nColorHueRange.executeUpdate();\n\nColorBlendRange.setSelectedBrightness(%selBright);\nColorBlendRange.setSelectedSaturation(%selSat);\nColorBlendRange.executeUpdate();\n\nColorAlphaRange.setSelectedAlpha(%selAlpha);\nColorAlphaRange.executeUpdate();"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiControl() { + position = "0 324"; + extent = "267 96"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + + new GuiControl() { + extent = "98 104"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + + new GuiTextCtrl() { + text = "R:"; + position = "8 0"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(RedTextEdit) { + position = "30 1"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerRGBClass"; + }; + new GuiTextCtrl() { + text = "G:"; + position = "8 24"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(GreenTextEdit) { + position = "30 24"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerRGBClass"; + }; + new GuiTextCtrl() { + text = "B:"; + position = "8 48"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(BlueTextEdit) { + position = "30 48"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerRGBClass"; + }; + new GuiTextCtrl() { + text = "A:"; + position = "8 72"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(AlphaTextEdit) { + position = "30 72"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerRGBClass"; + }; + }; + new GuiControl() { + position = "112 0"; + extent = "97 104"; + profile = "GuiDefaultProfile"; + tooltipProfile = "GuiToolTipProfile"; + isContainer = "1"; + + new GuiTextCtrl() { + text = "H:"; + position = "8 0"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(HueTextEditor) { + position = "30 1"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerHSBClass"; + }; + new GuiTextCtrl() { + text = "S:"; + position = "8 24"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(SatTextEditor) { + position = "30 24"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerHSBClass"; + }; + new GuiTextCtrl() { + text = "B:"; + position = "8 48"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(BrightTextEditor) { + position = "30 48"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + class = "ColorPickerHSBClass"; + }; + new GuiTextCtrl() { + text = "#"; + position = "8 72"; + extent = "13 21"; + profile = "ToolsGuiTextProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiTextEditCtrl(HexTextEditor) { + position = "30 72"; + extent = "64 20"; + profile = "ToolsGuiTextEditProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + new GuiButtonCtrl() { + text = "Apply"; + position = "211 1"; + extent = "52 20"; + command = "DoColorPickerCallback();"; + profile = "ToolsGuiButtonProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + position = "211 24"; + extent = "52 20"; + command = "DoColorPickerCancelCallback();"; + profile = "ToolsGuiButtonProfile"; + tooltipProfile = "GuiToolTipProfile"; + }; + }; + }; + }; + new GuiRolloutCtrl() { + caption = ":: Color Palette"; + position = "0 445"; + extent = "271 36"; + profile = "GuiRolloutProfile"; + tooltipProfile = "GuiToolTipProfile"; + + new GuiStackControl() { + stackingType = "Dynamic"; + padding = "5"; + changeChildSizeToFit = "0"; + position = "0 17"; + extent = "271 16"; + profile = "GuiDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "slider"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextCtrl() { - text = "Alpha"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "355 0"; - extent = "28 18"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextProfile"; - visible = "1"; - active = "1"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiTextEditCtrl(Channel_A_Val) { // Alpha Channal - text = "0"; - maxLength = "4"; - position = "392 0"; - extent = "34 18"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiTextEditProfile"; - altCommand = "$ThisControl.getParent().updateFromChild($ThisControl); updateColorPickerAlpha( $ThisControl.getValue() );"; - internalName = "TextEdit"; }; }; - }; - new GuiButtonCtrl() { - text = "Select"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "349 37"; - extent = "84 24"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; - command = "DoColorPickerCallback();"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiButtonCtrl() { - text = "Cancel"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "349 68"; - extent = "84 24"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "ToolsGuiButtonProfile"; - visible = "1"; - active = "1"; - command = "DoColorPickerCancelCallback();"; - Clickable = "1"; - AffectChildren = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; }; @@ -736,37 +319,13 @@ function GetColorI( %currentColor, %callback, %root, %updateCallback, %cancelCal $ColorPickerUpdateCallback = %updateCallback; $ColorCallbackType = 1; // ColorI - oldColor.color = ColorIntToFloat( %currentColor ); - myColor.color = ColorIntToFloat( %currentColor ); - - ColorRangeSelect.showReticle = true; - ColorBlendSelect.showReticle = true; - - // Set the range according to int - ColorAlphaSelect.range = "0 255"; - - // Set the RGBA displays accordingly - %red = getWord(%currentColor, 0); - %green = getWord(%currentColor, 1); - %blue = getWord(%currentColor, 2); - %alpha = getWord(%currentColor, 3); - - //Set the red green blue text fields - Channel_R_Val.setValue(%red); - Channel_G_Val.setValue(%green); - Channel_B_Val.setValue(%blue); - - //Have the rgb text fields update the rest - Channel_R_Val.onValidate(); + ColorOld.setSelectedColorI(%currentColor); + ColorOld.executeUpdate(); if(!isObject(%root)) %root = Canvas; %root.pushDialog(ColorPickerDlg); - - // update the alpha value first - ColorAlphaSelect.setValue( %alpha ); - Channel_A_Val.setText( %alpha ); } function GetColorF( %currentColor, %callback, %root, %updateCallback, %cancelCallback ) @@ -777,96 +336,54 @@ function GetColorF( %currentColor, %callback, %root, %updateCallback, %cancelCal $ColorPickerUpdateCallback = %updateCallback; $ColorCallbackType = 2; // ColorF - oldColor.color = %currentColor; - myColor.color = %currentColor; - - ColorRangeSelect.showReticle = true; - ColorBlendSelect.showReticle = true; - - // Set the range according to float - ColorAlphaSelect.range = "0 1"; - - // Set the RGBA displays accordingly - %red = mRoundColour(getWord(%currentColor, 0), 3); - %green = mRoundColour(getWord(%currentColor, 1), 3); - %blue = mRoundColour(getWord(%currentColor, 2), 3); - %alpha = mRoundColour(getWord(%currentColor, 3), 3); - - //Set the red green blue text fields - Channel_R_Val.setValue(%red); - Channel_G_Val.setValue(%green); - Channel_B_Val.setValue(%blue); - - //Have the rgb text fields update the rest - Channel_R_Val.onValidate(); + ColorOld.setSelectedLinearColor(%currentColor); + ColorOld.executeUpdate(); if(!isObject(%root)) %root = Canvas; %root.pushDialog(ColorPickerDlg); - - // update the alpha value first - ColorAlphaSelect.setValue( %alpha ); - Channel_A_Val.setText( %alpha ); } function ColorPickerRGBClass::onValidate(%this) { - %red = Channel_R_Val.getValue(); - %green = Channel_G_Val.getValue(); - %blue = Channel_B_Val.getValue(); - - //Rest of the fields just do everything with ints so convert - if( $ColorCallbackType != 1 ) - { - %rgb = ColorFloatToInt(%red SPC %green SPC %blue SPC "1.0"); - %red = getWord(%rgb, 0); - %green = getWord(%rgb, 1); - %blue = getWord(%rgb, 2); - } - + %red = RedTextEdit.getValue(); + %green = GreenTextEdit.getValue(); + %blue = BlueTextEdit.getValue(); + %alpha = AlphaTextEdit.getValue(); + //Update all the other color fields %hsb = ColorRGBToHSB(%red SPC %green SPC %blue); - Channel_H_Val.setValue(getWord(%hsb, 0)); - Channel_S_Val.setValue(getWord(%hsb, 1)); - Channel_Br_Val.setValue(getWord(%hsb, 2)); - - %hex = ColorRGBToHEX(%red SPC %green SPC %blue); - HexColor_Val.setValue(%hex); - HexColor_Val.onKeyDown(); - - //Update everything else with our new color - setColorInfo(); + + // these automatically update our ColorNewSelected which + // updates all text fields including these. + ColorHueRange.setSelectedHue(getWord(%hsb, 0)); + ColorHueRange.executeUpdate(); + + ColorBlendRange.setSelectedSaturation(getWord(%hsb, 1)); + ColorBlendRange.setSelectedBrightness(getWord(%hsb, 2)); + ColorBlendRange.executeUpdate(); + + ColorAlphaRange.setSelectedAlpha(%alpha); + ColorAlphaRange.executeUpdate(); } function ColorPickerHSBClass::onValidate(%this) { - %hue = Channel_H_Val.getValue(); - %saturation = Channel_S_Val.getValue(); - %brightness = Channel_Br_Val.getValue(); - - //Update all the other color fields - %rgb = ColorHSBToRGB(%hue SPC %saturation SPC %brightness); - %hex = ColorRGBToHEX(%rgb); - HexColor_Val.setValue(%hex); - HexColor_Val.onKeyDown(); - - //convert to float for rgb if we need to - if( $ColorCallbackType != 1 ) - { - %rgb = ColorIntToFloat(%rgb); - } - %red = getWord(%rgb, 0); - %green = getWord(%rgb, 1); - %blue = getWord(%rgb, 2); - Channel_R_Val.setValue(%red); - Channel_G_Val.setValue(%green); - Channel_B_Val.setValue(%blue); - - //Update everything else with our new color - setColorInfo(); + %hue = HueTextEditor.getValue(); + %saturation = SatTextEditor.getValue(); + %brightness = BrightTextEditor.getValue(); + + // these automatically update our ColorNewSelected which + // updates all text fields including these. + ColorHueRange.setSelectedHue(%hue); + ColorHueRange.executeUpdate(); + + ColorBlendRange.setSelectedSaturation(%saturation); + ColorBlendRange.setSelectedBrightness(%brightness); + ColorBlendRange.executeUpdate(); } -function HexColor_Val::onKeyDown(%this) +function HexTextEditor::onKeyDown(%this) { //Get the value %value = %this.getValue(); @@ -889,7 +406,7 @@ function HexColor_Val::onKeyDown(%this) } } -function HexColor_Val::onValidate(%this) +function HexTextEditor::onValidate(%this) { //if the current text is invalid don't do anyting if(!%this.isValidText()) @@ -915,210 +432,47 @@ function HexColor_Val::onValidate(%this) %rgb = ColorHEXToRGB(%hex); %hsb = ColorRGBToHSB(%rgb); - //convert to float for rgb if we need to - if( $ColorCallbackType != 1 ) - { - %rgb = ColorIntToFloat(%rgb); - } - - %red = getWord(%rgb, 0); - %green = getWord(%rgb, 1); - %blue = getWord(%rgb, 2); - Channel_R_Val.setValue(%red); - Channel_G_Val.setValue(%green); - Channel_B_Val.setValue(%blue); - - Channel_H_Val.setValue(getWord(%hsb, 0)); - Channel_S_Val.setValue(getWord(%hsb, 1)); - Channel_Br_Val.setValue(getWord(%hsb, 2)); - - //Update everything else with our new color - setColorInfo(); -} + // these automatically update our ColorNewSelected which + // updates all text fields including these. + ColorHueRange.setSelectedHue(getWord(%hsb, 0)); + ColorHueRange.executeUpdate(); -// This function is used to update the text controls at the top -function setColorInfo() -{ - %red = Channel_R_Val.getValue(); - %green = Channel_G_Val.getValue(); - %blue = Channel_B_Val.getValue(); - - if( $ColorCallbackType == 1) - %rgb = ColorIntToFloat(%red SPC %green SPC %blue SPC "255"); - else - %rgb = %red SPC %green SPC %blue SPC "1.0"; - - $ColorPickerSignal = 0; - - //Convert color over to hue color - %hsb = ColorRGBToHSB(ColorFloatToInt(%rgb)); - %tempColor = ColorHSBToRGB( getWord(%hsb, 0) SPC 100 SPC 50); - %tempColor = ColorIntToFloat(setWord(%tempColor, 3, 255)); - - //Make sure all the text fields and everything don't update because of the cursors - ColorRangeSelect.update = false; - ColorBlendSelect.update = false; - - //Set values for the hue color picker - ColorRangeSelect.baseColor = %tempColor; - ColorRangeSelect.pickColor = %tempColor; - ColorRangeSelect.updateColor(); - - //Set the cursor for the hue picker - ColorRangeSelect.setSelectorColor(%tempColor); - - //Set the values for the gradient color picker - ColorBlendSelect.baseColor = %tempColor; - ColorBlendSelect.pickColor = %rgb; - ColorBlendSelect.updateColor(); - - //Set the cursor for the gradiant color picker - ColorBlendSelect.setSelectorColor(%rgb); - - //Update our current color - %alpha = getWord(myColor.color, 3); - myColor.color = setWord(%rgb, 3, %alpha); + ColorBlendRange.setSelectedSaturation(getWord(%hsb, 1)); + ColorBlendRange.setSelectedBrightness(getWord(%hsb, 2)); + ColorBlendRange.executeUpdate(); } // return mycolor.color function DoColorPickerCallback() { - eval( $ColorPickerCallback @ "(\"" @ constructNewColor(mycolor.color, $ColorCallbackType) @"\");" ); + if( $ColorCallbackType == 1) + %col = ColorNewSelected.getSelectedColorI(); + else + %col = ColorNewSelected.getSelectedLinearColor(); + + eval( $ColorPickerCallback @ "(\"" @ %col @"\");" ); ColorPickerDlg.getRoot().popDialog(ColorPickerDlg); } function DoColorPickerCancelCallback() { + if( $ColorCallbackType == 1) + %col = ColorOld.getSelectedColorI(); + else + %col = ColorOld.getSelectedLinearColor(); + ColorPickerDlg.getRoot().popDialog( ColorPickerDlg ); if( $ColorPickerCancelCallback !$= "" ) - eval( $ColorPickerCancelCallback @ "(\"" @ constructNewColor( oldColor.color, $ColorCallbackType ) @ "\");" ); + eval( $ColorPickerCancelCallback @ "(\"" @ %col @ "\");" ); } function DoColorPickerUpdateCallback() { + if( $ColorCallbackType == 1) + %col = ColorNewSelected.getSelectedColorI(); + else + %col = ColorNewSelected.getSelectedLinearColor(); + if( $ColorPickerUpdateCallback !$= "" ) - eval( $ColorPickerUpdateCallback @ "(\"" @ constructNewColor( myColor.color, $ColorCallbackType ) @ "\");" ); -} - -// this is called from ColorRangeSelect.updateColor -function updatePickerBaseColor( %location ) -{ - if(!ColorRangeSelect.update) - { - ColorRangeSelect.update = true; - return; - } - - if( $ColorPickerSignal && %location ) - %pickColor = ColorRangeSelect.baseColor; - else - %pickColor = ColorRangeSelect.pickColor; - $ColorPickerSignal = 0; - - %red = getWord(%pickColor, 0); - %green = getWord(%pickColor, 1); - %blue = getWord(%pickColor, 2); - %alpha = getWord(%pickColor, 3); - - ColorBlendSelect.baseColor = %red SPC %green SPC %blue SPC "1.0"; - ColorBlendSelect.updateColor(); -} - -// this is called from ColorBlendSelect.updateColor -function updateRGBValues( %location ) -{ - if(!ColorBlendSelect.update) - { - ColorBlendSelect.update = true; - return; - } - - //update the color based on where it came from - if( $ColorPickerSignal && %location ) - %pickColor = ColorBlendSelect.baseColor; - else - %pickColor = ColorBlendSelect.pickColor; - - //lets prepare the color - %red = getWord(%pickColor, 0); - %green = getWord(%pickColor, 1); - %blue = getWord(%pickColor, 2); - //the alpha should be grabbed from mycolor - %alpha = getWord(myColor.color, 3); - - // set the color! - myColor.color = %red SPC %green SPC %blue SPC %alpha; - - DoColorPickerUpdateCallback(); - - //update differently depending on type - if( $ColorCallbackType == 1 ) - { - %red = mCeil(%red * 255); - %blue = mCeil(%blue * 255); - %green = mCeil(%green * 255); - } - else - { - %red = mFloatLength(%red, 3); - %blue = mFloatLength(%blue, 3); - %green = mFloatLength(%green, 3); - } - - // changes current color values - Channel_R_Val.setValue(%red); - Channel_G_Val.setValue(%green); - Channel_B_Val.setValue(%blue); - - //Rest of the fields just do everything with ints so convert - if( $ColorCallbackType != 1 ) - { - %rgb = ColorFloatToInt(%red SPC %green SPC %blue SPC "1.0"); - %red = getWord(%rgb, 0); - %green = getWord(%rgb, 1); - %blue = getWord(%rgb, 2); - } - - //Update all the other color fields - %hsb = ColorRGBToHSB(%red SPC %green SPC %blue); - Channel_H_Val.setValue(getWord(%hsb, 0)); - Channel_S_Val.setValue(getWord(%hsb, 1)); - Channel_Br_Val.setValue(getWord(%hsb, 2)); - - %hex = ColorRGBToHEX(%red SPC %green SPC %blue); - HexColor_Val.setValue(%hex); - HexColor_Val.onKeyDown(); - - $ColorPickerSignal = 0; -} - -function updateColorPickerAlpha( %alphaVal ) -{ - //lets prepare the color - %red = getWord(myColor.color, 0); - %green = getWord(myColor.color, 1); - %blue = getWord(myColor.color, 2); - %alpha = %alphaVal; - - if( $ColorCallbackType == 1 ) - %alpha = (%alpha / 255); - - myColor.color = %red SPC %green SPC %blue SPC %alpha ; - - DoColorPickerUpdateCallback(); -} - -function constructNewColor(%pickColor, %colorType ) -{ - %red = getWord(%pickColor, 0); - %green = getWord(%pickColor, 1); - %blue = getWord(%pickColor, 2); - %alpha = ColorAlphaSelect.getValue(); - - // Update the text controls to reflect new color - //setColorInfo(%red, %green, %blue, %alpha); - if ( %colorType == 1 ) // ColorI - return mCeil( %red * 255 ) SPC mCeil( %green * 255 ) SPC mCeil( %blue * 255 ) SPC %alpha; - else // ColorF - return %red SPC %green SPC %blue SPC %alpha; + eval( $ColorPickerUpdateCallback @ "(\"" @ %col @ "\");" ); }