Revision: 49011
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49011
Author: vino
Date: 2012-07-17 21:59:20 +0000 (Tue, 17 Jul 2012)
Log Message:
-----------
Created floating buttons for changing the edit selection mode, vert edge or
face. These buttons work similar to the manipulator buttons in that pressing
one shuts off the others, unless shift is down.
Modified Paths:
--------------
branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_scene.c
branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c
Modified:
branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
2012-07-17 20:56:01 UTC (rev 49010)
+++ branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d.py
2012-07-17 21:59:20 UTC (rev 49011)
@@ -2711,6 +2711,7 @@
def draw(self, context):
view = context.space_data
+ tools = context.tool_settings
if bpy.context.user_preferences.edit.floating_controls == 'BOTTOM' or
bpy.context.user_preferences.edit.floating_controls == 'TOP':
layout = self.layout
@@ -2725,6 +2726,13 @@
row.prop(view, "use_manipulator_rotate", text="", icon='MAN_ROT',
clearfield=True)
row.prop(view, "use_manipulator_scale", text="", icon='MAN_SCALE',
clearfield=True)
+ if bpy.context.object.mode == 'EDIT':
+ row.separator()
+
+ row.prop(tools, "use_select_vertex", text="", clearfield=True)
+ row.prop(tools, "use_select_edge", text="", clearfield=True)
+ row.prop(tools, "use_select_face", text="", clearfield=True)
+
elif bpy.context.user_preferences.edit.floating_controls == 'LEFT' or
bpy.context.user_preferences.edit.floating_controls == 'RIGHT':
layout = self.layout
@@ -2740,8 +2748,16 @@
column.prop(view, "use_manipulator_rotate", text="",
icon='MAN_ROT', clearfield=True)
column.prop(view, "use_manipulator_scale", text="",
icon='MAN_SCALE', clearfield=True)
+ if bpy.context.object.mode == 'EDIT':
+ column.separator()
+
+ column.prop(tools, "use_select_vertex", text="",
clearfield=True)
+ column.prop(tools, "use_select_edge", text="", clearfield=True)
+ column.prop(tools, "use_select_face", text="", clearfield=True)
+
+
def register():
bpy.utils.register_module(__name__)
Modified: branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_scene.c
2012-07-17 20:56:01 UTC (rev 49010)
+++ branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_scene.c
2012-07-17 21:59:20 UTC (rev 49011)
@@ -1220,6 +1220,87 @@
}
}
+static void rna_Scene_editmesh_use_select_vertex_set(PointerRNA *ptr, int
value)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ BMEditMesh *em = NULL;
+
+ if (value)
+ ts->selectmode |= SCE_SELECT_VERTEX;
+ else
+ ts->selectmode &= ~SCE_SELECT_VERTEX;
+
+ if (scene->basact && scene->basact->object &&
scene->basact->object->type == OB_MESH) {
+ em = BMEdit_FromObject(scene->basact->object);
+ }
+
+ if (em) {
+ em->selectmode = ts->selectmode;
+ EDBM_selectmode_set(em);
+ }
+}
+
+static void rna_Scene_editmesh_use_select_edge_set(PointerRNA *ptr, int value)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ BMEditMesh *em = NULL;
+
+ if (value)
+ ts->selectmode |= SCE_SELECT_EDGE;
+ else
+ ts->selectmode &= ~SCE_SELECT_EDGE;
+
+ if (scene->basact && scene->basact->object &&
scene->basact->object->type == OB_MESH) {
+ em = BMEdit_FromObject(scene->basact->object);
+ }
+
+ if (em) {
+ em->selectmode = ts->selectmode;
+ EDBM_selectmode_set(em);
+ }
+}
+
+static void rna_Scene_editmesh_use_select_face_set(PointerRNA *ptr, int value)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ BMEditMesh *em = NULL;
+
+ if (value)
+ ts->selectmode |= SCE_SELECT_FACE;
+ else
+ ts->selectmode &= ~SCE_SELECT_FACE;
+
+ if (scene->basact && scene->basact->object &&
scene->basact->object->type == OB_MESH) {
+ em = BMEdit_FromObject(scene->basact->object);
+ }
+
+ if (em) {
+ em->selectmode = ts->selectmode;
+ EDBM_selectmode_set(em);
+ }
+}
+
+static void rna_Scene_editmesh_use_select_mode_clear(PointerRNA *ptr)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ BMEditMesh *em = NULL;
+
+ ts->selectmode = 0;
+
+ if (scene->basact && scene->basact->object &&
scene->basact->object->type == OB_MESH) {
+ em = BMEdit_FromObject(scene->basact->object);
+ }
+
+ if (em) {
+ em->selectmode = ts->selectmode;
+ EDBM_selectmode_set(em);
+ }
+}
+
static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene
*scene, PointerRNA *UNUSED(ptr))
{
Mesh *me = NULL;
@@ -1727,6 +1808,27 @@
RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh
elements selection works on");
RNA_def_property_update(prop, 0,
"rna_Scene_editmesh_select_mode_update");
+ prop = RNA_def_property(srna, "use_select_vertex", PROP_BOOLEAN,
PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selectmode",
SCE_SELECT_VERTEX);
+ RNA_def_property_boolean_funcs(prop, NULL,
"rna_Scene_editmesh_use_select_vertex_set",
"rna_Scene_editmesh_use_select_mode_clear");
+ RNA_def_property_ui_text(prop, "Vertex", "Edit vertices. Shift-click
for multiple modes");
+ RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_select_edge", PROP_BOOLEAN,
PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selectmode",
SCE_SELECT_EDGE);
+ RNA_def_property_boolean_funcs(prop, NULL,
"rna_Scene_editmesh_use_select_edge_set",
"rna_Scene_editmesh_use_select_mode_clear");
+ RNA_def_property_ui_text(prop, "Edge", "Edit edges. Shift-click for
multiple modes");
+ RNA_def_property_ui_icon(prop, ICON_EDGESEL, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_select_face", PROP_BOOLEAN,
PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selectmode",
SCE_SELECT_FACE);
+ RNA_def_property_boolean_funcs(prop, NULL,
"rna_Scene_editmesh_use_select_face_set",
"rna_Scene_editmesh_use_select_mode_clear");
+ RNA_def_property_ui_text(prop, "Face", "Edit faces. Shift-click for
multiple modes");
+ RNA_def_property_ui_icon(prop, ICON_FACESEL, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT,
PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign
in vertex groups");
Modified: branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c
2012-07-17 20:56:01 UTC (rev 49010)
+++ branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c
2012-07-17 21:59:20 UTC (rev 49011)
@@ -1657,19 +1657,19 @@
prop = RNA_def_property(srna, "use_manipulator_translate",
PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "twtype",
V3D_MANIP_TRANSLATE);
- RNA_def_property_ui_text(prop, "Manipulator Translate", "Translation
manipulator. Shift-click for multiple modes.");
+ RNA_def_property_ui_text(prop, "Manipulator Translate", "Translation
manipulator. Shift-click for multiple modes");
RNA_def_property_ui_icon(prop, ICON_MAN_TRANS, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN,
PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE);
- RNA_def_property_ui_text(prop, "Manipulator Rotate", "Rotation
manipulator. Shift-click for multiple modes.");
+ RNA_def_property_ui_text(prop, "Manipulator Rotate", "Rotation
manipulator. Shift-click for multiple modes");
RNA_def_property_ui_icon(prop, ICON_MAN_ROT, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
prop = RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN,
PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE);
- RNA_def_property_ui_text(prop, "Manipulator Scale", "Scaling
manipulator. Shift-click for multiple modes.");
+ RNA_def_property_ui_text(prop, "Manipulator Scale", "Scaling
manipulator. Shift-click for multiple modes");
RNA_def_property_ui_icon(prop, ICON_MAN_SCALE, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs