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
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-04-07 18:02:13 +0300
committerAntonioya <blendergit@gmail.com>2019-04-07 18:02:13 +0300
commit75f551facaf0a103b169ccc955b57099bd33a16a (patch)
tree3cde3d8a4e814bbb3049cf3266eb3a85ba177c44 /source
parent13eb2e964014e2d8bd02767cc91baf92b93c9611 (diff)
GPencil: Fix wrong Brush texture for pinned materials
If the Brush had a pinned material with texture, but the material slot was in a different material, the texture was not working. The material was not recovered from brush, but from object.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 3a74e44836d..c5546a55dda 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -22,8 +22,10 @@
#include "DRW_engine.h"
#include "DRW_render.h"
+#include "BKE_gpencil.h"
#include "BKE_library.h"
#include "BKE_object.h"
+#include "BKE_paint.h"
#include "BKE_shader_fx.h"
#include "DNA_gpencil_types.h"
@@ -302,7 +304,9 @@ void GPENCIL_cache_init(void *vedata)
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
+ ToolSettings *ts = scene->toolsettings;
View3D *v3d = draw_ctx->v3d;
+ Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
/* Special handling for when active object is GP object (e.g. for draw mode) */
Object *obact = draw_ctx->obact;
@@ -311,7 +315,15 @@ void GPENCIL_cache_init(void *vedata)
if (obact && (obact->type == OB_GPENCIL) && (obact->data)) {
obact_gpd = (bGPdata *)obact->data;
- gp_style = BKE_material_gpencil_settings_get(obact, obact->actcol);
+ /* use the brush material */
+ Material *ma = BKE_gpencil_get_material_for_brush(obact, brush);
+ if (ma != NULL) {
+ gp_style = ma->gp_style;
+ }
+ /* this is not common, but avoid any special situations when brush could be without material */
+ if (gp_style == NULL) {
+ gp_style = BKE_material_gpencil_settings_get(obact, obact->actcol);
+ }
}
if (!stl->g_data) {