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

Function to import images by filename #1109

Merged
merged 6 commits into from Dec 4, 2018

Conversation

Projects
None yet
4 participants
@davidlamhauge
Copy link
Contributor

davidlamhauge commented Oct 15, 2018

This function will make it possible to import images based on the images filenames. This is mainly a feature that is usefull for traditional animators like myself.
Filenames must follow this format: 'prefix' + 'four digits' + 'suffix'.
If you have a layer with the character 'Joe', you could have the following files: 'Joe0001.png', 'Joe0013.png', 'Joe0015.png', 'Joe0017.png' and 'Joe0019.png'. If you import these drawings with the new function 'importImageSequenceNumbered()', you wil get a new layer named 'Joe' (the prefix), and the drawings will be placed at frames 1, 13, 15, 17 and 19.
I like it. I hope you like it too.

@Jose-Moreno

This comment has been minimized.

Copy link
Member

Jose-Moreno commented Oct 15, 2018

@davidlamhauge Excellent! I was missing a proposal like this. I think it will really help traditional animators to get the timing straight from their drawings.

For a future consideration it would be great if this could become integrated with the proposal to handle x-sheet data, that way you wouldn't need to keep track of the drawings themselves while cross referencing with the physical x-sheet but for a bigger production you can have your x-sheet data entered on a spreadsheet for each scene and then allow it to be imported along with the referenced image path so Pencil2D would automatically get them for you in the correct placement (this would be particularly useful for longer sequences and separation of different scenes for digitizing bulk work).

I see this function as groundwork for that, so thank you for taking the time! 🙂

@davidlamhauge

This comment has been minimized.

Copy link
Contributor Author

davidlamhauge commented Oct 16, 2018

@Jose-Moreno Thanks!
I too see it as a very useful feature, that can be expanded in the way you propose.

  1. You could import all drawings from a spredsheet (csv) into a new scene in Pencil2D, so you had your layers and their drawn/scanned drawings in the right place in the timeline.
  2. You could import one or more layers into an existing scene. This kind of reuse is widely used in the business, and with the possibility to copy, move etc. it would be easy to adjust the imported layer,so it matched the rest of the scene.
@davidlamhauge

This comment has been minimized.

Copy link
Contributor Author

davidlamhauge commented Oct 16, 2018

I split the function in two, so the actual import is separated from the finding filename.
The new function ('addLayerByFilename(strFilePath)') can now be called from other functions, if necessary.

@davidlamhauge

This comment has been minimized.

Copy link
Contributor Author

davidlamhauge commented Oct 17, 2018

While I'm waiting for a decision on how this should be implemented, I've enhanced it a little.
Now you can have any number of digits in the filename. Now it is not only 'Joe0001.png', 'Joe0013.png', 'Joe0015.png', 'Joe0017.png' and 'Joe0019.png', that are valid, but also Joe000001.png', 'Joe000013.png', 'Joe000015.png', 'Joe000017.png' and 'Joe000019.png' or J01.png', 'J13.png', 'J15.png', 'J17.png' and 'J19.png'.
The new rule is that the prefix must be at least one character, the number of digits must be consistent, and the suffixes must be the same.

@Jose-Moreno

This comment has been minimized.

Copy link
Member

Jose-Moreno commented Dec 3, 2018

@davidlamhauge David I have been thinking for a few days. Recently I had to recover the work of another user, and I did this by importing all of their images on each layer but it was painful to select non-sequenced drawings and find their corresponding frame to import them there. I feel this function can help address that problem so users can start recovering work on their own as well.

My question is: Would it be possible to have a way to customize the import rules to be able to quickly import Pencil2D internal naming which is currently saved as PNG files that represent bitmap drawings with layer name as the layer index followed by a separator and then followed by the frame position eg. 004.00001.png -> this would be an internal png that holds the drawing data from the fourth layer in the first frame.

What do you think?

@chchwy chchwy added this to the 0.6.3 milestone Dec 4, 2018

@chchwy chchwy merged commit 82a6c87 into pencil2d:master Dec 4, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@chchwy

This comment has been minimized.

Copy link
Member

chchwy commented Dec 4, 2018

Merged. Thanks @davidlamhauge

@chchwy chchwy referenced this pull request Dec 4, 2018

Merged

Error counting digits fixed #1135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.