samreid / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

PSwing added to PCamera not working since PSwing r863 #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If i use PSwing code from r819 my PSwing added directly to the camera is 
working.

If i use any version more recent it is not working anymore.
This is because in the method listenForCanvas the test for PCamera as parent 
before the test for PCanvas as parent is gone.

If i add the code of this method from r819 it work again.

Can you please update the source code to keep the test for PSwing added 
directly to the camera ?

Julien Blaize

Original issue reported on code.google.com by julien.b...@gmail.com on 11 Apr 2012 at 7:43

GoogleCodeExporter commented 9 years ago
Julien, Thanks for submitting this. Can you clarify what the problem is. I 
looked at r819 but I don't see any changes to a listenForCanvas method.

Original comment by atdi...@gmail.com on 23 Apr 2012 at 3:37

GoogleCodeExporter commented 9 years ago
Hi,

if i look at PSwingNode r819 lines 610 to 615 are a test to see if the 
PSwingNode is directly added to the camera.
In the latter revisions the test is gone, and so PSwingNode added to a PCamera 
doesn't work anymore. If you copy the code from 610 to 615 in the latest 
PSwingNode revision it works again.

Original comment by julien.b...@gmail.com on 23 Apr 2012 at 6:54

GoogleCodeExporter commented 9 years ago
Is this on svn trunk or branches/release-1.3?

Original comment by heue...@gmail.com on 31 Aug 2012 at 4:35

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 31 Aug 2012 at 8:29

GoogleCodeExporter commented 9 years ago
Hi,
i checked and the part is missing in trunk latest version and in 1.3.1 branch 
(the java part).

You can find the code i am talking about (r819 line 610-615) in the trunk 
revision.
I copy the code here if you can't find it.
this is the part in the if(parent instanceof PCamera).

  private void listenForCanvas(final PNode node) {
        // need to get the full tree for this node
        PNode p = node;
        while (p != null) {
            listenToNode(p);

            final PNode parent = p;
            if (parent instanceof PCamera) {
                final PCamera cam = (PCamera) parent;
                if (cam.getComponent() instanceof PSwingCanvas) {
                    updateCanvas((PSwingCanvas) cam.getComponent());
                }
            }
            else if (parent instanceof PLayer) {
                final PLayer player = (PLayer) parent;
                for (int i = 0; i < player.getCameraCount(); i++) {
                    final PCamera cam = player.getCamera(i);
                    if (cam.getComponent() instanceof PSwingCanvas) {
                        updateCanvas((PSwingCanvas) cam.getComponent());
                        break;
                    }
                }
            }
            p = p.getParent();
        }
    }

Original comment by julien.b...@gmail.com on 3 Sep 2012 at 8:00