Commit Graph

425 Commits

Author SHA1 Message Date
29dc8259a8 Mistake naming in recent commit 2014-05-22 17:40:35 +10:00
049b6cfa6d Fix for image garbage collection failing to run for render-only views
Check for freeing old images was running per-object, move this to viewport drawing.
2014-05-22 11:58:07 +10:00
fa25d7cf7b Code cleanup: remove defines no longer needed on windows 2014-05-02 00:55:54 +10:00
a2c107aef1 Code cleanup: use 'const' for arrays (blenkernel) 2014-04-27 00:25:15 +10:00
551096d6fd BLI_open: check returned value for -1 instead of < 0 2014-04-22 16:40:17 +10:00
11ee2d8b97 implement cache line for image editor
It works exactly the same as a cache line in movie clip editor.
2014-04-02 16:54:30 +06:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
6316306cc0 Fix bug in image texture UI: "Use Alpha" checkbox doesn't appear if file format is BMP. 2014-03-31 17:37:55 +09:00
6452d9f02f Fix T39395: Switching to "Textured solid" and "GLSL" view will cause the FPS drop to 0
Issue was caused by the cache limitor which was removing 4k textures from the
memory when accessing other images.

This is pretty much awful situation and solved by making it so only image sequences
and movies ace cache-guarded.

Could be optimized further so images used by viewport are not being freed, but
that's much more tricky to do..

This is a nice candidature for 'a'.
2014-03-25 12:30:41 +06:00
2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
4080673ea7 Fix bug 1 of T39156: Deadlock while undoing paint operations on image
sequences.

This commit should be included in 2.70 release
2014-03-13 19:56:16 +02:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
3c86a1932f Code cleanup: add BLI_testextensie_n, replacing multuple calls to BLI_testextensie
also use attributes for BLI path functions
2014-01-31 03:30:05 +11:00
39eb314cb9 UI: Refactor timecode functions into BLI_timecode
- deduplicate timecode_simple_string from image.c
- replace V2D_UNIT_SECONDSSEQ with V2D_UNIT_SECONDS
- avoid possible buffer overflow bugs (sprintf -> BLI_snprintf)
- remove option not to use timecode and split into 2 functions

Patch D227 by Andrew Buttery with own refactoring.
2014-01-29 20:44:01 +11:00
4ae7ae6f2e Code Cleanup: use bool for return values and correct comments
also remove CDDM_Check, theres no need for it.
2014-01-22 02:53:48 +11:00
1f2136b329 Python/Depsgraph: bpy.data.*.is_updated now detects add/remove of any datablock.
Previously this only worked for some datablocks relevant to rendering, now it
can be used to detect if any type of datablock was added or removed (but not
yet to detect if it was modified, we need many more depsgraph tags for that).

Most of the changes are some function parameter changes, the important parts
are the DAG_id_type_tag calls.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D195
2014-01-15 16:47:53 +01:00
c48c62a831 Code Cleanup: replace checks for ima->source with BKE_image_is_animated 2014-01-14 04:59:58 +11:00
5ad5883ce3 Fix crash happening on render after recent imbuf PERSISTENT flag 2014-01-13 20:25:42 +06:00
b1bb7d2ee0 Fix T38040: Crash after loading big image file in compositor
Issue was caused by cache limitor removing viewer image buffer
from the memory during compositing. Now made it so all viewer
images are persistent in the memory.

This solves the crash mentioned above and also makes it so
render/compo results are never lost.

Further tweaks are possible, but pretty much happy now, at
least no stoppers for work are there.
2014-01-13 18:47:15 +06:00
0dabf824fb Fix T38045: Clone stamp crashes
Issue seems to be caused by thread-unsafe IMB_freeImBuf.
Now use generic BKE_image_release_ibuf to de-reference
image buffer which was acquired from image datablock.
2014-01-03 23:00:53 +06:00
71f689843d Fix deadlock happening when using Save Buffers for render
Summary:
Issue was caused by the same tile being written twice to
the EXR file. This was happening because of partial update
of work-in-progress tiles was merging result to the final
render result in order to make color management pipeline
happy.

We need to avoid such a merges and keep memory usage as
low as possible when Save Buffers is enabled.

Now render pipeline will allocate special display buffer
in render layer which will contain combined pass in the
display space. This keeps memory usage as low as we can
do at this moment.

There's one weak thing which is changing color management
settings during rendering would lead to lossy conversion.
This is because render result's display buffer uses color
space from the time when rendering was invoked.

This is actually what was happening in previous release
already actually so not a big issue.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D162
2014-01-01 22:32:47 +06:00
b0c4133c67 Followup for fix T37718: image was not saving with proper settings second time
This was actually a regression after color management re-implementation, need
to copy settings from saved image buffer to an original one since they might
be modified during save.

Also noticed image format planes detection didn't work properly from an image
buffer. Made it so save operator works fine now, but also marked a TODO in
BKE_imbuf_to_image_format() which needs to be investigated further.
2013-12-19 17:20:12 +06:00
d9e42cf43e Style Cleanup: minor edits in recent changes 2013-12-18 15:35:31 +11:00
c5d7ea091f Changes to partial update during rendering
Summary:
Mainly addressed to solve old TODO with color managed fallback
to CPU mode when displaying render result during rendering.

That fallback was caused by the fact that partial image update
was always acquiring image buffer for composite output and was
only modifying display buffer directly.

This was a big issue for Cycles rendering which renders layers
one by one and wanted to display progress of each individual
layer. This lead to situations when display buffer was based on
what Cycles passes via RenderResult and didn't take layer/pass
from image editor header into account.

Now made it so image buffer which partial update is operating
with always corresponds to what is set in image editor header.

To make Cycles displaying progress of all the layers one by one
made it so image_rect_update switches image editor user to
newly rendering render layer. It happens only once when render
engine starts rendering next render layer, so should not be
annoying for navigation during rendering.

Additional change to render engines was done to make it so
they're able to merge composite output to final result
without marking tile as done. This is done via do_merge_result
argument to end_result() callback. This argument is optional
so should not break script compatibility.

Additional changes:

- Partial display update for Blender Internal now happens from
  the same thread as tile rendering. This makes it so display
  conversion (which could be pretty heavy actually) is done in
  separate threads. Also gives better UI feedback when rendering
  easy scene with small tiles.

- Avoid freeing/allocating byte buffer for render result
  if it's owned by the image buffer. Only mark it as invalid
  for color management.

  Saves loads of buffer re-allocations in cases when having
  several image editors opened with render result. This change
  in conjunction with the rest of the patch gave around
  50%-100% speedup of render time when displaying non-combined
  pass during rendering on my laptop.

- Partial display buffer update was wrong for buffers with number
  of channels different from 4.

- Remove unused window from RenderJob.

- Made image_buffer_rect_update static since it's only used
  in single file.

Reviewers: brecht

Reviewed By: brecht

CC: dingto

Differential Revision: http://developer.blender.org/D98
2013-12-17 23:42:38 +06:00
04eb24a337 Fix T37718: Texture compression missing
Make sure image will saved as (not over) after changing
it's type to Generated by clearing image's path in signal
handler.
2013-12-17 22:16:53 +06:00
8e59beb815 Code Cleanup: comment unused define 2013-12-18 00:20:18 +11:00
c193dbe30b Fix T37826: Opening a new image in the image editor
Cast dimensions to size_t before multiplication.
Also made add_ibuf_size survive cases when image
buffer allocation failed.
2013-12-16 16:51:27 +06:00
17604cded9 Missing NULL-pointer check in BKE_image_free_anim_ibufs 2013-12-16 16:30:28 +06:00
ce893552c3 Image cache rewrite to using generic movie cache
Summary:
Behaves very much the same as cache for Movie Clip datablock:

- Image now have `MovieCache *cache` field which replaced
  legacy `ListBase ibufs`.

  This allows image datablock to easily keep of image
  buffers which are owned by itself. This field isn't
  saved to the file and getting restored on undo steps.

  However, cache limit is global for movies, sequences
  and image datablocks now. So overall cached image buffers
  size will not go above cache limit size in user
  preferences.

- Image buffers which are marked as BITMAPDIRTY will never
  be freed from the cache.

- Added utility function to iterate over image buffers
  saved in movie cache.

- Movie cache cleanup check callback now have ImBuf argument
  which can be used in a condition of cleanup.

- Added some utility functions which replaces legacy ibufs
  iterations with image cache iteration which happens from
  inside a lock.

- Fixed `image_mem_size()` which was only counting one of
  the buffers if both float and byte buffer present.

Additional notes:

- `BKE_image_get_first_ibuf()` is rather stupid, but direct
  access to ibufs->first was also the same stupid idea.

  Would consider avoid this function is another project.

- There are some places which doesn't look threadsafe, but
  they already were not so much threadsafe anyway before.

  So think not a big deal with solving this later.

Finally solves infinite memory usage by image sequences! :)

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: sebastian_k

Differential Revision: http://developer.blender.org/D95
2013-12-13 16:30:00 +06:00
61616b0b88 Code cleanup: indent preprocessor directives inside #ifdef 2013-12-12 13:10:03 +06:00
1815225faa Blender Font (BLF): add length argument to string width/height functions
This also fixes a crash editing buttons longer then UI_MAX_DRAW_STR
2013-12-02 21:10:07 +11:00
a7778ab55d Code cleanup: Typo fix for image function, patch by kgeogeo.
Differential Revision: http://developer.blender.org/D46
2013-11-26 00:42:49 +01:00
b2c1bb74b2 Tweaks to PNG file output
- Made tooltip for compression a bit more clear.
- Use default compression of 15%. Gives around
  two times boost on export movie file here in
  test with only 10% increased file size.

Reviewers: Jonathan Williamson
2013-11-25 16:24:31 +06:00
beae4f498d code cleanup: spelling 2013-10-31 14:10:01 +00:00
e667f12783 Fix #37221: Multilayer EXR inputs generate pink frame/last displayed frame when using an image sequence offset
generally speaking, if multilayer image fails to load for current
frame doesn't mean anything bad. It might be used to make it so
image sequence is being alpha-overed somewhere in the middle of
scene time.

Made it so if the whole file fails to load, image node will
deliver black transparent color, the same what happens for
regular (non-multilayer images).

Also needed to tweak code in load_multilayer_sequwnce to make
sure no cached frames are pointing to a freed memory.
2013-10-28 12:16:17 +00:00
Dalai Felinto
029f4b9767 adding WITH_IMAGE_OPENIMAGEIO and removing the PSD build option
As per Brecht van Lommel's suggestion.
2013-10-11 16:38:04 +00:00
Dalai Felinto
4abb8fde95 Photoshop PSD support
We now support the combined layer of Photoshop files (stored as layer 0
in the file). This way users can keep their files as multilayer PSD and
Blender always handle them as flat images.

For perfect alpha this requires an OpenImageIO update:
342cc2633f

Photoshop sample files:
https://github.com/OpenImageIO/oiio-images

Brecht has some pending fixes to push for OIIO as well, so we may as
well wait to update our libraries.

What works:
===========
* 8bit images (with or without alpha)
* 16bits images (alpha discarded)
* Photoshop files saved with 'Maximum Compatibility'
* Cycles, Blender internal,  BGE (and player)

Known limitations
(due to OIIO dependency):
=========================
* Images with less than 4 channels show a wrong thumbnail (bug may be in  OIIO)
* Packed images are not supported
* We do not write PSD files.

Note: old Blenders have support for PSD via Quicktime library. But due
to license issues this was discontinued.

Many thanks for Brecht van Lommel for reviewing the patch, suggesting
multiple improvements and to help solving the alpha issue.
2013-10-08 21:17:24 +00:00
b6bdb122c2 startup.blend: save images as RGBA by default, to avoid losing data when
forgetting to change it from RGB when painting images or saving renders.

This makes more sense in the new alpha pipeline, renders no longer contain an
alpha channel that does not match the RGB channels, so saving files as RGBA
should give the expected results when opening them in other applications.
2013-09-10 13:25:37 +00:00
Lukas Toenne
79759d8368 Fix for the BKE_image_walk_all_users function: This included a check for movie/sequence image types meant for the original use to set IMA_NEED_FRAME_RECALC flag. But the function name suggests it should be generic, so better move this filter into the callback. 2013-09-02 13:45:57 +00:00
8ef934c73f ghash/bli-listbase edits, rename BLI_ghash_pop -> BLI_ghash_popkey (since it takes a key as an arg and isnt popping any element from the hash as you might expect).
add BLI_pophead/tail, since getting the first element from a list and removing it is a common task.
2013-08-26 23:37:08 +00:00
98e5e544b5 Fix #36408: Setting image.colorspace_settings.name changes saved alpha
Issue was caused by reload caused by input colorspace change.

For generated images generated alpha flags weren't saved to
DNA, which lead to fallback from 32 bit depth to 24 when
doing any kind reload of generated image.

The same alpha loss happens when you save .blend file with
generated images.

Now added generated depth to DNA, so reload image and .blend
file wouldn't loss alpha.
2013-08-12 07:47:44 +00:00
26c0839220 disable cycles when building without python, also use const for function args in more places. 2013-08-07 22:40:03 +00:00
d2dbc0b85e more consistent use of checks of BLI_open(), check 'fd < 0' rather then -1. packedfile incorrectly treated 0 as an error value. best not be vague/sloppy with this. 2013-08-04 17:30:47 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
8a2a323991 fix for sequence strips being given non utf8 names, where the filepath wasn't utf8.
also correct bad assumption in BKE_image_load_exists() that all paths are relative to the current blend file.
2013-07-15 11:26:43 +00:00
edb850c842 remove redundant null checks and avoid divide by zero in driver evaluation 2013-07-13 05:53:14 +00:00
225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
6bc2d57235 Fix #35449: image sequences to drive e.g. particle length or used in modifiers
were no properly updating when rendering animations.

The render engine was only updating the image user current frame on images used
by material textures. Now moved the function that updates all from the editors
to blenkernel level and do it on all frame changes.
2013-05-22 22:17:07 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00