Skip to content

Commit

Permalink
Changed parent property value from null to 'none' for 'no parent' sem…
Browse files Browse the repository at this point in the history
…antics (null is not supported by recorder.js).

Fixed missing update of parent property on human objects present on the server.
  • Loading branch information
ptc-mklaudiny committed Apr 4, 2023
1 parent af9be7a commit e7da4ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions libraries/HumanPoseFuser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions libraries/HumanPoseObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e7da4ac

Please sign in to comment.