Commit Graph

71 Commits

Author SHA1 Message Date
Charlie Jolly be70827e6f Nodes: Add Float Curve for GN and Shader nodes.
Replacement for float curve in legacy Attribute Curve Map node.

Float Curve defaults to [0.0-1.0] range.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D12683
2021-09-30 19:24:40 +01:00
Patrick Busch 3eb8307160 Python API: Expose CurveMapping Reset View function
The Python API for the curve mapping widget offers the `update`
function, but no way to reset the view to the clipping rectangle.

This commit adds a blenkernel function for this operation,
and exposes it to the CurvMapping RNA API. This allows addons
to display a more user-friendly view of the data in this widget.

Differential Revision: https://developer.blender.org/D10561
2021-03-02 13:13:36 -06:00
Jacques Lucke 62223e9851 Refactor: move color settings .blend I/O to blenkernel
Ref T76372.
2020-11-06 14:10:31 +01:00
Campbell Barton 38a66903e5 Cleanup: sort struct declarations 2020-09-30 11:51:13 +10:00
Jacques Lucke f5e55c3337 Cleanup: use bool instead of int in various places 2020-09-02 19:10:40 +02:00
Jacques Lucke 7283e6fb73 Merge branch 'blender-v2.90-release' into master 2020-08-07 10:04:57 +02:00
Jacques Lucke 91694b9b58 Code Style: use "#pragma once" in source directory
This replaces header include guards with `#pragma once`.
A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`),
because they are used in other places.

This patch has been generated by P1561 followed by `make format`.

Differential Revision: https://developer.blender.org/D8466
2020-08-07 09:50:34 +02:00
Campbell Barton 901ee66ea1 Cleanup: use term init instead of initialize/initialise
The abbreviation 'init' is brief, unambiguous and already used
in thousands of places, also initialize is often accidentally
written with British spelling.
2020-08-01 13:51:05 +10:00
Jacques Lucke d3de5d7ca5 Refactor: Move curvemapping .blend read/write to blenkernel
This is necessary so that it can be accessed from `blendWrite`
and `blendRead` callbacks from modifiers.
2020-06-16 16:59:52 +02:00
Jacques Lucke 5de56f9596 Cleanup: make remaining blenkernel headers work in C++ 2020-03-02 15:07:49 +01:00
Jeroen Bakker 2e6159a494 Curve: CurveMapping Extend Option
Extend options are currently stored per curve. This was not clearly
communicated to the user and they expected this to be a setting per
CurveMapping.

This change will move the option from `Curve` to `CurveMapping`. In
order to support this the API had to be changed.

BPY: CurveMap.evaluate is also moved to CurveMapping.evaluate what
breaks Python API. Cycles has been updated but other add-ons have
not. After release of 2.81 we can merge this to master and adapt
the add-ons.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D6169
2019-11-27 16:05:54 +01:00
Campbell Barton 00cb31de65 Cleanup: use BKE_ prefix for BKE_colortools.h 2019-08-07 03:38:01 +10:00
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
Campbell Barton eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
Brecht Van Lommel 9a63fa21eb Color management: change view transform for color pickers and display modes.
* Use simple default view transform for color pickers, as Filmic does not work
  well for all types of colors. We better handle this with an option and tagging
  of colors as emissive or albedo like.
* For solid/workbench we also no longer use Filmic, as there is not enough contrast
  and it's not really needed since this is not physically based lighting.
* For lookdev always take into account the view transform and look. Other view
  settings like exposure are only taken into account if scene lighting is used,
  since these are often dependent on scene light intensity.

Fixes T61022, T57649, T59363.
2019-02-01 20:56:42 +01:00
Campbell Barton 6cbb4c576a Cleanup: manually remove header text not handled by automation 2019-02-02 01:49:31 +11:00
Campbell Barton 65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton c0f88ed8a8 Cleanup: sort forward declarations of enum & struct
Done using:
  source/tools/utils_maintenance/c_sort_blocks.py
2019-01-28 21:17:58 +11:00
Sergey Sharybin 7ed8e9167d Color management: Use default view with no extra transform when not specified 2018-12-06 12:31:50 +01:00
Sergey Sharybin 005e6274ad Color management: Cleanup, make function name more clear
The idea is to reflect that the view settings are the best
for cases when one wants to see things as if they are a
render result.
2018-12-06 12:31:50 +01:00
Sergey Sharybin b927d19696 Color management: Query default view from display
Solves weird situation when default display name is queried
from OCIO, but Default view being assumed to be set for it.

Now view is initialized to a default view of that display.
2018-12-05 14:11:21 +01:00
Campbell Barton 75fc1c3507 Cleanup: trailing whitespace (comment blocks)
Strip unindented comment blocks - mainly headers to avoid conflicts.
2018-06-01 18:19:39 +02:00
Bastien Montagne eeb9e5316a Make whole ID copying code use const source pointer.
Noisy change, but safe, and better do it sooner than later if we are to
rework copying code. Also, previous commit shows this *is* useful to
catch some mistakes.
2017-06-14 22:38:11 +02:00
Campbell Barton 8c74ebb64f Support Auto-Clamped Handle for Curve-Mapping
This patch supports auto-clamped handles for curves,
useful since without this it can be difficult to have 'flat' sections of a curve.
2016-08-01 09:06:40 +10:00
Sergey Sharybin b909dfdae1 Cycles: Expose user-defined shutter curve to the interface
Shutter curve now can be controlled using curve mapping widget in the motion
blur panel in Render buttons. Only mapping from 0..1 by x axis are allowed,
Y values will be normalized to fill in 0..1 space as well automatically.

Y values of 0 means fully closed shutter, Y values of 1 means fully opened
shutter.

Default mapping is set to old behavior when shutter opens and closes instantly.

This shutter mapping curve could easily be used by any other render engine by
accessing scene.render.motion_blur_shutter_curve.

Reviewers: #cycles, brecht, juicyfruit, campbellbarton

Differential Revision: https://developer.blender.org/D1585
2015-10-28 02:43:06 +05:00
Sergey Sharybin 868717e312 Support symmetrical curve mapping presets
Previously curve mapping was always setting to only a single slope which then
was symmetrizied by a tools (such as brush or compositing).

With this change it's possible to set curve to symmetrical slopes as a part
of preset.
2015-10-28 02:43:06 +05:00
Sergey Sharybin f4d064a5b2 Send color managed signal if input spaces changes during image saving
We're currently only supporting save to a default format color space, which
makes it a bit tricky to prevent ImBuf from being changed.

For until when saving to a custom colorspace works we'll just reload image
if the space changes.
2015-05-20 15:33:30 +05:00
Campbell Barton 617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
Campbell Barton b9114cb609 UI: Use bool rather then int/short's where possible 2014-01-04 18:10:01 +11:00
Antony Riakiotakis f16047c2df Better fix for #36688.
Throw a python error if user attempts to use CurveMap without calling
CurveMapping.initialize() first. Added access to the initialize function
to CurveMapping on RNA level.

Thanks to Campbel for the help and remarks!
2013-09-11 23:28:23 +00:00
Antony Riakiotakis 00641bb237 Attempt fix for #36688.
Curves may not be not initialized when called from python. C code
explicilty says that curvemapping_initialize should be called prior to
evaluating the curve, however the curve clip rectangle is not available
when calling evaluation on the curvemap. This is not possible unless we
force the evaluation on CurveMapping level, not on CurveMap level.

For now just pass a rectangle with the x boundary values of the curvemap
for evaluation to avoid the crash.
2013-09-09 18:39:51 +00:00
Campbell Barton 9c003a36d6 patch from Harley Acheson to remove multiple inline defines. 2013-01-12 17:12:48 +00:00
Campbell Barton a31449edad all remove functions now invalidate the RNA objects passed, to help script authors to avoid bugs with accessing removed data. 2012-11-02 09:41:26 +00:00
Sergey Sharybin abff7cac7e Color Management: remove unused function and get rid of unneeded float->byte conversion 2012-10-15 07:47:38 +00:00
Campbell Barton 232571c61a code cleanup: replace macro for BLI_rect size/center with inline functions. 2012-09-15 11:48:20 +00:00
Sergey Sharybin 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
Campbell Barton f9d9459e3f code cleanup: modify DO_INLINE define to not use __inline with mingw
make RegisterBlendExtension_Fail a static func
       u
2012-09-15 02:29:47 +00:00
Campbell Barton 8bd7c3fba2 change curve evaluation functions never to modify curve data (ensures thread safety), now initializations has to be done outside evaluation. 2012-08-21 14:43:51 +00:00
Campbell Barton 3204731209 code cleanup: don't use magic numbers for curve flag & use bool args for curvemapping_changed() 2012-08-21 08:47:36 +00:00
Campbell Barton 988df24551 compositor color curve was MEM_dupallocN'ing the curve for every pixel calculation (when there were black or white inputs on the curve node).
avoid allocation by using local vars for black/white storage & curve calculation.
2012-08-21 08:30:45 +00:00
Sergey Sharybin 995a19a983 Sequencer: per-sequence modifier stack for color grading
This implements basic color grading modifiers in sequencer, supporting
color balance, RGB curves and HUE corrections.

Implementation is close to object modifiers, some details are there:

http://wiki.blender.org/index.php/User:Nazg-gul/SequencerModifiers

Modifiers supports multi-threaded calculation, masks and instant
parameter changes.

Also added cache for pre-processed image buffers for current frame,
so changing sequence properties does not require rendering of original
sequence (like rendering scene, loading file from disk and so)
2012-08-19 15:41:56 +00:00
Campbell Barton fd212cd4bc image sample line now updates with the compositor changes (mango request) 2012-06-13 22:38:31 +00:00
Brecht Van Lommel 7aa21d677a Python/CurveMapping: add Curve Mapping functions to add/remove curve points,
evaluate the curve and update after changes.
2012-05-15 18:34:00 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Brecht Van Lommel b9ff5840a6 Code refactoring: add unified image buffer functions for doing float => byte,
byte => float, float => float, byte => byte conversions with profile, dither
and predivide. Previously code for this was spread out too much.

There should be no functional changes, this is so the predivide/table/dither
patches can work correctly.
2011-12-28 13:29:33 +00:00
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton 4b449aefea remove support for irix 2011-09-21 08:40:30 +00:00
Campbell Barton 599cd56f53 minor edits / cleanup - no functional changes.
- use 'const float *' and array size in some function declarations.
- replace macros for BLI_math functions INPF, VECCOPY, VECADD etc.
- remove unused VertRen.clip struct member.
- remove static squared_dist() from 2 files, replace with BLI_math function len_squared_v3v3().
- use vertex arrays for drawing clipping background in the 3D viewport.
2011-09-11 02:50:01 +00:00