Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c15
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
index 9ea146c77f2..818effc98bb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c
@@ -40,6 +40,8 @@
#include "MOD_gpencil_modifiertypes.h"
#include "MOD_gpencil_util.h"
+#include "DEG_depsgraph_query.h"
+
void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[])
{
#define INIT_GP_TYPE(typeName) \
@@ -73,7 +75,7 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[])
/* verify if valid layer, material and pass index */
bool is_stroke_affected_by_modifier(Object *ob,
char *mlayername,
- const Material *material,
+ Material *material,
const int mpassindex,
const int gpl_passindex,
const int minpoints,
@@ -84,8 +86,8 @@ bool is_stroke_affected_by_modifier(Object *ob,
const bool inv3,
const bool inv4)
{
- Material *ma = BKE_gpencil_material(ob, gps->mat_nr + 1);
- MaterialGPencilStyle *gp_style = ma->gp_style;
+ Material *ma_gps = BKE_gpencil_material(ob, gps->mat_nr + 1);
+ MaterialGPencilStyle *gp_style = ma_gps->gp_style;
/* omit if filter by layer */
if (mlayername[0] != '\0') {
@@ -102,13 +104,16 @@ bool is_stroke_affected_by_modifier(Object *ob,
}
/* Omit if filter by material. */
if (material != NULL) {
+ /* Requires to use the original material to compare the same pointer address. */
+ Material *ma_md_orig = (Material *)DEG_get_original_id(&material->id);
+ Material *ma_gps_orig = (Material *)DEG_get_original_id(&ma_gps->id);
if (inv4 == false) {
- if (material != ma) {
+ if (ma_md_orig != ma_gps_orig) {
return false;
}
}
else {
- if (material == ma) {
+ if (ma_md_orig == ma_gps_orig) {
return false;
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
index 2878ad4c73a..30e54f44499 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h
@@ -31,7 +31,7 @@ struct bGPDstroke;
bool is_stroke_affected_by_modifier(struct Object *ob,
char *mlayername,
- const struct Material *material,
+ struct Material *material,
const int mpassindex,
const int gpl_passindex,
const int minpoints,