Design issue Duplicate style properties

Arty

Well-known member
If two similar styles that have same custom style properties are installed in different parts of styles tree (as in not child styles of each other) and then moved to same styles tree, style properties get duplicated.

How to test it:

Here is a blank style with 1 new style property:
Code:
<?xml version="1.0" encoding="utf-8"?>
<style title="Test Style" description="" user_selectable="1">
  <properties>
  <property property_name="testProperty" property_type="scalar" definition="1" group_name="general" title="Test property" description="" css_components="" scalar_type="boolean" scalar_parameters="" display_order="1" sub_group=""><![CDATA[1]]></property>
  </properties>
  <templates/>
</style>
It has a custom check box "Test property" that is shown in style properties -> general.

Install it twice, make sure they are not part of same styles tree:
tree_origina;.webp

Then edit one of styles to set it as child style of another style:

changed_tree.webp

Then look in style properties -> general, where custom style property is:
duplicate_properties.webp

As you can see there are two identical style properties instead of one.

To make things more confusing, style property from parent style overrides style property from child style.
 
I'm going to have to call this a design issue. Properties are expected (and assumed) to be unique in a tree. You can see this if you try to create a property with a duplicate name in a child style. Detecting this case when moving a style is difficult (and then there's a problem of how to actually handle the situation).

This is one of those where the alternative mostly involves not allowing style properties to be defined anywhere other than the master style and that is likely not a trade off stylers would be happy with.
 
Top Bottom