Page MenuHome

Initial support for an image layers system in Blender.
Changes PlannedPublic

Authored by Kévin Dietrich (kevindietrich) on Feb 22 2015, 12:09 AM.

Details

Summary

This serves as an update to T30975 by @Fabio Russo (ruesp83), which in turn is based on some GSOC 2010 project, see some somewhat still reliable docs here.

This patch compiles but isn't usuable at all at the moment. I upload this here as it is easier for other devs to see the changes and in turn for me to get help.

The code in Blender changed a bit since last update by @Fabio Russo (ruesp83), and more work needs to done to port the patch to a usable state. Mainly, the image cache system was reworked as per rBce893552c359d11cfa93709f239a3c93f4cdb244 and this here patch should align with it.

Some quick notes:

  • IMB_imbuf_types.h was moved to the DNA, I reverted the change. Apparently this was to be able to read/write the layers' imbufs from/to the blender file (which feels wrong to me, judging from other code)
  • some logic here and there (e.g. getting the current layer) could be improved/simplified
  • a fair amount of syle issues (naming convention essentially)
  • the patch could be split up: e.g. one for the layer system, and one or two for the extra image filters/tools that it brings

Diff Detail

Repository
rB Blender
Branch
image_layers

Event Timeline

Kévin Dietrich (kevindietrich) retitled this revision from to Initial support for an image layers system in Blender..
Kévin Dietrich (kevindietrich) updated this object.
Kévin Dietrich (kevindietrich) set the repository for this revision to rB Blender.

Snip from IRC (just in case):

kevindietrich : sergey-: as a side project I updated the image layers patch (https://developer.blender.org/T30975) but there's some issues with getting the image buffer/cache which you changed in https://developer.blender.org/rBce893552c359d11cfa93709f239a3c93f4cdb244.
kevindietrich : sergey-: Currently the layers are using the old approach (Listbase ibufs), and when entering paint mode the image gets a layer, which duplicates the image imbuf (IMB_dupImBuf(ima->ibufs.fist)). And that doesn't work well with the new system (either I get a crash, or it gets stuck at some point in BLI_spinlock()).
kevindietrich : One option (the best IMO) would be to rewrite the layers to use a MovieCache. It'd be good to get your eyes on it at some point :). Mind if >upload the patch to differential system to have a quick look (when you have time :) )?
sergey- : kevindietrich: yah, review is easier in Differencial
sergey- : upload patch there and i'll have a look later


Some interesting piece of knowledge:
After many failed attempts to upload this patch through arcanist, I decided to upload it manually. I figured that arcanist generates the patch like so:

git diff --no-ext-diff --no-textconv --no-color --src-prefix=a/ --dst-prefix=b/ -U32767 -M -C 'current_master_head' 'current_branch_head' --

Generally when diffing, only 3 lines before and after the changes are included to have some sort of context. The -U32767 option will basically include 32767 lines before and after (so basically the whole file, thus having full blown context), which in this case creates a *.diff of about 8Mb which apparently exceeds the file size limit for uploading. And I'm not including the other infos (commits, logs, branch...), which made the size of the data to transfer to about ~11Mb. The culprit here being that IMB_imbuf_types.h -> DNA_imbuf_types.h change...

Updating the diff through arc (hopefully).
This includes a few cleanups and reverts the move of IMB_imbuf types to the DNA.

  • Add new files from the patch.
  • Move IMB_imbuf_types to dna.
  • Addendum to previous commits.
  • Import changes from BKE_image, round 1
  • Import changes from BKE_image, round 2
  • Import some more changes from the patch, almost done
  • Import some more changes from the patch, although there's still quite a few lines to be ported I'd rather do a commit now as a checkpoint
  • Finally done with the C-code, now to the UI-copter!
  • UI code merged from patch
  • Some fixes for the UI
  • Fix infinite loop when loading an image
  • A bunch of style cleanup, comment out unused functions
  • Style cleanup, remove dead code
  • Merge branch 'master' into image_layers
  • Code cleanup(tm)
  • Prepare ground for next commit
  • Revert "Move IMB_imbuf_types to dna."
  • Addendum to previous commit

I'm seeing this dumped to console and killing the build. What am I missing?

[ 31%] /home/mdriftmeyer/Projects/Blender/blender/source/blender/editors/sculpt_paint/paint_image_proj.c:1033:44: error:

controlling expression type 'const int [3]' not compatible with any
generic association type
                  i1_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i1);
                                                          ^~~~~~~

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenkernel/BKE_mesh_mapping.h:204:21: note:

  expanded from macro 'BKE_MESH_TESSTRI_VINDEX_ORDER'
(CHECK_TYPE_ANY(_tri, unsigned int *, int *, const unsigned int *, c...
                ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:379:74: note:

    expanded from macro 'CHECK_TYPE_ANY'
...CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__)
                                                                  ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:69:80: note:

    expanded from macro 'VA_NARGS_CALL_OVERLOAD'
..._VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__))
                                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:50:32: note:

expanded from macro '_VA_NARGS_GLUE'

#define _VA_NARGS_GLUE(x, y) x y

^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:100:19: note:

expanded from macro '_VA_CHECK_TYPE_ANY5'
  ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0))
                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/editors/sculpt_paint/paint_image_proj.c:1033:53: error:

controlling expression type 'const unsigned int' not compatible with any
generic association type
                  i1_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i1);
                                                                   ^~

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenkernel/BKE_mesh_mapping.h:205:21: note:

 expanded from macro 'BKE_MESH_TESSTRI_VINDEX_ORDER'
CHECK_TYPE_ANY(_v, unsigned int, int)),                                \
               ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:379:74: note:

    expanded from macro 'CHECK_TYPE_ANY'
...CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__)
                                                                  ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:69:80: note:

    expanded from macro 'VA_NARGS_CALL_OVERLOAD'
..._VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__))
                                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:50:32: note:

expanded from macro '_VA_NARGS_GLUE'

#define _VA_NARGS_GLUE(x, y) x y

^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:96:19: note:

expanded from macro '_VA_CHECK_TYPE_ANY3'
  ((void)_Generic((v), a0: 0, b0: 0))
                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/editors/sculpt_paint/paint_image_proj.c:1034:44: error:

controlling expression type 'const int [3]' not compatible with any
generic association type
                  i2_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i2);
                                                          ^~~~~~~

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenkernel/BKE_mesh_mapping.h:204:21: note:

  expanded from macro 'BKE_MESH_TESSTRI_VINDEX_ORDER'
(CHECK_TYPE_ANY(_tri, unsigned int *, int *, const unsigned int *, c...
                ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:379:74: note:

    expanded from macro 'CHECK_TYPE_ANY'
...CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__)
                                                                  ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:69:80: note:

    expanded from macro 'VA_NARGS_CALL_OVERLOAD'
..._VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__))
                                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:50:32: note:

expanded from macro '_VA_NARGS_GLUE'

#define _VA_NARGS_GLUE(x, y) x y

^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:100:19: note:

expanded from macro '_VA_CHECK_TYPE_ANY5'
  ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0))
                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/editors/sculpt_paint/paint_image_proj.c:1034:53: error:

controlling expression type 'const unsigned int' not compatible with any
generic association type
                  i2_fidx = BKE_MESH_TESSTRI_VINDEX_ORDER(lt_vtri, i2);
                                                                   ^~

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenkernel/BKE_mesh_mapping.h:205:21: note:

 expanded from macro 'BKE_MESH_TESSTRI_VINDEX_ORDER'
CHECK_TYPE_ANY(_v, unsigned int, int)),                                \
               ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:379:74: note:

    expanded from macro 'CHECK_TYPE_ANY'
...CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__)
                                                                  ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:69:80: note:

    expanded from macro 'VA_NARGS_CALL_OVERLOAD'
..._VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__))
                                   ^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_utildefines.h:50:32: note:

expanded from macro '_VA_NARGS_GLUE'

#define _VA_NARGS_GLUE(x, y) x y

^

/home/mdriftmeyer/Projects/Blender/blender/source/blender/blenlib/BLI_compiler_typecheck.h:96:19: note:

expanded from macro '_VA_CHECK_TYPE_ANY3'
  ((void)_Generic((v), a0: 0, b0: 0))

@Marc J. Driftmeyer (mdriftmeyer), this patch won't work at all, as written in the description and the IRC snippet I posted above. I would think that due to the numerous changes which happened in master since I posted this patch, it would need to be updated.

For now development is on hold from my side at the moment, as my main focus is elsewhere. I can update the patch to compile with current master it you wish to continue development here, otherwise you'll have to wait a bit :)

Kévin Dietrich (kevindietrich) planned changes to this revision.Jan 28 2016, 8:41 AM

Alright I just revisited this patch and managed to fix the couple of issues which lead me to upload this here to get some help, so for the time being, setting this as planned changes so it doesn't stay on someone's "to review" stack.

Please continue this really usefull work :)

I second @mathieu menuet (bliblubli), this would be great to have! This could pave the way to 2D art in blender!

I'm not sure what the policy on here is about the +1s, but I'll allow myself to weigh in. Came here from ruesp83.com, and I would so much like to see this in Blender. Blender is already my favorite app in the universe, and it replaces several apps of my old workflow (Maya, AFX), and is shaping up to be maybe the best 2D animation package there ever was. The interface is amazing. I would love it if I could do everything without quitting Blender at all.

Blenderize all the things!