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

Custom property of type object references the original object, but should not if the reference is also copied. #3361

Closed
smjnab opened this issue May 18, 2022 · 4 comments
Assignees
Labels
feature It's a feature, not a bug. usability Generally about making something more intuitive or efficient.

Comments

@smjnab
Copy link

smjnab commented May 18, 2022

Is your feature request related to a problem? Please describe.
You have an object that is using a custom property of object type and it is referencing another object. If you copy the object, the copy will reference the same object as the original. This works fine and is the expected behaviour.

However, if you at the same time also copy the referenced object, the new copy with the reference keeps referencing the original reference. But, I believe that in this situation you would (almost) always want the reference to be updated to reference the copy of the referenced object.

Describe the solution you'd like
Unsure what is best: That it assumes to do the different behaviour by default, when doing a copy of objects with references to other objects ask the user what to do or a setting to toggle it. I believe option 1 is preferable as if you do copy of objects with references to objects that are also copied, the intention is to reference the new objects.

Describe alternatives you've considered
None except updating the references manually, which is what I am doing at the moment :)

Thanks!

@smjnab smjnab added the feature It's a feature, not a bug. label May 18, 2022
@bjorn bjorn added the usability Generally about making something more intuitive or efficient. label May 18, 2022
@bjorn bjorn self-assigned this May 18, 2022
@bjorn
Copy link
Member

bjorn commented May 18, 2022

Thanks for bringing this up! I had heard this mentioned before but forgot about it again. It's implemented for the next patch release now. :-)

If you'd like a build earlier, you should soon be able to get it from https://github.com/mapeditor/tiled/actions/runs/2344266176 (scroll down to Artifacts).

@smjnab
Copy link
Author

smjnab commented May 18, 2022

Works nicely to copy and paste. Tested in map edit, object edit and by copying from one map to another.

As a note: Using duplicate on objects, or using duplicate on a layer, will not work. It creates a copy that references the old objects.

@bjorn
Copy link
Member

bjorn commented May 18, 2022

As a note: Using duplicate on objects, or using duplicate on a layer, will not work. It creates a copy that references the old objects.

Hmm, yeah I should definitely look into applying the same logic to these actions.

@bjorn bjorn closed this as completed in f6bf60f May 30, 2022
bjorn added a commit to bjorn/tiled-dev that referenced this issue Jun 3, 2022
Expands on f6bf60f. Now this behavior
also applies to the following actions:

* Duplicate Layer
* Duplicate Objects
* Layer via Copy
* When the AutoMapper places objects

See issue mapeditor#3361
bjorn added a commit to bjorn/tiled-dev that referenced this issue Jun 3, 2022
Expands on f6bf60f. Now this behavior
also applies to the following actions:

* Duplicate Layer
* Duplicate Objects
* Layer via Copy
* When the AutoMapper places objects

See issue mapeditor#3361
@bjorn
Copy link
Member

bjorn commented Jun 3, 2022

As a note: Using duplicate on objects, or using duplicate on a layer, will not work. It creates a copy that references the old objects.

Should be fixed for all cases now!

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. usability Generally about making something more intuitive or efficient.
Projects
None yet
Development

No branches or pull requests

2 participants