Commit: 15bb1b4b45098304bc0443ff489ec735c6254ab7
Author: Antonio Vazquez
Date:   Wed Apr 25 09:54:29 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB15bb1b4b45098304bc0443ff489ec735c6254ab7

WIP: Rename settings function in Draw Manager

===================================================================

M       source/blender/blenkernel/BKE_material.h
M       source/blender/blenkernel/intern/material.c
M       source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M       source/blender/draw/engines/gpencil/gpencil_engine.c
M       source/blender/draw/engines/gpencil/gpencil_geom.c
M       source/blender/makesrna/intern/rna_material.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_material.h 
b/source/blender/blenkernel/BKE_material.h
index 71b07618db1..6658fa152ae 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -79,7 +79,6 @@ enum {
 };
 
 struct Material *give_current_material(struct Object *ob, short act);
-struct GpencilColorData *give_material_gpencil_settings(struct Object *ob, 
short act);
 void assign_material_id(struct ID *id, struct Material *ma, short act);
 void assign_material(struct Object *ob, struct Material *ma, short act, int 
assign_type);
 void assign_matarar(struct Object *ob, struct Material ***matar, short totcol);
@@ -88,6 +87,8 @@ short BKE_object_material_slot_find_index(struct Object *ob, 
struct Material *ma
 bool  BKE_object_material_slot_add(struct Object *ob);
 bool  BKE_object_material_slot_remove(struct Object *ob);
 
+struct GpencilColorData *BKE_material_gpencil_settings_get(struct Object *ob, 
short act);
+
 void BKE_texpaint_slot_refresh_cache(struct Scene *scene, struct Material *ma);
 void BKE_texpaint_slots_refresh_object(struct Scene *scene, struct Object *ob);
 
diff --git a/source/blender/blenkernel/intern/material.c 
b/source/blender/blenkernel/intern/material.c
index 52d853f7b58..5df1867b7a9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -523,7 +523,7 @@ Material *give_current_material(Object *ob, short act)
        return ma;
 }
 
-GpencilColorData *give_material_gpencil_settings(Object *ob, short act)
+GpencilColorData *BKE_material_gpencil_settings_get(Object *ob, short act)
 {
        Material *ma = give_current_material(ob, act);
        if (ma != NULL) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c 
b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index ed092f4974e..85ecccab7bd 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -317,7 +317,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache 
*cache, DRWShadingGroup *
        Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
        const float tintcolor[4], const bool onion, const bool custonion)
 {
-       GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+       GpencilColorData *gpcolor = BKE_material_gpencil_settings_get(ob, 
gps->mat_nr + 1);
        if (gps->totpoints >= 3) {
                float tfill[4];
                /* set color using palette, tint color and opacity */
@@ -354,7 +354,7 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache 
*cache, DRWShadingGroup
        float tcolor[4];
        float ink[4];
        short sthickness;
-       GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+       GpencilColorData *gpcolor = BKE_material_gpencil_settings_get(ob, 
gps->mat_nr + 1);
 
        /* set color using base color, tint color and opacity */
        if (!onion) {
@@ -398,7 +398,7 @@ static void gpencil_add_editpoints_shgroup(
                GPENCIL_StorageList *stl, GpencilBatchCache *cache,ToolSettings 
*ts, Object *ob, 
                bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps)
 {
-       GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+       GpencilColorData *gpcolor = BKE_material_gpencil_settings_get(ob, 
gps->mat_nr + 1);
 
        if (GPENCIL_ANY_EDIT_MODE(gpd)) {
                const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -450,7 +450,7 @@ static void gpencil_draw_onion_strokes(GpencilBatchCache 
*cache, GPENCIL_e_data
 
        for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
                
-               GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+               GpencilColorData *gpcolor = 
BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
                copy_v4_v4(gps->tmp_rgb, gpcolor->rgb);
                copy_v4_v4(gps->tmp_fill, gpcolor->fill);
 
@@ -533,7 +533,7 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, 
GPENCIL_e_data *e_dat
                        continue;
                }
 
-               GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+               GpencilColorData *gpcolor = 
BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
 
                /* be sure recalc all chache in source stroke to avoid 
recalculation when frame change 
                 * and improve fps */
@@ -637,7 +637,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data 
*e_data, void *vedata, T
        /* if the brush has a palette and color defined, use these and not 
current defaults */
        //TODO: BKE_gpencil_get_color_from_brush(gpd, brush, false);
        if (gpcolor == NULL) {
-               gpcolor = give_material_gpencil_settings(ob, ob->actcol);
+               gpcolor = BKE_material_gpencil_settings_get(ob, ob->actcol);
        }
        
        /* drawing strokes */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c 
b/source/blender/draw/engines/gpencil/gpencil_engine.c
index d296a99b850..90e6b799b52 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -389,7 +389,7 @@ static void GPENCIL_cache_init(void *vedata)
                                gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
                        }
                }
-               GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
ob->actcol);
+               GpencilColorData *gpcolor = 
BKE_material_gpencil_settings_get(ob, ob->actcol);
 
                if (gpcolor) {
                        stl->storage->stroke_style = gpcolor->stroke_style;
diff --git a/source/blender/draw/engines/gpencil/gpencil_geom.c 
b/source/blender/draw/engines/gpencil/gpencil_geom.c
index 70ccf415f2b..5628acc0b9b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_geom.c
+++ b/source/blender/draw/engines/gpencil/gpencil_geom.c
@@ -393,7 +393,7 @@ bool gpencil_can_draw_stroke(struct Object *ob, const 
bGPDstroke *gps, const boo
        if ((gps->points == NULL) || (gps->totpoints < 1))
                return false;
 
-       GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+       GpencilColorData *gpcolor = BKE_material_gpencil_settings_get(ob, 
gps->mat_nr + 1);
 
        /* check if the color is visible */
        if ((gps->palette == NULL) || (gpcolor == NULL) ||
@@ -576,7 +576,7 @@ static void gpencil_set_fill_point(
 /* recalc the internal geometry caches for fill and uvs */
 void DRW_gpencil_recalc_geometry_caches(Object *ob, bGPDstroke *gps) {
        if (gps->flag & GP_STROKE_RECALC_CACHES) {
-               GpencilColorData *gpcolor = give_material_gpencil_settings(ob, 
gps->mat_nr + 1);
+               GpencilColorData *gpcolor = 
BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
 
                /* Calculate triangles cache for filling area (must be done 
only after changes) */
                if ((gps->tot_triangles == 0) || (gps->triangles == NULL)) {
diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 3c5b63db228..f445be02b34 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -92,7 +92,7 @@ static void rna_Material_update(Main *UNUSED(bmain), Scene 
*UNUSED(scene), Point
        Material *ma = ptr->id.data;
 
        DEG_id_tag_update(&ma->id, 0);
-       WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
+       WM_main_add_notifier(NC_MATERIAL | ND_SHADING | NC_GPENCIL, ma);
 }
 
 static void rna_Material_update_previews(Main *UNUSED(bmain), Scene 
*UNUSED(scene), PointerRNA *ptr)

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to