librocket GUI support

I must apologize for both, my long posts, and if I’ve sent anyone on a wild goose chase.

I have discovered more accurately when the situation happens, and have two new test cases for you…

  1. When rocket is required as a package through packp3d, there is no issue and everything works as desired, see code below
import direct.directbase.DirectStart
from panda3d.rocket import *

run()

Compile that into a p3d file using:

packp3d -o myapp.p3d -r rocket

No issue occurs.

  1. When rocket is installed at-runtime (which I seem to be able to do with other packages, bullet, my own packages, etc) there is the “ImportError: libboost_python.so.1.48.0: cannot open shared object file: No such file or directory” error, which may be due to my own lacking knowledge of the package system. See the below:
import direct.directbase.DirectStart
from direct.p3d.DWBPackageInstaller import DWBPackageInstaller

def onFinish(worked):
	print 'onFinish(%s)' % worked
	from panda3d.rocket import LoadFontFace

pi = DWBPackageInstaller(base.appRunner, parent = base.a2dTopRight, scale = 0.5, pos = (-0.6, 0, -0.1), finished = onFinish)

pi.addPackage('rocket', 'cmu_1.8')
pi.donePackages()

run()

As you can see, the above code will install the rocket package at runtime, and once done, attempt to load the rocket module (by simply importing LoadFontFace from panda3d.rocket module)

Compile the above into a p3d simply with:

packp3d -o myapp.p3d

So it appears my new question is, why can other panda3d C modules/packages, such as Bullet, be installed at runtime, and the rocket C module/package is the opposite, with the missing libboost_python… error?

I apologize for the incorrect information before,
Thank you,
~powerpup118

Bah. Somehow it must be grabbing the librocket libraries on your system instead of the librocket libraries in the rtdist.

The only way I see to fix this is for me to rename the libRocket libraries into something else, and then linking to those.

I’m busy at the moment with other tasks, so please file a bug report.

Okay, I’ll go ahead and file a bug report about this.

Since it’s grabbing the libRocket libraries from my own system, in theory, the problem should be non existent for anyone who has never installed libRocket, (directly as a system install, I mean), is that correct?

I’ll go ahead and test this theory as well, and if it’s different from what I think, I’ll let you know on the bug tracker.

Appreciate your time,
~powerpup118

You can easily test it by simply renaming the libRocket libraries on your system, or moving them to another directory.

When I run the following program:

from direct.showbase.ShowBase import ShowBase 
from panda3d.rocket import * 

class MyApp(ShowBase): 

    def __init__(self): 
        ShowBase.__init__(self) 

app = MyApp() 
app.run() 

I get this exception:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/share/panda3d/panda3d.py", line 200, in __getattr__
    for obj in dir(self.__manager__.libimport(lib)):
  File "/usr/share/panda3d/panda3d.py", line 129, in libimport
    raise ImportError, message
ImportError: DLL loader cannot find _rocketcore.

This ImportError occurs with both 1.8 and the latest Lucid Lynx buildbot. Like carthartguy, I too have no _rocketcore.so file in /usr/lib/panda3d. Plus this problem occurs both with and without librocket being separately installed on my system. Anyone have any suggestions?

Sorry, I must have forgotten to build libRocket on lucid lynx.

So can I expect librocket to be in the Lucid Lynx build by tommorrow?

The current lucid builds (as of this very moment) should contain libRocket support.

Thanks, rdb - librocket works with the Lucid Lynx build now :slight_smile:

Hi again all,

I have a sort of suggestion/feature request I suppose, it’s however specifically relate to rocket, sso instead of posting it under Feature Request I thought I’d post it here.

libRocket allows C++ users to inherit from Rocket::Core::Element, and then define onUpdate/onRender calls for that specified element, and then it will be properly drawn in order, with respect to other elements.

For an example, a minimap, or some sort of 3d character drawn “onto” an libRocket window, using your own custom element tag.

See this libRocket thread on their forums here

Also see ElementGame.cpp in libRocket/Samples/pyinvaders/rc/ElementGame.cpp

This is an example of such usage, and I can see this being indeed very useful.

I was thinking of some sort of “rocketElementNode” or something of the sort, which could have a tag, and inherit from Rocket::Core::Element, and then any panda3d geom’s etc under that node would be drawn in the onRender/onUpdate callback or however that works

This is just an suggestion, and I’m more than aware that this requires C++ work that perhaps nobody is willing or knowledgeable enough to do.

Just an idea,
~powerpup118

Intriguing. I’ll look into it.

It wouldn’t work. Interrogate doesn’t support overriding virtual methods from C++. Boost::python does, however, so nothing is stopping you from inheriting directly from Rocket::Core::Element.

I’m having a bit of trouble changing properties at runtime - and I’m kind of assuming I just don’t understand the libRocket API well enough - but whenever I try to change an object property once run() is called it either crashes my application or does nothing.

What I’m trying to do is create a text field I can update as needed, but I get the following error:

Boost.Python.ArgumentError: Python argument types in
    None.None(Element, unicode)
did not match C++ signature:
    None(class Rocket::Core::Element {lvalue}, class Rocket::Core::StringBase<char>)

I’ve tried using a

and a

. From what I gather a div is translated into an Element, and a

is translated into an ElementText. Respectively, I’ve tried assigning document.getElementById(‘id’).inner_rml and document.getElementById(‘id’).text directly. The

property crashes with the above error, and the

method doesn’t seem to do anything. I’ve tried calling context.Update() after the

property, but that doesn’t help.

If I change these properties before Panda’s run() method is called I have no issues, but once run() is called the

method crashes and the

method doesn’t do anything. I’m assuming I’m just doing this wrong. What’s the right way to do this is? Any help would be much appreciated.

I’ve figured it out. When assigning a value directly it is a string type, but when assigning as a variable it was a unicode type. By casting the value with str() before assigning it worked.

Hi there !

It’s great news that Rocket is getting integrated in Panda3D ! And I’d like to try it out : I compiled it alright and can use it, but I just don’t know how.

The RocketNode object from the first post doesn’t exist anymore (does it ?).
I have a RocketRegion, with and a successfully loaded ElementDocument, but I don’t know how to display it into Panda.
I didn’t find anything in the documentation to create a PandaNode.

Is there any way to see a sample of code in C++ ?

rdb.name/rocket-sample.zip

Alright thank you ! I managed to write it in C++ and it works wonders !

But there’s a problem I know how to solve with PGButtons but not with the libRockets !

If you want to ignore the clicks intercepted by a PGButton, you would do this :

button->get_region()->set_suppress_flags(MouseWatcherRegion::SF_mouse_button);

But I can’t find a way to do this with RocketRegions. Is there something to do that ?

At the moment, there isn’t. I could look into adding it, though. Could you file a big report with that information at launchpad? Thanks!

Done ! Here’s the bug report : bugs.launchpad.net/panda3d/+bug/1001931

hello fellows

I´m studying libRocket´s tutorial Dragging : http://librocket.com/wiki/documentation/tutorials/Dragging

Everything goes right but when i set icon drag property to clone in tutorial.rss the app run, but when i´m about to drag any icon my app simply crash :confused:

I´m on windows 7 and panda3d 1.8. Any ideas?
Thanx