Refactor: Move ShaderFX header files to C++

Required for #149789

Pull Request: https://projects.blender.org/blender/blender/pulls/149793
This commit is contained in:
Guillermo Venegas 2025-11-13 15:17:54 +01:00 • committed by Hans Goudey
parent 410e6c20ab
commit deae3086d0
28 changed files with 82 additions and 90 deletions

View file

@ -51,15 +51,15 @@ typedef enum {
} ShaderFxTypeFlag;
typedef void (*ShaderFxIDWalkFunc)(void *user_data,
struct Object *ob,
struct ID **idpoin,
Object *ob,
ID **idpoin,
LibraryForeachIDCallbackFlag cb_flag);
typedef void (*ShaderFxTexWalkFunc)(void *user_data,
struct Object *ob,
struct ShaderFxData *fx,
Object *ob,
ShaderFxData *fx,
const char *propname);
typedef struct ShaderFxTypeInfo {
struct ShaderFxTypeInfo {
/* The user visible name for this effect */
char name[32];
@ -77,21 +77,21 @@ typedef struct ShaderFxTypeInfo {
/* Copy instance data for this effect type. Should copy all user
* level settings to the target effect.
*/
void (*copy_data)(const struct ShaderFxData *fx, struct ShaderFxData *target);
void (*copy_data)(const ShaderFxData *fx, ShaderFxData *target);
/* Initialize new instance data for this effect type, this function
* should set effect variables to their default values.
*
* This function is optional.
*/
void (*init_data)(struct ShaderFxData *fx);
void (*init_data)(ShaderFxData *fx);
/* Free internal effect data variables, this function should
* not free the fx variable itself.
*
* This function is optional.
*/
void (*free_data)(struct ShaderFxData *fx);
void (*free_data)(ShaderFxData *fx);
/* Return a boolean value indicating if this effect is able to be
* calculated based on the effect data. This is *not* regarding the
@ -101,21 +101,20 @@ typedef struct ShaderFxTypeInfo {
*
* This function is optional (assumes never disabled if not present).
*/
bool (*is_disabled)(struct ShaderFxData *fx, bool use_render_params);
bool (*is_disabled)(ShaderFxData *fx, bool use_render_params);
/* Add the appropriate relations to the dependency graph.
*
* This function is optional.
*/
void (*update_depsgraph)(struct ShaderFxData *fx,
const struct ModifierUpdateDepsgraphContext *ctx);
void (*update_depsgraph)(ShaderFxData *fx, const ModifierUpdateDepsgraphContext *ctx);
/* Should return true if the effect needs to be recalculated on time
* changes.
*
* This function is optional (assumes false if not present).
*/
bool (*depends_on_time)(struct ShaderFxData *fx);
bool (*depends_on_time)(ShaderFxData *fx);
/* Should call the given walk function with a pointer to each ID
* pointer (i.e. each data-block pointer) that the effect data
@ -124,18 +123,15 @@ typedef struct ShaderFxTypeInfo {
*
* This function is optional.
*/
void (*foreach_ID_link)(struct ShaderFxData *fx,
struct Object *ob,
ShaderFxIDWalkFunc walk,
void *user_data);
void (*foreach_ID_link)(ShaderFxData *fx, Object *ob, ShaderFxIDWalkFunc walk, void *user_data);
/* Should iterate over every working space color. */
void (*foreach_working_space_color)(ShaderFxData *fx,
const IDTypeForeachColorFunctionCallback &func);
/* Register the panel types for the effect's UI. */
void (*panel_register)(struct ARegionType *region_type);
} ShaderFxTypeInfo;
void (*panel_register)(ARegionType *region_type);
};
#define SHADERFX_TYPE_PANEL_PREFIX "FX_PT_"
@ -151,38 +147,35 @@ void BKE_shaderfx_init(void);
* the defined prefix.
*/
void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname);
void BKE_shaderfx_panel_expand(struct ShaderFxData *fx);
void BKE_shaderfx_panel_expand(ShaderFxData *fx);
const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type);
struct ShaderFxData *BKE_shaderfx_new(int type);
void BKE_shaderfx_free_ex(struct ShaderFxData *fx, int flag);
void BKE_shaderfx_free(struct ShaderFxData *fx);
ShaderFxData *BKE_shaderfx_new(int type);
void BKE_shaderfx_free_ex(ShaderFxData *fx, int flag);
void BKE_shaderfx_free(ShaderFxData *fx);
/**
* Check unique name.
*/
void BKE_shaderfx_unique_name(struct ListBase *shaders, struct ShaderFxData *fx);
bool BKE_shaderfx_depends_ontime(struct ShaderFxData *fx);
void BKE_shaderfx_unique_name(ListBase *shaders, ShaderFxData *fx);
bool BKE_shaderfx_depends_ontime(ShaderFxData *fx);
/**
* Check whether given shaderfx is not local (i.e. from linked data) when the object is a library
* override.
*
* \param shaderfx: May be NULL, in which case we consider it as a non-local shaderfx case.
*/
bool BKE_shaderfx_is_nonlocal_in_liboverride(const struct Object *ob,
const struct ShaderFxData *shaderfx);
struct ShaderFxData *BKE_shaderfx_findby_type(struct Object *ob, ShaderFxType type);
struct ShaderFxData *BKE_shaderfx_findby_name(struct Object *ob, const char *name);
void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst);
void BKE_shaderfx_copydata(struct ShaderFxData *fx, struct ShaderFxData *target);
void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx, struct ShaderFxData *target, int flag);
void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src);
void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *user_data);
bool BKE_shaderfx_is_nonlocal_in_liboverride(const Object *ob, const ShaderFxData *shaderfx);
ShaderFxData *BKE_shaderfx_findby_type(Object *ob, ShaderFxType type);
ShaderFxData *BKE_shaderfx_findby_name(Object *ob, const char *name);
void BKE_shaderfx_copydata_generic(const ShaderFxData *fx_src, ShaderFxData *fx_dst);
void BKE_shaderfx_copydata(ShaderFxData *fx, ShaderFxData *target);
void BKE_shaderfx_copydata_ex(ShaderFxData *fx, ShaderFxData *target, int flag);
void BKE_shaderfx_copy(ListBase *dst, const ListBase *src);
void BKE_shaderfx_foreach_ID_link(Object *ob, ShaderFxIDWalkFunc walk, void *user_data);
/**
* Check if exist grease pencil effects.
*/
bool BKE_shaderfx_has_gpencil(const struct Object *ob);
bool BKE_shaderfx_has_gpencil(const Object *ob);
void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase);
void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader,
struct ListBase *lb,
struct Object *ob);
void BKE_shaderfx_blend_write(BlendWriter *writer, ListBase *fxbase);
void BKE_shaderfx_blend_read_data(BlendDataReader *reader, ListBase *lb, Object *ob);

View file

@ -503,7 +503,7 @@ set(SRC
BKE_scene.hh
BKE_scene_runtime.hh
BKE_screen.hh
BKE_shader_fx.h
BKE_shader_fx.hh
BKE_shrinkwrap.hh
BKE_softbody.h
BKE_sound.hh

View file

@ -122,7 +122,7 @@
#include "BKE_preview_image.hh"
#include "BKE_rigidbody.h"
#include "BKE_scene.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BKE_softbody.h"
#include "BKE_speaker.hh"
#include "BKE_subdiv_ccg.hh"

View file

@ -23,9 +23,9 @@
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "FX_shader_types.h"
#include "FX_shader_types.hh"
#include "BLO_read_write.hh"

View file

@ -85,7 +85,7 @@
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
#include "BKE_scene.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BKE_sound.hh"
#include "BKE_tracking.h"
#include "BKE_volume.hh"

View file

@ -83,7 +83,7 @@
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_rigidbody.h"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BKE_shrinkwrap.hh"
#include "BKE_tracking.h"
#include "BKE_world.h"

View file

@ -16,7 +16,7 @@
#include "BKE_material.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BKE_camera.h"

View file

@ -11,7 +11,7 @@
#include "BLI_listbase.h"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "ED_object.hh"

View file

@ -25,7 +25,7 @@
#include "BKE_lib_id.hh"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View file

@ -28,7 +28,7 @@
#include "BKE_lib_remap.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BLT_translation.hh"

View file

@ -34,7 +34,7 @@
#include "BKE_object.hh"
#include "BKE_particle.h"
#include "BKE_report.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_build.hh"

View file

@ -82,7 +82,7 @@ static const EnumPropertyItem rna_enum_glow_blend_modes_items[] = {
# include <fmt/format.h>
# include "BKE_shader_fx.h"
# include "BKE_shader_fx.hh"
# include "DEG_depsgraph.hh"
# include "DEG_depsgraph_build.hh"

View file

@ -17,7 +17,7 @@ set(INC_SYS
)
set(SRC
intern/FX_shader_util.h
intern/FX_shader_util.hh
intern/FX_ui_common.cc
intern/FX_shader_blur.cc
@ -31,8 +31,8 @@ set(SRC
intern/FX_shader_util.cc
intern/FX_shader_wave.cc
intern/FX_ui_common.h
FX_shader_types.h
intern/FX_ui_common.hh
FX_shader_types.hh
)
set(LIB

View file

@ -8,7 +8,7 @@
#pragma once
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
/* ****************** Type structures for all effects ****************** */

View file

@ -20,8 +20,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -22,8 +22,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -18,8 +18,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -17,15 +17,15 @@
#include "BKE_idtype.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "UI_interface_layout.hh"
#include "UI_resources.hh"
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *md)
{

View file

@ -20,8 +20,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -22,8 +22,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -17,15 +17,15 @@
#include "BKE_lib_query.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "UI_interface_layout.hh"
#include "UI_resources.hh"
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
#include "DEG_depsgraph_build.hh"

View file

@ -14,7 +14,7 @@
#include "BKE_lib_query.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "DNA_screen_types.h"
@ -23,8 +23,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
#include "DEG_depsgraph_build.hh"

View file

@ -6,9 +6,9 @@
* \ingroup shader_fx
*/
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "FX_shader_types.h"
#include "FX_shader_types.hh"
void shaderfx_type_init(ShaderFxTypeInfo *types[])
{

View file

@ -18,8 +18,8 @@
#include "RNA_access.hh"
#include "FX_shader_types.h"
#include "FX_ui_common.h"
#include "FX_shader_types.hh"
#include "FX_ui_common.hh"
static void init_data(ShaderFxData *fx)
{

View file

@ -14,7 +14,7 @@
#include "BKE_context.hh"
#include "BKE_library.hh"
#include "BKE_screen.hh"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
@ -34,7 +34,7 @@
#include "WM_api.hh"
#include "WM_types.hh"
#include "FX_ui_common.h" /* Self include */
#include "FX_ui_common.hh" /* Self include */
/* -------------------------------------------------------------------- */
/** \name Panel Drag and Drop, Expansion Saving

View file

@ -8,7 +8,7 @@
#pragma once
#include "FX_shader_types.h" // IWYU pragma: export
#include "FX_shader_types.hh" // IWYU pragma: export
struct PointerRNA;
struct Panel;
@ -21,13 +21,12 @@ using PanelDrawFn = void (*)(const bContext *, Panel *);
/**
* Draw shaderfx error message.
*/
void shaderfx_panel_end(struct uiLayout *layout, PointerRNA *ptr);
void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr);
/**
* Gets RNA pointers for the active object and the panel's shaderfx data.
*/
struct PointerRNA *shaderfx_panel_get_property_pointers(struct Panel *panel,
struct PointerRNA *r_ob_ptr);
PointerRNA *shaderfx_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr);
/**
* Create a panel in the context's region
@ -40,9 +39,9 @@ PanelType *shaderfx_panel_register(ARegionType *region_type, ShaderFxType type,
* \note To create the panel type's idname, it appends the \a name argument to the \a parent's
* idname.
*/
struct PanelType *shaderfx_subpanel_register(struct ARegionType *region_type,
const char *name,
const char *label,
PanelDrawFn draw_header,
PanelDrawFn draw,
struct PanelType *parent);
PanelType *shaderfx_subpanel_register(ARegionType *region_type,
const char *name,
const char *label,
PanelDrawFn draw_header,
PanelDrawFn draw,
PanelType *parent);

View file

@ -50,7 +50,7 @@
#include "BKE_modifier.hh"
#include "BKE_node.hh"
#include "BKE_particle.h"
#include "BKE_shader_fx.h"
#include "BKE_shader_fx.hh"
#include "BKE_sound.hh"
#include "BKE_vfont.hh"
#include "BKE_volume.hh"