Yeah... bitflags are great for speed, but speed is not the requirement here.
I was thinking about this some more, and had another idea. How about if you could write a little script function for each item class to customize which properties are shown. The function would take an instance of an item, and return an array of the properties to show for that instance. It might look something like this:
Code: Select all
string[] visibleProperties( body b ) {
string[] props;
//this property would always be shown
props.insertLast( 'category' );
//properties relevant to animals
if ( b.getCustomString( 'category' ) == 'animal' ) {
props.insertLast( 'numLegs' );
props.insertLast( 'moveSpeed' );
props.insertLast( 'habitatAltitude' );
}
//properties relevant to plants
if ( b.getCustomString( 'category' ) == 'plant' ) {
props.insertLast( 'edible' );
props.insertLast( 'habitatAltitude' );
if ( b.getCustomFloat( 'habitatAltitude' ) > 0 ) //above sea level
props.insertLast( 'flowerColor' );
}
return props;
}
This would allow total customization of what should show when, based on whatever criteria the user finds necessary. Properties can appear in more than one category, and the order of properties can be customized. It may seem like some effort to program, but if you are dealing with a large number of categories it could be a good trade-off to keep them all tidy.
This could possibly get a little slow when a large number of items are selected, I would have to check about that.
In any case, this is a pretty big job and there are many other things I would do first, but I had another idea that might be able to help you sooner.... you may have noticed in the Display tab of the Options dialog, there is a checkbox to specify whether unset custom property values should be shown in tooltips. It would be fairly simple to add another checkbox there, to specify whether unset values should appear in the properties panel table. Then you could set a dummy value in the properties for items that should show that property (otherwise they will not appear for you to set

)
You could use a script to set dummy values for a selection of items, eg.
Code: Select all
body[] bs = sb(); //selected bodies
for (uint i = 0; i < bs.length; i++)
if ( ! bs[i].hasCustomProperty( 'numLegs' ) )
bs[i].setCustomInt( 'numLegs', -1 );
If you think this could help I can do it pretty soon. Anyway, let me know what you think about these ideas.