BUG: NodeUpdater/View

ok … this is not really a bug … but if you use NodeUpdater and the node you try to update doesn’t own a transformgroup child the call to NodeUpdater.preRender() crashes…
this can be solved easily in two ways:

in View line 999: check if there is a TransformGroup and a Transform3D and call preRender depending on the result:


if ( node instanceof NodeUpdater && node.getTransformGroup() != null && node.getTransformGroup().getTransform() != null ) {
  if (!((NodeUpdater)node).preRender(
                            		getTransform(),
                            		frustum,
                            		node.getTransformGroup().getTransform(),
                            		currentFrameStartTime)) return;
} 

or ( in my opinon the preferable way ): always call preRender even if there is no transform stuff


if ( node instanceof NodeUpdater ) {
                            if (!((NodeUpdater)node).preRender(
                            		getTransform(),
                            		frustum,
                            		( node.getTransformGroup() != null ? node.getTransformGroup().getTransform() : null ),
                            		currentFrameStartTime)) return;
                        } 

this of course assumes that everybody who uses TransformGroupS has Transform3Ds in them

just my 50 cent … Florian

what does NodeUpdater do? sorry, this is OT, but I haven’t used it (or better haven’t known something like this exist), so I’m curios if I could use it someway… Or is this something internal? maybe it will also help me to clear this issue here up (even as it seems, that you’ve already fixed it :wink: )

Arne

NodeUpdater ( it’s an interface ) gives you the possibility to do prerendering calculations as it seems
NodeUpdater.preRender() takes some very interessting attribues ( including the camera location, frustum and the time ) and the result decides if the implementing Shape3D renderes

i’ve just had another look at the code … the check if the current node is an instance of NodeUpdater is only done if it is an Shape3D … so far … what does a TransformGroup do that is added to a Shape3D? … is it even necessary to give the transform group through preRender() ?

Haeh? How can one add TransformGroupS to Shape3DS ? You can do it the other way round, if this is what you wanted to say.
From your explanation I think prerender goes the full tree from the shape to the root, so trying to test a TransformGroup would be senseless, because a Shape can’t be a parent of a TransformGroup and a TransformGroup itself doesn’t contain Geometry that could be tested.

eh … right … so the transformgroup thingy in the second preRender call ( line 999 ) can be always be null

but i just saw there is another call in line 841 (proggy crashed :wink: … i think the test if the node has an transformgroup can be applied there too

Ok I don’t understand all this, but try if the test fixes this, then we can discuss. It actually looks to me that in line 841 it get’s called, when it’s not a Shape3D, if you want to add that it doesn’t get called, when it’s a TransformGroup, when does this get called then? Are you sure, you’re using NodeUpdater correctly?

the first call can be left unchanged … or the test can be added cause not every node there does have a transformgroup
but the second call is a shape3d … but shapes doesn’t have attached transformgroups like someone said before … so i suggest to change the second call to give a null pointer instead of having a nullpointer exception

but maybe i’m using the whole thingy wrong :wink: