You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extensions/2.0/Khronos/KHR_interactivity/Specification.adoc
+43-38Lines changed: 43 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -3235,12 +3235,12 @@ Both pointers are functional even if the nodes do not belong to the current glTF
3235
3235
Implementations that import glTF assets into pre-existing scenes may need to maintain mappings between their internal objects and glTF objects defined in the asset. If the implementation's coordinate system is different from the one used in glTF, extra runtime conversions may be necessary for properties that depend on the XYZ axes.
3236
3236
====
3237
3237
3238
-
When a behavior graph is loaded, all JSON Pointer Templates **MUST** be processed as described in the following sections. If a pointer template contains path segments wrapped in curly brackets, called _template parameters_, they define input value socket ids (with the curly brackets stripped) for the node. These template parameters **MUST NOT** be empty or contain `/`, `{`, `}`, or `~` characters; the same parameter **MUST NOT** be used more than once within a template string. If a JSON property used in the Pointer Template string contains curly brackets, they **MUST** be escaped with a back slash character (`\`, `0x5C`).
3238
+
When a behavior graph is loaded, all JSON Pointer Templates **MUST** be processed as described in the following sections. If a pointer template contains path segments wrapped in curly brackets, called _template parameters_, they define input value socket ids (with the curly brackets stripped) for the node. These template parameters **MUST NOT** be empty; the same parameter **MUST NOT** be used more than once within a template string. If used literally, curly brackets **MUST** be doubled, i.e, `{` **MUST** be written as `{{`, and `}` **MUST** be written as `}}` when used within path segments; curly brackets **MUST NOT** be used within parameters. Tilde (`~`) and forward slash (`/`) characters used in path segments or parameters **MUST** be encoded as `~0` and `~1` respectively as defined in <<rfc6901,RFC 6901>>.
3239
3239
3240
3240
[NOTE]
3241
3241
.Implementation Note
3242
3242
====
3243
-
None of the glTF properties currently defined in Khronos specifications contain curly brackets in their names but such properties can exist in arbitrary glTF assets within vendor-specific extensions or `extras` objects.
3243
+
None of the glTF properties currently defined in Khronos specifications contain curly brackets, forward slash, or tilde in their names but such properties can exist in arbitrary glTF assets within vendor-specific extensions or `extras` objects.
3244
3244
====
3245
3245
3246
3246
When an Object Model Access node is activated, its JSON Pointer Template and input values (if present) are used to generate the effective JSON Pointer string value.
@@ -3249,83 +3249,88 @@ If the property being accessed is also affected by a currently active animation,
3249
3249
3250
3250
===== JSON Pointer Template Parsing
3251
3251
3252
-
The input to these steps is the `pointer` string configuration value; the output includes a boolean validity flag and a template parameter array. Implementations **MAY** optimize these steps as long as such optimizations do not change the output.
3252
+
The input to these steps is the `pointer` string configuration value; the output includes a boolean validity flag and a template parameter array. Each template parameter array entry consists of a string representing the corresponding input value socket id and the parameter substring location (e.g., start and end offsets) in the JSON Pointer Template.
3253
+
3254
+
Implementations **MAY** optimize these steps as long as such optimizations do not change the output.
3253
3255
3254
3256
1. Let the validity flag be true and the template parameter array be empty.
3255
-
2. If the pointer template string is not a syntactically valid JSON Pointer as defined in <<rfc6901,RFC 6901>> regardless of the pointer applicability to the glTF asset, reject the pointer template string with a syntax error.
3257
+
2. If the pointer template string is not a syntactically valid JSON Pointer as defined in <<rfc6901,RFC 6901>> regardless of the pointer applicability to the glTF asset and/or template parameters, reject the pointer template string with a syntax error.
3256
3258
3. Split the pointer template string at all matches of the forward slash character (`/`, `0x2F`). This step produces a path segment array consisting of a substring before the first match, substrings between the matches, and a substring after the last match.
3257
3259
4. For each path segment substring produced during step 3:
3258
-
.. If the substring starts with a left curly bracket (`{`, `0x7B`):
3259
-
... Assume the substring to be a template parameter.
3260
-
... If the substring contains more than one left curly bracket, more than one right curly bracket (`}`, `0x7D`), if it does not end with a right curly bracket (`}`, `0x7D`), if there are no characters between the curly brackets (i.e., if the entire substring is `{}`), or if the substring contains a tilde (`~`, `0x7E`), set the validity flag to false, ignore all other segments, and goto step 5.
3261
-
... Add the substring to the template parameter array.
3262
-
... If the template parameter array contains duplicate elements, set the validity flag to false and goto step 5.
3263
-
.. If the substring does not start with a left curly bracket (`{`, `0x7B`):
3264
-
... Assume the substring to be a literal path segment, i.e., not a template parameter.
3265
-
... If the substring contains a left or right curly bracket not escaped by a back slash character (`\`, `0x5C`), set the validity flag to false and goto step 5.
3260
+
.. If the path segment consists of a single left curly bracket (`{`, `0x7B`) character,
3261
+
... set the validity flag to false, ignore all other segments, and goto step 5.
3262
+
.. If the first character of the path segment substring is a left curly bracket and the second character is not a left curly bracket:
3263
+
... Assume the path segment substring to be a template parameter.
3264
+
... If the path segment substring contains left curly brackets not including the first character, right curly brackets (`}`, `0x7D`) not including the last character, if it does not end with a right curly bracket, or if there are no characters between the first and the last curly brackets (i.e., if the entire path segment substring is `{}`), set the validity flag to false, ignore all other segments, and goto step 5.
3265
+
... Derive the input value socket id as follows:
3266
+
.... Strip the first and the last characters, i.e., the leading left and trailing right curly brackets.
3267
+
.... Replace all instances of `~1` with `/`.
3268
+
.... Replace all instances of `~0` with `~`.
3269
+
... If the template parameter array contains an element with the same value socket id, set the validity flag to false and goto step 5.
3270
+
... Add a new entry to the template parameter array consisting of the derived input value socket id and the path segment substring location in the pointer template string.
3271
+
.. If the first character of the path segment substring is not a left curly bracket or if the first two characters are left curly brackets:
3272
+
... Assume the path segment substring to be a literal path segment, i.e., not a template parameter.
3273
+
... If the path segment substring contains an odd number of consecutive left curly brackets or an odd number of consecutive right curly brackets, set the validity flag to false and goto step 5.
3266
3274
5. If the validity flag is true, output the parameter array; if the validity flag is false, reject the pointer template string with a syntax error.
3267
3275
3268
3276
[NOTE]
3269
3277
.Valid Syntax Examples
3270
3278
====
3271
3279
- The template string `"/myProperty"` is syntactically valid and has no template parameters. As it does not represent a recognized glTF Asset Object Model property, using this pointer will result in runtime errors defined by the corresponding nodes.
3272
3280
3273
-
- The template string `"/nodes/0/scale"` is syntactically valid and has no template parameters.
3281
+
- The template string `"/nodes/0/scale"` is syntactically valid and has no template parameters thus it does not yield any input value socket ids.
3274
3282
3275
-
- The template string `"/nodes/{index}/scale"` is syntactically valid and has one template parameter called `{index}`, which would result in an input value socket with id `index`.
3283
+
- The template string `"/nodes/{index}/scale"` is syntactically valid and has one template parameter that yields an input value socket with id `index`.
3276
3284
3277
-
- The template string `"/nodes/{index\\}/scale"` is syntactically valid and has one template parameter called `{index\}`, which corresponds to the input value socket with id `index\`. Note that backslash characters are escaped when used in JSON strings.
3285
+
- The template string `"/nodes/{index}/extras/{{index}}"` is syntactically valid and has one template parameter that yields an input value socket with id `index`. The curly brackets that are part of the `{index}` property name are doubled.
3278
3286
3279
-
- The template string `"/nodes/{index}/extras/\\{index\\}"` is syntactically valid and has one template parameter called `{index}`. Since the pointer targets the `{index}` JSON property, the curly brackets of the property are escaped. Note that backslash characters are escaped when used in JSON strings.
3287
+
- The template string `"/nodes/{\~0~0index\~0~0}/rotation"` is syntactically valid and has one template parameter that yields an input value socket with id `\~~index~~`. The tilde characters used in the template parameter are encoded as `~0`.
3280
3288
3281
-
- The template string `"/nodes/0/extras/e\\}\\{traProperty"` is syntactically valid and has no template parameters. Since the pointer targets the `e}{traProperty` JSON property, the curly brackets of the property are escaped. Note that backslash characters are escaped when used in JSON strings.
3289
+
- The template string `"/nodes/{my~1index}/scale"` is syntactically valid and has one template parameter that yields an input value socket with id `my/index`. The forward slash character used in the template parameter is encoded as `~1`.
3282
3290
====
3283
3291
3284
3292
[NOTE]
3285
3293
.Invalid Syntax Examples
3286
3294
====
3287
3295
- The template string `"/nodes/{index}/extras/~2"` is syntactically invalid because the `~2` character sequence is invalid in JSON Pointers, see <<rfc6901,RFC 6901>>.
3288
3296
3289
-
- The template string `"/nodes/{index}/weights/{index}"` is syntactically invalid because the `{index}` template parameter is used twice.
3290
-
3291
-
- The template string `"/nodes/{~index}/scale"` is syntactically invalid because the path segment substring that starts with `{` contains the `~` character.
3292
-
3293
-
- The template string `"/nodes/{}/scale"` is syntactically invalid because the path segment substring that starts with `{` has no characters between `{` and `}`.
3297
+
- The template string `"/nodes/{index}/weights/{index}"` is syntactically invalid because it yields two input value sockets with the same id.
3294
3298
3295
-
- The template string `"/nodes/{index/scale"` is syntactically invalid because the path segment substring that starts with `{` does not end with `}`.
3299
+
- The template string `"/nodes/{/scale"` is syntactically invalid because it contains a `{` path segment.
3296
3300
3297
-
- The template string `"/nodes/{i}ndex/scale"` is syntactically invalid because the path segment substring that starts with `{` does not end with `}`.
3301
+
- The template string `"/nodes/{}/scale"` is syntactically invalid because the template parameter path segment has no characters between `{` and `}`.
3298
3302
3299
-
- The template string `"/nodes/{{index}/scale"` is syntactically invalid because the path segment substring that starts with `{` has more than one `{` character.
3303
+
- The template string `"/nodes/{index/scale"` is syntactically invalid because the template parameter path segment does not end with `}`.
3300
3304
3301
-
- The template string `"/nodes/{\\{index}/scale"` is syntactically invalid because the path segment substring that starts with `{` has more than one `{` character.
3305
+
- The template string `"/nodes/{i{ndex}/scale"` is syntactically invalid because the template parameter path segment contains a left curly bracket inside the parameter.
3302
3306
3303
-
- The template string `"/nodes/\\{index}/scale"` is syntactically invalid because the path segment substring that does not start with `{` has the unescaped `}` character.
3307
+
- The template string `"/nodes/{i}ndex}/scale"` is syntactically invalid because the template parameter path segment contains a right curly bracket inside the parameter.
3304
3308
3305
-
- The template string `"/nodes/{index}}/scale"` is syntactically invalid because the path segment substring that starts with `{` has more than one `}` character.
3309
+
- The template string `"/nodes/0/extras/{{i{ndex}}"` is syntactically invalid because a literal path segment has an odd number of consecutive left curly brackets.
3306
3310
3307
-
- The template string `"/nodes/0/extras/myData{Index}"` is syntactically invalid because it has a path segment substring that does not start with `{` and contains an unescaped `{` character.
3311
+
- The template string `"/nodes/0/extras/{{index}"` is syntactically invalid because a literal path segment has an odd number of consecutive right curly brackets.
3308
3312
====
3309
3313
3310
3314
===== Effective JSON Pointer Generation
3311
3315
3312
3316
The inputs to these steps are the `pointer` configuration value, the template parameter array, and the corresponding input values provided at runtime by the behavior graph; the output is the effective JSON Pointer string that will be handled by the Object Model Access nodes. Implementations **MAY** optimize these steps as long as such optimizations do not change the output.
3313
3317
3314
-
1. Let _P_ be a copy of the `pointer` configuration value.
3315
-
2. For each element of the template parameter array:
3316
-
.. assert that the corresponding input socket value is not negative;
3317
-
.. convert the corresponding input socket value to its decimal string representation containing only ASCII characters `0x30 ... 0x39` with no extra leading zeros.
3318
-
.. update _P_ by replacing the template parameter substring in it with the converted input socket value.
3319
-
3. Update _P_ by replacing all occurrences of the `\{` substring in it with `{`.
3320
-
4. Update _P_ by replacing all occurrences of the `\}` substring in it with `}`.
3321
-
5. Output _P_ as the effective JSON Pointer string.
3318
+
1. Assume that the `pointer` configuration value is syntactically valid.
3319
+
2. Let _P_ be a copy of the `pointer` configuration value.
3320
+
3. For each element of the template parameter array:
3321
+
.. Assert that the corresponding input socket value is not negative.
3322
+
.. Convert the corresponding input socket value to its decimal string representation containing only ASCII characters `0x30 ... 0x39` with no extra leading zeros.
3323
+
.. Update _P_ by replacing the template parameter substring, as identified by the template parameter location, with the decimal string value of the corresponding input value socket.
3324
+
4. Update _P_ by replacing all occurrences of the `{{` substring in it with `{`.
3325
+
5. Update _P_ by replacing all occurrences of the `}}` substring in it with `}`.
3326
+
6. Output _P_ as the effective JSON Pointer string.
3322
3327
3323
3328
[NOTE]
3324
3329
.Examples
3325
3330
====
3326
3331
- Let the `pointer` configuration value be `"/nodes/{N}/weights/{W}"`. Then the nodes using this template pointer string have the `N` and `W` input value sockets. Let the runtime `N` value be 1 and the runtime `W` value be 2. Then the effective JSON Pointer is `"/nodes/1/weights/2"`.
3327
3332
3328
-
- Let the `pointer` configuration value be `"/nodes/{index}/extras/\\{index\\}"`. Then the nodes using this template pointer string have the `index` input value socket. Let the runtime `index` value be 2. Then the effective JSON Pointer is `"/nodes/2/extras/{index}"`.
3333
+
- Let the `pointer` configuration value be `"/nodes/{index}/extras/{{index}}"`. Then the nodes using this template pointer string have the `index` input value socket. Let the runtime `index` value be 2. Then the effective JSON Pointer is `"/nodes/2/extras/{index}"`.
0 commit comments