I’ve started working on this, and I’ve hit a snag. (For the moment I’m just implementing the multiple-parenting; if that works well, I may decide to leave aside the proposed rendering alterations.)
“PandaNode.addChild(…)” seems to work in that the child-object is indeed rendered more than once. However, the object’s position doesn’t seem to be as expected. Whether I leave the position unaltered or attempt to get a NodePath by calling “NodePath.find(…)” from the new parent-node, I seem to end up with one or another of the rendered objects being misplaced.
Here is what I have thus far:
# "np" = the NodePath of the object to be parented
# "node" is "np.node()"
# "pos" is "np.getPos(render)"
#
# Omitted for brevity: building the list of cells
# to which to parent the object
if len(cellList) > 0:
np.wrtReparentTo(cellList[0].geometryRoot)
for cell in cellList[1:]:
cell.geometryRoot.node().addChild(np.node())
newNP = cell.geometryRoot.find("**/" + np.getName())
newNP.setPos(render, pos)
How might I get around this? Should I perhaps use actual instancing instead, under the assumption that this would build better NodePaths and thus better allow for positioning?