tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Request: More signals for extentions

Open finscn opened this issue 4 years ago • 4 comments

I want to listen some properties change of Object. e.g. visible , selected .

But , I found that they are not implemented.

In document :

Properties usually will have related signals which can be used to detect changes to that property, but most of those are currently not implemented.

Could you support signals of visible , selected ?

Thanks

finscn avatar Sep 30 '21 10:09 finscn

I found selectedObjectsChanged & currentObjectsChanged could be used for selected object

But I change found the method to listen object.visible

finscn avatar Sep 30 '21 10:09 finscn

This is a complicated topic since there are a huge number of properties to add signals for. With the current implementation it will take a lot of work to connect all the change notifications to signals for each property.

Also, the question is how useful it would be to receive a signal from each affected object, since that would mean you need to connect to each object that you want to receive change notifications for. What if you want know about any event where an object changes visibility?

Internally, Tiled uses more centralized change event notification, where change event signals are emitted by each asset (map or tileset) when any change is made that affects that asset. Alternatively, these change events could be somehow exposed to scripts.

Maybe you can write a little bit about your use-case of connecting to a change in visibility?

bjorn avatar Oct 05 '21 09:10 bjorn

@bjorn , Could you supply a common api to listen any property changed of the object. the callback with some arguments : propertyName, oldValue , newValue , oldType, newType ....

finscn avatar Oct 05 '21 12:10 finscn

Maybe you can write a little bit about your use-case of connecting to a change in visibility?

I create some shdow-node , the shdow-node links to some real nodes.

When shdow-node hide/display, I try to hide/display the real nodes linked.

finscn avatar Oct 05 '21 12:10 finscn