diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-12-03 14:09:20 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-12-03 14:09:47 +0300 |
commit | a51f7c8a50c8dd0858577957fc6a7fe7f48278a0 (patch) | |
tree | ac39a3d8c5e66bd6c771dc40b2a66d83f0ecf300 /source/blender/makesrna/intern/rna_gpencil.c | |
parent | d6fe8cea736957fc8ef8164159d555e1d1b7cfe8 (diff) |
Fix T72134: Adaptive UVs does not affect strokes that are already drawn
Now when change the setting the strokes are recalculated.
To do this, it was necessary to move the UV recalc to BKE module in order to share with Draw Engine. If the recalc it was done in draw engine, the factor was only calculated for evaluated version and there was a problem when draw a new sytroke.
Now, the RNA parameter recalc the original datablock instead of tag for be calculated in Draw Engine.
Diffstat (limited to 'source/blender/makesrna/intern/rna_gpencil.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 2601600c6ee..46317a30b19 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -167,32 +167,23 @@ static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *UNUSED(scene WM_main_add_notifier(NC_SCENE | ND_MODE | NC_MOVIECLIP, NULL); } -static void UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain, - Scene *scene, - PointerRNA *ptr) +/* Recalc UVs and Fill for all strokes. */ +static void rna_GPencil_strokes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bGPdata *gpd = (bGPdata *)ptr->owner_id; - bGPDlayer *gpl; - bool enabled = false; - - /* Ensure that the data-block's onion-skinning toggle flag - * stays in sync with the status of the actual layers - */ - for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - if (gpl->onion_flag & GP_LAYER_ONIONSKIN) { - enabled = true; + if (gpd) { + for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { + for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { + for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { + BKE_gpencil_triangulate_stroke_fill(gpd, gps); + } + } } } - if (enabled) { - gpd->flag |= GP_DATA_SHOW_ONIONSKINS; - } - else { - gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; - } - /* Now do standard updates... */ - rna_GPencil_update(bmain, scene, ptr); + DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); + WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } /* Poll Callback to filter GP Datablocks to only show those for Annotations */ @@ -1781,7 +1772,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_UV_ADAPTIVE); RNA_def_property_ui_text( prop, "Adaptive UV", "Automatic UVs are calculated depending of the stroke size"); - RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); + RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_strokes_update"); prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS); |