PandaNode inside DirectGui?

Hi, i have some PandaNode objects within a DirectFrame (used as dummy objects).

Thus, how do I attach the buttons to PandaNode objects within the DirectFrame object?

thank to everyone.

A DirectFrame is just a NodePath, so you can treat it like an ordinary node. To add it as a child to a PandaNode, just use pandaNode.addChild(myFrame.node()).

Sorry rdb, but i think that you do not understand my question.

I have a hierarchy like this:

  _________________
 |   DirectFrame   |
 | _______________ |
 ||  PandaNode1   ||
 ||_______________||
 | _______________ |
 ||  PandaNode2   ||
 ||_______________||
 | _______________ |
 ||  PandaNode3   ||
 ||_______________||
 |_________________|

All hierarchy node above was imported with one single .egg file and after, they have become a single DirectFrame. PandaNodes above are used like dummy objects.
Therefore, i need to reparent or attach a DirectButton to the PandaNode2.

How can i do it?

thanks.

p.s.: I try to use DirectFrame as a PandaNode, but when i use DirectFrame.find(" **/PandaNode2 "), it return me
“not found”.

Help me please.

Thanks again

When you load the .egg file, the structure is simplified. You may use the tag in the .egg file to prevent this.

Sorry, but when i load the structure like a normal panda object as:

myframe = loader.loadModel("myframe.egg")

it work correctly and i can find all subobject,
but when i try to use it as a directframe with:

directframe=DirectFrame(geom=myframe,frameColor=(0,0,0,0))

i can’t find subobject in directframe.
thus, I don’t think that this is a problem of loading, right?
However as I insert tag?

Oh, sorry. Well, what is the output of directframe.ls() ?.

This is the output:

PGItem DirectFrame-pg0

but if i output myframe with .ls():

ModelRoot left_panel.egg
  PandaNode 
    PandaNode leftPanel T:m(pos -0.177899 0.0534297 -0.0396454)
      PandaNode left_panel T:m(pos 0 0.000844114 0 hpr 0 -90 0)
        GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dcnctype_left T:m(pos 0 -0.709567 0 scale 1.03163 1 1.03163)
          PandaNode Dcnctypeleft_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dcnctype_right T:m(pos 0 -0.472293 0 scale 1.03163 1 1.03163)
          PandaNode Dcnctyperight_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dcamera_pos T:m(pos 0 -0.235019 0 scale 1.03163 1 1.03163)
          PandaNode Dcamerapos_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dcnc_param T:m(pos 0 0.00225509 0 scale 1.03163 1 1.03163)
          PandaNode Dcncparam_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dvideo_opt T:m(pos 0 0.239529 0 scale 1.03163 1 1.03163)
          PandaNode Dvideoopt_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dswitch_startstop T:m(pos 0 0.476803 0 scale 1.03163 1 1.03163)
          PandaNode Dswitch_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))
        PandaNode Dexit T:m(pos 0 0.714077 0 scale 1.03163 1 1.03163)
          PandaNode Dexit_test T:m(pos 0 0 0.0429166 scale 0.969343 0.969343 1)
            GeomNode  (1 geoms: S:(ColorAttrib TextureAttrib TransparencyAttrib))

As you can see it work without DirectFrame mode.
Why?
DirectFrame is bugged?

Can anyone help me?
It is important

The DirectFrame copies the geometry you give it into its own internal node. If you really want to find the copy and work with it, you can find it under frame.stateNodePaths[0].

But mostly, you’re expected to leave that alone once you put it under a DirectFrame.

David

Thanks very much Drwr, you was very helpfull.

But i have another problem.
If i do:

mybutton.reparentTo(frame.stateNodePath[0].find("**/pandanode2"))

It seem to work, but i can’t see the button on the pandanode2 position, even if the two coordinates are the same (i did getPos(aspect2d) for each).

How can i put it in the same position after reparenting?

pandanode2 isn’t properly a child of aspect2d, so getPos(aspect2d) isn’t going to give you a meaningful answer. But in any case, getPos() returns the position of the model’s origin, which is not necessarily the same thing as its visible position, which also depends on its vertices.

If your goal is to put a node on top of the frame, you’re probably better off using the conventional scene graph and parenting it to the DirectFrame. Or, parent it to your model before you add it to the frame in the first place. Or, don’t even use DirectFrame; simply parent your original model directly to aspect2d.

David

I finally solved this problem as well!
My work is proceeding at full speed. :wink:

For your information, to reparent and object to an directgui hierarchy sub-model, you can use one of the following two forms:

      directbuttonobj.reparentTo(frameobj.component('geom0').find("**/dummyObj"))
-----------------------------
      directbuttonobj.reparentTo(frameobj.stateNodePath[0].find("**/dummyObj"))

Now i can do GUI object model in 3dsmax and directly import it in panda3d as i can see in the CGI software (with texture-cards inside).

thank you all.