Patch for [editor]/editor_gui/client/elementproperties.lua and [editor]/edf/edf.lua
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