-
-
Notifications
You must be signed in to change notification settings - Fork 388
Allow setting game.project properties using editor scripts #11178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Now, it's possible to set properties in `game.project` file using editor scripts: ```lua editor.transact({ editor.tx.set("/game.project", "project.dependencies", { "https://github.com/defold/extension-spine/archive/refs/tags/3.10.0.zip" }) }) ``` Fixes #11163
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I like that :form-ops
now return transaction steps. However, I think you'll need to also update the behavior in extension-simpledata
: https://github.com/defold/extension-simpledata/blob/ca1dbf55d2ad7ae9324206806141d474ee9893eb/defold-simpledata/editor/src/simpledata-ext.clj#L90
We also need to explicitly provide migration instructions in release notes, since game projects might have added Clojure code based on extension-simpledata
to their projects.
Simpledata PR: defold/extension-simpledata#19 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
(defn- ensure-does-not-transact [ret f] | ||
(when (g/tx-result? ret) | ||
(throw | ||
(IllegalStateException. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct exception type to throw? Would UnsupportedOperationException
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think exception type doesn't matter here as much as the message...
Now, it's possible to set properties in the
game.project
file using editor scripts:🚨 Breaking change 🚨 for extensions that are based on extension-simpledata: Now, the editor expects the code that is invoked when form values are set/cleared to return transaction steps instead of performing a transaction. See this PR for the changes you need to make.
Fixes #11163