Rube loader

General discussion about the R.U.B.E editor
Post Reply
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Rube loader

Post by Rogerboy »

I am using the code from SFML rube loader, it seems not not actually get any data from the rube json file resulting in a world with 0 in each field. I really have no idea how to fix this, I am on Qt GCC compiler and box2D was also compiled with that. I just copied all the header and source from json loader folder inside sfml folder and compiled like that.

Please help.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rube loader

Post by iforce2d »

The loader has an errorMsg parameter which you can check for some info, which may give you a lead. Any decent IDE will let you step through the code as it executes so you can see what happens.
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Re: Rube loader

Post by Rogerboy »

The error message is blank and I tried to step through but its damn confusing stepping through the giant json loader header ;(
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rube loader

Post by iforce2d »

If you mean all the preprocessor macros, yeah they are confusing. But you shouldn't need to step all the way in there to get an idea of what the problem is. Did you come across any clues? The only clues I have are the clues you have ;)
If you don't mind sharing the .json file, you could attach it here just in case there is something weird about it. You are trying to load the 'raw info' exported file right, not the .rube file?
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Re: Rube loader

Post by Rogerboy »

I am deciding whether I should buy the full version, I am using the images.json file from the trial folder. What seems to happen is it loads some stuff in the json loader but as soon as it gets to b2World* b2dJson::j2b2World(Json::Value worldValue) the worldValue contains map[0] (1 element only) = metaworld and the allocated parameter is -1 or 0.
Last edited by Rogerboy on Fri Aug 30, 2013 6:52 pm, edited 1 time in total.
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Re: Rube loader

Post by Rogerboy »

Debug info from Qt:
Attachments
Debug info
Debug info
QTInfo.jpg (154.71 KiB) Viewed 12969 times
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Rube loader

Post by iforce2d »

The presence of a 'metaworld' element suggests you are trying to load a .rube file, rather than the 'raw info' export that b2dJson expects. The formats are both JSON and quite similar, but with some differences (see the help topic under "Using exported data" -> "Difference between saving and exporting" for details).

Edit: and I just noticed, the name of the file is image.rube :)
Rogerboy
Posts: 9
Joined: Thu Aug 29, 2013 11:18 pm

Re: Rube loader

Post by Rogerboy »

Ok thanks it works now, was a bit confusing about the .json and .rube files.
Post Reply