Filter for custom properties

What would you like to see in future versions of the editor?
Post Reply
toojee
Posts: 9
Joined: Fri May 31, 2013 7:56 am

Filter for custom properties

Post by toojee » Thu Jun 06, 2013 8:19 am

Hi! I do an importer rube to flash (citrusengine) and I need a system to filter custom properties.
For now, I create a custom properties "citrusClass" with a combobox attributes like Hero, Enemy, Platform, Coin etc... In flash the class is directly created, so for example, a circle with Enemy in Rube, start to move automaticly in flash! The Hero, can move by keyboard key and jump on head of enemy to kill him without any code! Thanks to CitrusEngine :D

But all citrus classes (Hero, Platform etc... ) don't have obsiouly the same properties, for MovingPlatform I need startX, startY, endX and endY. But for a cannon I need fireRate, startingDirection, missileFuseDuration etc...
Right now, with Rube I can do all that, but its pretty messy :D
If we can link combobox properties to others, maybe like shapes tree in fixture, its will be more clear.

But I can do without it! Its a optionnal request :D

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Filter for custom properties

Post by iforce2d » Thu Jun 06, 2013 8:51 am

Take a look at this thread, which covers almost the same issue: https://www.iforce2d.net/forums/viewtopic.php?f=6&t=38

I'm hoping to add this in one of the next few updates...

toojee
Posts: 9
Joined: Fri May 31, 2013 7:56 am

Re: Filter for custom properties

Post by toojee » Thu Jun 06, 2013 9:36 am

ok cool!
But I copy and paste the code and I have an error and I don't understand why :
line 2, col 14: Expected '('

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Filter for custom properties

Post by iforce2d » Thu Jun 06, 2013 11:12 am

If you're talking about the first code block in that post, that is only there as a proposal of what the script might look like when that capability is added.

Edit: ah, but that does not explain why the script does not compile... to declare functions in the script you need to also have a void main() somewhere in the script as well. If there is no void main() anywhere, the script will be treated as if the entire thing was inside a void main() function. This is a little unclear perhaps, but you can find more info about this in the main help (F1) in the section "Scripting" -> "Defining your own functions".

toojee
Posts: 9
Joined: Fri May 31, 2013 7:56 am

Re: Filter for custom properties

Post by toojee » Thu Jun 06, 2013 11:44 am

oh ok I was thinking we can do that by script but not directly in the panel.

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Filter for custom properties

Post by iforce2d » Thu Jun 06, 2013 12:45 pm

Not yet :) It will require the application to pass the body to the script to work with, and the application will also have to read back the result from the script as well, so it's more complicated than just saying "run!" like the script does now, through the main() function which has no parameters, and returns nothing.

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Filter for custom properties

Post by iforce2d » Wed Sep 25, 2013 4:26 pm

This has been implemented in v1.5. The application calls a script function for each property, so you need to fill in functions like this:

Code: Select all

bool shouldDisplayProperty( body b, const string& in propertyName )
See the "Property display filter" section of this video: http://www.youtube.com/watch?v=K-VzlEtXdJM
... or search for 'shouldDisplayProperty' in the help.

Post Reply