Page 1 of 1
					
				Missing exported 'world' custom properties
				Posted: Fri Dec 25, 2015 11:19 am
				by Voptiplex
				Hi,
I have saved a Json file with 
Code: Select all
b2dJson::writeToFile(b2World* world, const char* filename)
and noticed that custom properties belonging to the world are not saved.
I therefore changed:
Code: Select all
Json::Value b2dJson::b2j(b2World* world)
{
    Json::Value customPropertyValue = writeCustomPropertiesToJson(NULL);
}
to (adding world pointer)
Json::Value b2dJson::b2j(b2World* world)
{
    Json::Value customPropertyValue = writeCustomPropertiesToJson(world);
}
and now it seems to work.
Is that change correct and are there some additional changes missing ?
Thanks,
Thomas
 
			 
			
					
				Re: Missing exported 'world' custom properties
				Posted: Sat Dec 26, 2015 8:44 am
				by iforce2d
				Perhaps I may not have mentioned it anywhere, but I have arranged it so that passing NULL as the item for the custom property to be attached to will cause it to become a 'global' custom property. I think if you try setting the property like this it should be saved correctly:
setCustomInt( NULL, "myint", 123 );
			 
			
					
				Re: Missing exported 'world' custom properties
				Posted: Sat Dec 26, 2015 10:02 am
				by Voptiplex
				Ok, I will try passing a NULL from my SW to see if the code writes values to Json.
But I have several 'world' custom properties set in Rube which I would like to preserve in Json.
And with passing writeCustomPropertiesToJson(world) these values set in Rube get written to Json as well.
So is the intention that I have to write to Json the custom values from Rube  in my software 'by hand' with 
setCustomInt( NULL, "myint", 123 ); ?
Happy XMAS,
Thomas
			 
			
					
				Re: Missing exported 'world' custom properties
				Posted: Sun Dec 27, 2015 5:08 pm
				by Voptiplex
				Hi,
I have tried passing a NULL to setCustomInt(), but then the code does not compile. The compiler complains about ambiguous function and the compiler can not decide which function to use.
If I pass a b2world pointer to setCustomInt(), and as explained above, pass a b2world pointer to writeCustomPropertiesToJson() everything works ok.
I guess I do not get how to use the functions.
As it works OK with the current code, shall I just leave it as it is ?
Thanks for your help,
Thomas
			 
			
					
				Re: Missing exported 'world' custom properties
				Posted: Sun Jan 03, 2016 2:22 pm
				by iforce2d
				Yeah I guess if it's working ok you should leave it 

You might be able to pass 
(b2World*)NULL
as the parameter to get around the compiler error.