Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting: the API for getting PropertyTypes #3419

Open
finscn opened this issue Jul 21, 2022 · 2 comments · May be fixed by #3971
Open

Scripting: the API for getting PropertyTypes #3419

finscn opened this issue Jul 21, 2022 · 2 comments · May be fixed by #3971
Labels
feature It's a feature, not a bug.

Comments

@finscn
Copy link

finscn commented Jul 21, 2022

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.

@finscn finscn added the feature It's a feature, not a bug. label Jul 21, 2022
@max-carroll-sky
Copy link

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]
        }

@Ishadijcks
Copy link

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

@dogboydog dogboydog linked a pull request Jun 17, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants