这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@davidlamhauge
Copy link
Contributor

A new sound layer was named 'Sound layer 2', even if one selected 'Sound layer'. The reason was that the nameSuggestLayer() function was called twice.
Fixes #1414

Copy link
Member

@scribblemaniac scribblemaniac left a comment

Choose a reason for hiding this comment

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

So I can confirm that this fixes the issue, however this might need a bit of discussion. I haven't looked at when this bug was introduced, however I can see that there are really two considerations here. First, nameSuggestLayer should be called before the new layer dialog comes up so that users can see an actually unique name. That is all this PR does. However, there might also be a point to be made for having it in the new layer functions in the layer manager. Doing so would prevent two layers from being created with the same name. So we have to consider whether we even want to allow layers with the same name. Although I think it's really bad practice, I think we should probably just leave it like this because if we want to properly prevent multiple layers with the same name we would also need to modify the renaming and file loading and there is no technical reason why we can't have layers with the same name. On the flip side, allowing this behavior does make some things more complex, for instance when selecting between two camera layers with the same name in the export dialog.

@scribblemaniac scribblemaniac added the 🔹 Minor PR (only one reviewer required) label Aug 18, 2020
@davidlamhauge
Copy link
Contributor Author

I think we should avoid layer names with the same name, but when I suggested it once, the argument was that if you have a bitmap layer called 'Hero', and you wanted to clean it up on a vector layer, it would be logical to have the vector layer called 'Hero' too.
I will at any time support a PR that prevents identical layer names.

@chchwy chchwy added this to the 0.6.6 milestone Aug 25, 2020
@chchwy
Copy link
Member

chchwy commented Aug 26, 2020

Thanks @davidlamhauge. I confirmed it works, too.

For the issue of same name layer, I just checked three painting software (Photoshop, Krita and Paint.NET), they all allow multiple layers with the same name. I think it depends on whether we treat the layer name as a unique identifier or just a name displayed on UI. Internally, layer id should be used instead of layer name to avoid duplicated names. The camera selection process can be improved by displaying layer indexes plus names like 1: my camera, 2: my 2nd camera. (I made the problematic camera selection dropdowns ;) haha)

Personally I prefer to leave the layer name to the users so they can use whatever they want. We can suggest a unique name like what we've done in this PR, but don't have to force it.

@chchwy chchwy merged commit 8d10618 into pencil2d:master Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layer Management 🔹 Minor PR (only one reviewer required)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ISSUE] When first adding a new layer the system will add a wrong name

3 participants