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

support converting object reference property to and from int #2734

Merged
merged 2 commits into from Jan 21, 2020
Merged

support converting object reference property to and from int #2734

merged 2 commits into from Jan 21, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jan 15, 2020

Users could have previously had custom properties of type int that
referenced objects by ID. Registering a converter for ObjectRef to
and from int should help migration to the new object reference type.

Updates #707

Copy link
Member

@bjorn bjorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, I didn't know about this feature! Maybe while you're at it you could do the same for converting between "string" and "file" properties?

src/tiled/main.cpp Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Jan 16, 2020

Maybe while you're at it you could do the same for converting between "string" and "file" properties?

It seems the change for this isn't as trivial as the ObjectRef/int conversion, at least for someone who doesn't know the tiled code very well (the UI doesn't update itself correctly after the conversion). I can perhaps try this in another PR.

@bjorn
Copy link
Member

bjorn commented Jan 21, 2020

It seems the change for this isn't as trivial as the ObjectRef/int conversion, at least for someone who doesn't know the tiled code very well (the UI doesn't update itself correctly after the conversion).

Yeah, that wasn't so easy to find. It was due to a bug in VariantPropertyManager::valueType, which caused PropertyBrowser::setCustomPropertyValue to think that the type of the property didn't change, and so it didn't recreate the property.

Required fixing up VariantPropertyManager::valueType to return the
actual type used for FilePath and ObjectRef values (which is not
QString).

Also fixed PropertyBrowser::setCustomPropertyValue to use the "display
value" of the property when comparing the type, which would otherwise
needlessly reinstantiate ObjectRef properties when they changed.
@bjorn bjorn merged commit e583937 into mapeditor:master Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant