Commit Graph

102 Commits

Author SHA1 Message Date
a798623fff Bugfix [#32865] Usercounts for World Textures not decremented after preview
render

When adjusting settings for world textures (with Both/World preview modes),
every tweak would result in the usercount of the texture increasing. As a
result, before long the texture would claim to have over 100 users. Fortunately,
this only appeared to be just a cosmetic issue (i.e. no real memory leak here),
though it was a bit unsettling.

NOTE: this is still a bit glitchy, as now we have flickering when updating
texture settings - the texture still temporarily has a second user during
preview rendering.
2012-10-13 01:19:23 +00:00
9829ba31b9 Color Management: fixed color management-less texture rendering
There was a missing check for whether color management enabled or not when
converting byte textures to linear space.

This commit also fixes wrong texture preview rendering, which was applying
sRGB transform twice, making procedural textures bright. This will make
float textures being previewed dark (in a linear space) but that's how it
used to behave in pre-OCIO color management.
2012-10-10 05:56:49 +00:00
e7089c0643 Disable render part of display transformation for icon/texture preview
This change mainly caused by too dark icon generated for texture brushes,
but also makes it a bit more straightforward from what's going on point of view.
2012-10-01 12:41:20 +00:00
232571c61a code cleanup: replace macro for BLI_rect size/center with inline functions. 2012-09-15 11:48:20 +00:00
a73dd3476e Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.

This introduces two configurable color spaces:

- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).

  This setting could be found in image/clip data block settings.

- Display color space which defines space in which particular display is working.

  This settings could be found in scene's Color Management panel.

When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.

This conversions are:

- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.

- Exposure affects on image exposure before tone map is applied.

- Gamma is post-display gamma correction, could be used to match particular
  display gamma.

- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.

All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.

This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).

Some technical notes:

- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.

- Space of byte buffer is stored in image buffer's rect_colorspace property.

- Profile of image buffer was removed since it's not longer meaningful.

- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.

- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.

- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.

More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management

--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
7a13bc2196 Fix wrong user counter in world node trees
World is being localized without increasing ID users, so no need
to decrease ID users on localized world free.
2012-08-29 12:47:42 +00:00
b0dd030ba6 Fixed regression introduced in 50107
Shader preview job localizes material without referencing it as a user,
so don't need to unreference itself as a user from this material.

Added BKE_material_free_ex function which could skip user dereferencing.
This also removed old hack with mtex users.
2012-08-22 17:22:04 +00:00
77f47799dd code cleanup: use BLI_RCT_SIZE macro 2012-08-20 23:06:17 +00:00
15bd03f958 fix for missing change to fluidsim from last commit and name jobs a more useful name - 'wm_job'. 2012-08-15 10:03:29 +00:00
97859e8709 add wm job types they are not used yet, so this just defines them for new jobs add add argument to search by job type. 2012-08-15 09:42:06 +00:00
c567cf3fab code cleanup: WM naming conventions 2012-08-11 21:35:24 +00:00
f0951f58ca code cleanup: rename G.afbreek --> is_break, G.rendering --> is_rendering 2012-08-08 18:37:06 +00:00
9ff4fa6671 style cleanup 2012-08-04 12:30:16 +00:00
af3e348430 code cleanup: use TRUE/FALSE rather then 1/0 for better readability, also replace do prefix with do_ for bool vars. 2012-05-19 13:28:19 +00:00
a731e13043 code cleanup: function naming, use BKE_*type* prefix. 2012-05-05 14:03:12 +00:00
112162e09e code cleanup: header cleanup 2012-04-30 14:24:11 +00:00
bfcdd45245 corrections from an article about using PVS-Studio static checker with blender - http://www.viva64.com/en/b/0145/ 2012-04-23 15:54:43 +00:00
6701933f5c style cleanup 2012-04-21 12:51:47 +00:00
44258c3c9a Fix #30876, #30932: crash in material preview render after undo or file load,
due to old material copies hanging around in the preview database.

This crash happened pretty randomly, but was especially noticeable when using
node groups.
2012-04-13 12:12:54 +00:00
8ec4371ff1 style cleanup: render 2012-03-29 22:42:32 +00:00
ab4a2aaf4a style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:38:07 +00:00
2f348d8b5d style cleanup: mainly for mesh code, also some WM function use. 2012-03-24 02:51:46 +00:00
a2c182e923 style cleanup - use aligned * prefixed blocks for descriptive comments (was already used a lot and part of proposed style guide). 2012-03-03 16:31:46 +00:00
8f97f3ed29 Fix #25649: Image editor paint icon missing until enter weight paint
Issue was caused by starting Icon Preview render job from two places:
- Texture buttons for small icon preview
- Properties panel in image editor for large icon of texture

This preview job is starting in suspended mode and if new instance of the same job is
starting, suspended job will be totally stopped. This is normally for cases when you're
changing different settings -- in this case you'd wouldn't want re-render be triggered
on every slide change.
But what we've have with brush preview is that two instances of this job were creating for
large and small icon separately, but because of described policy only one icon was rendered.

If suspended job is getting to be stopped, check if it was started for the same icon
resolution and if not, that resolution will be also rendered in new job.
So it'll be still minimal re-rendering happens, but in cases when job was started from
two places for different icon sizes it'll work just fine.
2012-02-17 16:06:32 +00:00
9f2443293e replace fixed sizes with sizeof when passing string length since size wasn't always correct. 2012-01-12 13:16:30 +00:00
d7d856a23d Color management: add "Color Unpremultiply" option for images and render settings.
For premultiplied alpha images, this makes any color space conversion for the image
or render output work on color without alpha multiplied in.

This is typically useful to avoid fringing when the image was or will be composited
over a light background. If the image will be composited over a black background on
the other hand, leaving this option off will give correct results.

In an ideal world, there should never be any color space conversion on images with
alpha, since it's undefined what to do then, but in practice it's useful to have
this option.

Patch by Troy Sobotka, with changes by me.
2011-12-30 14:17:11 +00:00
647447db58 Code refactoring: split lamp functions from object.c into new lamp.c. 2011-11-05 13:11:49 +00:00
30f1f28a8a Nodes: add support for shader nodes on world and lamps, in addition to materials.
The internal render engine does not support them, and they are not accesible in
the UI yet, but cycles will use them.
2011-11-02 18:55:32 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
0664868aec BLI_make_file_string wasn't guaranteed to initialize the resulting path, some parts of the code accounted for this but most not, always initialize the string to "". 2011-10-23 05:56:55 +00:00
5cf593a778 strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known. 2011-10-19 23:10:54 +00:00
3b996ac1b3 add macro OB_TYPE_SUPPORT_MATERIAL, type checks were being done inline, some comparing range, some using ELEM#(), once was missing metaball check. 2011-10-03 17:29:43 +00:00
fa2ba5fbf5 - use static vars and functions where possible.
- use NULL rather than 0 when used as pointers.
2011-08-28 05:06:30 +00:00
609933208d dont include the preview.blend in headless mode 2011-07-13 19:27:42 +00:00
525f4e226e Fix for preview render, lamp and world now also get localized like material and texture. 2011-05-19 11:37:08 +00:00
54b97c1d9d Code refactor: split code for render updates and opening render view into
separate files, no functional changes.
2011-05-19 11:34:11 +00:00
22c2aef77c replace inline string searches with BLI_findstring(), strcmp(..., ""), with char comparisons. 2011-05-01 06:34:40 +00:00
1860c0c565 Fix for bug #26590, `Texture preview fails when path to custom brush
icon is set'

* Main problem was calling BKE_icon_changed too much, blocked previews
  from updating
* Also fixed clearing the icon when it's not a valid image path

Review link: http://codereview.appspot.com/4356045/
2011-04-27 01:16:24 +00:00
f2fd9d11bc Bugfix #26761
Texture preview render now doesn't increment/decrement material->texture
user counts anymore. Blenders library.c code could use some overhaul
once to support data relinkage and copying around better. :)
2011-04-04 13:47:34 +00:00
44692c70ae Bugfix, irc report:
Pressing ESC on material icon preview changes made it stop updating
the icons. Was caused by default 'break' callback testing ESC and
not resetting it. Now it uses same break callback as other previews.
2011-03-11 17:59:40 +00:00
c7fccc84bf use NULL rather then 0 for pointer assignments & comparison, modifier, imbuf & editors. 2011-03-05 10:29:10 +00:00
24fa1d1f04 Two additional fixes for node-tree + texture paint:
- "need exec" flag was cleared in wrong tree for preview renders
  (it should clear it in the copy, i did in original).
  This fixes projection paint on images with previews open
- Previews for nodes were copied always, now only for previews 
  invoked by node editor itself.
2011-03-04 12:59:09 +00:00
18afcbcb7d bugfix #26267
ImageWindow + 3D view texture paint + texture preview render + texture nodes.
Threading hell! But it works now :)
2011-03-03 18:53:07 +00:00
Nathan Letwory
95100afc12 doxygen: blender/editors tagged. 2011-02-27 20:29:51 +00:00
38bd8dcf05 Bugfix #26221
Two bugs in one:

- Lukas commit monday for new group/socket handling accidentally removed
  to set socketype in stacks, which as used by (texture) nodes to detect
  whether value, color or vector had to be read.
  Result was that all texture nodes were rendering as B&W

- Old 2.5 bug: preview renders for texture nodes didn't call a 
  NodeEndExec function, which gave crashes on deleting nodes.

The change in interface_hanlers.c is only a comment to explain
how keymaps are being found.
2011-02-26 13:53:15 +00:00
d7bee4ce2c bugfix [#26156] Opening .blend files through OS ignores "Load UI" flag 2011-02-21 02:40:48 +00:00
2ef296dc4c bugfix [#26118] Getting 'Error Totblock' when using sub-properties from a PointerProperty
blender wasnt freeing ID-Properties when freeing the material copy.
Checked that this isnt a problem for other preview types - texture/world/lamp.
2011-02-21 02:07:26 +00:00
8f21a43535 split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
2011-01-07 18:36:47 +00:00
b067a85aa3 Todo item:
Object color option now is incorporated in preview render, and
in display in 3D window.

Note that Object-color is "modulating" the render result, it just
multiplies... which is very limited for practical use. This was
added for Apricot game project. The original meaning however was
to replace diffuse only... so specular and light work still correct.

ALso made header for properties editor start on top, to reflect
default (report in tracker).
2011-01-05 15:10:35 +00:00
5db20b512e Todo item:
New option to start threaded wmJobs, with flag WM_JOB_SUSPEND.
This makes the job wait 1 timer step before running. 

Used now for Material Icon render renders, which makes the
big preview to be always rendered first while using UI.
2011-01-04 14:59:55 +00:00