Status: In PO Review
Fix Version/s: None
Currently, when parts of formulas are copied or cut in the formula editor, they are forgotten as soon as the formula editor is exited.
With the present ticket, the last formula copied or cut shall be remembered across formula editor sessions.
The remembered formula shall be overwritten by the next copied or cut formula. Unless it is overwritten, it can be pasted several times.
The formula shall be remembered persistently across Catroid sessions, even if the session was force-closed.
Note: If certain formula elements do not make sense in the new context where the formula shall be pasted in a new formula editor session, replace these parts with a string as explained below, or another appropriate default value if strings are not allowed syntactically as a part of a formula, the latter when names of objects are expected as a parameter of a reporter.
- There can be multiple such parts that may need to be replaced, depending on the context. E.g., the formula editor may be opened in another object, scene, or even another project.
- If local, global, or multiplayer variables, or local or global lists, or inputs for user defined bricks are part of the copied or cut formula, but do not exist in the new object or script, replace them by a string saying 'missing variable XXX' where XXX is replaced by the old name (similar for lists and inputs). This should be inserted in the current language of the user, i.e., these must be translatable resource strings.
- When checking the existence of the names, use the name of variables, lists, inputs etc, not their internal IDs. This way, it may be that a variable that was local becomes global, or even a multiplayer variable. This is fine, and the variable or list type shall be the one from the new context
- If a part of the formula is a "touches actor or object" reporter, which takes another object as its argument, and if there is no other object with this name in the new context, e.g., because we are in another scene or another project, then replace it with the Background (which always exists). If there exists an object in the new context with the same name as the name referred to in the formula, then use this object even if the internal ID of the object is different.
- If a sensor is inserted that is part of an extension that is not activated in the current instance of Catroid, nevertheless keep it inserted. However, do not activate the extension automatically.