bdk-blender/source/blender/imbuf
Jesse Yurkovich b89548add0 Fix #109442: Match previous behavior when loading BC5 DDS images
Prior to using OIIO for image loading, DDS files were hard-coded to
always treat files with BC5/ATI2 compression as normal maps[1].

This basically means that the B channel would be reconstructed from the
R,G channels in a particular way. There is a non-standard header flag
(coming from tools like NVTT and various others) that can also be used
to indicate if such processing should take place, and OIIO understands
that flag and acts appropriately.  However, not all files have that flag
set.

This patch reverts to the hard-coded behavior to match prior versions.
If the user has explicitly set the OIIO environment variable to say
otherwise, we will respect that setting instead.

[1] https://projects.blender.org/blender/blender/src/branch/blender-v3.5-release/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp#L870

Pull Request: blender/blender#109541

Pull Request: blender/blender#109694
2023-07-04 13:55:19 +02:00
..
intern Fix #109442: Match previous behavior when loading BC5 DDS images 2023-07-04 13:55:19 +02:00
CMakeLists.txt Refactor: Convert ImBuf to C++ 2023-05-02 11:32:27 +02:00
IMB_colormanagement.h Refactor: Convert ImBuf to C++ 2023-05-02 11:32:27 +02:00
IMB_imbuf_types.h Cleanup: spelling, use term polygons in polygon callbacks 2023-05-05 09:46:28 +10:00
IMB_imbuf.h Cleanup: disambiguate terms "name", "file" & "str" / "string" 2023-05-03 15:26:14 +10:00
IMB_metadata.h Cleanup: reserve the term 'len' for string length 2023-05-13 17:34:23 +10:00
IMB_moviecache.h Remove "All Rights Reserved" from Blender Foundation copyright code 2023-03-30 10:51:59 +02:00
IMB_openexr.h Fix #109048: RenderLayer.load_from_file does not support multilayer EXR 2023-06-16 18:53:08 +02:00
IMB_thumbs.h Remove "All Rights Reserved" from Blender Foundation copyright code 2023-03-30 10:51:59 +02:00
readme.txt

The following 4 steps to adding a new image format to blender, its
probably easiest to look at the png code for a clean clear example,
animation formats are a bit more complicated but very similar:

Step 1:
create a new file named after the format for example lets say we were
creating an openexr read/writer  use openexr.c
It should contain functions to match the following prototypes:

struct ImBuf *imb_loadopenexr(unsigned char *mem,int size,int flags);
/* Use one of the following depending on what's easier for your file format */
short imb_saveopenexr(struct ImBuf *ibuf, FILE myfile, int flags);
short imb_saveopenexr(struct ImBuf *ibuf, char *myfile, int flags);

/* Used to test if its the correct format
int IMB_is_openexr(void *buf);

Step 2:
Add your hooks to read and write the image format these go in
	writeimage.c and readimage.c  just look at how the others are done

Step 3:
Add in IS_openexr to blender/source/blender/imbuf/IMB_imbuf_types.h
Add in R_openexr to source/blender/makesdna/DNA_scene_types.h

Step 4:
Add your hooks to the gui.
source/blender/src/buttons_scene.c
source/blender/src/toets.c
source/blender/src/writeimage.c

Step 5:
edit the following files:
blender/source/blender/imbuf/intern/util.c
blender/source/blender/src/filesel.c
blender/source/blender/src/screendump.c
and add your extension so that your format gets recognized in the thumbnails.

Step 6:
Alter the build process:
For cmake you need to edit blender/source/blender/imbuf/CMakeLists.txt
and add in your additional files to source_files.
If you have any external library info you will also need to add that
to the various build processes.

Step 7:
Its also good to add your image format to:
makepicstring in blender/source/blender/blenkernel/intern/image.c