- UV header sync selection vert/edge/face buttons were displayed as 3 tickboxes
authorCampbell Barton <ideasman42@gmail.com>
Sat, 16 Jan 2010 14:31:21 +0000 (14:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 16 Jan 2010 14:31:21 +0000 (14:31 +0000)
- fix for all of them being able to be disabled at once.
- 3D header now uses the rna buttons.

release/scripts/ui/space_image.py
release/scripts/ui/space_view3d.py
source/blender/editors/space_view3d/view3d_header.c
source/blender/makesrna/intern/rna_scene.c

index 894ec60bb64e4d9c4fafdda2e636328ebe819be3..0a8784732a629e334f89bc359f2032487b75c23b 100644 (file)
@@ -30,7 +30,7 @@ class IMAGE_MT_view(bpy.types.Menu):
 
         sima = context.space_data
         # uv = sima.uv_editor
 
         sima = context.space_data
         # uv = sima.uv_editor
-        settings = context.tool_settings
+        toolsettings = context.tool_settings
 
         show_uvedit = sima.show_uvedit
 
 
         show_uvedit = sima.show_uvedit
 
@@ -40,7 +40,7 @@ class IMAGE_MT_view(bpy.types.Menu):
 
         layout.prop(sima, "update_automatically")
         if show_uvedit:
 
         layout.prop(sima, "update_automatically")
         if show_uvedit:
-            layout.prop(settings, "uv_local_view") # Numpad /
+            layout.prop(toolsettings, "uv_local_view") # Numpad /
 
         layout.separator()
 
 
         layout.separator()
 
@@ -201,7 +201,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
         sima = context.space_data
         uv = sima.uv_editor
 
         sima = context.space_data
         uv = sima.uv_editor
-        settings = context.tool_settings
+        toolsettings = context.tool_settings
 
         layout.prop(uv, "snap_to_pixels")
         layout.prop(uv, "constrain_to_image_bounds")
 
         layout.prop(uv, "snap_to_pixels")
         layout.prop(uv, "constrain_to_image_bounds")
@@ -230,8 +230,8 @@ class IMAGE_MT_uvs(bpy.types.Menu):
 
         layout.separator()
 
 
         layout.separator()
 
-        layout.prop_menu_enum(settings, "proportional_editing")
-        layout.prop_menu_enum(settings, "proportional_editing_falloff")
+        layout.prop_menu_enum(toolsettings, "proportional_editing")
+        layout.prop_menu_enum(toolsettings, "proportional_editing_falloff")
 
         layout.separator()
 
 
         layout.separator()
 
@@ -247,7 +247,7 @@ class IMAGE_HT_header(bpy.types.Header):
         sima = context.space_data
         ima = sima.image
         iuser = sima.image_user
         sima = context.space_data
         ima = sima.image
         iuser = sima.image_user
-        settings = context.tool_settings
+        toolsettings = context.tool_settings
 
         # show_render = sima.show_render
         # show_paint = sima.show_paint
 
         # show_render = sima.show_render
         # show_paint = sima.show_paint
@@ -279,22 +279,25 @@ class IMAGE_HT_header(bpy.types.Header):
             uvedit = sima.uv_editor
 
             layout.prop(uvedit, "pivot", text="", icon_only=True)
             uvedit = sima.uv_editor
 
             layout.prop(uvedit, "pivot", text="", icon_only=True)
-            layout.prop(settings, "uv_sync_selection", text="")
+            layout.prop(toolsettings, "uv_sync_selection", text="")
 
 
-            if settings.uv_sync_selection:
-                layout.prop(settings, "mesh_selection_mode", text="", expand=True)
+            if toolsettings.uv_sync_selection:
+                row = layout.row(align=True)
+                row.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL')
+                row.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL')
+                row.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL')
             else:
             else:
-                layout.prop(settings, "uv_selection_mode", text="", expand=True)
+                layout.prop(toolsettings, "uv_selection_mode", text="", expand=True)
                 layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
 
             row = layout.row(align=True)
                 layout.prop(uvedit, "sticky_selection_mode", text="", icon_only=True)
 
             row = layout.row(align=True)
-            row.prop(settings, "proportional_editing", text="", icon_only=True)
-            if settings.proportional_editing != 'DISABLED':
-                row.prop(settings, "proportional_editing_falloff", text="", icon_only=True)
+            row.prop(toolsettings, "proportional_editing", text="", icon_only=True)
+            if toolsettings.proportional_editing != 'DISABLED':
+                row.prop(toolsettings, "proportional_editing_falloff", text="", icon_only=True)
 
             row = layout.row(align=True)
 
             row = layout.row(align=True)
-            row.prop(settings, "snap", text="")
-            row.prop(settings, "snap_element", text="", icon_only=True)
+            row.prop(toolsettings, "snap", text="")
+            row.prop(toolsettings, "snap_element", text="", icon_only=True)
 
             # mesh = context.edit_object.data
             # row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
 
             # mesh = context.edit_object.data
             # row.prop_object(mesh, "active_uv_layer", mesh, "uv_textures")
@@ -455,24 +458,24 @@ class IMAGE_PT_paint(bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
     def draw(self, context):
         layout = self.layout
 
-        settings = context.tool_settings.image_paint
-        brush = settings.brush
+        toolsettings = context.tool_settings.image_paint
+        brush = toolsettings.brush
         wide_ui = context.region.width > narrowui
 
         col = layout.split().column()
         row = col.row()
         wide_ui = context.region.width > narrowui
 
         col = layout.split().column()
         row = col.row()
-        row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
+        row.template_list(toolsettings, "brushes", toolsettings, "active_brush_index", rows=2)
 
 
-        col.template_ID(settings, "brush", new="brush.add")
+        col.template_ID(toolsettings, "brush", new="brush.add")
 
         if wide_ui:
             sub = layout.row(align=True)
         else:
             sub = layout.column(align=True)
 
         if wide_ui:
             sub = layout.row(align=True)
         else:
             sub = layout.column(align=True)
-        sub.prop_enum(settings, "tool", 'DRAW')
-        sub.prop_enum(settings, "tool", 'SOFTEN')
-        sub.prop_enum(settings, "tool", 'CLONE')
-        sub.prop_enum(settings, "tool", 'SMEAR')
+        sub.prop_enum(toolsettings, "tool", 'DRAW')
+        sub.prop_enum(toolsettings, "tool", 'SOFTEN')
+        sub.prop_enum(toolsettings, "tool", 'CLONE')
+        sub.prop_enum(toolsettings, "tool", 'SMEAR')
 
         if brush:
             col = layout.column()
 
         if brush:
             col = layout.column()
@@ -502,14 +505,14 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
 
     def poll(self, context):
         sima = context.space_data
 
     def poll(self, context):
         sima = context.space_data
-        settings = context.tool_settings.image_paint
-        return sima.show_paint and settings.brush
+        toolsettings = context.tool_settings.image_paint
+        return sima.show_paint and toolsettings.brush
 
     def draw(self, context):
         layout = self.layout
 
 
     def draw(self, context):
         layout = self.layout
 
-        settings = context.tool_settings.image_paint
-        brush = settings.brush
+        toolsettings = context.tool_settings.image_paint
+        brush = toolsettings.brush
 
         layout.prop(brush, "use_airbrush")
         col = layout.column()
 
         layout.prop(brush, "use_airbrush")
         col = layout.column()
@@ -531,14 +534,14 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
 
     def poll(self, context):
         sima = context.space_data
 
     def poll(self, context):
         sima = context.space_data
-        settings = context.tool_settings.image_paint
-        return sima.show_paint and settings.brush
+        toolsettings = context.tool_settings.image_paint
+        return sima.show_paint and toolsettings.brush
 
     def draw(self, context):
         layout = self.layout
 
 
     def draw(self, context):
         layout = self.layout
 
-        settings = context.tool_settings.image_paint
-        brush = settings.brush
+        toolsettings = context.tool_settings.image_paint
+        brush = toolsettings.brush
 
         layout.template_curve_mapping(brush, "curve")
         layout.operator_menu_enum("brush.curve_preset", property="shape")
 
         layout.template_curve_mapping(brush, "curve")
         layout.operator_menu_enum("brush.curve_preset", property="shape")
index 4e394839166ecf00c5acb3a3315a118376a981f8..af0e2ec78793ae509c4f1f9f856ffe4daa84333e 100644 (file)
@@ -30,7 +30,7 @@ class VIEW3D_HT_header(bpy.types.Header):
         mode_string = context.mode
         edit_object = context.edit_object
         obj = context.active_object
         mode_string = context.mode
         edit_object = context.edit_object
         obj = context.active_object
-        toolsettings = context.scene.tool_settings
+        toolsettings = context.tool_settings
 
         row = layout.row()
         row.template_header()
 
         row = layout.row()
         row.template_header()
@@ -56,6 +56,12 @@ class VIEW3D_HT_header(bpy.types.Header):
 
         row.template_header_3D()
 
 
         row.template_header_3D()
 
+        if obj and obj.mode == 'EDIT' and obj.type == 'MESH':
+            row_sub = row.row(align=True)
+            row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=0, icon='VERTEXSEL')
+            row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=1, icon='EDGESEL')
+            row_sub.prop(toolsettings, "mesh_selection_mode", text="", index=2, icon='FACESEL')
+
         # Particle edit
         if obj and obj.mode == 'PARTICLE_EDIT':
             row.prop(toolsettings.particle_edit, "selection_mode", text="", expand=True, toggle=True)
         # Particle edit
         if obj and obj.mode == 'PARTICLE_EDIT':
             row.prop(toolsettings.particle_edit, "selection_mode", text="", expand=True, toggle=True)
index 98f0f2fec65d6c8793c7a2c3229e27a29a1d6d4b..3ef6166bc7c08fcfbe99f3dfb9e84207280a74ce 100644 (file)
@@ -533,17 +533,4 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
                /* Scene lock */
                uiItemR(layout, "", 0, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY);
        }
                /* Scene lock */
                uiItemR(layout, "", 0, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY);
        }
-
-       /* selection modus */
-       if(obedit && (obedit->type == OB_MESH)) {
-               EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-               row= uiLayoutRow(layout, 1);
-               block= uiLayoutGetBlock(row);
-               uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode");
-               uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select mode");
-               uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL, 0,0,XIC,YIC, &em->selectmode, 1.0, 0.0, 0, 0, "Face select mode");
-
-               BKE_mesh_end_editmesh(obedit->data, em);
-       }
 }
 }
index 3d36dbedd191dfb6973fa83341bb729ed6bdcc32..d68ac2ce14ce72c9ae6be03300b1fa73920e7014 100644 (file)
@@ -606,13 +606,15 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
        ToolSettings *ts = (ToolSettings*)ptr->data;
        int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE:0);
 
        ToolSettings *ts = (ToolSettings*)ptr->data;
        int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE:0);
 
-       ts->selectmode = flag;
-
-       if(scene->basact) {
-               Mesh *me= get_mesh(scene->basact->object);
-               if(me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
-                       me->edit_mesh->selectmode= flag;
-                       EM_selectmode_set(me->edit_mesh);
+       if(flag) {
+               ts->selectmode = flag;
+
+               if(scene->basact) {
+                       Mesh *me= get_mesh(scene->basact->object);
+                       if(me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
+                               me->edit_mesh->selectmode= flag;
+                               EM_selectmode_set(me->edit_mesh);
+                       }
                }
        }
 }
                }
        }
 }