diff --git a/docs/sdk/definition/script.xml b/docs/sdk/definition/script.xml
index 564b9e521..53253aefb 100644
--- a/docs/sdk/definition/script.xml
+++ b/docs/sdk/definition/script.xml
@@ -526,6 +526,19 @@ func SaveScenarioObject(props)
+ Properties published to the editor as EditorProps can also be saved automatically by setting the SaveAsCall property of the EditorProp to a string for the setter-function to call or setting SaveAsSet to true for saving directly to the property. These properties are atuomatically saved if they are different from their default value. E.g.:
+ /* Define two properties that can be set in the editor */
+// foo is a property with a setter function
+local foo = 42;
+public func SetFoo(new_foo) { foo = new_foo; return true; }
+
+// bar is just a property without setter
+local bar = 23;
+
+local EditorProps = {
+ foo = { Type="int", SaveAsCall="SetFoo" }; // saved as object->SetFoo(value); unless foo is 42.
+ bar = { Type="int", SaveAsSet=true; } // saved as object.bar = value; unless bar is 23.
+};
By default, effects are not saved in scenarios. To force saving of an effect, define the Fx*SaveScen callback. For example, the fire effect saves itself like this:
global func FxFireSaveScen(object obj, proplist fx, proplist props)
{
diff --git a/planet/System.ocg/SaveScenario.c b/planet/System.ocg/SaveScenario.c
index 4b8e36a18..101ab9826 100644
--- a/planet/System.ocg/SaveScenario.c
+++ b/planet/System.ocg/SaveScenario.c
@@ -412,6 +412,30 @@ global func SaveScenarioObject(props)
// Effects
var fx; i=0;
while (fx = GetEffect("*", this, i++)) EffectCall(this, fx, "SaveScen", props);
+ // EditorProps
+ if (this.EditorProps)
+ {
+ var all_prop_names = GetProperties(this.EditorProps), prop_save, prop_name, prop;
+ for (prop_name in all_prop_names)
+ {
+ if ((prop=this.EditorProps[prop_name]))
+ {
+ if (GetType(prop) == C4V_PropList)
+ {
+ v = this[prop_name];
+ var default_v = GetID()[prop_name];;
+ if ((prop_save = prop.SaveAsCall))
+ {
+ if (!DeepEqual(v, default_v)) props->AddCall("EditorProp", this, prop_save, SaveScenarioValue2String(v));
+ }
+ else if (prop.SaveAsSet)
+ {
+ if (!DeepEqual(v, default_v)) props->AddSet("EditorProp", this, prop_name, SaveScenarioValue2String(v));
+ }
+ }
+ }
+ }
+ }
return true;
}