Properties on polyline nodes

Im thinking the polyline points attribute is a bit weird?

From the orthogonal-outside.tmx example:

<object id="5" name="guard" type="NPC" x="22" y="361">
   <polyline points="-3,120 87,91 154,96 181,16 273,-1"/>
</object>

It creates a string, that would need some weird splitting up on first the whitespaces and then the commas.

My suggestion:

<object id="5" name="guard" type="NPC" x="22" y="361">
   <polyline>
      <points>
         <point x="-3" y="120"/>
         <point x="87" y="91"/>
         <point x="154" y="96">
            <properties>
               <property name="foo" value="100"/>
               <property name="bar" value="200"/>
            </properties>
         </point>
         <point x="181" y="16"/>
         <point x="273" y="-1"/>
      </points>
   </polyline>
</object>

Splitting up the points/nodes could potential give the feature of adding properties to the points/nodes like above (which is what I actually want to do). This could be accessed just as when you would delete a node.

Any thoughts or possible work around for now?

In fact it uses the same format used by SVG to store polygons. In the future I’d like to also include support for bezier curves, which can be stored by extending the support for SVG further.

I agree it would be useful to be able to associate properties with the nodes though, but the same could be achieved by doing:

<object id="5" name="guard" type="NPC" x="22" y="361">
   <polyline points="-3,120 87,91 154,96 181,16 273,-1">
      <node index="2">
         <properties>
            <property name="foo" value="100"/>
            <property name="bar" value="200"/>
         </properties>
      </node>
   </polyline>
</object>

And as such it would also be backwards compatible, which isn’t unimportant.

Possible workarounds for now would be to use custom properties on the polygon object and use some property naming style that allows you to determine for which node a custom property is meant. Of course, one problem is that node indexes are currently not displayed anywhere (issue #145).

Thanks for the reploy, wasnt aware of the SVG specification.

Your example would definitely work, and I would really love to see that feature. Hope to see it in the roadmap!

Yes, a naming convention for the object properties could be a work around for now. Thou changing properties and deleting nodes would become a pain, having to manually edit the index’s in the map properties.

I’ve created an issue about it on GitHub:

https://github.com/bjorn/tiled/issues/1728

However, due to the overwhelming amount of other things to do this is unlikely to get added to the roadmap any time soon. There is also more demand for the ability to connect objects, which may also provide a solution for your use-case.