StefanTraistaru / batch-export

Inkscape extension that allows you to export each layer into a single file.
MIT License
62 stars 7 forks source link

Plugin doesn't respect layer-inherited hidden/visible property #16

Open frankhval opened 3 years ago

frankhval commented 3 years ago

First of all thank you for your plugin it's been such a life saver for me many times!

Issue: I've got several layers with included layers inside(I suppose it is called hierarchical layers). These top layers are essentially almost carbon copies with few tweaks here and there. I'm trying to export those layers using "skip hidden layers" checkbox but the plugin somehow ignores that checkbox on sub-layers(layers that are "inside" a main layer) and proceed to export every sub-layer ignoring the fact the parent layer is invisible.

What was even more confusing is that since these top layers are copy of one another I haven't been able to pinpoint what's going on since hidden layers were overwriting shown layers.

But after some experimentation I've found the root of the problem: even if a parent layer is hidden the plugin goes on and export sub-layers as-is ignoring parent's visibility.

Hot to Reproduce:

  1. Create a new file
  2. Create "layer 1"(names are not important obviously)
  3. Create "layer 2" and move in inside "layer 1"
  4. Create any path or shape on "layer 2"
  5. Click hide icon(an eye) on "layer 1"
  6. try to export with "skip hidden layers" ticked

Expected result: Nothing will be exported since there are no layers visible Observed result: "Layer 2" will be exported(since it got it's visibility flag on)

inkscape 1.1.

I'm including a test file as well.

test_batchExport.zip

StefanTraistaru commented 3 years ago

Thank you for the detailed description. I managed to reproduce the problem.

I only recently added the option of using hierarchical layers (grouped layers, parent layers) and I did not take into consideration this use-case. I didn't even know you can group layers until 2 months ago, haha.

So to clarify your expected behaviour, in a file with a structure like this:

- Layer 1              // Invisible
    - Layer 2          // Visible
    - Layer 3          // Visible
- Layer 4              // Visible
  1. Using the option: Layer export mode = Use parent layers as background layers.
    • It will export only Layer 4. The same way Inkscape displays the layers.
  2. Using the option: Layer export mode = Export each layer as a single layer.
    • It will export Layer 4 as before, but also Layer 2 and Layer 3. Because, while they are not visible in the viewport of Inkscape, it should treat them as individual layers and therefore export them.

So I believe this should be the behavior, but I fell like it's still a bit clunky in the second scenario. I would like to know your opinion on this:

P.S.

First of all thank you for your plugin it's been such a life saver for me many times!

I would appreciate if you can give it a star.

frankhval commented 3 years ago

So to clarify your expected behaviour, in a file with a structure like this:

- Layer 1              // Invisible
    - Layer 2          // Visible
    - Layer 3          // Visible
- Layer 4              // Visible
  1. Using the option: Layer export mode = Use parent layers as background layers.

    • It will export only Layer 4. The same way Inkscape displays the layers.
  2. Using the option: Layer export mode = Export each layer as a single layer.

    • It will export Layer 4 as before, but also Layer 2 and Layer 3. Because, while they are not visible in the viewport of Inkscape, it should treat them as individual layers and therefore export them.

So I believe this should be the behavior, but I fell like it's still a bit clunky in the second scenario. I would like to know your opinion on this:

  • Does this seem intuitive to you as well?
  • If not, how would you think it should be?

I want to clarify the behaviour in case when Layer 1 is visible: what will be exported in that case with option 1(use parent layers as background layers)? Layer 1 or Layer 2 and 3 as well?

Second option seems kinda unintuitive to be honest. My train of thought was when I was using/expecting the export is what I see is what I get i.e. if I see a layer on canvas it gets exported, if it's not visible no matter what individual visibility settings it has it won't be exported.

The whole point of making sublayers is to use upper layer as a group/folder to easily manipulate with visibility of those layers at once. So in a sense it's a group but not for transformation reasons but for visibility; like different costumes for a character that you can toggle individually(several jackets and throusers for example).

To give you an example/expected behaviour: in Krita there is an option to export layers as individual files as well and there options are looking like this: image

So the options(that are important to our discussion) here are:

And that was the behaviour I was expecting to get.

So I would propose to use behaviour something like this without any additional options(to be honest "background layers" name is kinda misleading, and if anything I would default to export all hierarchy and rename this option to "exclude sublayers" or something like that) and use an option "skip hidden layers" with respect to parent visibility/what is seen atm on canvas(maybe add a second checkbox for "don't respect parent visibility" if anyone will need this).

And on a side note on my grievances with exporting sublayers with same names maybe an option with adding a name of a parent to such layers(like "parentlayer" + "layer1" = "parentlayer_layer1") so those wouldn't overwrite other exported layers(as happened with mine)?

P.S.

First of all thank you for your plugin it's been such a life saver for me many times!

I would appreciate if you can give it a star.

I'm not using github much(well I use it almost exclusively on reporting issues) so I don't know what that star thing means but it's certainly not a problem at all, given!

StefanTraistaru commented 2 years ago

Hi

I just wanted to respond saying that I read your comment and I appreciate your effort into helping me with feedback on this issue.

Sadly I have been busy almost all of the time this past few months (university started and I got a new job) so I did not find the time to look into this further. I believe that user experience is important but cannot be done in a rush so I want to have a few days in order to look at the design and proposed changes to see what feels intuitive and what not.

I will update this issue once I get working on it.

frankhval commented 2 years ago

No worries! I totally understand your situation and appreciate what you've done already and please feel no pressure from me about the issue!

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Monday, November 29th, 2021 at 16:52, Stefan Traistaru @.***> wrote:

Hi

I just wanted to respond saying that I read your comment and I appreciate your effort into helping me with feedback on this issue.

Sadly I have been busy almost all of the time this past few months (university started and I got a new job) so I did not find the time to look into this further. I believe that user experience is important but cannot be done in a rush so I want to have a few days in order to look at the design and proposed changes to see what feels intuitive and what not.

I will update this issue once I get working on it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.