From 288a16844ca1fabcd272c28a2d042b841d27f17b Mon Sep 17 00:00:00 2001 From: Alexey Knyazev <3479527+lexaknyazev@users.noreply.github.com> Date: Mon, 10 Jun 2024 00:00:00 +0000 Subject: [PATCH 1/2] KHR_node_visibility draft --- .../2.0/Khronos/KHR_node_visibility/README.md | 63 +++++++++++++++++++ .../node.KHR_node_visibility.schema.json | 17 +++++ 2 files changed, 80 insertions(+) create mode 100644 extensions/2.0/Khronos/KHR_node_visibility/README.md create mode 100644 extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json diff --git a/extensions/2.0/Khronos/KHR_node_visibility/README.md b/extensions/2.0/Khronos/KHR_node_visibility/README.md new file mode 100644 index 0000000000..61cdb3e3d8 --- /dev/null +++ b/extensions/2.0/Khronos/KHR_node_visibility/README.md @@ -0,0 +1,63 @@ +# KHR_node_visibility + +## Contributors + +- Dwight Rodgers, Adobe +- Peter Martin, Adobe +- Emmett Lalish, Google +- Alexey Knyazev, Independent + +## Status + +Draft + +## Dependencies + +Written against the glTF 2.0 spec. + +## Overview + +This extension allows glTF animations and interactivity to control visibility of node hierarchies. It is intended for use in conjunction with `KHR_animation_pointer` and/or `KHR_interactivity` extensions. + +## Extending Nodes + +The `KHR_node_visibility` extension object is added to the objects within the `nodes` array. The extension object contains a single boolean `hidden` property. This value is mutable through JSON pointers as defined in the glTF 2.0 Asset Object Model and controls visibility of the node that contains it and all its children nodes recursively. A value of `true` causes all nodes below in the hierarchy to be omitted from display, even any nodes below that have a value of `false`. + +| | Type | Description | Required | +|------------|-----------|---------------------------------------|---------------------| +| **hidden** | `boolean` | Specifies whether the node is hidden. | No, default: `false`| + +In other words, a node is visible if and only if its own `hidden` property is `false` and all its parents are visible. This allows a single change of a `hidden` property at a high level of the hierarchy to hide or show complex (multi-node) objects. + +In the following example, both nodes (and therefore their meshes) are initially hidden. + +```json +{ + "nodes": [ + { + "children": [1], + "mesh": 0, + "extensions": { + "KHR_node_visibility": { + "hidden": true + } + }, + }, + { + "mesh": 1 + } + ] +} +``` + +## Extending glTF 2.0 Asset Object Model + +The following pointer template represents the mutable property defined by this extension. + +| Pointer | Type | +|---------------------------------------------------|--------| +| `/nodes/{}/extensions/KHR_node_visibility/hidden` | `bool` | + +## JSON Schema + +- [node.KHR_node_visibility.schema.json](schema/node.KHR_node_visibility.schema.json) diff --git a/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json b/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json new file mode 100644 index 0000000000..09d16ce254 --- /dev/null +++ b/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema", + "title": "KHR_node_visibility glTF Node Extension", + "type": "object", + "description": "glTF extension that defines node's visibility.", + "allOf": [ { "$ref": "glTFProperty.schema.json" } ], + "properties": { + "hidden": { + "type": "boolean", + "description": "Specifies whether the node is hidden.", + "default": false, + "gltf_detailedDescription": "Specifies whether the node is hidden. A value of true means that the node and all its children are hidden." + }, + "extensions": { }, + "extras": { } + } +} From 52d04b54cdd953486b4caf7d2e2da58808c84382 Mon Sep 17 00:00:00 2001 From: Alexey Knyazev <3479527+lexaknyazev@users.noreply.github.com> Date: Mon, 17 Jun 2024 00:00:00 +0000 Subject: [PATCH 2/2] Use positive property name --- .../2.0/Khronos/KHR_node_visibility/README.md | 20 +++++++++---------- .../node.KHR_node_visibility.schema.json | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/extensions/2.0/Khronos/KHR_node_visibility/README.md b/extensions/2.0/Khronos/KHR_node_visibility/README.md index 61cdb3e3d8..4a6b3e7662 100644 --- a/extensions/2.0/Khronos/KHR_node_visibility/README.md +++ b/extensions/2.0/Khronos/KHR_node_visibility/README.md @@ -1,4 +1,4 @@ -# KHR_node_visibility +# KHR\_node\_visibility ## Contributors @@ -21,13 +21,13 @@ This extension allows glTF animations and interactivity to control visibility of ## Extending Nodes -The `KHR_node_visibility` extension object is added to the objects within the `nodes` array. The extension object contains a single boolean `hidden` property. This value is mutable through JSON pointers as defined in the glTF 2.0 Asset Object Model and controls visibility of the node that contains it and all its children nodes recursively. A value of `true` causes all nodes below in the hierarchy to be omitted from display, even any nodes below that have a value of `false`. +The `KHR_node_visibility` extension object is added to the objects within the `nodes` array. The extension object contains a single boolean `visible` property. This value is mutable through JSON pointers as defined in the glTF 2.0 Asset Object Model and controls visibility of the node that contains it and all its children nodes recursively. A value of `false` causes all nodes below in the hierarchy to be omitted from display, even any nodes below that have a value of `true`. -| | Type | Description | Required | -|------------|-----------|---------------------------------------|---------------------| -| **hidden** | `boolean` | Specifies whether the node is hidden. | No, default: `false`| +| | Type | Description | Required | +|-------------|-----------|----------------------------------------|--------------------| +| **visible** | `boolean` | Specifies whether the node is visible. | No, default: `true`| -In other words, a node is visible if and only if its own `hidden` property is `false` and all its parents are visible. This allows a single change of a `hidden` property at a high level of the hierarchy to hide or show complex (multi-node) objects. +In other words, a node is visible if and only if its own `visible` property is `true` and all its parents are visible. This allows a single change of a `visible` property at a high level of the hierarchy to hide or show complex (multi-node) objects. In the following example, both nodes (and therefore their meshes) are initially hidden. @@ -39,7 +39,7 @@ In the following example, both nodes (and therefore their meshes) are initially "mesh": 0, "extensions": { "KHR_node_visibility": { - "hidden": true + "visible": false } }, }, @@ -54,9 +54,9 @@ In the following example, both nodes (and therefore their meshes) are initially The following pointer template represents the mutable property defined by this extension. -| Pointer | Type | -|---------------------------------------------------|--------| -| `/nodes/{}/extensions/KHR_node_visibility/hidden` | `bool` | +| Pointer | Type | +|----------------------------------------------------|--------| +| `/nodes/{}/extensions/KHR_node_visibility/visible` | `bool` | ## JSON Schema diff --git a/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json b/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json index 09d16ce254..d6bc68199d 100644 --- a/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json +++ b/extensions/2.0/Khronos/KHR_node_visibility/schema/node.KHR_node_visibility.schema.json @@ -5,11 +5,11 @@ "description": "glTF extension that defines node's visibility.", "allOf": [ { "$ref": "glTFProperty.schema.json" } ], "properties": { - "hidden": { + "visible": { "type": "boolean", - "description": "Specifies whether the node is hidden.", - "default": false, - "gltf_detailedDescription": "Specifies whether the node is hidden. A value of true means that the node and all its children are hidden." + "description": "Specifies whether the node is visible.", + "default": true, + "gltf_detailedDescription": "Specifies whether the node is visible. A value of false means that the node and all its children are hidden." }, "extensions": { }, "extras": { }