Commit: af3d7123c9721bc0e53432528839a32ed5da920b
Author: Bastien Montagne
Date: Wed Jun 16 16:03:35 2021 +0200
Branches: master
https://developer.blender.org/rBaf3d7123c9721bc0e53432528839a32ed5da920b
ShaderFX/LibOverride: Add `BKE_shaderfx_is_nonlocal_in_liboverride` util.
Used to detect if a shaderfx is purely local, or comes from linked data,
in case of a liboverride.
Not actually used yet since we do not currently support adding
shaderfx's to overrides, but will be in the future, and matches
constraints and modifiers code.
===================================================================
M source/blender/blenkernel/BKE_shader_fx.h
M source/blender/blenkernel/intern/shader_fx.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_shader_fx.h
b/source/blender/blenkernel/BKE_shader_fx.h
index e385f77565b..7e3783a3ee9 100644
--- a/source/blender/blenkernel/BKE_shader_fx.h
+++ b/source/blender/blenkernel/BKE_shader_fx.h
@@ -160,6 +160,8 @@ void BKE_shaderfx_free_ex(struct ShaderFxData *fx, const
int flag);
void BKE_shaderfx_free(struct ShaderFxData *fx);
bool BKE_shaderfx_unique_name(struct ListBase *shaderfx, struct ShaderFxData
*fx);
bool BKE_shaderfx_depends_ontime(struct ShaderFxData *fx);
+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);
diff --git a/source/blender/blenkernel/intern/shader_fx.c
b/source/blender/blenkernel/intern/shader_fx.c
index 3727ec866ca..60f0b744e59 100644
--- a/source/blender/blenkernel/intern/shader_fx.c
+++ b/source/blender/blenkernel/intern/shader_fx.c
@@ -164,6 +164,18 @@ const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType
type)
return NULL;
}
+/**
+ * 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 Object *ob, const
ShaderFxData *shaderfx)
+{
+ return (ID_IS_OVERRIDE_LIBRARY(ob) &&
+ ((shaderfx == NULL) || (shaderfx->flag &
eShaderFxFlag_OverrideLibrary_Local) == 0));
+}
+
/**
* Get an effect's panel type, which was defined in the #panelRegister
callback.
*
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs