Node design questions

Due to my work on a new, node-based, gamestate system, I’ve been looking through the com.jme.scene.Node, and got some questions:


  1. When you attach a child to a forceculled Node, the child will in turn also get forceculled. But when you call Node.setForceCull the already maintained children won’t get affected. Is this a design flaw, or should it be that way?


  2. When you call Node.hasChild, the Node will also go through its sub-nodes in order to find it. But none of the other methods (i.e. getChild nor detachChild) seem to consider children of sub-nodes as their own.



    I know these are tiny inconsistencies - I’m not trying to be a smartass or anything, just curious :slight_smile:
1) When you attach a child to a forceculled Node, the child will in turn also get forceculled. But when you call Node.setForceCull the already maintained children won't get affected. Is this a design flaw, or should it be that way?


When the scene is rendered, a branch is no longer processed once it reaches any level that is culled. So, children of a culled node don't need to be set to forceculled. However, it does sound like there is some inconsistency regarding the adding.

2) When you call Node.hasChild, the Node will also go through its sub-nodes in order to find it. But none of the other methods (i.e. getChild nor detachChild) seem to consider children of sub-nodes as their own.


That's more a bad naming of the hasChild method than anything. Since a child is only one generation below the parent. A node should only be able to detach or get it's own children.

I know these are tiny inconsistencies - I'm not trying to be a smartass or anything, just curious


Those are two valid points, and I'll see what I can do to remove confusion.

Ah, thanks mojo, that was exactly the kind of answers I was looking for!