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
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-08-31 21:37:38 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-08-31 22:00:30 +0300
commit333feea6e9450379f5314f327cf1ac1aef6d8a07 (patch)
tree733c5da53fbae58268a4c1d68beb2fc383ad5187 /source/blender/makesrna/intern/rna_main_api.c
parent0018483dfaf96af569fad40bed6f47389ef3358f (diff)
Fix T45258, impossible to select brush when removing it from 2d
painting. Also system added a brush every time it found no paint brush in the system which is not what we would want. Solution: * Brush panel stays visible always, regardless of whether there is a brush or not. * We search for first available brush when we find no brush in paint struct instead of always generating a new one. * Generating and searching for a brush take a mode argument now. Needed some refactoring to users of BKE_paint_init as well. * Did some style cleanups for paint mode enums. Patch is big but it's mostly argument refactoring.
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 9ccff3eb1fa..b38f4fa67b6 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -36,6 +36,7 @@
#include "DNA_ID.h"
#include "DNA_modifier_types.h"
#include "DNA_space_types.h"
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
@@ -88,7 +89,6 @@
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
-#include "DNA_object_types.h"
#include "DNA_speaker_types.h"
#include "DNA_sound_types.h"
#include "DNA_text_types.h"
@@ -483,12 +483,13 @@ static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRN
}
}
-static Brush *rna_Main_brushes_new(Main *bmain, const char *name)
+static Brush *rna_Main_brushes_new(Main *bmain, const char *name, int mode)
{
- Brush *brush = BKE_brush_add(bmain, name);
+ Brush *brush = BKE_brush_add(bmain, name, mode);
id_us_min(&brush->id);
return brush;
}
+
static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr)
{
Brush *brush = brush_ptr->data;
@@ -1422,6 +1423,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new brush to the main database");
parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm = RNA_def_enum(func, "mode", object_mode_items, OB_MODE_TEXTURE_PAINT, "", "Paint Mode for the new brush");
/* return type */
parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
RNA_def_function_return(func, parm);