Commit Graph

38 Commits

Author SHA1 Message Date
Omar Emara
92d5c2078e Render: Add Media Type option
This patch adds a new Media Type option to image format settings, which
is used in the Render Output panel, File Output node, and Image Saving
operation. The option does not provide any new functionality, but
improves the UX of selecting file types by categorizing the existing file
type option into:

- Image.
- Multi-Layer EXR.
- Video.

Each option would then list only the file types that fit that media
type. For Multi-Layer and Video, the file type option is no longer drawn
for now since only one option exist for now, OpenEXR Multi-Layer and
FFMPEG respectively. This also improves the experience by not listing
technical terms like FFMPEG in the UI, but rather use "Video" instead.

The original motivation for introducing this option is the recent
redesign of the File Output node. The problem is that the distinction
between images and multi-layers images is not at all clear, while the
behavior of the node changes quite a bit when multi-layer is chosen.
While now with the new option, the distinction is quite clear.

Implementation-wise, the new option is mostly a UI layer that controls
the available enum items for the file format and callbacks to set a
default format if the existing format doesn't match the media type.
However, core code is unaffected and still transparently reads the image
format only.

Pull Request: https://projects.blender.org/blender/blender/pulls/142955
2025-07-25 11:15:28 +02:00
Clément Foucault
decd88f67e Python: Remove deprecated BGL API
The API was in a deprecation state for many years now.
This API was not compatible with Metal nor Vulkan.

This also remove `Image.bindcode`.

Pull Request: https://projects.blender.org/blender/blender/pulls/140370
2025-06-16 12:50:50 +02:00
Aras Pranckevicius
f685f23434 ImBuf: Remove pre-2.80 Texture mipmaps/filters
Removes various image filtering/mipmapping leftovers from
pre-2.80 days.

Code: removes all mipmap handling from ImBuf (which is about half of
ImBuf struct size), removes now unused "sample procedural texture
with mipmaps" code, now-unused FELINE filter, etc. The osatex
parameter to various CPU texture sampling functions is never
actually used, which means none of the mipmap code was ever executing.

User visible part: there were settings on the legacy Texture data
block (as used by Brushes etc.), under Sampling section: "MIP Map",
"Gaussian Filter", "Filter Type", "Eccentricity", "Minimum Size" --
they had no effect anywhere, so they are gone, and what remains is
only "Interpolation" and "Size".

RNA / Python API part: removes the ImageTexture RNA properties
corresponding to the above: filter_type, use_mipmap, use_mipmap_gauss,
filter_lightprobes, filter_eccentricity, use_filter_size_min.

Pull Request: https://projects.blender.org/blender/blender/pulls/139978
2025-06-09 11:35:19 +02:00
Campbell Barton
6d6c695619 Fix: integer overflows calculating the number of pixels in imbuf
Use IMB_get_pixel_count to prevent integer overflow.
2025-04-11 18:52:38 +10:00
Campbell Barton
ab20edf469 RNA: support flagging properties as support blend file relative prefix
Some paths in Blender support the `//` prefix for blend-file relative
paths however this is not communicated anywhere.

Support declaring this with a new flag which can be applied to filepath
& dirpath typed properties.

This is used to:

- Show red-alert when "//" are used in paths which don't support a relative prefix.
- Show a warning in the tooltip that the relative suffix is used when unsupported.
- Python warns if this prefix is ever used in an assignment or
  function argument.

Resolves #133456.

Ref !137060
2025-04-10 23:27:21 +00:00
Bastien Montagne
45f231141d Core: Add info about chain of ancestors (owner data) of a PointerRNA.
The general idea is to store an array of (type, data) pointers of all
PointerRNA ancestors of the current one.

This will help solving cases in our code where the owner (or sometimes
even the owner of the owner) of a random PointerRNA needs to be
accessed. Current solution mainly relies on linear search from the owner
ID, which is sub-optimal at best, and may not even be possible in case a
same data is shared between different owners.

This lead to refactoring quite a bit of existing PointerRNA creation code.

At a high level (i.e. expected usages outside of RNA internals):
* Add `RNA_pointer_create_with_parent` and
  `RNA_pointer_create_id_subdata` to create RNA pointers with
  ancestors info.
* `RNA_id_pointer_create` and `RNA_main_pointer_create` remain
  unchanged, as they should never have ancestors currently.
* Add `RNA_pointer_create_from_ancestor` to re-create a RNA pointer
  from the nth ancestor of another PointerRNA.
* Add basic python API to access this new ancestors data.
* Update internal RNA/bpy code to handle ancestors generation in most
  common generic cases.
  - The most verbose change here is for collection code, as the owner of the
    collection property is now passed around, to allow collection items to get
    a valid ancestors chain.

Internally:
* `PointerRNA` now has an array of `AncestorPointerRNA` data to store
  the ancestors.
* `PointerRNA` now has constructors that take care of setting its data for
  most usual cases, including handling of the ancestor array data.
* Pointer type refining has been fully factorized into a small utils,
  `rna_pointer_refine`, that is now used from all code doing that operation.
* `rna_pointer_inherit_refine` has been replaced by
  `rna_pointer_create_with_ancestors` as the core function taking care of
  creating pointers with valid ancestors info.
  - Its usage outside of `rna_access` has been essentially reduced to custom
    collection lookup callbacks.

Implements #122431.

--------------

Some notes:
* The goal of this commit is _not_ to fully cover all cases creating
  PointerRNA that should also store the ancestors' chain info. It only
  tackles the most generic code paths (in bpyrna and RNA itself mainly).
  The remaining 'missing cases' can be tackle later, as needs be.
* Performances seem to be only marginally affected currently.
* Currently `AncestorPointerRNA` only stores PointerRNA-like data.
  This will help `StructPathFunc` callbacks to more efficiently generate
  an RNA paths when calling e.g. `RNA_path_from_ID_to_property`, but will
  not be enough info to build these paths without these callbacks. And some
  cases may still remain fuzzy. We'd have to add thinks like a `PropertyRNA`
  pointer, and for RNA collection ones, an index and string identifier, to store
  a complete unambiguous 'RNA path' info. This is probably not needed, nor
  worth the extra processing and memory footprint,  for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/122427
2025-02-05 15:45:04 +01:00
Brecht Van Lommel
93d7b85264 Cleanup: Various clang-tidy warnings in makesrna
Pull Request: https://projects.blender.org/blender/blender/pulls/133734
2025-01-31 17:03:18 +01:00
Jacques Lucke
684fd4643a Nodes: use BKE_main_ensure_invariants directly instead of ED_node_tree_propagate_change
`BKE_main_ensure_invariants` was added in 1fae5fd8f6. The older
`ED_node_tree_propagate_change` was already implemented as a thin wrapper around
`BKE_main_ensure_invariants`. This patch removes the wrapper and calls the more
general function directly.

A new overload of `BKE_main_ensure_invariants` is added for the common case when
only a single data-block has been modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133048
2025-01-14 16:26:54 +01:00
Jacques Lucke
038159e96b Refactor: Nodes: improve node tree update API
Main goals of this refactor:
* Make it more obvious which update function should be used.
* Make it more obvious which parameters are required by using references instead
  of pointers.
* Support passing in multiple modified trees instead of just a single one.

No functional changes are expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/132862
2025-01-09 17:00:05 +01:00
Jacques Lucke
db7ff834c9 Refactor: Nodes: remove context argument from propagation function
The part that used the context does not seem to be necessary anymore. If the
given tree has any update tag set, the same notifiers will be sent anyway by the
`tree_changed_fn` callback.

If it turns out that we are now missing some notifier, then we have to change
the caller. It either has to call the proper `BKE_ntree_update_tag_*` function,
or create the notifier directly.

This change helps to generalize the concept of propagating changes in original
data, because the context is rarely available.

Pull Request: https://projects.blender.org/blender/blender/pulls/132810
2025-01-08 19:45:50 +01:00
Aras Pranckevicius
e99252d7fd Refactor: more cleanups and renamed to movie/ffmpeg related files
- All movie related public headers now have MOV_ prefix instead of
  IMB_movie_.
- All movie related public functions now have MOV_ prefix as well,
  instead of IMB_movie_ or IMB_anim_.
- IMB_anim.hh -> MOV_read.hh (also ImBufAnim -> MovieReader), and
  various utility functions not related to playback were split off
  into MOV_util.hh.
- Other function name tweaks for clarity, e.g. IMB_suffix_anim
  -> MOV_set_multiview_suffix and so on.
- All except one usages of MOV_get_fps (nee IMB_anim_get_fps) were
  ultimately just converting returned value into a float. So make
  MOV_get_fps just return that directly. For the (exactly just one)
  place that needs numerator and denominator, have
  MOV_get_fps_num_denom.
- Code comments on the public header functions.
- Removed never-used code paths inside movie timecode proxy building
  file.

It might be easier to review each commit separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/132145
2024-12-20 13:23:08 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Jesse Yurkovich
6385296e56 Fix #127651: Properly load generated UDIM image tiles in Cycles
Since their introduction, generated UDIM images/tiles would not be
loaded in Cycles. In relative recent history 72ab6faf5d added the
ability to track which tiles were still marked as being "generated" and
unsaved. However, that check was never implemented into the Cycles code.

With this PR, these two additional scenarios should now work:
- Properly load pixels if all tiles are generated
- Properly load pixels if a UDIM image has been loaded from a file and
  new generated tiles have been added but not saved yet etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/127673
2024-09-19 00:40:30 +02:00
Philipp Oeser
e7979317ec Fix #122163: Image Editor ImageUser RNA paths incomplete/wrong
Somewhat similar to !125365 (but more specialized for ImageUser), this
PR adds the missing "areas[x].spaces[x]" subpath to an Image Editor
ImageUser.

Pull Request: https://projects.blender.org/blender/blender/pulls/125963
2024-08-07 11:12:47 +02:00
Harley Acheson
bfa36039c2 UI: Add Periods to RNA multi-sentence descriptions
We are now wanting tooltip descriptions to not include a terminal
period unless they are multi-sentence (so internally containing a
period). #125460 removed the automatic addition of the terminal period,
but now we have to manually add them back where needed. This PR removes
the error message shown if these items end in period, and then adds one
for all RNA descriptions that are multi-sentence.

Pull Request: https://projects.blender.org/blender/blender/pulls/125507
2024-08-01 00:55:02 +02:00
Damien Picard
f739d4832e I18n: Extract and disambiguate a few messages
Disambiguate
- "Thickness": use "Material" for EEVEE's thickness material setting.
- "Generated": use "Texture" for texture coordinates, "Image" for
  image source, keep default context for animation keyframe types.

Translate
- Split "Online access required to (check for|install) updates..."
  into 2x2 messages individually translatable.
- "Geometry" input in bake node.
- "New" for the Palette ID: extract it as part of the
   BLT_I18N_MSGID_MULTI_CTXT for "New".

Some issues reported by Gabriel Gazzán and Satoshi Yamasaki.

Pull Request: https://projects.blender.org/blender/blender/pulls/123404
2024-06-26 19:25:22 +02:00
Bastien Montagne
b8a8a97440 RNA: ImageUser path: Add generic 'unresovled' for Screen-owned cases.
E.g. the Image editor can have such an ImageUser data. Ref. #122163.
2024-05-24 14:39:11 +02:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Omar Emara
749768db5b Merge branch 'blender-v4.1-release' 2024-02-13 14:34:13 +02:00
Omar Emara
0c9df3d470 Fix: Image does not update when file path changes
Images do not update in the compositor and other places when their file
path changes or their generated options change. This is because the
compositor relies on depsgraph updates, which weren't tagged in this
case. Fix this by tagging appropriately in RNA.

Pull Request: https://projects.blender.org/blender/blender/pulls/118187
2024-02-13 13:31:49 +01:00
Bastien Montagne
54618dbae3 Cleanup: Make BKE_global.h a Cpp header. 2024-02-10 18:25:14 +01:00
Hans Goudey
a1792e98a4 Cleanup: Use std::string for RNA path functions
Use an optional string instead of a manually allocated char pointer.
Optional is used because sometimes `nullptr` was returned. It's
still inconsistent though, because often "" or ".." was returned
instead.
2024-01-31 13:00:28 -05:00
Hans Goudey
de26427bb1 Cleanup: Move internal RNA headers to C++ 2024-01-31 13:00:28 -05:00
Hans Goudey
99f9084bee Cleanup: Replace some CLAMP macros with C++ functions
Pull Request: https://projects.blender.org/blender/blender/pulls/117460
2024-01-23 21:10:33 +01:00
Campbell Barton
6cc8ac7cb3 Cleanup: rename ImBuf anim & anim_index structs
Rename: anim -> ImBufAnim
Rename: anim_index -> ImBufAnimIndex

There were cases where removing redundant "struct" qualifier caused
a warning since the name of the struct member was also anim.

Use uppercase type name to conform with other types names.

Ref !117394
2024-01-23 20:26:55 +11:00
Aras Pranckevicius
a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Hans Goudey
3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Campbell Barton
e38ff7c06d Cleanup: use C++ comments for disabled code 2023-09-25 17:06:04 +10:00
Hans Goudey
867f99c2af Cleanup: Move depsgraph headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/110816
2023-09-22 03:18:17 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke
cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00
Hans Goudey
ffe4fbe832 Cleanup: Move editors headers to C++
See #103343

Pull Request: https://projects.blender.org/blender/blender/pulls/110820
2023-08-05 02:57:52 +02:00
Hans Goudey
bc8c892c65 Cleanup: Move WM headers to C++
Also move a few more headers that included WM headers.

Pull Request: https://projects.blender.org/blender/blender/pulls/110815
2023-08-04 23:11:22 +02:00
Campbell Barton
81ee130063 Cleanup: use C++ system headers
Apply clang-tidy modernize-deprecated-headers to source/
2023-07-22 11:27:25 +10:00
Campbell Barton
23acedd432 Cleanup: code-comments 2023-07-07 15:11:19 +10:00
Jacques Lucke
3ece6876af RNA: move most rna files to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/109585
2023-07-01 16:38:46 +02:00
Jacques Lucke
422e0c02e9 Cleanup: move more rna files to C++
Also see #103343.

There was one unusual complication due to `openvdb` here. The `BKE_volume.h`
header included `openvdb` but that would not link correctly in rna code. I'm not entirely
sure why any of the openvdb code is actually instantiated, may be an issue in the
`openvdb` headers. The solution is to create a new header that gives access to the
underlying `openvdb` data structure for a `Volume` geometry. This header can't be
included in rna for now, until the linking issues are resolved.

Pull Request: https://projects.blender.org/blender/blender/pulls/109508
2023-06-30 08:49:53 +02:00