[Bf-blender-cvs] [4486e89de71] greasepencil-object: Add stroke placement 3D Cursor
Antonio Vazquez
noreply at git.blender.org
Fri Jul 7 13:35:27 CEST 2017
Commit: 4486e89de71e03b4a2dc4ec3223796b20b5018dc
Author: Antonio Vazquez
Date: Fri Jul 7 13:35:15 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4486e89de71e03b4a2dc4ec3223796b20b5018dc
Add stroke placement 3D Cursor
Add the option for 3D cursor in list of placement options and not as separated option to make UI more consistent.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index f6f8b845818..bdb00b85061 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -135,10 +135,9 @@ class VIEW3D_HT_header(Header):
if ob.grease_pencil.is_stroke_paint_mode:
row.separator()
row.prop(toolsettings, "gpencil_stroke_placement_view3d", text='')
- if toolsettings.gpencil_stroke_placement_view3d == 'CURSOR':
+ if toolsettings.gpencil_stroke_placement_view3d in('ORIGIN', 'CURSOR'):
row.separator()
row.prop(toolsettings.gpencil_sculpt, "lockaxis", text='')
- row.prop(toolsettings, "use_gpencil_3dcursor")
if toolsettings.gpencil_stroke_placement_view3d in ('SURFACE', 'STROKE'):
row.prop(toolsettings, "use_gpencil_stroke_endpoints")
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 641f5c15e31..b2c6d7a1c29 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1377,6 +1377,8 @@ static bool gp_session_initdata(bContext *C, tGPsdata *p)
if ((!obact) || (obact->type != OB_GPENCIL)) {
obact = ED_add_gpencil_object(C, p->scene, cur);
}
+ /* set grease pencil mode to object */
+ ts->gpencil_src = GP_TOOL_SOURCE_OBJECT;
break;
}
case SPACE_NODE:
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 6bebfa016d8..1c52dfb9f60 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1272,7 +1272,7 @@ void ED_gp_get_drawing_reference(ToolSettings *ts, View3D *v3d, Scene *scene, Ob
}
}
/* use cursor */
- if (ts->gpencil_flags & GP_TOOL_FLAG_USE_3DCURSOR) {
+ if (align_flag & GP_PROJECT_CURSOR) {
/* use 3D-cursor */
copy_v3_v3(vec, fp);
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 91453cc492f..5d28d6e0de4 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -2225,9 +2225,7 @@ typedef enum eGPencil_Flags {
/* When creating new frames, the last frame gets used as the basis for the new one */
GP_TOOL_FLAG_RETAIN_LAST = (1 << 1),
/* Add the strokes below all strokes in the layer */
- GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2),
- /* Add the strokes using 3D cursor location (only for gp objects) */
- GP_TOOL_FLAG_USE_3DCURSOR = (1 << 3)
+ GP_TOOL_FLAG_PAINT_ONBACK = (1 << 2)
} eGPencil_Flags;
/* toolsettings->gpencil_src */
@@ -2250,6 +2248,7 @@ typedef enum eGPencil_Placement_Flags {
/* "Use Endpoints" */
GP_PROJECT_DEPTH_STROKE_ENDPOINTS = (1 << 4),
+ GP_PROJECT_CURSOR = (1 << 5),
} eGPencil_Placement_Flags;
/* toolsettings->particle flag */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index ad263ea9f00..b00312e34ed 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3506,7 +3506,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
};
static EnumPropertyItem gpencil_stroke_placement_items[] = {
- {GP_PROJECT_VIEWSPACE, "CURSOR", ICON_CURSOR, "Origin", "Draw stroke at the Object origin or 3D cursor"},
+ {GP_PROJECT_VIEWSPACE, "ORIGIN", ICON_ROTATECOLLECTION, "Origin", "Draw stroke at Object origin"},
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
// {0, "VIEW", ICON_VISIBLE_IPO_ON, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, "Surface", "Stick stroke to surfaces"},
//{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", ICON_GREASEPENCIL, "Stroke", "Stick stroke to other strokes"},
@@ -3744,12 +3745,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
"When draw new strokes, the new stroke is drawn below of all strokes in the layer");
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
- prop = RNA_def_property(srna, "use_gpencil_3dcursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_USE_3DCURSOR);
- RNA_def_property_ui_text(prop, "Use 3D Cursor",
- "When draw new strokes, use 3D cursor location as origin");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
prop = RNA_def_property(srna, "grease_pencil_source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_src");
RNA_def_property_enum_items(prop, gpencil_source_3d_items);
More information about the Bf-blender-cvs
mailing list