Layer comments

Hi

Here a small description of something that could be useful I think.
(Useful for me sure :grimacing:, but maybe useful for other users too :blush:)

Edit: rewritten feature taking in account remarks

Description

My idea is to be able to store some comments on layers, ideally a right-click on layer and then “properties” menu to display layer properties.

Currently, I use a text file in addition to kra file…
It’s better than nothing but:

  • It will be faster to write directly on layer
  • No risk to loose notes (as embedded in Kra file)
  • Don’t need to update text file if layer is renamed/deleted/moved

Solution to anotate directly by drawing on a paint layer or in vector layer is a workaround but:

  • Can’t easily change content on a paint layer
  • Not ideal as not linked directly to a layer, and usually these kind of notes are more technical and ideas that don’t really have to be available directly on drawing area

Editing a comment on a layer

The Layer Properties dialog box could be completed with a simple text editor to take note about layer content.

Using the dialog box properties make sense:

  • Comment would be a property of layer
  • No need to implement a new interface, just improve existing one
  • Easy to access (context menu on layer, "properties / properties buttons in layer docker)

Ideally, editor for text comment:

  1. Is pure text only
  • Easier/faster to implement than rich text formatting interface
  • Rich text formatting interface is source of bug
  • Idea for comment is to take short notes, not a complete documentation

Note: editor as a rich text edit could off course be implemented if it’s not too complex to implement/maintain
If a rich text edit is implemented, please take care about merging of rich text content that could be a little bit more complex and plain text (cf. below rules defined about layers merge)

  1. Use monospace font
  • Because it’s not rich text, monospace font allows simple formatting with spaces, minus and plus signs
    (old school mode :-))

Note: in case of a rich text editor is implemented, at least:

  • Choice of font familly & size
  • Bold & Italic
    Other formatting action are bonus:
  • Underline & Strikethrough
  • Text color
  • Bullet list
  1. Accept unicode characters (UTF8)
  • Because maybe some users like chinese or japanese need to use it
  • Because other users would use some unicode characters
  1. No text size limit
  • Even if main usage is to take short notes rather than a complete documentation, it’s better to not be blocked with a text size limit
  • But maybe 32KB or 64KB limit size could be imposed for technical reasons if needed
  1. Optional functions
    Could be useful for lazy users :slight_smile:
  • A button [Current date/time]
    – Insert current date/time (locale format) at current cursor position
  • A button [Separator]
    – Insert a separator (15 minus sign “---------------”) at current cursor position
  • A button [Clear comment]
    – Reset comment content

Note: an updated mockup can be provided if needed

Creation of layer

When a new layer is created, there’s no comment

Duplicate of a layer

When a layer is duplicated:

  • if original layer have no comments, duplicated layer have no comments
  • if original layer have comments, duplicated layer have the same comments prefixed with following header
    ---[Duplicated from layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
    (Date/time should match local format)

Deletion of layer

When a layer with comment is deleted, there’s no confirmation, no warning (like it’s made for a layer with painted content)There’s no reason to have an alert/warning about this more than

Editing layer properties

When opening the property editor, if comment text editor need scrollbars, scrollbar is on top (let user start comment from beginning)
But cursor position is at the end (let user continue to edit comment from the end)

Merge of layers

Keep in mind that it’s always a “merge down” and then, bottom layer is always the final layer

When layers are merged, the following rules can be applied:

  • Merged layer (“above” layer) comment is added below final layer comment
  • A blank line followed by a specific separator is added between comments
    ---[From merged layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
    (Date/time should match locale format)

Example:

  • Layer 4 (comment = “C444”)
  • Layer 3 (comment = “C333”)
  • Layer 2 (comment = no)
  • Layer 1 (comment = “C111”)

Merged result:

C111

---[From layer "Layer 3" @ 2020-02-02 00:25:00]---
C333

---[From layer "Layer 4" @ 2020-02-02 00:25:00]---
C444

Note: When doing multiple “duplicate layer” and then “merge” actions, comments in final layer would be awful
A solution would be to ask user if he want to merge comments or ignore comments…
But I think this case should be ignored because it’s a workflow breaker
And the most simple case is to let user manually remove unwanted merged comments from final layer (easy as merged comment are prefixed with a separator)

Copy/Paste of layers

When a layer is pasted (ie: right click on layer>copy layer and then right-click>paste layer):

  • if original layer have no comments, pasted layer have no comments
  • if original layer have comments, pasted layer have the same comments prefixed with following header
    ---[Pasted from layer "<Layer name>" @ YYYY-MM-DD HH24:MI:SS]---
    (Date/time should match locale format)

Note: when a group layer is copied/pasted, rule is applied for group layer and all sub-layers

Cut/Paste of layers

When a layer is cut/pasted, comments should be unchanged

Copy/Paste a selection from layer

Only a copy/paste of a layer should impact comments.

When doing a copy of a selection and paste it as a new layer, it doesn’t seems to be a good idea to copy comments content because the copied/pasted selection might be modified/transformed/filtered before being merged with somethingelse and in this case it’s better to let user define an appropriate comment to new layer.
(and same rule for Cut selection to a new layer and Copy selection to a new layer)

Concerned layers

Should be concerned by this feature:

  • Paint layer
  • Vector layer
  • Group layer

An maybe:

  • File layer
  • Clone layer

Layers docker

We need to easily spot layers with comments in tree without overload current layer row.

Icons

A new icon on right side is added according to situation

Case Icon
Layer without comments nothing
Layer with comments image
Group layer without comments + sub-layer with comments image
Group layer with comments + sub-layer with comments image

Example of layers docker with commented layers:

Note: Sorry for icon quality, drawn quickly, but it’s more here to provide an example :slight_smile:

When comment icon is visible and not grayed, a click on it will open properties dialog box, allowing user to read/edit comment

Tooltip

Tooltip have to be improved to display comment.

Note: for a group layer with sub-layer for which comment are set, property value is:

  • “Yes (Sub layers: Yes)” if group have a comment
  • “No (Sub layers: Yes))” if group have a comment

For comment text, according to implementation choice:

  • If plain text, text use monospace font
  • If rich text, text is formatted as defined by user

According to what user set in comments, content can be heavy and oversized to be properly displayed in a tooltip.

Here some possible rules to apply concerning tooltip size (can be affined if needed)

  • Width should be: MAX(thumbnail.width, thumbnail.height) + propertiesBox.width + 2 * margin
  • Height should be: 2 * (MAX(thumbnail.width, thumbnail.height, propertiesBox.height) + 2 * margin) + title.height
    – Meaning: height for comment part is equal to height defined for properties+thumbnail

    (sorry mockup doesn’t respect this rule :sweat_smile: )

Note: currently, there’s a bug on tooltip layout


=> Properties box content shouldn’t be wrapped, tooltip width should be adapted according to content

Context menu

Note: no time for now to write it properly, just write the idea

Context menu is udpated with a new menu entry
[ ] Show comments on layers

When checked (by default) comments icons are visible
When unchecked, comments icons are not visible
=> option is global to all layers (not per layer like “pin to timeline”)

Status is saved in kra file

Saving KRA document

A document made from a previous Krita version won’t have comments; then consider there’s no comments.

For retro-compatibility, a document made with Krita X+1 must be able to be opened with a Krita X-1

This is a technical part for developper but an unknown XML node and/or attribute might currently be ignored when maindoc.xml is loaded.
Like current files in layers directory, in maindoc.xml, a reference to a text file *layerN.comment could be a solution.

Python

Ideally, the comment property would be accessible in python:

  • myNode.setComment(text)
  • myNode.comment()

This will allows plugins to provide extended functionnalities around comment (markdown formatting, direct editor in docker for selected layer, …)

Currently the Node class is the base class for all layers types.
But also the class used to manage paint layer type.

This means:

  • Method to get/set comments should be implemented in this class
  • myNode.comment() should return None for layers type for which comment is not possible
    – Method also returns None if no comments are set on a layer that support comments
  • myNode.setComment() should do nothing for layers type for which comment is not possible

Grum999

6 Likes

The comment should also be visible without opening the properties every time i.e. by hovering over the node in the docker and layers with comments need an indicator in the layers docker otherwise every layer would need to be checked for comments every time one opens a document and doesn’t remember/know if layers have commets.

@Takiro thanks for remarks :slight_smile:

Here an example of what it can be:

Concerning indicator that a comment is set on layer, rather than adding an icon, I added a small red triangle in the corner, like some spreadsheet software does.
Not sure everybody will like it, but:

  • It’s already a common way to indicate a comment on a cell
  • Too much icons might overload layer row

But ok, all ideas are welcome.

And having the comment content in tooltip, I don’t know.
Currently, tooltip is not displayed properly, and tooltip layout might be completely reviewed is comment is displayed into it.
But I agree it’s interesting to have it quickly without having to go in layer properties.

I think in that comment in tooltip should be reduced to first lines only (because if comment is too big, tooltip content might be… I don’t know but it might not be Ok :slight_smile: )

Grum999

1 Like

I like that indicator, it’s just what I would expect.

I like this idea. It would be easy enough to store in a .kra file. However, you need to think about what should happen if two layers with comments get merged, and what happens when part of a layer is copied and pasted.

3 Likes

You’re right, I didn’t think about everything… :sweat_smile:

I’ll try to take this in account :slight_smile:

grum999

I have rewritten the feature request to properly take in account remarks.

I still have some things to think about/describe, I’ll try to finish this tomorrow.

Grum999

Yes this can be collapsible since it would be a bit annoying when user will be hovering over the layers for a quick look

Why not a dot over the icon or something instead? The triangle seems harsh on the eyes if you have a ton of comments but it works. And maybe use kritas current accent color so it respects the active theme.

Made another update.

Maybe, but if you could provide an example mockup that will be easier to visualize :wink:

Taken this remark in account as a note
I tried to use label color to avoid having a contrast between labeled color row and triangle, but if triangle is in first column, it could be a good thing to use highlight color theme

I tried to provide a solution.
I have to confess that I’m not entirely satisfied by my proposition, but it’s a base from which we can start to discuss about :slight_smile:

Taken in account :slight_smile:

Still have to review tooltip case.
But I think current specification start to be usable?
Even if i probably didn’t think about all impacts :sweat_smile:

Grum999

something sorta like this perhaps.

that or perhaps a new column showing that it has a entry with a new icon next to the lock sign.

I just feel something more round to be more pleasing. I hate comment signs in excel with those triangles. if you have one or two it is okay. but if you make too many you just cant see it because it is on a corner between cells not on the cell itself.

This is looking really good. I’m not sure about the monospace font, that’s my main quibble. I get the pros with simple indentation and so on, but we’ve got a semi-rich text editor available. The proposal itself is definitely at the right level now.

Is this something you want to code up and make an MR for? If not, it’s interesting enough that I would like to discuss it with @IvanYossi – and see how we can implement it.

Yes, I know Qt provides rich text edit and I already used it to build a rich text editor for a plugin, it’s not really difficult to implement in Qt.

But my idea was to simplify the development and probably reduce bugs by using a plain text editor :slight_smile:
And in this case, I prefer to have a monospaced font.

But if having a rich text editor is not a problem, I can update the feature request :slight_smile:
Maybe text editor used for Text tool can be reused, don’t know if it’s been implemented as a widget or directly in text tool interface :thinking:

Unfortunately my first and last attempt to make a MR was a such failure that I don’t feel comfortable to start to code it.
And I already have my BuliCommander plugin, 2 another plugins, and one animation on which I’m currently not really progressing… :frowning:

So I think it’s better to wait a developer is available to implement it, it will be implemented faster than if I try by myself.
But I can try to create feature in phabricator if it can help.

I’ll try to finalize feature request tomorrow (concerning tooltip + maybe try to find something visually better to provide information about comments available on layer in layers docker)

Grum999

1 Like

Hi,

Updated feature request description:

  • Tooltip description/mockup
  • Possibility of rich text editor

Grum999

Hi

Here a version with dots.

Less agressive than triangle for sure, but less intuitive than triangle I think :thinking:

Grum999

1 Like

I don’t know then. on the corner it does feel the triangle to make a bit more sense I guess.

Adding on your mock-up I made one more option of the circles besides the name of the layer. As that is where layer specific properties are shown.

Option two is using single circle to show the state.

Hi @raghukamath

Thanks for mockups.

Some remarks.

With option 1


What if there’s more than 1 sub-layer with comment?
– Only 1 second dot?
– One dot per sub-layer with comment? (will became unreadable very fast in this case)

=> Option 2 seems better to me

For both options

Dot colors

How colors are defined?
– Group layer is green and paint layer (or any other layer type) is orange?
– According to layer color label?

I think color should be defined:
– According to color label, so possibly many colors in layer tree
or
– According to current theme (use of highlight color as proposed by @EyeOdin), so only one colored dot

Dot alignment

I’m not really convinced by right alignment for the following reasons:
– Currently on right side, there’s only icons on which it’s possible to click on to change a layer property
– Number of columns is not fixed and can vary according to layer type and layer options, then comment dots won’t be aligned
– Adding another one column on right side overload the row
– Contrast between dot and icon is strong

Grum999

Opening it with a click on the right side would not be a bad idea though. I think it would make it easier for productions even though it does not affect the pixels directly. Uhm mmm food for thought.

But there is precedent to something like this. Blender on the outlined also has 3 rows of icons on the right for each object on the scene. However you can adjust the visibility of what you want to see on that side and you have like 7 icons you can display in total. I usually add one so i end up with 4 in display there.

On krita layer styles display acts like a guest icon on the side. I don’t see why you could not also with the comments.

Clicking the icon and opening a window with just the comment does not seem bad at all.

Yes, but not completely.
Once icon is visible, click on it change Fx status to active/inactive, that’s not just an indicator.

But you’re right, if a dot is added on right side it could work like icon for Fx, and if visible a click on it display properties dialog box to let user read/edit comment…

But in this case, I prefer to have real icons :slight_smile:

Case Icon
Layer without comments nothing
Layer with comments image
Group layer without comments + sub-layer with comments image
Group layer with comments + sub-layer with comments image

(Sorry for icon quality, drawn quickly but this is to illustrate idea)

Grum999

4 Likes