From 22f01f4761bb3918ff0bc8162944493a2ac18016 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 27 Jan 2010 11:56:14 +0000 Subject: [PATCH] Bugfix #20845: Grease Pencil settings lack view refresh Added updates to Grease Pencil RNA data, and added appropriate listeners to 3D-View and Nodes Editors that were previously missing too. --- source/blender/editors/space_node/space_node.c | 4 ++++ .../blender/editors/space_view3d/space_view3d.c | 4 ++++ source/blender/makesrna/intern/rna_gpencil.c | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 40f7f56bf21..125c669cd4c 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -312,6 +312,10 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn) if(wmn->data==ND_SPACE_NODE) ED_region_tag_redraw(ar); break; + case NC_SCREEN: + if(wmn->data == ND_GPENCIL) + ED_region_tag_redraw(ar); + break; case NC_SCENE: case NC_MATERIAL: case NC_TEXTURE: diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8f28cf11aac..999673f2ce4 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -598,6 +598,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) if(wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; + case NC_SCREEN: + if(wmn->data == ND_GPENCIL) + ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 30591efc481..40e0c316cc1 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -35,6 +35,8 @@ #include "MEM_guardedalloc.h" +#include "WM_types.h" + #ifdef RNA_RUNTIME static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) @@ -81,11 +83,13 @@ static void rna_def_gpencil_stroke_point(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "x"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Coordinates", ""); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pressure"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Pressure", "Pressure of tablet at point when drawing it."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); } static void rna_def_gpencil_stroke(BlenderRNA *brna) @@ -168,55 +172,65 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Color", "Color that all sketches in this layer are drawn with."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "color[3]"); RNA_def_property_range(prop, 0.3, 1.0f); RNA_def_property_ui_text(prop, "Opacity", "Visibility of strokes."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); /* Line Thickness */ prop= RNA_def_property(srna, "line_thickness", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "thickness"); RNA_def_property_range(prop, 1, 10); RNA_def_property_ui_text(prop, "Thickness", "Thickness of strokes (in pixels)."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); /* Onion-Skinning */ prop= RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN); RNA_def_property_ui_text(prop, "Use Onion Skinning", "Ghost frames on either side of frame."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "max_ghost_range", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gstep"); RNA_def_property_range(prop, 0, 120); RNA_def_property_ui_text(prop, "Max Ghost Range", "Maximum number of frames on either side of the active frame to show. (0 = just show the 'first' available sketch on either side)"); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); /* Flags */ prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE); RNA_def_property_ui_text(prop, "Hide", "Layer doesn't get drawn."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "locked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED); RNA_def_property_ui_text(prop, "Locked", "Layer is protected from further editing and/or frame changes."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "frame_lock", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK); RNA_def_property_ui_text(prop, "Frame Locked", "Current frame displayed by layer cannot be changed."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE); RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set"); RNA_def_property_ui_text(prop, "Active", "Layer is 'active' layer being edited."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT); RNA_def_property_ui_text(prop, "Selected", "Layer is selected for editing in the DopeSheet."); + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); // XXX keep this option? prop= RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG); RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)."); - + RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL); } static void rna_def_gpencil_data(BlenderRNA *brna)