[Bf-blender-cvs] [ab144437e26] blender2.8: Fix T59579: Grease Pencil copy buffer loses material information
Antonioya
noreply at git.blender.org
Wed Dec 19 22:57:09 CET 2018
Commit: ab144437e26ae098207cbdaf55b72a07cc52c636
Author: Antonioya
Date: Wed Dec 19 22:56:29 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBab144437e26ae098207cbdaf55b72a07cc52c636
Fix T59579: Grease Pencil copy buffer loses material information
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 916a268dc57..5cfc35d122a 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -871,7 +871,9 @@ GHash *gp_copybuf_validate_colormap(bContext *C)
}
/* Store this mapping (for use later when pasting) */
- BLI_ghash_insert(new_colors, key, ma);
+ if (!BLI_ghash_haskey(new_colors, POINTER_FROM_INT(*key))) {
+ BLI_ghash_insert(new_colors, POINTER_FROM_INT(*key), ma);
+ }
}
gp_strokes_copypastebuf_colors_name_to_material_free(name_to_ma);
@@ -1118,13 +1120,13 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
BLI_addtail(&gpf->strokes, new_stroke);
/* Remap material */
- Material *ma = BLI_ghash_lookup(new_colors, &new_stroke->mat_nr);
+ Material *ma = BLI_ghash_lookup(new_colors, POINTER_FROM_INT(new_stroke->mat_nr));
if ((ma) && (BKE_gpencil_get_material_index(ob, ma) > 0)) {
- gps->mat_nr = BKE_gpencil_get_material_index(ob, ma) - 1;
- CLAMP_MIN(gps->mat_nr, 0);
+ new_stroke->mat_nr = BKE_gpencil_get_material_index(ob, ma) - 1;
+ CLAMP_MIN(new_stroke->mat_nr, 0);
}
else {
- gps->mat_nr = 0; /* only if the color is not found */
+ new_stroke->mat_nr = 0; /* only if the color is not found */
}
}
More information about the Bf-blender-cvs
mailing list