Skip to content

Commit

Permalink
properly get value in pointer/set, fix setting visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Nov 13, 2024
1 parent 9c78384 commit 57000a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/BasicBehaveEngine/decorators/BabylonDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,17 @@ export class BabylonDecorator extends ADecorator {
}, (path, value) => {
const parts: string[] = path.split("/");
const node = this.world.glTFNodes[Number(parts[2])];
const shouldBeVisible = value || value === undefined || value === null;

if (node instanceof AbstractMesh) {
(node as AbstractMesh).isVisible = value || value === undefined || value === null;
(node as AbstractMesh).isVisible = shouldBeVisible;
}
if (node._babylonTransformNode) {
(node._babylonTransformNode as AbstractMesh).isVisible = shouldBeVisible;
}
node._primitiveBabylonMeshes?.forEach((mesh: AbstractMesh) => {
mesh.isVisible = shouldBeVisible;
});
}, "bool");

this.registerJsonPointer(`/nodes/${maxGltfNode}/extensions/KHR_node_hoverability/hoverable`, (path) => {
Expand Down
2 changes: 1 addition & 1 deletion src/BasicBehaveEngine/nodes/pointer/PointerSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class PointerSet extends BehaveEngineNode {
const configValues = this.evaluateAllValues([...this._pointerVals].map(val => val.id));
const requiredValues = this.evaluateAllValues([...this.REQUIRED_VALUES].map(val => val.id));
const populatedPath = this.populatePath(this._pointer, configValues)
const targetValue = requiredValues.val;
const targetValue = requiredValues.value;
this.graphEngine.processNodeStarted(this);

if (this.graphEngine.isValidJsonPtr(populatedPath)) {
Expand Down

0 comments on commit 57000a2

Please sign in to comment.