Context: remove active_gpencil_brush
authorCampbell Barton <ideasman42@gmail.com>
Mon, 17 Dec 2018 06:17:43 +0000 (17:17 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 17 Dec 2018 06:17:43 +0000 (17:17 +1100)
We don't have this for other painting modes,
no need for a special case here.

doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_ui/properties_grease_pencil_common.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_context.h
source/blender/blenkernel/intern/context.c
source/blender/editors/screen/screen_context.c
source/blender/windowmanager/intern/wm_operators.c

index 1bba5f1a693052412bb121bdf344572c4e5f8a60..ec2ee39a5e129456ed2fc180c64c75968dae188d 100644 (file)
@@ -984,7 +984,6 @@ context_type_map = {
     # context_member: (RNA type, is_collection)
     "active_base": ("ObjectBase", False),
     "active_bone": ("EditBone", False),
-    "active_gpencil_brush": ("GPencilSculptBrush", False),
     "active_gpencil_frame": ("GreasePencilLayer", True),
     "active_gpencil_layer": ("GPencilLayer", True),
     "active_node": ("Node", False),
index 770133e2514c32e73e89eee0310e8d989cd94b7a..135148af790bebbc08be6933bf6bd1b75d2ba0d7 100644 (file)
@@ -643,7 +643,7 @@ class AddPresetGpencilBrush(AddPresetBase, Operator):
     preset_menu = "VIEW3D_PT_gpencil_brush_presets"
 
     preset_defines = [
-        "brush = bpy.context.active_gpencil_brush",
+        "brush = bpy.context.tool_settings.gpencil_paint.brush",
         "settings = brush.gpencil_settings"
     ]
 
index 32c0aa6ab0bd2a1318ecf7fecaa4bd7aca2a35b6..0f098bcc1292f1331c5df62e49bfa16a23632194 100644 (file)
@@ -45,7 +45,8 @@ def gpencil_stroke_placement_settings(context, layout):
 
 
 def gpencil_active_brush_settings_simple(context, layout):
-    brush = context.active_gpencil_brush
+    tool_settings = context.tool_settings
+    brush = tool_settings.gpencil_paint.brush
     if brush is None:
         layout.label(text="No Active Brush")
         return
@@ -324,10 +325,11 @@ class GreasePencilAppearancePanel:
         layout.use_property_split = True
         layout.use_property_decorate = False
 
+        tool_settings = context.tool_settings
         ob = context.active_object
 
         if ob.mode == 'PAINT_GPENCIL':
-            brush = context.active_gpencil_brush
+            brush = tool_settings.gpencil_paint.brush
             gp_settings = brush.gpencil_settings
 
             sub = layout.column(align=True)
@@ -348,7 +350,7 @@ class GreasePencilAppearancePanel:
                 layout.prop(brush, "cursor_color_add", text="Color")
 
         elif ob.mode in {'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
-            settings = context.tool_settings.gpencil_sculpt
+            settings = tool_settings.gpencil_sculpt
             brush = settings.brush
             tool = settings.sculpt_tool
 
@@ -452,7 +454,6 @@ class GPENCIL_MT_pie_settings_palette(Menu):
         gpd = context.gpencil_data
         gpl = context.active_gpencil_layer
         palcolor = None  # context.active_gpencil_palettecolor
-        # brush = context.active_gpencil_brush
 
         is_editmode = bool(gpd and gpd.use_stroke_edit_mode and context.editable_gpencil_strokes)
 
index b80085503e987389742166710f6d5e429d61cb28..65de2e1c0ff5c15ca1c7110a25fa51643483e785 100644 (file)
@@ -1476,15 +1476,15 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        ts = context.scene.tool_settings
-        settings = ts.gpencil_paint
+        tool_settings = context.scene.tool_settings
+        gpencil_paint = tool_settings.gpencil_paint
 
         row = layout.row()
         col = row.column()
-        col.template_ID_preview(settings, "brush", new="brush.add_gpencil", rows=3, cols=8)
+        col.template_ID_preview(gpencil_paint, "brush", new="brush.add_gpencil", rows=3, cols=8)
 
         col = row.column()
-        brush = context.active_gpencil_brush
+        brush = gpencil_paint.brush
 
         sub = col.column(align=True)
         sub.operator("gpencil.brush_presets_create", icon='HELP', text="")
@@ -1551,7 +1551,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         return brush is not None and brush.gpencil_tool != 'ERASE'
 
     def draw_header_preset(self, context):
@@ -1563,7 +1563,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
 
         if brush is not None:
@@ -1587,11 +1587,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         return brush is not None and brush.gpencil_tool == 'DRAW'
 
     def draw_header(self, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         self.layout.prop(gp_settings, "use_settings_stabilizer", text="")
 
@@ -1601,7 +1601,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_stabilizer(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         layout.active = gp_settings.use_settings_stabilizer
 
@@ -1617,11 +1617,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         return brush is not None and brush.gpencil_tool != 'ERASE'
 
     def draw_header(self, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         self.layout.prop(gp_settings, "use_settings_postprocess", text="")
 
@@ -1631,7 +1631,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         layout.active = gp_settings.use_settings_postprocess
 
@@ -1656,11 +1656,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         return brush is not None and brush.gpencil_tool != 'ERASE'
 
     def draw_header(self, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         self.layout.prop(gp_settings, "use_settings_random", text="")
 
@@ -1670,7 +1670,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
         layout.active = gp_settings.use_settings_random
 
@@ -1691,7 +1691,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         return brush is not None and brush.gpencil_tool != 'ERASE'
 
     @staticmethod
@@ -1709,7 +1709,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):
         layout = self.layout
         layout.use_property_split = True
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
 
         layout.template_curve_mapping(gp_settings, "curve_sensitivity", brush=True)
@@ -1725,7 +1725,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_strength(View3DPanel, Panel):
         layout = self.layout
         layout.use_property_split = True
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
 
         layout.template_curve_mapping(gp_settings, "curve_strength", brush=True)
@@ -1741,7 +1741,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves_jitter(View3DPanel, Panel):
         layout = self.layout
         layout.use_property_split = True
 
-        brush = context.active_gpencil_brush
+        brush = context.tool_settings.gpencil_paint.brush
         gp_settings = brush.gpencil_settings
 
         layout.template_curve_mapping(gp_settings, "curve_jitter", brush=True)
index 246ba5ba5f04f4a76d47f4b846d84ddc9f89cd33..f78740fd03ac3336d47837435d26e8a964473896 100644 (file)
@@ -311,7 +311,6 @@ int CTX_data_visible_pose_bones(const bContext *C, ListBase *list);
 struct bGPdata *CTX_data_gpencil_data(const bContext *C);
 struct bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C);
 struct bGPDframe *CTX_data_active_gpencil_frame(const bContext *C);
-struct Brush *CTX_data_active_gpencil_brush(const bContext *C);
 int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list);
 int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list);
 int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
index a907babd661273b2f4529ad6115a13624685ddb7..1fb8af59c55e20bfe88d9d8f46152529aa11e11f 100644 (file)
@@ -1218,11 +1218,6 @@ bGPDlayer *CTX_data_active_gpencil_layer(const bContext *C)
        return ctx_data_pointer_get(C, "active_gpencil_layer");
 }
 
-Brush *CTX_data_active_gpencil_brush(const bContext *C)
-{
-       return ctx_data_pointer_get(C, "active_gpencil_brush");
-}
-
 bGPDframe *CTX_data_active_gpencil_frame(const bContext *C)
 {
        return ctx_data_pointer_get(C, "active_gpencil_frame");
index 287d0ad37b91de9002b693224630fe5de0e8c6d3..a33bea4d1becd5e69cd55f47aae6f6596add14ef 100644 (file)
@@ -86,7 +86,7 @@ const char *screen_context_dir[] = {
        "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
        "gpencil_data", "gpencil_data_owner", /* grease pencil data */
        "visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes",
-       "active_gpencil_layer", "active_gpencil_frame", "active_gpencil_brush",
+       "active_gpencil_layer", "active_gpencil_frame",
        "active_operator", "selected_editable_fcurves",
        NULL};
 
@@ -578,14 +578,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                        }
                }
        }
-       else if (CTX_data_equals(member, "active_gpencil_brush")) {
-               Brush *brush = BKE_paint_brush(&scene->toolsettings->gp_paint->paint);
-
-               if (brush) {
-                       CTX_data_pointer_set(result, &scene->id, &RNA_Brush, brush);
-                       return 1;
-               }
-       }
        else if (CTX_data_equals(member, "active_gpencil_frame")) {
                /* XXX: see comment for gpencil_data case... */
                bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, sa, scene, obact);
index 439b4d4c75fdea37c14cf3301ec0a6696d0e1157..7c7b953087eae7d9bab44c15a4265d8bc6d06627 100644 (file)
@@ -440,7 +440,6 @@ static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr
                switch (GS(((ID *)ptr->id.data)->name)) {
                        case ID_SCE:
                        {
-                               CTX_TEST_PTR_DATA_TYPE(C, "active_gpencil_brush", RNA_Brush, ptr, CTX_data_active_gpencil_brush(C));
                                CTX_TEST_PTR_ID(C, "scene", ptr->id.data);
                                break;
                        }