I just wanted to say that your last commit fixed a segfault issue for me.
I successfully compiled it and can now use it on Ubuntu 11.04 / 32 bit.
Thank you! ~powerpup118
I just wanted to say that your last commit fixed a segfault issue for me.
I successfully compiled it and can now use it on Ubuntu 11.04 / 32 bit.
Thank you! ~powerpup118
Hey rdb, could you post some test code, or a sample? I built the latest, and while nothing crashes, the rocket windows aren’t rendering. (I started with the walking panda example, and the panda looks great.)
(Also, I’m no longer at the machine with the code on it; I’ll post that separately tomorrow)
–Chris
Sure. It’s not very clean code or anything, but it should do the trick:
In case someone is reluctant to try librocket, it works now
With which tools are you generating rml files? Is there any kind of free editors to do your windows/menu?
I didn’t make those, I used the files from a libRocket sample. But .rml files are very similar to .html files, and .rcss to .css. If you know HTML and CSS then picking up the libRocket syntax shouldn’t be difficult. You can use your favourite text editor, one with HTML syntax highlighting.
Hi all,
how can I open the debugger window that is displayed here: http://librocket.com/wiki/documentation/tutorials/WindowTemplate?
I guess I need to use the Debugger plugin from librocket, but how do I do that?
Thanks for the addition of librocket, looks really cool!
Greetings
Revington
Has anyone gotten the High Scores portion of the rocket sample to work? I created my own class which inherited from DataSource and the object exists and contains all of the information, but I can’t seem to get the datagrid to know about the source. I get this error:
:rocket(error) Bad data source name high_scores.scores
In high_score.rml:
def OnLoad(window):
dataSource = HighScoreDataSource('high_scores')
datagrid = window.GetElementById('datagrid')
datagrid.AddEventListener('rowupdate', OnRowAdd, False)
HighScoreDataSource:
class HighScoreDataSource(DataSource):
def __init__(self, name):
DataSource.__init__(self, name)
def GetRow(self, row, tableName, rowIndex, columns):
if(tableName == 'scores'):
for col in columns:
if(col == 'name'):
row.append('TestName')
elif(col == 'score'):
row.append('5')
elif(col == 'color'):
row.append('#F00')
elif(col == 'wave'):
row.append('testWave')
def GetNumRows(self, tableName):
if(tableName == 'scores'):
return 1
return 0
librocket.com/wiki/documentation … s/Datagrid
Edit:
On an aside, when can we expect to see documentation for the classes associated with libRocket? For example, I discovered the DataSource class by looking at the documentation at libRocket’s site and got lucky that it exists in panda3d.rocket, but it doesn’t seem like the entire class is there. For example, the APIs over there describe a GetDataSourceName function that doesn’t exist in the panda version of DataSource
@Revington: I haven’t thought about the debugger yet. I’ll look into it.
@EdBighead: The API that Panda3D exposes is 100% the same as the Python bindings of libRocket expose.
@rdb: Thank you!
@EdBighead:
You need an instance of your HighScoreDataSource where you passed the name of the datasource to the constructor.
Below is how I got it to work:
import traceback
class HighScoreDataSource(DataSource):
def __init__(self, name):
self.scores = [] # could be any name
self.scores.append({'name': 'Mike', 'wave': 1, 'score': "42", "colour": "USSExcelsior"})
DataSource.__init__(self, name)
def GetRow(self, table_name, index, columns):
row = list()
try:
if index > len(self.scores)-1:
return row
if(table_name == 'scores'):
for col in columns:
if col not in self.scores[index]:
continue # skip columns we don't know
if(col == 'name'):
row.append(self.scores[index][col])
elif(col == 'score'):
row.append(self.scores[index][col])
elif(col == 'colour'):
row.append(self.scores[index][col])
elif(col == 'wave'):
row.append(self.scores[index][col])
except:
traceback.print_exc()
return row
def GetNumRows(self, table_name):
if(table_name == 'scores'):
return len(self.scores)
return 0
hs = HighScoreDataSource("high_scores")
How to access event data(“parameters” is property name).
From their sample, i found that there is “key_identifier”, but not much else… I tried to iterate over “parameters”, but had no success.
I think it’s event.parameters[“mouse_x”] etc.
That’s what I do:
def myClicker():
print "event: ", event
print "event.current_element: ", event.current_element
print "event.type: ", event.type
print "event.parameters: ", event.parameters
myBut = doc.GetElementById("myclickerbutton")
myBut.AddEventListener("click", myClicker)
As stated here http://librocket.com/wiki/documentation/PythonManual/Events, the event handler that is called has three global variables: event, document and self
Thanks rdb, and Revington, so for now i know that there are 3 parameters that exist.
“key_identifier”
“mouse_x”
“mouse_y”
For me, print(event.parameters gives only _rocketcore.Dictionary instance at 0x…)
len(event.parameters) gives 8.
This should list all possible parameters.
Revington, thank you very much, do not know how i missed that
Thanks again!
I’ve just checked in support for the libRocket debugger:
rdb.name/librocket_debugger.png
You can enable it using rocketRegion.initDebugger() and then setDebuggerVisible(True).
It’s only available in a build with optimize level 3 and lower, so the standard SDK builds will contain support for it, but in the runtime build (if you pack your app as .p3d), initDebugger will not work and simply return false.
The change will be in tomorrow’s devel builds (assuming I didn’t make a mistake and the build succeeds) and also in the upcoming 1.8.1 release.
Nice, I’ll check it out, as soon as possible.
RDB, does your example from above work on your system with threading-model Cull/Draw
support-threads t?
I get random crashes if I fiddle with the buttons etc. I guess it’s because of librocket lack of threading support(http://librocket.com/wiki/PlannedFeatures), but just to make sure I didn’t break something.
Right, libRocket is not thread-safe. I’ve pondered for a long time about how to resolve this properly on the Panda side, but don’t know of a way until perhaps panda switches to boost::python.
Maybe I could submit a patch to the libRocket developer team, but that’d require me to devote a significant amount of time to it, which I don’t have.
Does the 501 dev build include the debugger?