Commit: 3bb345b7c5a146417d7c8af552482acb687d169f
Author: Lukas Tönne
Date:   Fri Dec 14 13:07:16 2018 +0000
Branches: hair_object
https://developer.blender.org/rB3bb345b7c5a146417d7c8af552482acb687d169f

temp: add brushes for hair editing.

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

M       release/scripts/startup/bl_ui/properties_paint_common.py
M       source/blender/editors/screen/screen_context.c
M       source/blender/makesdna/DNA_scene_types.h
M       source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py 
b/release/scripts/startup/bl_ui/properties_paint_common.py
index 1bd95019a45..5d2f979beeb 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -42,6 +42,8 @@ class UnifiedPaintPanel:
             return None
         elif context.particle_edit_object:
             return toolsettings.particle_edit
+        elif context.hair_edit_object:
+            return toolsettings.hair_edit
 
         return None
 
diff --git a/source/blender/editors/screen/screen_context.c 
b/source/blender/editors/screen/screen_context.c
index 1cfe34c86a1..6be1577ef1e 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -82,7 +82,7 @@ const char *screen_context_dir[] = {
        "active_bone", "active_pose_bone",
        "active_base", "active_object", "object", "edit_object",
        "sculpt_object", "vertex_paint_object", "weight_paint_object",
-       "image_paint_object", "particle_edit_object", "uv_sculpt_object",
+       "image_paint_object", "particle_edit_object", "hair_edit_object", 
"uv_sculpt_object",
        "sequences", "selected_sequences", "selected_editable_sequences", /* 
sequencer */
        "gpencil_data", "gpencil_data_owner", /* grease pencil data */
        "visible_gpencil_layers", "editable_gpencil_layers", 
"editable_gpencil_strokes",
@@ -447,6 +447,12 @@ int ed_screen_context(const bContext *C, const char 
*member, bContextDataResult
 
                return 1;
        }
+       else if (CTX_data_equals(member, "hair_edit_object")) {
+               if (obact && (obact->mode & OB_MODE_EDIT) && obact->type == 
OB_HAIR) {
+                       CTX_data_id_pointer_set(result, &obact->id);
+               }
+               return 1;
+       }
        else if (CTX_data_equals(member, "uv_sculpt_object")) {
                /* TODO(campbell): most likely we change rules for uv_sculpt. */
                if (obact && (obact->mode & OB_MODE_EDIT)) {
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index f4d19621925..a1ed7e15bd8 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -917,8 +917,28 @@ typedef enum HairEditFollicleDrawMode {
        HAIR_FOLLICLE_DRAW_AXES,
 } HairEditFollicleDrawMode;
 
+/* HairEditSettings.brushtype */
+typedef enum eHairBrushTypes {
+       HAIR_BRUSH_ADD           = 0,
+
+       /* !!! Update HairEditSettings brush[###]; below !!! */
+       HAIR_BRUSH_TYPE_MAX,
+} eHairBrushTypes;
+
+/* Settings for a hair brush */
+typedef struct HairBrushData {
+       short flag;
+       short size;             /* radius of brush */
+       float strength;         /* strength of effect */
+} HairBrushData;
+
 /* Hair Edit Mode Settings */
 typedef struct HairEditSettings {
+       HairBrushData brush[12];    /* HAIR_BRUSH_TYPE_MAX */
+       void *paintcursor;          /* runtime */
+
+       int brushtype;              /* eHairBrushTypes */
+
        int flag;
        short select_mode;
        short follicle_draw_mode;
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c 
b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 01fec1b84d8..7818dfc3544 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -288,6 +288,18 @@ static void rna_HairEditSettings_update(bContext *C, 
PointerRNA *UNUSED(ptr))
        }
 }
 
+static PointerRNA rna_HairEditSettings_brush_get(PointerRNA *ptr)
+{
+       HairEditSettings *hset = (HairEditSettings *)ptr->data;
+       HairBrushData *brush = NULL;
+
+       if (hset->brushtype >= 0 && hset->brushtype < HAIR_BRUSH_TYPE_MAX) {
+               brush = &hset->brush[hset->brushtype];
+       }
+
+       return rna_pointer_inherit_refine(ptr, &RNA_HairBrush, brush);
+}
+
 static bool rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
 {
        const Paint *paint = ptr->data;
@@ -1233,6 +1245,12 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
        RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
        RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
        RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, 
"rna_HairEditSettings_update");
+
+       prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+       RNA_def_property_struct_type(prop, "HairBrush");
+       RNA_def_property_pointer_funcs(prop, "rna_HairEditSettings_brush_get", 
NULL, NULL, NULL);
+       RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+       RNA_def_property_ui_text(prop, "Brush", "");
 }
 
 static void rna_def_gpencil_sculpt(BlenderRNA *brna)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to