From e7da4ace71b725a61a3f14c1d105926ac80a214f Mon Sep 17 00:00:00 2001 From: Martin Klaudiny Date: Tue, 4 Apr 2023 12:55:06 +0200 Subject: [PATCH] Changed parent property value from null to 'none' for 'no parent' semantics (null is not supported by recorder.js). Fixed missing update of parent property on human objects present on the server. --- libraries/HumanPoseFuser.js | 9 ++++++--- libraries/HumanPoseObject.js | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/HumanPoseFuser.js b/libraries/HumanPoseFuser.js index b2abe8a6a..c575e1bb8 100644 --- a/libraries/HumanPoseFuser.js +++ b/libraries/HumanPoseFuser.js @@ -282,14 +282,14 @@ class HumanPoseFuser { // remove parent reference from its remaining associated human objects for (let id of this.humanObjectsOfFusedObject[objectId]) { if (this.objectsRef[id] !== undefined) { - this.objectsRef[id].parent = null; + this.objectsRef[id].parent = 'none'; this.batchedUpdates[id] = { objectKey: id, frameKey: null, nodeKey: null, propertyPath: 'parent', - newValue: null, + newValue: 'none', editorId: 0 }; } @@ -626,7 +626,7 @@ class HumanPoseFuser { if (!proximityMatrix[fi][index]) { // detach the standard object from the fused human object so the pose is not used in subsequent fusion this.humanObjectsOfFusedObject.removeStandardObject(id); - parentValue = null; + parentValue = 'none'; unassignedStandardIndices.push(index); if (this.verbose) { console.log('unassigning human obj=' + id + ' from ' + fid); @@ -657,6 +657,9 @@ class HumanPoseFuser { } if (parentValue !== undefined) { + // set new parent reference + this.objectsRef[id].parent = parentValue; + // make entry in batchedUpdates this.batchedUpdates[id] = { objectKey: id, diff --git a/libraries/HumanPoseObject.js b/libraries/HumanPoseObject.js index ab233db10..b1e9c4996 100644 --- a/libraries/HumanPoseObject.js +++ b/libraries/HumanPoseObject.js @@ -52,9 +52,9 @@ function HumanPoseObject(ip, version, protocol, objectId, poseJointSchema) { // This is capture timestamp of the image used to compute the pose in the update. Units are miliseconds, but it is a floating-point number with nanosecond precision. this.lastUpdateDataTS = 0; // Parent is defined when this human object is associated and supports a fused human object (therefore this object does not need to be analyzed/visualized ...) - // Parent is 'null' for any fused human object or standalone human object not currently associated with a fused one. + // Parent is 'none' for any fused human object or standalone human object not currently associated with a fused one. // NOTE: this property can change over time and subscribers to this object should take that into account - this.parent = null; + this.parent = 'none'; } HumanPoseObject.prototype.getName = function(bodyId) {