SMTK 's property system allows developers to create their own custom Property data structures as well as instantiations of any Property data structures defined in the system. For example, you can create a long property called “foo” on a resource simply by calling the following:
resource->properties().get<long>()["foo"] = 2;
So I am about to add the ability to control in the UI whether a specific attribute name can be modified and am planning on implementing this capability by using an simple bool Property. The question is how to “reserve” this Property instance name so that it:
- Doesn’t collide with another developer’s design
- Try to indicate what it is used for
What I propose is to do the following:
Naming Convention
Make the Property instance name as clear as possible by including the plugin, module, or role that is using it. So in this example I might call it one of the following:
- smtk::UI:attributeNameReadOnly
- smtk::extensions::qt:attributeNameReadOnly
I tend to prefer the first version only because it might be used in either Web or Desktop UI’s.
Documentation
In addition I would propose that there is a file that lists all of the Property Instance Names reserved by that plugin / module. It would contain the following:
- Type
- Property Name
- What it is “applied” to?
- What does it represents?
So in the smtk/extensions/qt directory there could be a file called reserved_properties.txt that would look like the following:
bool smtk::UI:attributeNameReadOnly
Applied to smtk::attributes.
If present, indicates that the attribute’s name should be modifiable in the UI.
Comments?