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:
authorAntonioya <blendergit@gmail.com>2018-12-20 00:56:29 +0300
committerAntonioya <blendergit@gmail.com>2018-12-20 00:57:03 +0300
commitab144437e26ae098207cbdaf55b72a07cc52c636 (patch)
tree73d08096560cb3fc422ed10374bcad7071b52d05 /source/blender/editors/gpencil/gpencil_edit.c
parenta9706476e36c073111e01b4ec6544fbb7f471173 (diff)
Fix T59579: Grease Pencil copy buffer loses material information
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c12
1 files changed, 7 insertions, 5 deletions
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 */
}
}