tiled
tiled copied to clipboard
Scripting: the API for getting PropertyTypes
the 1.9 supplies the feature about PropertyTypes. Bug there is no API for get the PropertyTypes informations.
And I can't get the display name of a custom Enum-Property. The value of it is number.
So, I hope there could be some APIs for that work.
Yes would love this feature too, for a work around I'm doing this for the moment
const projectFile = new TextFile("C:\\Users\\{my name}\\tiled-project\\untitled.tiled-project", TextFile.ReadOnly)
const pfText = projectFile.readAll()
const project = JSON.parse(pfText)
const {propertyTypes} = project
Then I am getting the values later on like this
const genericEnum = o.resolvedProperty('aiType')
let aiType = ''
if (genericEnum) {
aiType = propertyTypes.find(p=> p.id === genericEnum.typeId).values[genericEnum.value]
}
I would love if editing PropertyTypes was added to the API. I'd like to create an extension which synchronizes Tiled PropertyTypes with TypeScript enums