瀏覽代碼

Merge branch 'master' of https://github.com/defold/doc

Björn Ritzl 9 月之前
父節點
當前提交
5e3fee5c2e

+ 4 - 4
docs/en/manuals/bob.md

@@ -9,11 +9,11 @@ Bob is a command line tool for building Defold projects outside of the normal ed
 
 Bob is able to build data (corresponding to the build step of selecting the editor menu item <kbd>Project ▸ Build</kbd>), create data archives and create standalone, distributable application bundles (corresponding to the editor menu item <kbd>Project ▸ Bundle ▸ ...</kbd> options)
 
-Bob is distributed as a Java _JAR_ archive containing everything needed to build. You find the latest *bob.jar* distribution on the [GitHub Releases page](https://github.com/defold/defold/releases). Select a release, then download *bob/bob.jar*. If you are using Defold 1.4.8, you will need OpenJDK 17 to run it. For older versions of Defold, you will need openJDK 11.
+Bob is distributed as a Java _JAR_ archive containing everything needed to build. You find the latest *bob.jar* distribution on the [GitHub Releases page](https://github.com/defold/defold/releases). Select a release, then download *bob/bob.jar*. If you are using Defold 1.9.6, you will need OpenJDK 21 to run it. For older versions of Defold, you will need openJDK 17 or 11.
 
-Compatible OpenJDK 17 mirrors (from Defold 1.4.8):
-* [OpenJDK 17 by Microsoft](https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-17)
-* [OpenJDK 17 by Adoptium Working Group](https://github.com/adoptium/temurin17-binaries/releases) / [Adoptium.net](https://adoptium.net/)
+Compatible OpenJDK 21 mirrors (from Defold 1.9.6):
+* [OpenJDK 21 by Microsoft](https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-21)
+* [OpenJDK 21 by Adoptium Working Group](https://github.com/adoptium/temurin21-binaries/releases) / [Adoptium.net](https://adoptium.net/)
 
 If you are on Windows you want the .msi file installer for OpenJDK.
 

+ 9 - 0
docs/en/manuals/editor-preferences.md

@@ -32,6 +32,15 @@ Lint Code on Build
 Path to custom keymap
 : Absolute path to a file containing [custom keyboard shortcuts](/manuals/editor-keyboard-shortcuts).
 
+Engine Arguments
+: Arguments that will be passed to the dmengine executables when the editor builds and runs.
+ Use one argument per line. For example:
+ ```
+--config=bootstrap.main_collection=/my dir/1.collectionc
+--verbose
+--graphics-adapter=vulkan
+```
+
 
 ## Code
 

+ 46 - 0
docs/en/manuals/editor-scripts.md

@@ -33,6 +33,10 @@ function M.get_language_servers()
   -- TODO - define language servers
 end
 
+function M.get_prefs_schema()
+  -- TODO - define preferences
+end
+
 return M
 ```
 Editor then collects all editor scripts defined in project and libraries, loads them into single Lua VM and calls into them when needed (more on that in [commands](#commands) and [lifecycle hooks](#lifecycle-hooks) sections).
@@ -63,6 +67,7 @@ You can interact with the editor using `editor` package that defines this API:
 - `editor.save()` — persist all unsaved changed to disk.
 - `editor.transact(txs)` — modify the editor in-memory state using 1 or more transaction steps created with `editor.tx.*` functions.
 - `editor.ui.*` — various UI-related functions, see [UI manual](/manuals/editor-scripts-ui).
+- `editor.prefs.*` — functions for interacting with editor preferences, see [prefs](#prefs).
 
 You can find the full editor API reference [here](https://defold.com/ref/alpha/editor/).
 
@@ -244,6 +249,47 @@ You can publish libraries for other people to use that contain commands, and the
 
 Also note that although dependencies are shown in Assets view, they do not exist as files (they are entries in a zip archive). It's possible to make the editor extract some files from the dependencies into `build/plugins/` folder. To do it, you need to create `ext.manifest` file in your library folder, and then create `plugins/bin/${platform}` folder in the same folder where the `ext.manifest` file is located. Files in that folder will be automatically extracted to `/build/plugins/${extension-path}/plugins/bin/${platform}` folder, so your editor scripts can reference them.
 
+## Prefs
+
+Editor scripts can define and use preferences — persistent, uncommitted pieces of data stored on the user's computer. These preferences have three key characteristics:
+- typed: every preference has a schema definition that includes the data type and other metadata like default value
+- scoped: prefs are scoped either per project or per user
+- nested: every preference key is a dot-separated string, where the first path segment identifies an editor script, and the rest 
+
+All preferences must be registered by defining their schema:
+```lua
+function M.get_prefs_schema()
+  return {
+    ["my_json_formatter.jq_path"] = editor.prefs.schema.string(),
+    ["my_json_formatter.indent.size"] = editor.prefs.schema.integer({default = 2, scope = editor.prefs.SCOPE.PROJECT}),
+    ["my_json_formatter.indent.type"] = editor.prefs.schema.enum({values = {"spaces", "tabs"}, scope = editor.prefs.SCOPE.PROJECT}),
+  }
+end
+```
+After such editor script is reloaded, the editor registers this schema. Then the editor script can get and set the prefs, e.g.:
+```lua
+-- Get a specific preference
+editor.prefs.get("my_json_formatter.indent.type")
+-- Returns: "spaces"
+
+-- Get an entire preference group
+editor.prefs.get("my_json_formatter")
+-- Returns:
+-- {
+--   jq_path = "",
+--   indent = {
+--     size = 2,
+--     type = "spaces"
+--   }
+-- }
+
+-- Set multiple nested preferences at once
+editor.prefs.set("my_json_formatter.indent", {
+    type = "tabs",
+    size = 1
+})
+```
+
 ## Execution modes
 
 The editor script runtime uses 2 execution modes that are mostly transparent to editor scripts: **immediate** and **long-running**. 

二進制
docs/en/manuals/images/editor/preferences_general.png


+ 1 - 1
docs/ru/manuals/bob.md

@@ -9,7 +9,7 @@ Bob - это инструмент командной строки для сбо
 
 Bob может делать сборки (соответствует этапу сборки при выборе пункта меню редактора <kbd>Project ▸ Build</kbd>), создавать архивы данных и создавать автономные распространяемые бандлы (соответствует пункту меню редактора <kbd> Project ▸ Bundle ▸ ... </kbd>)
 
-Bob распространяется в виде Java _JAR_ архива, содержащего все необходимое для сборки. Вы найдете дистрибутив *bob.jar* последней актуальной версии на [странице загрузки Defold](http://d.defold.com) и на [GitHub странице релизов](https://github.com/defold/defold/releases) . Выберите релиз, затем загрузите *bob/bob.jar*. Чтобы запустить утилиту Bob, с версии Defold 1.4.8 вам необходимо [установить на вашем компьютере OpenJDK 17](https://jdk.java.net/17/). Для предыдущих версий Defold необходима [OpenJDK 11](https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-11).
+Bob распространяется в виде Java _JAR_ архива, содержащего все необходимое для сборки. Вы найдете дистрибутив *bob.jar* последней актуальной версии на [странице загрузки Defold](http://d.defold.com) и на [GitHub странице релизов](https://github.com/defold/defold/releases) . Выберите релиз, затем загрузите *bob/bob.jar*. Чтобы запустить утилиту Bob, с версии Defold 1.4.8 вам необходимо [установить на вашем компьютере OpenJDK 21](https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-21). Для предыдущих версий Defold необходима [OpenJDK 17](https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-17).
 
 ## Применение
 

二進制
docs/ru/manuals/images/editor/preferences_general.png


+ 5 - 5
docs/zh/manuals/bob.md

@@ -9,13 +9,13 @@ Bob 是一个用于Defold项目编辑器之外的命令行编译工具.
 
 Bob 用来编译操作 (对应编辑器里的 <kbd>Project ▸ Build</kbd>), 来创建数据档或者创建可独立发布的应用 (对应编辑器里的 <kbd>Project ▸ Bundle ▸ ...</kbd> 选项)
 
-Bob 集合了编译所需的一切, 作为Java包 _JAR_ 发布. 最新的 *bob.jar* 发布在 [Defold 下载页](http://d.defold.com) 和 [GitHub 发布页](https://github.com/defold/defold/releases) 上. 选择一个版本, 下载 *bob/bob.jar*. 如果你使用的是 Defold 1.4.8, 您需要安装 OpenJDK 17. 对于 Defold 老版本, 你需要 openJDK 11.
+Bob 集合了编译所需的一切, 作为Java包 _JAR_ 发布. 最新的 *bob.jar* 发布在 [Defold 下载页](http://d.defold.com) 和 [GitHub 发布页](https://github.com/defold/defold/releases) 上. 选择一个版本, 下载 *bob/bob.jar*. 如果你使用的是 Defold 1.9.6, 您需要安装 OpenJDK 21. 对于 Defold 老版本, 你需要 openJDK 17.
 
-兼容 OpenJDK 17 镜像 (自从 Defold 1.4.8):
-* https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-17
-* https://github.com/adoptium/temurin17-binaries/releases / https://adoptium.net/
+兼容 OpenJDK 21 镜像 (自从 Defold 1.9.6):
+* https://docs.microsoft.com/en-us/java/openjdk/download#openjdk-21
+* https://github.com/adoptium/temurin21-binaries/releases / https://adoptium.net/
 
-比如在 Windows 平台上, 需要下载 OpenJDK 17 的 .msi 安装包.
+比如在 Windows 平台上, 需要下载 OpenJDK 21 的 .msi 安装包.
 
 ## 用法