Last active
August 29, 2015 14:12
-
-
Save qaisjp/4fe8657f5058de22cc15 to your computer and use it in GitHub Desktop.
Patch for [editor]/editor_gui/client/elementproperties.lua and [editor]/edf/edf.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: edf/edf.lua | |
=================================================================== | |
--- edf/edf.lua (revision 1024) | |
+++ edf/edf.lua (working copy) | |
@@ -408,7 +408,7 @@ | |
for dataField, dataDefinition in pairs(elementDefinition.data) do | |
local checkedData = edfCheckElementData(theElement, dataField, dataDefinition) | |
if checkedData == nil then | |
- outputDebugString('Failed validation for ' .. elementType .. '!' .. dataField) | |
+ exports.editor_gui:outputMessage("Unable to create element; validation failed for "..elementType.."!"..dataField) | |
return false | |
end | |
Index: editor_gui/client/elementproperties.lua | |
=================================================================== | |
--- editor_gui/client/elementproperties.lua (revision 1024) | |
+++ editor_gui/client/elementproperties.lua (working copy) | |
@@ -459,7 +459,12 @@ | |
spnProperties | |
) | |
guiLabelSetVerticalAlign ( controlLabel, "center" ) -- align it to the vertical center | |
- guiLabelSetColor( controlLabel, layout.label.R, layout.label.G, layout.label.B ) -- colour it as the rest of labels | |
+ -- color label red for properties that are required and currently have no value (which will fail validation) | |
+ if addedParameters.required and not addedParameters.value then | |
+ guiLabelSetColor( controlLabel, 255, 0, 0) | |
+ else | |
+ guiLabelSetColor( controlLabel, layout.label.R, layout.label.G, layout.label.B ) | |
+ end | |
caption[newControl] = controlLabel | |
-- Create the description tooltip | |
@@ -573,7 +578,8 @@ | |
applier, --property local applier function | |
{value = initialValue, | |
validvalues = dataDefinition.validvalues, | |
- datafield = dataField } --parameters table | |
+ datafield = dataField, | |
+ required = dataDefinition.required } --parameters table | |
) | |
end --for | |
end | |
@@ -593,7 +599,10 @@ | |
dataDefinition.friendlyname or dataField, | |
dataDefinition.description, | |
nil, | |
- { validvalues = dataDefinition.validvalues, datafield = dataField } | |
+ { value = dataDefinition.default, | |
+ validvalues = dataDefinition.validvalues, | |
+ datafield = dataField, | |
+ required = dataDefinition.required } | |
) | |
end | |
end | |
@@ -611,7 +620,7 @@ | |
newElementType, | |
newElementResource, | |
parametersTable, | |
- false --don't attach it later | |
+ true -- do attach it later | |
) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment