Skip to content

Commit

Permalink
fix during adding of new display node: name wasn't incremented proper…
Browse files Browse the repository at this point in the history
…ly and creation would fail.
  • Loading branch information
mchaptel committed Apr 14, 2022
1 parent 43e0789 commit c82d775
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions openHarmony/openHarmony_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,17 @@ $.oGroupNode.prototype.addNode = function( type, name, nodePosition ){

var _group = this.path;

// get unique name if type is DISPLAY as all other types increment on their own
if (type == "DISPLAY"){
var num = 1;
var displayName = name;
while (this.$node(displayName)){
displayName = name + "_" + num;
num++;
}
name = displayName;
}

// create node and return result (this sanitizes/increments the name, so we only create the oNode with the returned value)
var _path = node.add(_group, name, type, nodePosition.x, nodePosition.y, nodePosition.z);
_node = this.scene.getNodeByPath(_path);
Expand Down

0 comments on commit c82d775

Please sign in to comment.