2.5: Various Fixes
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 8 Jul 2009 15:34:41 +0000 (15:34 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 8 Jul 2009 15:34:41 +0000 (15:34 +0000)
* Context panel now draws without header, with arrows, no scene name.
* Softbody vertex group search popup.
* Improve names for autogenerated shortcut keys in menus.
* Make most Select menus in the 3D view header work.
* Fix armature border select selection syncing.
* Add POSE_OT_select_constraint_target,
  MESH_OT_select_by_number_vertices, MESH_OT_select_vertex_path.
* Merge mesh select similar into one operator.
* Don't give MESH_OT_select_random Space hotkey.
* Add DAG_object_flush_update to many mesh edit tools, not calling this
  will crash with modifiers.
* RNA_def_enum_funcs for dynamic enums in operators, but not very useful
  without context yet.
* Fix refresh issue with image window header + editmode.
* Fix drawing of shadow mesh for image painting.
* Remove deprecated uiDefMenuButO and uiDefMenuSep functions.
* Remove keyval.c, code is in wm_keymap.c already.
* Rename WM_operator_redo to WM_operator_props_popup.

42 files changed:
release/ui/buttons_physics_softbody.py
release/ui/buttons_scene.py
release/ui/space_image.py
source/blender/editors/armature/armature_intern.h
source/blender/editors/armature/armature_ops.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poseobject.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/ED_armature.h
source/blender/editors/include/UI_icons.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/keyval.c [deleted file]
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/physics/editparticle.c
source/blender/editors/screen/area.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/util/undo.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/makesdna/DNA_screen_types.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_ui.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_world.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index a4bfae3..774f7f6 100644 (file)
@@ -90,7 +90,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
                        col.itemL(text="Goal Settings:")
                        col.itemR(softbody, "goal_spring", text="Stiffness")
                        col.itemR(softbody, "goal_friction", text="Damping")
-                       layout.itemR(softbody, "goal_vertex_group", text="Vertex Group")
+                       layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group")
 
 class PHYSICS_PT_softbody_edge(PhysicButtonsPanel):
        __idname__ = "PHYSICS_PT_softbody_edge"
index df172ea..7e1f05d 100644 (file)
@@ -274,4 +274,4 @@ bpy.types.register(RENDER_PT_dimensions)
 bpy.types.register(RENDER_PT_antialiasing)
 bpy.types.register(RENDER_PT_shading)
 bpy.types.register(RENDER_PT_output)
-bpy.types.register(RENDER_PT_stamp)
\ No newline at end of file
+bpy.types.register(RENDER_PT_stamp)
index 49ef187..53563e7 100644 (file)
@@ -257,8 +257,6 @@ class IMAGE_HT_header(bpy.types.Header):
                if show_uvedit:
                        uvedit = sima.uv_editor
 
-                       layout.itemS()
-
                        layout.itemR(uvedit, "pivot", text="")
                        layout.itemR(settings, "uv_sync_selection", text="")
 
index 646c75f..1920471 100644 (file)
@@ -60,6 +60,7 @@ void POSE_OT_select_invert(struct wmOperatorType *ot);
 void POSE_OT_select_parent(struct wmOperatorType *ot);
 void POSE_OT_select_hierarchy(struct wmOperatorType *ot);
 void POSE_OT_select_linked(struct wmOperatorType *ot);
+void POSE_OT_select_constraint_target(struct wmOperatorType *ot);
 
 void SKETCH_OT_gesture(struct wmOperatorType *ot);
 void SKETCH_OT_delete(struct wmOperatorType *ot);
index 5c31883..adbfb50 100644 (file)
@@ -153,6 +153,7 @@ void ED_operatortypes_armature(void)
        WM_operatortype_append(POSE_OT_select_parent);
        WM_operatortype_append(POSE_OT_select_hierarchy);
        WM_operatortype_append(POSE_OT_select_linked);
+       WM_operatortype_append(POSE_OT_select_constraint_target);
        
        /* POSELIB */
        WM_operatortype_append(POSELIB_OT_browse_interactive);
@@ -194,14 +195,12 @@ void ED_keymap_armature(wmWindowManager *wm)
 
        kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
-               RNA_boolean_set(kmi->ptr, "extend", 0);
        kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
                RNA_boolean_set(kmi->ptr, "extend", 1);
        
        kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
-               RNA_boolean_set(kmi->ptr, "extend", 0);
        kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
                RNA_boolean_set(kmi->ptr, "extend", 1);
@@ -240,14 +239,12 @@ void ED_keymap_armature(wmWindowManager *wm)
 
        kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
-               RNA_boolean_set(kmi->ptr, "extend", 0);
        kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
                RNA_boolean_set(kmi->ptr, "extend", 1);
        
        kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
-               RNA_boolean_set(kmi->ptr, "extend", 0);
        kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
                RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
                RNA_boolean_set(kmi->ptr, "extend", 1);
index 7155bdd..97bf349 100644 (file)
@@ -110,7 +110,7 @@ static void adduplicate() {}
 /* **************** tools on Editmode Armature **************** */
 
 /* Sync selection to parent for connected children */
-static void armature_sync_selection(ListBase *edbo)
+void ED_armature_sync_selection(ListBase *edbo)
 {
        EditBone *ebo;
        
@@ -1435,7 +1435,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
 
        }
 
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
 
        /* BIF_undo_push("Select connected"); */
 
@@ -1668,7 +1668,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op)
        }
        
        
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
 
        WM_event_add_notifier(C, NC_OBJECT, obedit);
 
@@ -1742,7 +1742,7 @@ void deselectall_armature(Object *obedit, int toggle, int doundo)
                }
        }
        
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        if (doundo) {
                if (sel==1) BIF_undo_push("Select All");
                else BIF_undo_push("Deselect All");
@@ -1814,7 +1814,7 @@ void mouse_armature(bContext *C, short mval[2], int extend)
                                nearBone->flag |= selmask;
                }
                
-               armature_sync_selection(arm->edbo);
+               ED_armature_sync_selection(arm->edbo);
                
                if(nearBone) {
                        /* then now check for active status */
@@ -2246,7 +2246,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *op)
                
        }
        
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
 
        WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, obedit);
        
@@ -2508,7 +2508,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
        if (CTX_DATA_COUNT(C, selected_bones) == 0)
          return OPERATOR_CANCELLED;
        
-       armature_sync_selection(arm->edbo); // XXX why is this needed?
+       ED_armature_sync_selection(arm->edbo); // XXX why is this needed?
 
        preEditBoneDuplicate(arm->edbo);
 
@@ -3058,7 +3058,7 @@ void merge_armature(Scene *scene)
        }
        
        /* undo + updates */
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        BIF_undo_push("Merge Bones");
 }
 
@@ -3080,7 +3080,7 @@ void hide_selected_armature_bones(Scene *scene)
                        }
                }
        }
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        BIF_undo_push("Hide Bones");
 }
 
@@ -3100,7 +3100,7 @@ void hide_unselected_armature_bones(Scene *scene)
                        }
                }
        }
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        BIF_undo_push("Hide Unselected Bones");
 }
 
@@ -3118,7 +3118,7 @@ void show_all_armature_bones(Scene *scene)
                        }
                }
        }
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        BIF_undo_push("Reveal Bones");
 }
 
@@ -3251,7 +3251,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
        if (totbone==0) return OPERATOR_CANCELLED;
        
        /* Transform the endpoints */
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
 
        return OPERATOR_FINISHED;
 }
@@ -3812,7 +3812,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
        }
        CTX_DATA_END;
        
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
 
        /* note, notifier might evolve */
        WM_event_add_notifier(C, NC_OBJECT, ob);
@@ -3963,7 +3963,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
                }
        }
        
-       armature_sync_selection(arm->edbo);
+       ED_armature_sync_selection(arm->edbo);
        
        WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
        
index 281f314..4a70562 100644 (file)
@@ -443,6 +443,65 @@ void pose_select_constraint_target(Scene *scene)
 
 }
 
+static int pose_select_constraint_target_exec(bContext *C, wmOperator *op)
+{
+       Object *ob= CTX_data_active_object(C);
+       bArmature *arm= ob->data;
+       bPoseChannel *pchan;
+       bConstraint *con;
+       int found= 0;
+       
+       for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+               if (arm->layer & pchan->bone->layer) {
+                       if (pchan->bone->flag & (BONE_ACTIVE|BONE_SELECTED)) {
+                               for (con= pchan->constraints.first; con; con= con->next) {
+                                       bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+                                       ListBase targets = {NULL, NULL};
+                                       bConstraintTarget *ct;
+                                       
+                                       if (cti && cti->get_constraint_targets) {
+                                               cti->get_constraint_targets(con, &targets);
+                                               
+                                               for (ct= targets.first; ct; ct= ct->next) {
+                                                       if ((ct->tar == ob) && (ct->subtarget[0])) {
+                                                               bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
+                                                               if(pchanc) {
+                                                                       pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
+                                                                       found= 1;
+                                                               }
+                                                       }
+                                               }
+                                               
+                                               if (cti->flush_constraint_targets)
+                                                       cti->flush_constraint_targets(con, &targets, 1);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       if(!found)
+               return OPERATOR_CANCELLED;
+
+       WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
+
+       return OPERATOR_FINISHED;
+}
+
+void POSE_OT_select_constraint_target(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Select Constraint Target";
+       ot->idname= "POSE_OT_select_constraint_target";
+       
+       /* api callbacks */
+       ot->exec= pose_select_constraint_target_exec;
+       ot->poll= ED_operator_posemode;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 /* ******************* select hierarchy operator ************* */
 
 static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
@@ -453,6 +512,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
        Bone *curbone, *pabone, *chbone;
        int direction = RNA_enum_get(op->ptr, "direction");
        int add_to_sel = RNA_boolean_get(op->ptr, "extend");
+       int found= 0;
        
        for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
                curbone= pchan->bone;
@@ -469,8 +529,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
                                                if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
                                                curbone->flag &= ~BONE_ACTIVE;
                                                pabone->flag |= (BONE_ACTIVE|BONE_SELECTED);
-                                               
-                                               // XXX notifiers need to be sent to other editors to update
+
+                                               found= 1;
                                                break;
                                        }
                                } else { // BONE_SELECT_CHILD
@@ -483,8 +543,8 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
                                                if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
                                                curbone->flag &= ~BONE_ACTIVE;
                                                chbone->flag |= (BONE_ACTIVE|BONE_SELECTED);
-                                               
-                                               // XXX notifiers need to be sent to other editors to update
+
+                                               found= 1;
                                                break;
                                        }
                                }
@@ -492,6 +552,9 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
                }
        }
 
+       if(!found)
+               return OPERATOR_CANCELLED;
+
        WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob);
 
        return OPERATOR_FINISHED;
index 5283aac..64303c1 100644 (file)
@@ -1067,7 +1067,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= set_weight_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_editsurfcurve;
 
        /* flags */
@@ -1118,7 +1118,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= set_radius_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_editsurfcurve;
 
        /* flags */
@@ -4145,7 +4145,7 @@ void CURVE_OT_select_random(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= select_random_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_editsurfcurve;
 
        /* flags */
@@ -4179,7 +4179,7 @@ void CURVE_OT_select_every_nth(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= select_every_nth_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_editsurfcurve;
        
        /* flags */
index 0f2ac6e..f28dbe2 100644 (file)
@@ -103,6 +103,7 @@ void mouse_armature(struct bContext *C, short mval[2], int extend);
 struct Bone *get_indexed_bone (struct Object *ob, int index);
 float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]);
 EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, EditBone *ebo); // XXX this is needed for populating the context iterators
+void ED_armature_sync_selection(struct ListBase *edbo);
 
 void add_primitive_bone(struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d);
 
index 602e948..f9e427a 100644 (file)
@@ -880,3 +880,5 @@ DEF_ICON(VICON_DISCLOSURE_TRI_DOWN)
 DEF_ICON(VICON_MOVE_UP)
 DEF_ICON(VICON_MOVE_DOWN)
 DEF_ICON(VICON_X)
+DEF_ICON(VICON_SMALL_TRI_RIGHT)
+
index cf284e7..6743812 100644 (file)
@@ -544,11 +544,6 @@ void UI_init(void);
 void UI_init_userdef(void);
 void UI_exit(void);
 
-/* XXX hide this */
-
-uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
-uiBut *uiDefMenuSep(uiBlock *block);
-
 /* Layout
  *
  * More automated layout of buttons. Has three levels:
index 00ec875..a76fdcb 100644 (file)
@@ -2619,26 +2619,6 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext,
        return but;
 }
 
-static int ui_menu_y(uiBlock *block)
-{
-       uiBut *but= block->buttons.last;
-
-       if(but) return but->y1;
-       else return 0;
-}
-
-uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name)
-{
-       int y= ui_menu_y(block) - MENU_ITEM_HEIGHT;
-       return uiDefIconTextButO(block, BUT, opname, WM_OP_INVOKE_REGION_WIN, ICON_BLANK1, name, 0, y, MENU_WIDTH, MENU_ITEM_HEIGHT-1, NULL);
-}
-
-uiBut *uiDefMenuSep(uiBlock *block)
-{
-       int y= ui_menu_y(block) - MENU_SEP_HEIGHT;
-       return uiDefBut(block, SEPR, 0, "", 0, y, MENU_WIDTH, MENU_SEP_HEIGHT, NULL, 0.0, 0.0, 0, 0, "");
-}
-
 /* END Button containing both string label and icon */
 
 void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to)
index 315b869..549164c 100644 (file)
@@ -342,6 +342,28 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al
        viconutil_draw_lineloop_smooth(pts, 3);
 }
 
+static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha)
+{
+       GLint pts[3][2];
+       int cx = x+w/2-4;
+       int cy = y+w/2;
+       int d = w/5, d2 = w/7;
+
+       viconutil_set_point(pts[0], cx-d2, cy+d);
+       viconutil_set_point(pts[1], cx-d2, cy-d);
+       viconutil_set_point(pts[2], cx+d2, cy);
+
+       glColor4f(0.2f, 0.2f, 0.2f, alpha);
+
+       glShadeModel(GL_SMOOTH);
+       glBegin(GL_TRIANGLES);
+       glVertex2iv(pts[0]);
+       glVertex2iv(pts[1]);
+       glVertex2iv(pts[2]);
+       glEnd();
+       glShadeModel(GL_FLAT);
+}
+
 static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha)
 {
        GLint pts[3][2];
@@ -450,6 +472,7 @@ static void init_internal_icons()
        def_internal_vicon(VICON_MOVE_UP, vicon_move_up_draw);
        def_internal_vicon(VICON_MOVE_DOWN, vicon_move_down_draw);
        def_internal_vicon(VICON_X, vicon_x_draw);
+       def_internal_vicon(VICON_SMALL_TRI_RIGHT, vicon_small_tri_right_draw);
 
        IMB_freeImBuf(bbuf);
 }
index 319e69a..3e009b5 100644 (file)
@@ -539,6 +539,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
        int ofsx;
        
        if(panel->paneltab) return;
+       if(panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
 
        /* calculate header rect */
        /* + 0.001f to prevent flicker due to float inaccuracy */
@@ -644,6 +645,14 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
 
 /************************** panel alignment *************************/
 
+static int get_panel_header(Panel *pa)
+{
+       if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+               return 0;
+
+       return PNL_HEADER;
+}
+
 /* this function is needed because uiBlock and Panel itself dont
 change sizey or location when closed */
 static int get_panel_real_ofsy(Panel *pa)
@@ -656,8 +665,8 @@ static int get_panel_real_ofsy(Panel *pa)
 
 static int get_panel_real_ofsx(Panel *pa)
 {
-       if(pa->flag & PNL_CLOSEDX) return pa->ofsx+PNL_HEADER;
-       else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+PNL_HEADER;
+       if(pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
+       else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
        else return pa->ofsx+pa->sizex;
 }
 
@@ -762,18 +771,18 @@ int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
        /* no smart other default start loc! this keeps switching f5/f6/etc compatible */
        ps= panelsort;
        ps->pa->ofsx= 0;
-       ps->pa->ofsy= -ps->pa->sizey-PNL_HEADER-style->panelouter;
+       ps->pa->ofsy= -ps->pa->sizey-get_panel_header(ps->pa)-style->panelouter;
 
        for(a=0; a<tot-1; a++, ps++) {
                psnext= ps+1;
        
                if(align==BUT_VERTICAL) {
                        psnext->pa->ofsx= ps->pa->ofsx;
-                       psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-PNL_HEADER-style->panelouter;
+                       psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - psnext->pa->sizey-get_panel_header(psnext->pa)-style->panelouter;
                }
                else {
                        psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
-                       psnext->pa->ofsy= ps->pa->ofsy + ps->pa->sizey - psnext->pa->sizey;
+                       psnext->pa->ofsy= ps->pa->ofsy + ps->pa->sizey + get_panel_header(ps->pa) - psnext->pa->sizey - get_panel_header(psnext->pa);
                }
        }
        
@@ -1200,6 +1209,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 {
        ARegion *ar= CTX_wm_region(C);
        uiBlock *block;
+       Panel *pa;
        int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
 
        retval= WM_UI_HANDLER_CONTINUE;
@@ -1215,22 +1225,27 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 
                /* check if inside boundbox */
                inside= 0;
+               pa= block->panel;
+
+               if(!pa || pa->paneltab!=NULL)
+                       continue;
+               if(pa->type && pa->type->flag & PNL_NO_HEADER)
+                       continue;
 
-               if(block->panel && block->panel->paneltab==NULL)
-                       if(block->minx <= mx && block->maxx >= mx)
-                               if(block->miny <= my && block->maxy+PNL_HEADER >= my)
-                                       inside= 1;
+               if(block->minx <= mx && block->maxx >= mx)
+                       if(block->miny <= my && block->maxy+PNL_HEADER >= my)
+                               inside= 1;
 
                if(inside) {
                        /* clicked at panel header? */
-                       if(block->panel->flag & PNL_CLOSEDX) {
+                       if(pa->flag & PNL_CLOSEDX) {
                                if(block->minx <= mx && block->minx+PNL_HEADER >= mx) 
                                        inside_header= 1;
                        }
                        else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
                                inside_header= 1;
                        }
-                       else if(block->panel->control & UI_PNL_SCALE) {
+                       else if(pa->control & UI_PNL_SCALE) {
                                if(block->maxx-PNL_HEADER <= mx)
                                        if(block->miny+PNL_HEADER >= my)
                                                inside_scale= 1;
@@ -1242,8 +1257,8 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                                                ui_handle_panel_header(C, block, mx, my);
                                                break;
                                        }
-                                       else if(inside_scale && !(block->panel->flag & PNL_CLOSED)) {
-                                               panel_activate_state(C, block->panel, PANEL_STATE_DRAG_SCALE);
+                                       else if(inside_scale && !(pa->flag & PNL_CLOSED)) {
+                                               panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
                                                break;
                                        }
                                }
@@ -1258,7 +1273,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                                        int zoom=0;
                                
                                        /* if panel is closed, only zoom if mouse is over the header */
-                                       if (block->panel->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
+                                       if (pa->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
                                                if (inside_header)
                                                        zoom=1;
                                        }
@@ -1271,7 +1286,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
                                                SpaceLink *sl= sa->spacedata.first;
 
                                                if(sa->spacetype!=SPACE_BUTS) {
-                                                       if(!(block->panel->control & UI_PNL_SCALE)) {
+                                                       if(!(pa->control & UI_PNL_SCALE)) {
                                                                if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
                                                                else sl->blockscale-= 0.1;
                                                                CLAMP(sl->blockscale, 0.6, 1.0);
diff --git a/source/blender/editors/interface/keyval.c b/source/blender/editors/interface/keyval.c
deleted file mode 100644 (file)
index f2172ac..0000000
+++ /dev/null
@@ -1,540 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "stdio.h"
-#include "ctype.h"
-#include "string.h"
-
-#include "BKE_global.h"
-#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
-
-#include "WM_types.h"
-
-char *key_event_to_string(unsigned short event)
-{
-
-       switch(event) {
-       case AKEY:
-               return "A";
-               break;
-       case BKEY:
-               return "B";
-               break;
-       case CKEY:
-               return "C";
-               break;
-       case DKEY:
-               return "D";
-               break;
-       case EKEY:
-               return "E";
-               break;
-       case FKEY:
-               return "F";
-               break;
-       case GKEY:
-               return "G";
-               break;
-       case HKEY:
-               return "H";
-               break;
-       case IKEY:
-               return "I";
-               break;
-       case JKEY:
-               return "J";
-               break;
-       case KKEY:
-               return "K";
-               break;
-       case LKEY:
-               return "L";
-               break;
-       case MKEY:
-               return "M";
-               break;
-       case NKEY:
-               return "N";
-               break;
-       case OKEY:
-               return "O";
-               break;
-       case PKEY:
-               return "P";
-               break;
-       case QKEY:
-               return "Q";
-               break;
-       case RKEY:
-               return "R";
-               break;
-       case SKEY:
-               return "S";
-               break;
-       case TKEY:
-               return "T";
-               break;
-       case UKEY:
-               return "U";
-               break;
-       case VKEY:
-               return "V";
-               break;
-       case WKEY:
-               return "W";
-               break;
-       case XKEY:
-               return "X";
-               break;
-       case YKEY:
-               return "Y";
-               break;
-       case ZKEY:
-               return "Z";
-               break;
-
-       case ZEROKEY:
-               return "Zero";
-               break;
-       case ONEKEY:
-               return "One";
-               break;
-       case TWOKEY:
-               return "Two";
-               break;
-       case THREEKEY:
-               return "Three";
-               break;
-       case FOURKEY:
-               return "Four";
-               break;
-       case FIVEKEY:
-               return "Five";
-               break;
-       case SIXKEY:
-               return "Six";
-               break;
-       case SEVENKEY:
-               return "Seven";
-               break;
-       case EIGHTKEY:
-               return "Eight";
-               break;
-       case NINEKEY:
-               return "Nine";
-               break;
-
-       case LEFTCTRLKEY:
-               return "Leftctrl";
-               break;
-       case LEFTALTKEY:
-               return "Leftalt";
-               break;
-       case    RIGHTALTKEY:
-               return "Rightalt";
-               break;
-       case    RIGHTCTRLKEY:
-               return "Rightctrl";
-               break;
-       case RIGHTSHIFTKEY:
-               return "Rightshift";
-               break;
-       case LEFTSHIFTKEY:
-               return "Leftshift";
-               break;
-
-       case ESCKEY:
-               return "Esc";
-               break;
-       case TABKEY:
-               return "Tab";
-               break;
-       case RETKEY:
-               return "Ret";
-               break;
-       case SPACEKEY:
-               return "Space";
-               break;
-       case LINEFEEDKEY:
-               return "Linefeed";
-               break;
-       case BACKSPACEKEY:
-               return "Backspace";
-               break;
-       case DELKEY:
-               return "Del";
-               break;
-       case SEMICOLONKEY:
-               return "Semicolon";
-               break;
-       case PERIODKEY:
-               return "Period";
-               break;
-       case COMMAKEY:
-               return "Comma";
-               break;
-       case QUOTEKEY:
-               return "Quote";
-               break;
-       case ACCENTGRAVEKEY:
-               return "Accentgrave";
-               break;
-       case MINUSKEY:
-               return "Minus";
-               break;
-       case SLASHKEY:
-               return "Slash";
-               break;
-       case BACKSLASHKEY:
-               return "Backslash";
-               break;
-       case EQUALKEY:
-               return "Equal";
-               break;
-       case LEFTBRACKETKEY:
-               return "Leftbracket";
-               break;
-       case RIGHTBRACKETKEY:
-               return "Rightbracket";
-               break;
-
-       case LEFTARROWKEY:
-               return "Leftarrow";
-               break;
-       case DOWNARROWKEY:
-               return "Downarrow";
-               break;
-       case RIGHTARROWKEY:
-               return "Rightarrow";
-               break;
-       case UPARROWKEY:
-               return "Uparrow";
-               break;
-
-       case PAD2:
-               return "Pad2";
-               break;
-       case PAD4:
-               return "Pad4";
-               break;
-       case PAD6:
-               return "Pad6";
-               break;
-       case PAD8:
-               return "Pad8";
-               break;
-       case PAD1:
-               return "Pad1";
-               break;
-       case PAD3:
-               return "Pad3";
-               break;
-       case PAD5:
-               return "Pad5";
-               break;
-       case PAD7:
-               return "Pad7";
-               break;
-       case PAD9:
-               return "Pad9";
-               break;
-
-       case PADPERIOD:
-               return "Padperiod";
-               break;
-       case PADSLASHKEY:
-               return "Padslash";
-               break;
-       case PADASTERKEY:
-               return "Padaster";
-               break;
-
-       case PAD0:
-               return "Pad0";
-               break;
-       case PADMINUS:
-               return "Padminus";
-               break;
-       case PADENTER:
-               return "Padenter";
-               break;
-       case PADPLUSKEY:
-               return "Padplus";
-               break;
-
-       case    F1KEY:
-               return "F1";
-               break;
-       case    F2KEY:
-               return "F2";
-               break;
-       case    F3KEY:
-               return "F3";
-               break;
-       case    F4KEY:
-               return "F4";
-               break;
-       case    F5KEY:
-               return "F5";
-               break;
-       case    F6KEY:
-               return "F6";
-               break;
-       case    F7KEY:
-               return "F7";
-               break;
-       case    F8KEY:
-               return "F8";
-               break;
-       case    F9KEY:
-               return "F9";
-               break;
-       case    F10KEY:
-               return "F10";
-               break;
-       case    F11KEY:
-               return "F11";
-               break;
-       case    F12KEY:
-               return "F12";
-               break;
-
-       case    PAUSEKEY:
-               return "Pause";
-               break;
-       case    INSERTKEY:
-               return "Insert";
-               break;
-       case    HOMEKEY:
-               return "Home";
-               break;
-       case    PAGEUPKEY:
-               return "Pageup";
-               break;
-       case    PAGEDOWNKEY:
-               return "Pagedown";
-               break;
-       case    ENDKEY:
-               return "End";
-               break;
-       }
-       
-       return "";
-}
-
-/* 
- * Decodes key combination strings [qual1+[qual2+[...]]]keyname
- * The '+'s may be replaced by '-' or ' ' characters to support different
- * formats. No additional whitespace is allowed. The keyname may be an internal
- * name, like "RETKEY", or a more common name, like "Return". Decoding is case-
- * insensitive.
- *
- * Example strings: "Ctrl+L", "ALT-ESC", "Shift A"
- *
- * Returns 1 if successful. 
- */
-int decode_key_string(char *str, unsigned short *key, unsigned short *qual)
-{
-       int i, prev, len, invalid=0;
-
-       len= strlen(str);
-       *key= *qual= 0;
-
-       /* Convert to upper case */
-       for (i=0; i<len; i++) {
-               str[i]= toupper(str[i]);
-       }
-
-       /* Handle modifiers */
-       for (prev=i=0; i<len; i++) {
-               if (str[i]==' ' || str[i]=='+' || str[i]=='-') {
-// XXX                 if (!strncmp(str+prev, "CTRL", i-prev)) *qual |= LR_CTRLKEY;
-//                     else if (!strncmp(str+prev, "ALT", i-prev)) *qual |= LR_ALTKEY;
-//                     else if (!strncmp(str+prev, "SHIFT", i-prev)) *qual |= LR_SHIFTKEY;
-//                     else if (!strncmp(str+prev, "COMMAND", i-prev)) *qual |= LR_COMMANDKEY;
-                       prev=i+1;
-               }
-       }
-
-       /* Compare last part against key names */
-       if ((len-prev==1) || ((len-prev==4) && !strncmp(str+prev, "KEY", 3))) {
-               
-               if (str[prev]>='A' && str[prev]<='Z') {
-                       *key= str[prev]-'A'+AKEY;
-               } else if (str[prev]>='0' && str[prev]<='9') {
-                       *key= str[prev]-'0'+ZEROKEY;
-               } else {
-                       invalid= 1;
-               }
-       
-       } else if (!strncmp(str+prev, "ZEROKEY", len-prev) || !strncmp(str+prev, "ZERO", len-prev)) {
-               *key= ZEROKEY;
-       } else if (!strncmp(str+prev, "ONEKEY", len-prev) || !strncmp(str+prev, "ONE", len-prev)) {
-               *key= ONEKEY;
-       } else if (!strncmp(str+prev, "TWOKEY", len-prev) || !strncmp(str+prev, "TWO", len-prev)) {
-               *key= TWOKEY;
-       } else if (!strncmp(str+prev, "THREEKEY", len-prev) || !strncmp(str+prev, "THREE", len-prev)) {
-               *key= THREEKEY;
-       } else if (!strncmp(str+prev, "FOURKEY", len-prev) || !strncmp(str+prev, "FOUR", len-prev)) {
-               *key= FOURKEY;
-       } else if (!strncmp(str+prev, "FIVEKEY", len-prev) || !strncmp(str+prev, "FIVE", len-prev)) {
-               *key= FIVEKEY;
-       } else if (!strncmp(str+prev, "SIZEKEY", len-prev) || !strncmp(str+prev, "SIX", len-prev)) {
-               *key= SIXKEY;
-       } else if (!strncmp(str+prev, "SEVENKEY", len-prev) || !strncmp(str+prev, "SEVEN", len-prev)) {
-               *key= SEVENKEY;
-       } else if (!strncmp(str+prev, "EIGHTKEY", len-prev) || !strncmp(str+prev, "EIGHT", len-prev)) {
-               *key= EIGHTKEY;
-       } else if (!strncmp(str+prev, "NINEKEY", len-prev) || !strncmp(str+prev, "NINE", len-prev)) {
-               *key= NINEKEY;
-
-       } else if (!strncmp(str+prev, "ESCKEY", len-prev) || !strncmp(str+prev, "ESC", len-prev)) {
-               *key= ESCKEY;
-       } else if (!strncmp(str+prev, "TABKEY", len-prev) || !strncmp(str+prev, "TAB", len-prev)) {
-               *key= TABKEY;
-       } else if (!strncmp(str+prev, "RETKEY", len-prev) || !strncmp(str+prev, "RETURN", len-prev) || !strncmp(str+prev, "ENTER", len-prev)) {
-               *key= RETKEY;
-       } else if (!strncmp(str+prev, "SPACEKEY", len-prev) || !strncmp(str+prev, "SPACE", len-prev)) {
-               *key= SPACEKEY;
-       } else if (!strncmp(str+prev, "LINEFEEDKEY", len-prev) || !strncmp(str+prev, "LINEFEED", len-prev)) {
-               *key= LINEFEEDKEY;
-       } else if (!strncmp(str+prev, "BACKSPACEKEY", len-prev) || !strncmp(str+prev, "BACKSPACE", len-prev)) {
-               *key= BACKSPACEKEY;
-       } else if (!strncmp(str+prev, "DELKEY", len-prev) || !strncmp(str+prev, "DELETE", len-prev)) {
-               *key= DELKEY;
-       
-       } else if (!strncmp(str+prev, "SEMICOLONKEY", len-prev) || !strncmp(str+prev, "SEMICOLON", len-prev)) {
-               *key= SEMICOLONKEY;
-       } else if (!strncmp(str+prev, "PERIODKEY", len-prev) || !strncmp(str+prev, "PERIOD", len-prev)) {
-               *key= PERIODKEY;
-       } else if (!strncmp(str+prev, "COMMAKEY", len-prev) || !strncmp(str+prev, "COMMA", len-prev)) {
-               *key= COMMAKEY;
-       } else if (!strncmp(str+prev, "QUOTEKEY", len-prev) || !strncmp(str+prev, "QUOTE", len-prev)) {
-               *key= QUOTEKEY;
-       } else if (!strncmp(str+prev, "ACCENTGRAVEKEY", len-prev) || !strncmp(str+prev, "ACCENTGRAVE", len-prev)) {
-               *key= ACCENTGRAVEKEY;
-       } else if (!strncmp(str+prev, "MINUSKEY", len-prev) || !strncmp(str+prev, "MINUS", len-prev)) {
-               *key= MINUSKEY;
-       } else if (!strncmp(str+prev, "SLASHKEY", len-prev) || !strncmp(str+prev, "SLASH", len-prev)) {
-               *key= SLASHKEY;
-       } else if (!strncmp(str+prev, "BACKSLASHKEY", len-prev) || !strncmp(str+prev, "BACKSLASH", len-prev)) {
-               *key= BACKSLASHKEY;
-       } else if (!strncmp(str+prev, "EQUALKEY", len-prev) || !strncmp(str+prev, "EQUAL", len-prev)) {
-               *key= EQUALKEY;
-       } else if (!strncmp(str+prev, "LEFTBRACKETKEY", len-prev) || !strncmp(str+prev, "LEFTBRACKET", len-prev)) {
-               *key= LEFTBRACKETKEY;
-       } else if (!strncmp(str+prev, "RIGHTBRACKETKEY", len-prev) || !strncmp(str+prev, "RIGHTBRACKET", len-prev)) {
-               *key= RIGHTBRACKETKEY;
-       } else if (!strncmp(str+prev, "DELKEY", len-prev) || !strncmp(str+prev, "DELETE", len-prev)) {
-               *key= DELKEY;
-       
-       } else if (!strncmp(str+prev, "LEFTARROWKEY", len-prev) || !strncmp(str+prev, "LEFTARROW", len-prev)) {
-               *key= LEFTARROWKEY;
-       } else if (!strncmp(str+prev, "DOWNARROWKEY", len-prev) || !strncmp(str+prev, "DOWNARROW", len-prev)) {
-               *key= DOWNARROWKEY;
-       } else if (!strncmp(str+prev, "RIGHTARROWKEY", len-prev) || !strncmp(str+prev, "RIGHTARROW", len-prev)) {
-               *key= RIGHTARROWKEY;
-       } else if (!strncmp(str+prev, "UPARROWKEY", len-prev) || !strncmp(str+prev, "UPARROW", len-prev)) {
-               *key= UPARROWKEY;
-
-       } else if (!strncmp(str+prev, "PAD", 3)) {
-               
-               if (len-prev<=4) {
-               
-                       if (str[prev]>='0' && str[prev]<='9') {
-                               *key= str[prev]-'0'+ZEROKEY;
-                       } else {
-                               invalid= 1;
-                       }
-               
-               } else if (!strncmp(str+prev+3, "PERIODKEY", len-prev-3) || !strncmp(str+prev+3, "PERIOD", len-prev-3)) {
-                       *key= PADPERIOD;
-               } else if (!strncmp(str+prev+3, "SLASHKEY", len-prev-3) || !strncmp(str+prev+3, "SLASH", len-prev-3)) {
-                       *key= PADSLASHKEY;
-               } else if (!strncmp(str+prev+3, "ASTERKEY", len-prev-3) || !strncmp(str+prev+3, "ASTERISK", len-prev-3)) {
-                       *key= PADASTERKEY;
-               } else if (!strncmp(str+prev+3, "MINUSKEY", len-prev-3) || !strncmp(str+prev+3, "MINUS", len-prev-3)) {
-                       *key= PADMINUS;
-               } else if (!strncmp(str+prev+3, "ENTERKEY", len-prev-3) || !strncmp(str+prev+3, "ENTER", len-prev-3)) {
-                       *key= PADENTER;
-               } else if (!strncmp(str+prev+3, "PLUSKEY", len-prev-3) || !strncmp(str+prev+3, "PLUS", len-prev-3)) {
-                       *key= PADPLUSKEY;
-               } else {
-                       invalid= 1;
-               }
-
-       } else if (!strncmp(str+prev, "F1KEY", len-prev) || !strncmp(str+prev, "F1", len-prev)) {
-               *key= F1KEY;
-       } else if (!strncmp(str+prev, "F2KEY", len-prev) || !strncmp(str+prev, "F2", len-prev)) {
-               *key= F2KEY;
-       } else if (!strncmp(str+prev, "F3KEY", len-prev) || !strncmp(str+prev, "F3", len-prev)) {
-               *key= F3KEY;
-       } else if (!strncmp(str+prev, "F4KEY", len-prev) || !strncmp(str+prev, "F4", len-prev)) {
-               *key= F4KEY;
-       } else if (!strncmp(str+prev, "F5KEY", len-prev) || !strncmp(str+prev, "F5", len-prev)) {
-               *key= F5KEY;
-       } else if (!strncmp(str+prev, "F6KEY", len-prev) || !strncmp(str+prev, "F6", len-prev)) {
-               *key= F6KEY;
-       } else if (!strncmp(str+prev, "F7KEY", len-prev) || !strncmp(str+prev, "F7", len-prev)) {
-               *key= F7KEY;
-       } else if (!strncmp(str+prev, "F8KEY", len-prev) || !strncmp(str+prev, "F8", len-prev)) {
-               *key= F8KEY;
-       } else if (!strncmp(str+prev, "F9KEY", len-prev) || !strncmp(str+prev, "F9", len-prev)) {
-               *key= F9KEY;
-       } else if (!strncmp(str+prev, "F10KEY", len-prev) || !strncmp(str+prev, "F10", len-prev)) {
-               *key= F10KEY;
-       } else if (!strncmp(str+prev, "F11KEY", len-prev) || !strncmp(str+prev, "F11", len-prev)) {
-               *key= F11KEY;
-       } else if (!strncmp(str+prev, "F12KEY", len-prev) || !strncmp(str+prev, "F12", len-prev)) {
-               *key= F12KEY;
-
-       } else if (!strncmp(str+prev, "PAUSEKEY", len-prev) || !strncmp(str+prev, "PAUSE", len-prev)) {
-               *key= PAUSEKEY;
-       } else if (!strncmp(str+prev, "INSERTKEY", len-prev) || !strncmp(str+prev, "INSERT", len-prev)) {
-               *key= INSERTKEY;
-       } else if (!strncmp(str+prev, "HOMEKEY", len-prev) || !strncmp(str+prev, "HOME", len-prev)) {
-               *key= HOMEKEY;
-       } else if (!strncmp(str+prev, "PAGEUPKEY", len-prev) || !strncmp(str+prev, "PAGEUP", len-prev)) {
-               *key= PAGEUPKEY;
-       } else if (!strncmp(str+prev, "PAGEDOWNKEY", len-prev) || !strncmp(str+prev, "PAGEDOWN", len-prev)) {
-               *key= PAGEDOWNKEY;
-       } else if (!strncmp(str+prev, "ENDKEY", len-prev) || !strncmp(str+prev, "END", len-prev)) {
-               *key= ENDKEY;
-       
-       } else {
-               invalid= 1;
-       }
-
-       if (!invalid && *key) {
-               return 1;
-       }
-       
-       return 0;
-}
index 7f5201f..3ac6a17 100644 (file)
@@ -1947,26 +1947,35 @@ void EM_init_index_arrays(EditMesh *em, int forVert, int forEdge, int forFace)
 
        if (forVert) {
                em->totvert= BLI_countlist(&em->verts);
-               g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*em->totvert, "em_v_arr");
 
-               for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
-                       g_em_vert_array[i] = eve;
+               if(em->totvert) {
+                       g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*em->totvert, "em_v_arr");
+
+                       for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
+                               g_em_vert_array[i] = eve;
+               }
        }
 
        if (forEdge) {
                em->totedge= BLI_countlist(&em->edges);
-               g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*em->totedge, "em_e_arr");
 
-               for (i=0,eed=em->edges.first; eed; i++,eed=eed->next)
-                       g_em_edge_array[i] = eed;
+               if(em->totedge) {
+                       g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*em->totedge, "em_e_arr");
+
+                       for (i=0,eed=em->edges.first; eed; i++,eed=eed->next)
+                               g_em_edge_array[i] = eed;
+               }
        }
 
        if (forFace) {
                em->totface= BLI_countlist(&em->faces);
-               g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*em->totface, "em_f_arr");
 
-               for (i=0,efa=em->faces.first; efa; i++,efa=efa->next)
-                       g_em_face_array[i] = efa;
+               if(em->totface) {
+                       g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*em->totface, "em_f_arr");
+
+                       for (i=0,efa=em->faces.first; efa; i++,efa=efa->next)
+                               g_em_face_array[i] = efa;
+               }
        }
 }
 
index 12138ee..abbbb5a 100644 (file)
@@ -1307,6 +1307,7 @@ static float new_primitive_matrix(bContext *C, float primmat[][4])
 
 static int add_primitive_plane_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1316,6 +1317,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_PLANE, mat, 4, 0, 0, dia, 0.0f, 0, 1);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1337,6 +1339,7 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot)
 
 static int add_primitive_cube_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1346,6 +1349,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_CUBE, mat, 4, 0, 0, dia, 1.0f, 1, 1);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1367,6 +1371,7 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot)
 
 static int add_primitive_circle_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1376,6 +1381,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 0.0f, 0, 
                          RNA_boolean_get(op->ptr, "fill"));
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1402,6 +1408,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
 
 static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1411,6 +1418,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 1, 1);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1437,6 +1445,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
 
 static int add_primitive_tube_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1446,6 +1455,7 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 1, 0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1472,6 +1482,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
 
 static int add_primitive_cone_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1481,6 +1492,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 
                          RNA_float_get(op->ptr, "depth"), 0, RNA_boolean_get(op->ptr, "cap_end"));
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1509,6 +1521,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
 
 static int add_primitive_grid_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1518,6 +1531,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "x_subdivisions"), 
                          RNA_int_get(op->ptr, "y_subdivisions"), 0, dia, 0.0f, 0, 1);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1544,6 +1558,7 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 
 static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float mat[4][4];
        
@@ -1551,6 +1566,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
        
        make_prim(obedit, PRIM_MONKEY, mat, 0, 0, 2, 0.0f, 0.0f, 0, 0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1572,6 +1588,7 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
 
 static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1581,6 +1598,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "rings"), 
                          RNA_int_get(op->ptr, "segments"), 0, dia, 0.0f, 0, 0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
@@ -1607,6 +1625,7 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 
 static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        float dia, mat[4][4];
        
@@ -1616,6 +1635,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
        make_prim(obedit, PRIM_ICOSPHERE, mat, 0, 0, 
                          RNA_int_get(op->ptr, "subdivisions"), dia, 0.0f, 0, 0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        return OPERATOR_FINISHED;       
index afbf43c..9f804ee 100644 (file)
@@ -624,6 +624,7 @@ static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct
 
 static int knife_cut_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        ARegion *ar= CTX_wm_region(C);
@@ -703,6 +704,10 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
        BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
        
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
index 70a0c6b..67886ee 100644 (file)
@@ -642,25 +642,24 @@ static int unified_findnearest(ViewContext *vc, EditVert **eve, EditEdge **eed,
 
 /* ****************  SIMILAR "group" SELECTS. FACE, EDGE AND VERTEX ************** */
 
-/* selects new faces/edges/verts based on the
- existing selection
-
-FACES GROUP
- mode 1: same material
- mode 2: same image
- mode 3: same area
- mode 4: same perimeter
- mode 5: same normal
- mode 6: same co-planer
-*/
+/* selects new faces/edges/verts based on the existing selection */
+
+/* FACES GROUP */
+
+#define SIMFACE_MATERIAL       201
+#define SIMFACE_IMAGE          202
+#define SIMFACE_AREA           203
+#define SIMFACE_PERIMETER      204
+#define SIMFACE_NORMAL         205
+#define SIMFACE_COPLANAR       206
 
 static EnumPropertyItem prop_simface_types[] = {
-       {1, "MATERIAL", 0, "Material", ""},
-       {2, "IMAGE", 0, "Image", ""},
-       {3, "AREA", 0, "Area", ""},
-       {4, "PERIMETER", 0, "Perimeter", ""},
-       {5, "NORMAL", 0, "Normal", ""},
-       {6, "COPLANAR", 0, "Co-planar", ""},
+       {SIMFACE_MATERIAL, "MATERIAL", 0, "Material", ""},
+       {SIMFACE_IMAGE, "IMAGE", 0, "Image", ""},
+       {SIMFACE_AREA, "AREA", 0, "Area", ""},
+       {SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
+       {SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
+       {SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -695,12 +694,11 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
        if (!ok || !deselcount) /* no data selected OR no more data to select */
                return 0;
        
-       /*if mode is 3 then record face areas, 4 record perimeter */
-       if (mode==3) {
+       if (mode==SIMFACE_AREA) {
                for(efa= em->faces.first; efa; efa= efa->next) {
                        efa->tmp.fp= EM_face_area(efa);
                }
-       } else if (mode==4) {
+       } else if (mode==SIMFACE_PERIMETER) {
                for(efa= em->faces.first; efa; efa= efa->next) {
                        efa->tmp.fp= EM_face_perimeter(efa);
                }
@@ -708,7 +706,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
        
        for(base_efa= em->faces.first; base_efa; base_efa= base_efa->next) {
                if (base_efa->f1) { /* This was one of the faces originaly selected */
-                       if (mode==1) { /* same material */
+                       if (mode==SIMFACE_MATERIAL) { /* same material */
                                for(efa= em->faces.first; efa; efa= efa->next) {
                                        if (
                                                !(efa->f & SELECT) &&
@@ -722,7 +720,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==2) { /* same image */
+                       } else if (mode==SIMFACE_IMAGE) { /* same image */
                                MTFace *tf, *base_tf;
 
                                base_tf = (MTFace*)CustomData_em_get(&em->fdata, base_efa->data,
@@ -745,7 +743,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
                                                }
                                        }
                                }
-                       } else if (mode==3 || mode==4) { /* same area OR same perimeter, both use the same temp var */
+                       } else if (mode==SIMFACE_AREA || mode==SIMFACE_PERIMETER) { /* same area OR same perimeter, both use the same temp var */
                                for(efa= em->faces.first; efa; efa= efa->next) {
                                        if (
                                                (!(efa->f & SELECT) && !efa->h) &&
@@ -758,7 +756,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==5) { /* same normal */
+                       } else if (mode==SIMFACE_NORMAL) {
                                float angle;
                                for(efa= em->faces.first; efa; efa= efa->next) {
                                        if (!(efa->f & SELECT) && !efa->h) {
@@ -772,7 +770,7 @@ static int similar_face_select__internal(Scene *scene, EditMesh *em, int mode)
                                                }
                                        }
                                }
-                       } else if (mode==6) { /* same planer */
+                       } else if (mode==SIMFACE_COPLANAR) { /* same planer */
                                float angle, base_dot, dot;
                                base_dot= Inpf(base_efa->cent, base_efa->n);
                                for(efa= em->faces.first; efa; efa= efa->next) {
@@ -817,45 +815,26 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
        return OPERATOR_CANCELLED;
 }      
 
-void MESH_OT_faces_select_similar(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Similar Face Select";
-       ot->idname= "MESH_OT_faces_select_similar";
-       
-       /* api callbacks */
-       ot->invoke= WM_menu_invoke;
-       ot->exec= similar_face_select_exec;
-       ot->poll= ED_operator_editmesh;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* properties */
-       RNA_def_enum(ot->srna, "type", prop_simface_types, 0, "Type", "");
-}
-
 /* ***************************************************** */
 
-/*
-EDGE GROUP
- mode 1: same length
- mode 2: same direction
- mode 3: same number of face users
- mode 4: similar face angles.
- mode 5: similar crease
- mode 6: similar seam
- mode 7: similar sharp
-*/
+/* EDGE GROUP */
+
+#define SIMEDGE_LENGTH         101
+#define SIMEDGE_DIR                    102
+#define SIMEDGE_FACE           103
+#define SIMEDGE_FACE_ANGLE     104
+#define SIMEDGE_CREASE         105
+#define SIMEDGE_SEAM           106
+#define SIMEDGE_SHARP          107
 
 static EnumPropertyItem prop_simedge_types[] = {
-       {1, "LENGTH", 0, "Length", ""},
-       {2, "DIR", 0, "Direction", ""},
-       {3, "FACE", 0, "Amount of Vertices in Face", ""},
-       {4, "FACE_ANGLE", 0, "Face Angles", ""},
-       {5, "CREASE", 0, "Crease", ""},
-       {6, "SEAM", 0, "Seam", ""},
-       {7, "SHARP", 0, "Sharpness", ""},
+       {SIMEDGE_LENGTH, "LENGTH", 0, "Length", ""},
+       {SIMEDGE_DIR, "DIR", 0, "Direction", ""},
+       {SIMEDGE_FACE, "FACE", 0, "Amount of Vertices in Face", ""},
+       {SIMEDGE_FACE_ANGLE, "FACE_ANGLE", 0, "Face Angles", ""},
+       {SIMEDGE_CREASE, "CREASE", 0, "Crease", ""},
+       {SIMEDGE_SEAM, "SEAM", 0, "Seam", ""},
+       {SIMEDGE_SHARP, "SHARP", 0, "Sharpness", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -883,19 +862,19 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                        /* set all eed->tmp.l to 0 we use it later.
                        for counting face users*/
                        eed->tmp.l=0;
-                       eed->f2=0; /* only for mode 4, edge animations */
+                       eed->f2=0; /* only for mode SIMEDGE_FACE_ANGLE, edge animations */
                }
        }
        
        if (!ok || !deselcount) /* no data selected OR no more data to select*/
                return 0;
        
-       if (mode==1) { /*store length*/
+       if (mode==SIMEDGE_LENGTH) { /*store length*/
                for(eed= em->edges.first; eed; eed= eed->next) {
                        if (!eed->h) /* dont calc data for hidden edges*/
                                eed->tmp.fp= VecLenf(eed->v1->co, eed->v2->co);
                }
-       } else if (mode==3) { /*store face users*/
+       } else if (mode==SIMEDGE_FACE) { /*store face users*/
                EditFace *efa;
                /* cound how many faces each edge uses use tmp->l */
                for(efa= em->faces.first; efa; efa= efa->next) {
@@ -904,7 +883,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                        efa->e3->tmp.l++;
                        if (efa->e4) efa->e4->tmp.l++;
                }
-       } else if (mode==4) { /*store edge angles */
+       } else if (mode==SIMEDGE_FACE_ANGLE) { /*store edge angles */
                EditFace *efa;
                int j;
                /* cound how many faces each edge uses use tmp.l */
@@ -946,7 +925,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
        
        for(base_eed= em->edges.first; base_eed; base_eed= base_eed->next) {
                if (base_eed->f1) {
-                       if (mode==1) { /* same length */
+                       if (mode==SIMEDGE_LENGTH) { /* same length */
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -960,7 +939,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==2) { /* same direction */
+                       } else if (mode==SIMEDGE_DIR) { /* same direction */
                                float base_dir[3], dir[3], angle;
                                VecSubf(base_dir, base_eed->v1->co, base_eed->v2->co);
                                for(eed= em->edges.first; eed; eed= eed->next) {
@@ -980,7 +959,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                }
                                        }
                                }
-                       } else if (mode==3) { /* face users */                          
+                       } else if (mode==SIMEDGE_FACE) { /* face users */                               
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -994,7 +973,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==4 && base_eed->f2==2) { /* edge angles, f2==2 means the edge has an angle. */                          
+                       } else if (mode==SIMEDGE_FACE_ANGLE && base_eed->f2==2) { /* edge angles, f2==2 means the edge has an angle. */                         
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -1009,7 +988,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==5) { /* edge crease */
+                       } else if (mode==SIMEDGE_CREASE) { /* edge crease */
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -1023,7 +1002,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==6) { /* edge seam */
+                       } else if (mode==SIMEDGE_SEAM) { /* edge seam */
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -1037,7 +1016,7 @@ static int similar_edge_select__internal(Scene *scene, EditMesh *em, int mode)
                                                        return selcount;
                                        }
                                }
-                       } else if (mode==7) { /* edge sharp */
+                       } else if (mode==SIMEDGE_SHARP) { /* edge sharp */
                                for(eed= em->edges.first; eed; eed= eed->next) {
                                        if (
                                                !(eed->f & SELECT) &&
@@ -1078,24 +1057,6 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
        return OPERATOR_CANCELLED;
 }
 
-void MESH_OT_edges_select_similar(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Similar Edge Select";
-       ot->idname= "MESH_OT_edges_select_similar";
-       
-       /* api callbacks */
-       ot->invoke= WM_menu_invoke;
-       ot->exec= similar_edge_select_exec;
-       ot->poll= ED_operator_editmesh;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* properties */
-       RNA_def_enum(ot->srna, "type", prop_simedge_types, 0, "Type", "");
-}
-
 /* ********************************* */
 
 /*
@@ -1104,10 +1065,15 @@ VERT GROUP
  mode 2: same number of face users
  mode 3: same vertex groups
 */
+
+#define SIMVERT_NORMAL 0
+#define SIMVERT_FACE   1
+#define SIMVERT_VGROUP 2
+
 static EnumPropertyItem prop_simvertex_types[] = {
-       {0, "NORMAL", 0, "Normal", ""},
-       {1, "FACE", 0, "Amount of Vertices in Face", ""},
-       {2, "VGROUP", 0, "Vertex Groups", ""},
+       {SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""},
+       {SIMVERT_FACE, "FACE", 0, "Amount of Vertices in Face", ""},
+       {SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -1124,6 +1090,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        /*count how many visible selected edges there are,
        so we can return when there are none left */
        unsigned int deselcount=0;
+       int mode= RNA_enum_get(op->ptr, "type");
        
        short ok=0;
        float thresh= scene->toolsettings->select_thresh;
@@ -1148,7 +1115,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
                return 0;
        }
        
-       if(RNA_enum_is_equal(op->ptr, "type", "FACE")) {
+       if(mode == SIMVERT_FACE) {
                /* store face users */
                EditFace *efa;
                
@@ -1165,7 +1132,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        for(base_eve= em->verts.first; base_eve; base_eve= base_eve->next) {
                if (base_eve->f1) {
                                
-                       if(RNA_enum_is_equal(op->ptr, "type", "NORMAL")) {
+                       if(mode == SIMVERT_NORMAL) {
                                float angle;
                                for(eve= em->verts.first; eve; eve= eve->next) {
                                        if (!(eve->f & SELECT) && !eve->h) {
@@ -1182,7 +1149,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
                                        }
                                }
                        }
-                       else if(RNA_enum_is_equal(op->ptr, "type", "FACE")) {
+                       else if(mode == SIMVERT_FACE) {
                                for(eve= em->verts.first; eve; eve= eve->next) {
                                        if (
                                                !(eve->f & SELECT) &&
@@ -1199,7 +1166,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
                                        }
                                }
                        } 
-                       else if(RNA_enum_is_equal(op->ptr, "type", "VGROUP")) {
+                       else if(mode == SIMVERT_VGROUP) {
                                MDeformVert *dvert, *base_dvert;
                                short i, j; /* weight index */
 
@@ -1248,22 +1215,45 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        return OPERATOR_CANCELLED;
 }
 
-void MESH_OT_vertices_select_similar(wmOperatorType *ot)
+static int select_similar_exec(bContext *C, wmOperator *op)
 {
+       int type= RNA_enum_get(op->ptr, "type");
+
+       if(type < 100)
+               return similar_vert_select_exec(C, op);
+       else if(type < 200)
+               return similar_edge_select_exec(C, op);
+       else
+               return similar_face_select_exec(C, op);
+}
+
+static EnumPropertyItem *select_similar_type_itemf(PointerRNA *ptr)
+{
+       /* XXX need context! */
+       return prop_simface_types;
+       return prop_simvertex_types;
+       return prop_simedge_types;
+}
+
+void MESH_OT_select_similar(wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+
        /* identifiers */
-       ot->name= "Similar Vertex Select";
-       ot->idname= "MESH_OT_vertices_select_similar";
+       ot->name= "Select Similar";
+       ot->idname= "MESH_OT_select_similar";
        
        /* api callbacks */
        ot->invoke= WM_menu_invoke;
-       ot->exec= similar_vert_select_exec;
+       ot->exec= select_similar_exec;
        ot->poll= ED_operator_editmesh;
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* properties */
-       RNA_def_enum(ot->srna, "type", prop_simvertex_types, 0, "Type", "");
+       prop= RNA_def_enum(ot->srna, "type", prop_simvertex_types, 0, "Type", "");
+       RNA_def_enum_funcs(prop, select_similar_type_itemf);
 }
 
 /* ******************************************* */
@@ -2740,20 +2730,24 @@ void MESH_OT_reveal(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-void select_faces_by_numverts(EditMesh *em, wmOperator *op, int numverts)
+int select_by_number_vertices_exec(bContext *C, wmOperator *op)
 {
+       Object *obedit= CTX_data_edit_object(C);
+       EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        EditFace *efa;
+       int numverts= RNA_enum_get(op->ptr, "type");
 
        /* Selects trias/qiads or isolated verts, and edges that do not have 2 neighboring
         * faces
         */
 
        /* for loose vertices/edges, we first select all, loop below will deselect */
-       if(numverts==5)
+       if(numverts==5) {
                EM_set_flag_all(em, SELECT);
+       }
        else if(em->selectmode!=SCE_SELECT_FACE) {
                BKE_report(op->reports, RPT_ERROR, "Only works in face selection mode");
-               return;
+               return OPERATOR_CANCELLED;
        }
        
        for(efa= em->faces.first; efa; efa= efa->next) {
@@ -2765,8 +2759,32 @@ void select_faces_by_numverts(EditMesh *em, wmOperator *op, int numverts)
                }
        }
 
-//     if (EM_texFaceCheck())
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
+       return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
+{
+       static const EnumPropertyItem type_items[]= {
+               {3, "TRIANGLES", 0, "Triangles", NULL},
+               {4, "QUADS", 0, "Triangles", NULL},
+               {5, "OTHER", 0, "Other", NULL},
+               {0, NULL, 0, NULL, NULL}};
+
+       /* identifiers */
+       ot->name= "Select by Number of Vertices";
+       ot->idname= "MESH_OT_select_by_number_vertices";
+       
+       /* api callbacks */
+       ot->exec= select_by_number_vertices_exec;
+       ot->poll= ED_operator_editmesh;
        
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* props */
+       RNA_def_enum(ot->srna, "type", type_items, 3, "Type", "Type of elements to select.");
 }
 
 static int select_sharp_edges_exec(bContext *C, wmOperator *op)
@@ -3475,6 +3493,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec= mesh_select_random_exec;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_editmesh;
 
        /* flags */
@@ -3580,6 +3599,7 @@ void MESH_OT_selection_type(wmOperatorType *ot)
 
 static int editmesh_mark_seam(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        Mesh *me= ((Mesh *)obedit->data);
@@ -3610,9 +3630,11 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op)
                }
        }
 
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -3634,6 +3656,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot)
 
 static int editmesh_mark_sharp(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        Mesh *me= ((Mesh *)obedit->data);
@@ -3659,9 +3682,11 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
                }
        }
 
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -4055,6 +4080,7 @@ void righthandfaces(EditMesh *em, int select)     /* makes faces righthand turning *
 
 static int righthandfaces_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        
@@ -4063,9 +4089,11 @@ static int righthandfaces_exec(bContext *C, wmOperator *op)
        // XXX  need other args
        righthandfaces(em, RNA_boolean_get(op->ptr, "inside"));
        
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ?
 
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -4398,11 +4426,11 @@ static int smooth_vertex(bContext *C, wmOperator *op)
 
        recalc_editnormals(em);
 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       BKE_mesh_end_editmesh(obedit->data, em);
 
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -4531,9 +4559,11 @@ static int vertices_to_sphere_exec(bContext *C, wmOperator *op)
        
        vertices_to_sphere(scene, v3d, obedit, em, RNA_float_get(op->ptr,"percent"));
                
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -4576,6 +4606,7 @@ void flipface(EditMesh *em, EditFace *efa)
 
 static int flip_editnormals(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
        EditFace *efa;
@@ -4592,6 +4623,10 @@ static int flip_editnormals(bContext *C, wmOperator *op)
        recalc_editnormals(em);
 
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
@@ -4608,3 +4643,4 @@ void MESH_OT_flip_editnormals(wmOperatorType *ot)
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
+
index dc9c8c6..2c3007d 100644 (file)
@@ -496,6 +496,7 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
                BKE_report(op->reports, RPT_INFO, msg);
        }
                
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -698,28 +699,33 @@ void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op)
 // XXX should be a menu item
 static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        extrude_mesh(obedit,em, op);
+
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
        WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
-
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
 /* extrude without transform */
 static int mesh_extrude_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
        
        extrude_mesh(obedit,em, op);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -747,6 +753,7 @@ void MESH_OT_extrude(wmOperatorType *ot)
 
 static int split_mesh(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -760,9 +767,9 @@ static int split_mesh(bContext *C, wmOperator *op)
 
        WM_cursor_wait(0);
 
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
@@ -784,6 +791,7 @@ void MESH_OT_split(wmOperatorType *ot)
 
 static int extrude_repeat_mesh(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -819,9 +827,9 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
        
        EM_fgon_flags(em);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
@@ -931,16 +939,19 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
 
 static int spin_mesh_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        int ok;
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       
        ok= spin_mesh(C, op, NULL, RNA_int_get(op->ptr,"steps"), RNA_float_get(op->ptr,"degrees"), RNA_boolean_get(op->ptr,"dupli"));
        if(ok==0) {
                BKE_report(op->reports, RPT_ERROR, "No valid vertices are selected");
                return OPERATOR_CANCELLED;
        }
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
@@ -983,6 +994,7 @@ void MESH_OT_spin(wmOperatorType *ot)
 
 static int screw_mesh_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        EditVert *eve,*v1=0,*v2=0;
@@ -1038,7 +1050,9 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
        }
        
        if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) {
+               DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
                WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
                BKE_mesh_end_editmesh(obedit->data, em);                
                return OPERATOR_FINISHED;
        }
@@ -1047,8 +1061,6 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
                BKE_mesh_end_editmesh(obedit->data, em);
                return OPERATOR_CANCELLED;
        }
-
-       BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 /* get center and axis, in global coords */
@@ -1267,8 +1279,6 @@ void delete_mesh(Object *obedit, EditMesh *em, wmOperator *op, int event)
        }
 
        EM_fgon_flags(em);      // redo flags and indices for fgons
-
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 }
 
 /* Note, these values must match delete_mesh() event values */
@@ -1285,11 +1295,13 @@ static EnumPropertyItem prop_mesh_delete_types[] = {
 
 static int delete_mesh_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
-       delete_mesh(obedit,em, op,RNA_enum_get(op->ptr, "type"));
+       delete_mesh(obedit, em, op, RNA_enum_get(op->ptr, "type"));
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -2898,7 +2910,6 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut
        }
        
        recalc_editnormals(em);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 }
 
 static int count_selected_edges(EditEdge *ed)
@@ -3379,7 +3390,6 @@ void join_triangles(EditMesh *em)
        if(edsortblock) MEM_freeN(edsortblock);
                
        EM_selectmode_flush(em);
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 
 }
 /* ******************** END TRIANGLE TO QUAD ************************************* */
@@ -3475,9 +3485,6 @@ void edge_flip(EditMesh *em)
        free_tagged_edges_faces(em, em->edges.first, em->faces.first);
        
        MEM_freeN(efaar);
-       
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
 }
 
 static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
@@ -3658,6 +3665,7 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir)
 /* only accepts 1 selected edge, or 2 selected faces */
 static int edge_rotate_selected(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
                
@@ -3722,10 +3730,9 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
        /* flush selected vertices (again) to edges/faces */
        EM_select_flush(em);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
 
-       
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 
@@ -4733,9 +4740,6 @@ void mesh_set_smooth_faces(EditMesh *em, short event)
                }
                efa= efa->next;
        }
-       
-//     DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-       
 }
 
 /* ********************** mesh rip ********************** */
@@ -4776,6 +4780,7 @@ static void mesh_rip_setface(EditMesh *em, EditFace *sefa)
 /* based on mouse cursor position, it defines how is being ripped */
 static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
+       Scene *scene= CTX_data_scene(C);
        ARegion *ar= CTX_wm_region(C);
        RegionView3D *rv3d= ar->regiondata;
        Object *obedit= CTX_data_edit_object(C);
@@ -4977,13 +4982,17 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
                }
        }
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
+       BKE_mesh_end_editmesh(obedit->data, em);
+
        RNA_int_set(op->ptr, "mode", TFM_TRANSLATION);
        WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
 
 //     scene->prop_mode = propmode;
 // XXX scene->proportional = prop;
 
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -5762,8 +5771,13 @@ typedef struct PathEdge{
        float w;
 } PathEdge;
 
-void pathselect(EditMesh *em, wmOperator *op)
+#define PATH_SELECT_EDGE_LENGTH 0
+#define PATH_SELECT_TOPOLOGICAL 1
+
+int select_vertex_path_exec(bContext *C, wmOperator *op)
 {
+       Object *obedit= CTX_data_edit_object(C);
+       EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        EditVert *eve, *s, *t;
        EditEdge *eed;
        EditSelection *ese;
@@ -5812,9 +5826,7 @@ void pathselect(EditMesh *em, wmOperator *op)
                        }
                }
                
-               
-               
-               if(s->f1 && t->f1){ /*t can be reached by s*/
+               if(s->f1 && t->f1){ /* t can be reached by s */
                        Q = MEM_callocN(sizeof(PathNode)*totnodes, "Path Select Nodes");
                        totnodes = 0;
                        for(eve=em->verts.first; eve; eve=eve->next){
@@ -5908,15 +5920,41 @@ void pathselect(EditMesh *em, wmOperator *op)
                        MEM_freeN(previous);
                        BLI_heap_free(heap, NULL);
                        EM_select_flush(em);
-               //                      DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-
-//                     if (EM_texFaceCheck())
                }
        }
-       else{
+       else {
+               BKE_mesh_end_editmesh(obedit->data, em);
                BKE_report(op->reports, RPT_ERROR, "Path Selection requires that exactly two vertices be selected");
-               return;
+               return OPERATOR_CANCELLED;
        }
+       
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_vertex_path(wmOperatorType *ot)
+{
+       static const EnumPropertyItem type_items[] = {
+               {PATH_SELECT_EDGE_LENGTH, "EDGE_LENGTH", 0, "Edge Length", NULL},
+               {PATH_SELECT_TOPOLOGICAL, "TOPOLOGICAL", 0, "Topological", NULL},
+               {0, NULL, 0, NULL, NULL}};
+
+       /* identifiers */
+       ot->name= "Select Vertex Path";
+       ot->idname= "MESH_OT_select_vertex_path";
+       
+       /* api callbacks */
+       ot->exec= select_vertex_path_exec;
+       ot->invoke= WM_menu_invoke;
+       ot->poll= ED_operator_editmesh;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       /* properties */
+       RNA_def_enum(ot->srna, "type", type_items, PATH_SELECT_EDGE_LENGTH, "Type", "Method to compute distance.");
 }
 
 static int region_to_loop(bContext *C, wmOperator *op)
@@ -6156,6 +6194,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
 
 static int mesh_rotate_uvs(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6219,17 +6258,20 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
                }
        }
        
-       if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       }
-       
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       if(!change)
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
        return OPERATOR_FINISHED;
 }
 
 static int mesh_mirror_uvs(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6308,17 +6350,20 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op)
                }
        }
        
-       if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       }
-
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       if(!change)
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
 static int mesh_rotate_colors(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6364,18 +6409,21 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
                }
        }
        
-       if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       }       
-       
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       if(!change)
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
 
 static int mesh_mirror_colors(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
@@ -6420,12 +6468,14 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
                }
        }
        
-       if (change) {
-//             DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       }
-       
        BKE_mesh_end_editmesh(obedit->data, em);
+
+       if(!change)
+               return OPERATOR_CANCELLED;
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
        return OPERATOR_FINISHED;
 }
 
@@ -6487,15 +6537,17 @@ void MESH_OT_colors_mirror(wmOperatorType *ot)
 
 static int subdivide_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= CTX_data_edit_object(C);
        Scene *scene = CTX_data_scene(C);
+       Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, 1, 0);
                
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -6515,15 +6567,17 @@ void MESH_OT_subdivide(wmOperatorType *ot)
 
 static int subdivide_multi_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= CTX_data_edit_object(C);
        Scene *scene = CTX_data_scene(C);
+       Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0);
                
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -6546,15 +6600,17 @@ void MESH_OT_subdivide_multi(wmOperatorType *ot)
 
 static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= CTX_data_edit_object(C);
        Scene *scene = CTX_data_scene(C);
+       Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0);
                
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -6578,15 +6634,15 @@ void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot)
 
 static int subdivide_smooth_exec(bContext *C, wmOperator *op)
 {
-       Object *obedit= CTX_data_edit_object(C);
        Scene *scene = CTX_data_scene(C);
+       Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
                
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;       
 }
 
@@ -6922,15 +6978,17 @@ static void fill_mesh(EditMesh *em)
 
 static int fill_mesh_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        fill_mesh(em);
-       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);
-       
+
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
        
 }
@@ -6951,14 +7009,17 @@ void MESH_OT_fill(wmOperatorType *ot)
 
 static int beauty_fill_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        beauty_fill(em);
        
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -6978,11 +7039,13 @@ void MESH_OT_beauty_fill(wmOperatorType *ot)
 
 static int quads_convert_to_tris_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        convert_to_triface(em,0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -7005,11 +7068,13 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
 
 static int tris_convert_to_quads_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
 
        join_triangles(em);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -7032,11 +7097,13 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
 
 static int edge_flip_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        edge_flip(em);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
        BKE_mesh_end_editmesh(obedit->data, em);
@@ -7059,14 +7126,17 @@ void MESH_OT_edge_flip(wmOperatorType *ot)
 
 static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene= CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        mesh_set_smooth_faces(em,1);
        
+       BKE_mesh_end_editmesh(obedit->data, em);
+
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -7086,14 +7156,15 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
 
 static int mesh_faces_shade_solid_exec(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit= CTX_data_edit_object(C);
        EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
        
        mesh_set_smooth_faces(em,0);
        
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
        
-       BKE_mesh_end_editmesh(obedit->data, em);
        return OPERATOR_FINISHED;
 }
 
@@ -7110,3 +7181,4 @@ void MESH_OT_faces_shade_solid(wmOperatorType *ot)
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
+
index 22e3b40..ff07d03 100644 (file)
@@ -155,13 +155,12 @@ void MESH_OT_select_linked(struct wmOperatorType *ot);
 void MESH_OT_select_linked_pick(struct wmOperatorType *ot);
 void MESH_OT_hide(struct wmOperatorType *ot);
 void MESH_OT_reveal(struct wmOperatorType *ot);
+void MESH_OT_select_by_number_vertices(struct wmOperatorType *ot);
 void MESH_OT_normals_make_consistent(struct wmOperatorType *ot);
 void MESH_OT_faces_select_linked_flat(struct wmOperatorType *ot);
 void MESH_OT_edges_select_sharp(struct wmOperatorType *ot);
 void MESH_OT_select_shortest_path(struct wmOperatorType *ot);
-void MESH_OT_vertices_select_similar(struct wmOperatorType *ot);
-void MESH_OT_edges_select_similar(struct wmOperatorType *ot);
-void MESH_OT_faces_select_similar(struct wmOperatorType *ot);
+void MESH_OT_select_similar(struct wmOperatorType *ot);
 void MESH_OT_select_random(struct wmOperatorType *ot);
 void MESH_OT_vertices_transform_to_sphere(struct wmOperatorType *ot);
 void MESH_OT_selection_type(struct wmOperatorType *ot);
@@ -223,6 +222,7 @@ void MESH_OT_faces_shade_solid(struct wmOperatorType *ot);
 void MESH_OT_split(struct wmOperatorType *ot);
 void MESH_OT_extrude_repeat(struct wmOperatorType *ot);
 void MESH_OT_edge_rotate(struct wmOperatorType *ot);
+void MESH_OT_select_vertex_path(struct wmOperatorType *ot);
 void MESH_OT_loop_to_region(struct wmOperatorType *ot);
 void MESH_OT_region_to_loop(struct wmOperatorType *ot);
 
index 2a9357e..7e59cd6 100644 (file)
@@ -119,6 +119,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_selection_type);
        WM_operatortype_append(MESH_OT_hide);
        WM_operatortype_append(MESH_OT_reveal);
+       WM_operatortype_append(MESH_OT_select_by_number_vertices);
        WM_operatortype_append(MESH_OT_normals_make_consistent);
        WM_operatortype_append(MESH_OT_subdivide);
        WM_operatortype_append(MESH_OT_subdivide_multi);
@@ -149,6 +150,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_split);
        WM_operatortype_append(MESH_OT_extrude_repeat);
        WM_operatortype_append(MESH_OT_edge_rotate);
+       WM_operatortype_append(MESH_OT_select_vertex_path);
        WM_operatortype_append(MESH_OT_loop_to_region);
        WM_operatortype_append(MESH_OT_region_to_loop);
        
@@ -172,9 +174,7 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_loop_select);
        WM_operatortype_append(MESH_OT_edge_face_add);
        WM_operatortype_append(MESH_OT_select_shortest_path);
-       WM_operatortype_append(MESH_OT_vertices_select_similar);
-       WM_operatortype_append(MESH_OT_edges_select_similar);
-       WM_operatortype_append(MESH_OT_faces_select_similar);
+       WM_operatortype_append(MESH_OT_select_similar);
        WM_operatortype_append(MESH_OT_loop_multi_select);
        WM_operatortype_append(MESH_OT_mark_seam);
        WM_operatortype_append(MESH_OT_mark_sharp);
@@ -223,7 +223,6 @@ void ED_keymap_mesh(wmWindowManager *wm)
        RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
        RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
        
-       WM_keymap_add_item(keymap, "MESH_OT_select_random", SPACEKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
 
        WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_CTRL , 0);
@@ -232,10 +231,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_CTRL , 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_ALT , 0)->ptr,"set",1);
 
-       /* temp hotkeys! */
-       WM_keymap_add_item(keymap, "MESH_OT_vertices_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_edges_select_similar", GKEY, KM_PRESS, KM_SHIFT2|KM_CTRL, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_faces_select_similar", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL2, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
        
        /* selection mode */
        WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, KM_CTRL, 0);
index 1b6b5b4..b656aa8 100644 (file)
@@ -1826,7 +1826,7 @@ void PARTICLE_OT_rekey(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= rekey_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= PE_poll;
 
        /* flags */
index dd8efd6..1a06117 100644 (file)
@@ -1128,8 +1128,6 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
                em= (ar->type->minsizex)? 10: 20;
        }
 
-       header= 20; // XXX
-       triangle= 22;
        x= 0;
        y= -style->panelouter;
 
@@ -1150,10 +1148,14 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
                        block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
                        panel= uiBeginPanel(sa, ar, block, pt, &open);
 
+                       /* bad fixed values */
+                       header= (pt->flag & PNL_NO_HEADER)? 0: 20;
+                       triangle= 22;
+
                        if(vertical)
                                y -= header;
 
-                       if(pt->draw_header && (open || vertical)) {
+                       if(pt->draw_header && header && (open || vertical)) {
                                /* for enabled buttons */
                                panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
                                        triangle, header+style->panelspace, header, 1, style);
index 02179f3..9764409 100644 (file)
@@ -685,7 +685,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
        if(!path)
                return;
 
-       row= uiLayoutRow(layout, 0);
+       row= uiLayoutRow(layout, 1);
        uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
 
        block= uiLayoutGetBlock(row);
@@ -696,18 +696,18 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
        for(a=0; a<path->len; a++) {
                ptr= &path->ptr[a];
 
+               if(a != 0)
+                       uiDefIconBut(block, LABEL, 0, VICON_SMALL_TRI_RIGHT, 0, 0, 10, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+
                if(ptr->data) {
                        icon= RNA_struct_ui_icon(ptr->type);
                        name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf));
 
-#if 0
-                       if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) {
-                               uiItemL(row, "", icon); /* save some space */
-                       }
-                       else
-#endif
                        if(name) {
-                               uiItemL(row, name, icon);
+                               if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene)
+                                       uiItemL(row, "", icon); /* save some space */
+                               else
+                                       uiItemL(row, name, icon);
 
                                if(name != namebuf)
                                        MEM_freeN(name);
@@ -731,6 +731,7 @@ void buttons_context_register(ARegionType *art)
        strcpy(pt->idname, "BUTTONS_PT_context");
        strcpy(pt->label, "Context");
        pt->draw= buttons_panel_context;
+       pt->flag= PNL_NO_HEADER;
        BLI_addtail(&art->paneltypes, pt);
 }
 
index 24781cc..358da48 100644 (file)
@@ -1060,7 +1060,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= new_exec;
-       ot->invoke= WM_operator_redo;
+       ot->invoke= WM_operator_props_popup;
        ot->poll= ED_operator_image_active;
 
        /* flags */
index 7d6faa0..a1217f8 100644 (file)
@@ -294,6 +294,13 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
                case NC_IMAGE:  
                        ED_area_tag_redraw(sa);
                        break;
+               case NC_OBJECT:
+                       switch(wmn->data) {
+                               case ND_GEOM_SELECT:
+                               case ND_GEOM_DATA:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
        }
 }
 
@@ -395,6 +402,10 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
        /* image paint polls for mode */
        keymap= WM_keymap_listbase(wm, "ImagePaint", SPACE_IMAGE, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
+       /* XXX need context here?
+       keymap= WM_keymap_listbase(wm, "UVEdit", 0, 0);
+       WM_event_add_keymap_handler(&ar->handlers, keymap);*/
        
        /* own keymaps */
        keymap= WM_keymap_listbase(wm, "Image Generic", SPACE_IMAGE, 0);
@@ -459,13 +470,6 @@ static void image_main_area_listener(ARegion *ar, wmNotifier *wmn)
                                        break;
                        }
                        break;
-               case NC_OBJECT:
-                       switch(wmn->data) {
-                               case ND_GEOM_SELECT:
-                               case ND_GEOM_DATA:
-                                       ED_region_tag_redraw(ar);
-                                       break;
-                       }
        }
 }
 
index 5f475b0..e874953 100644 (file)
@@ -2969,7 +2969,6 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 {
        float vec[3], vec2[3];
        float *vd = pdd->vd;
-       float *nd = pdd->nd;
        float *cd = pdd->cd;
        float ma_r;
        float ma_g;
index a0d1b91..5b378f3 100644 (file)
@@ -1007,203 +1007,67 @@ static uiBlock *view3d_select_object_groupedmenu(bContext *C, ARegion *ar, void
 
 #endif
 
-static uiBlock *view3d_select_objectmenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_select_objectmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-//     short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, ar, "view3d_select_objectmenu", UI_EMBOSSP);
-       
+       uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
+
+       uiItemS(layout);
+
+       uiItemO(layout, "Select/Deselect All", 0, "OBJECT_OT_select_all_toggle");
+       uiItemO(layout, "Inverse", 0, "OBJECT_OT_select_invert");
+       uiItemO(layout, "Random", 0, "OBJECT_OT_select_random");
+       uiItemO(layout, "Select All by Layer", 0, "OBJECT_OT_select_by_layer");
+       uiItemMenuEnumO(layout, "Select All by Type", 0, "OBJECT_OT_select_by_type", "type");
+
 #if 0
-       uiBlockSetButmFunc(block, do_view3d_select_objectmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",                  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I",                                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random",                                                 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       
        uiDefIconTextBlockBut(block, view3d_select_object_layermenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Layer", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_select_object_typemenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Type", 0, yco-=20, 120, 19, "");
-               
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
+
+       uiItemS(layout);
+
        uiDefIconTextBlockBut(block, view3d_select_object_linkedmenu, NULL, ICON_RIGHTARROW_THIN, "Linked", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_select_object_groupedmenu, NULL, ICON_RIGHTARROW_THIN, "Grouped", 0, yco-=20, 120, 19, "");
 #endif
-       uiDefMenuButO(block, "VIEW3D_OT_select_border", "Border Select");
-       
-       uiDefMenuSep(block);
-       
-       uiDefMenuButO(block, "OBJECT_OT_select_all_toggle", "Select/Deselect All");
-       uiDefMenuButO(block, "OBJECT_OT_select_invert", "Inverse");
-       uiDefMenuButO(block, "OBJECT_OT_select_random", "Random");
-       uiDefMenuButO(block, "OBJECT_OT_select_by_layer", "Select All by Layer");
-       uiDefMenuButO(block, "OBJECT_OT_select_by_type", "Select All by Type");
-
-
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
-       
-       uiTextBoundsBlock(block, 50);
-       return block;
 }
 
-void do_view3d_select_meshmenu(bContext *C, void *arg, int event)
+static void view3d_select_meshmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-#if 0
-/*     extern void borderselect(void);*/
+       uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
 
-       switch(event) {
-       
-               case 0: /* border select */
-                       borderselect();
-                       break;
-               case 2: /* Select/Deselect all */
-                       deselectall_mesh();
-                       break;
-               case 3: /* Inverse */
-                       selectswap_mesh();
-                       break;
-               case 4: /* select linked vertices */
-                       selectconnected_mesh_all();
-                       break;
-               case 5: /* select random */
-                       selectrandom_mesh();
-                       break;
-               case 7: /* select more */
-                       select_more();
-                       break;
-               case 8: /* select less */
-                       select_less();
-                       break;
-               case 9: /* select non-manifold */
-                       select_non_manifold();
-                       break;
-               case 11: /* select triangles */
-                       select_faces_by_numverts(3);
-                       break;
-               case 12: /* select quads */
-                       select_faces_by_numverts(4);
-                       break;
-               case 13: /* select non-triangles/quads */
-                       select_faces_by_numverts(5);
-                       break;
-               case 14: /* select sharp edges */
-                       select_sharp_edges();
-                       break;
-               case 15: /* select linked flat faces */
-                       select_linked_flat_faces();
-                       break;
+       uiItemS(layout);
 
-               case 16: /* path select */
-                       pathselect();
-                       ED_undo_push(C, "Path Select");
-                       break;
-               case 17: /* edge loop select */
-                       loop_multiselect(0);
-                       break;
-               case 18: /* edge ring select */
-                       loop_multiselect(1);
-                       break;
-               case 19: /* loop to region */
-                       loop_to_region();
-                       break;
-               case 20: /* region to loop */
-                       region_to_loop();
-                       break;
-               case 21: /* Select grouped */
-                       select_mesh_group_menu();
-                       break;
-       }
-#endif
-}
+       uiItemO(layout, "Select/Deselect All", 0, "MESH_OT_select_all_toggle");
+       uiItemO(layout, "Inverse", 0, "MESH_OT_select_invert");
 
+       uiItemS(layout);
 
-static uiBlock *view3d_select_meshmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, ar, "view3d_select_meshmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_select_meshmenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
-                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random...",                              0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Non-Manifold|Ctrl Alt Shift M", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Sharp Edges|Ctrl Alt Shift S", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Linked Flat Faces|Ctrl Alt Shift F", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
-       
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
-                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Triangles|Ctrl Alt Shift 3", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Quads|Ctrl Alt Shift 4", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Non-Triangles/Quads|Ctrl Alt Shift 5", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-                                        "Similar to Selection...|Shift G", 
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
-
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
-                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "More|Ctrl NumPad +",
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Less|Ctrl NumPad -",
-                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
-                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linked Vertices|Ctrl L",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Vertex Path|W Alt 7",                            0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Edge Loop|Ctrl E 6",                     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Edge Ring|Ctrl E 7",                     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
-       
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
-                        menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop to Region|Ctrl E 8",                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Region to Loop|Ctrl E 9",                        0, yco-=20, menuwidth, 20, NULL, 0.0, 0.0, 1, 20, "");  
-       
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
+       uiItemO(layout, "Random...", 0, "MESH_OT_select_random"); // Random...
+       uiItemO(layout, "Sharp Edges", 0, "MESH_OT_edges_select_sharp");
+       uiItemO(layout, "Linked Flat Faces", 0, "MESH_OT_faces_select_linked_flat");
 
-       uiTextBoundsBlock(block, 50);
-       return block;
+       uiItemS(layout);
+
+       uiItemEnumO(layout, "Triangles", 0, "MESH_OT_select_by_number_vertices", "type", 3); // Ctrl Alt Shift 3
+       uiItemEnumO(layout, "Quads", 0, "MESH_OT_select_by_number_vertices", "type", 4); // Ctrl Alt Shift 4
+       uiItemEnumO(layout, "Loose Verts/Edges", 0, "MESH_OT_select_by_number_vertices", "type", 5); // Ctrl Alt Shift 5
+       uiItemO(layout, "Similar...", 0, "MESH_OT_select_similar");
+
+       uiItemS(layout);
+
+       uiItemO(layout, "Less", 0, "MESH_OT_select_more");
+       uiItemO(layout, "More", 0, "MESH_OT_select_less");
+
+       uiItemS(layout);
+
+       uiItemO(layout, "Linked", 0, "MESH_OT_select_linked");
+       uiItemO(layout, "Vertex Path", 0, "MESH_OT_select_vertex_path"); // W, Alt 7
+       // XXX uiItemO(layout, "Edge Loop", 0, "MESH_OT_select_edge_loop"); // loop_multiselect(0)
+       // XXX uiItemO(layout, "Edge Ring", 0, "MESH_OT_select_edge_ring"); // loop_multiselect(1)
+
+       uiItemS(layout);
+
+       uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region"); // Ctrl E 8
+       uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop"); // Ctrl E 9
 }
 
 static void view3d_select_curvemenu(bContext *C, uiLayout *layout, void *arg_unused)
@@ -1309,144 +1173,63 @@ static void view3d_select_latticemenu(bContext *C, uiLayout *layout, void *arg_u
        uiItemO(layout, NULL, 0, "LATTICE_OT_select_all_toggle");
 }
 
-static void do_view3d_select_armaturemenu(bContext *C, void *arg, int event)
+static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-#if 0
-/*     extern void borderselect(void);*/
+       PointerRNA ptr;
 
-       switch(event) {
-               case 0: /* border select */
-                       borderselect();
-                       break;
-               case 2: /* Select/Deselect all */
-                       deselectall_armature(1, 1);
-                       break;
-               case 3: /* Swap Select All */
-                       deselectall_armature(3, 1);
-                       break;
-               case 4: /* Select parent */
-                       armature_select_hierarchy(BONE_SELECT_PARENT, 0);
-                       break;
-               case 5: /* Select child */
-                       armature_select_hierarchy(BONE_SELECT_CHILD, 0);
-                       break;
-               case 6: /* Extend Select parent */
-                       armature_select_hierarchy(BONE_SELECT_PARENT, 1);
-                       break;
-               case 7: /* Extend Select child */
-                       armature_select_hierarchy(BONE_SELECT_CHILD, 1);
-                       break;
-       }
-#endif
-}
+       uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
 
-static uiBlock *view3d_select_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, ar, "view3d_select_armaturemenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_select_armaturemenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I",                 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[",                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]",                                 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [",                                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]",                                    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-       
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
+       uiItemS(layout);
 
-       uiTextBoundsBlock(block, 50);
-       return block;
-}
+       uiItemO(layout, "Select/Deselect All", 0, "ARMATURE_OT_select_all_toggle");
+       uiItemO(layout, "Inverse", 0, "ARMATURE_OT_select_invert");
 
-static void do_view3d_select_pose_armaturemenu(bContext *C, void *arg, int event)
-{
-#if 0
-/*     extern void borderselect(void);*/
-       
-       switch(event) {
-       case 0: /* border select */
-               borderselect();
-               break;
-       case 2: /* Select/Deselect all */
-               deselectall_posearmature(OBACT, 1, 1);
-               break;
-       case 3: /* Select Target(s) of Constraint(s) */
-               pose_select_constraint_target();
-               break;
-       case 5: /* Swap Select All */
-               deselectall_posearmature(OBACT, 3, 1);
-               break;
-       case 6: /* Select parent */
-               pose_select_hierarchy(BONE_SELECT_PARENT, 0);
-               break;
-       case 7: /* Select child */
-               pose_select_hierarchy(BONE_SELECT_CHILD, 0);
-               break;
-       case 8: /* Extend Select parent */
-               pose_select_hierarchy(BONE_SELECT_PARENT, 1);
-               break;
-       case 9: /* Extend Select child */
-               pose_select_hierarchy(BONE_SELECT_CHILD, 1);
-               break;
-       }
-#endif
+       uiItemS(layout);
+
+       uiItemEnumO(layout, "Parent", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_PARENT);
+       uiItemEnumO(layout, "Child", 0, "ARMATURE_OT_select_hierarchy", "direction", BONE_SELECT_CHILD);
+
+       uiItemS(layout);
+
+       WM_operator_properties_create(&ptr, "ARMATURE_OT_select_hierarchy");
+       RNA_boolean_set(&ptr, "extend", 1);
+       RNA_enum_set(&ptr, "direction", BONE_SELECT_PARENT);
+       uiItemFullO(layout, "Extend Parent", 0, "ARMATURE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN);
+
+       WM_operator_properties_create(&ptr, "ARMATURE_OT_select_hierarchy");
+       RNA_boolean_set(&ptr, "extend", 1);
+       RNA_enum_set(&ptr, "direction", BONE_SELECT_CHILD);
+       uiItemFullO(layout, "Extend Child", 0, "ARMATURE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN);
 }
 
-static uiBlock *view3d_select_pose_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
+static void view3d_select_posemenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-       
-       block= uiBeginBlock(C, ar, "view3d_select_pose_armaturemenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_select_pose_armaturemenu, NULL);
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Border Select|B",                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I",                         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W",                     0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[",                                        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]",                                 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
-       
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [",                                   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]",                                    0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
-       
-       if(ar->alignment==RGN_ALIGN_TOP) {
-               uiBlockSetDirection(block, UI_DOWN);
-       }
-       else {
-               uiBlockSetDirection(block, UI_TOP);
-               uiBlockFlipOrder(block);
-       }
+       PointerRNA ptr;
 
-       uiTextBoundsBlock(block, 50);
-       return block;
+       uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
+
+       uiItemS(layout);
+
+       uiItemO(layout, "Select/Deselect All", 0, "POSE_OT_select_all_toggle");
+       uiItemO(layout, "Inverse", 0, "POSE_OT_select_invert");
+       uiItemO(layout, "Constraint Target", 0, "POSE_OT_select_constraint_target");
+
+       uiItemS(layout);
+
+       uiItemEnumO(layout, "Parent", 0, "POSE_OT_select_hierarchy", "direction", BONE_SELECT_PARENT);
+       uiItemEnumO(layout, "Child", 0, "POSE_OT_select_hierarchy", "direction", BONE_SELECT_CHILD);
+
+       uiItemS(layout);
+
+       WM_operator_properties_create(&ptr, "POSE_OT_select_hierarchy");
+       RNA_boolean_set(&ptr, "extend", 1);
+       RNA_enum_set(&ptr, "direction", BONE_SELECT_PARENT);
+       uiItemFullO(layout, "Extend Parent", 0, "POSE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN);
+
+       WM_operator_properties_create(&ptr, "POSE_OT_select_hierarchy");
+       RNA_boolean_set(&ptr, "extend", 1);
+       RNA_enum_set(&ptr, "direction", BONE_SELECT_CHILD);
+       uiItemFullO(layout, "Extend Child", 0, "POSE_OT_select_hierarchy", ptr.data, WM_OP_EXEC_REGION_WIN);
 }
 
 void do_view3d_select_faceselmenu(bContext *C, void *arg, int event)
@@ -5071,17 +4854,17 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
        xmax= GetButStringLength("Select");
        if (obedit) {
                if (ob && ob->type == OB_MESH) {
-                       uiDefPulldownBut(block, view3d_select_meshmenu, NULL, "Select", xco,yco, xmax-3, 24, "");
+                       uiDefMenuBut(block, view3d_select_meshmenu, NULL, "Select",     xco,yco, xmax-3, 20, "");
                } else if (ob && (ob->type == OB_CURVE || ob->type == OB_SURF)) {
-                       uiDefMenuBut(block, view3d_select_curvemenu, NULL, "Select", xco, yco, xmax-3, 24, "");
+                       uiDefMenuBut(block, view3d_select_curvemenu, NULL, "Select", xco, yco, xmax-3, 20, "");
                } else if (ob && ob->type == OB_FONT) {
                        xmax= 0;
                } else if (ob && ob->type == OB_MBALL) {
-                       uiDefPulldownBut(block, view3d_select_metaballmenu, NULL, "Select",     xco,yco, xmax-3, 24, "");
+                       uiDefPulldownBut(block, view3d_select_metaballmenu, NULL, "Select",     xco,yco, xmax-3, 20, "");
                } else if (ob && ob->type == OB_LATTICE) {
-                       uiDefMenuBut(block, view3d_select_latticemenu, NULL, "Select", xco, yco, xmax-3, 24, "");
+                       uiDefMenuBut(block, view3d_select_latticemenu, NULL, "Select", xco, yco, xmax-3, 20, "");
                } else if (ob && ob->type == OB_ARMATURE) {
-                       uiDefPulldownBut(block, view3d_select_armaturemenu, NULL, "Select",     xco,yco, xmax-3, 20, "");
+                       uiDefMenuBut(block, view3d_select_armaturemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
                }
        } else if (FACESEL_PAINT_TEST) {
                if (ob && ob->type == OB_MESH) {
@@ -5094,9 +4877,9 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
        } else {
                
                if (ob && (ob->flag & OB_POSEMODE))
-                       uiDefPulldownBut(block, view3d_select_pose_armaturemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
+                       uiDefMenuBut(block, view3d_select_posemenu, NULL, "Select", xco,yco, xmax-3, 20, "");
                else
-                       uiDefPulldownBut(block, view3d_select_objectmenu, NULL, "Select",       xco,yco, xmax-3, 20, "");
+                       uiDefMenuBut(block, view3d_select_objectmenu, NULL, "Select",   xco,yco, xmax-3, 20, "");
        }
        xco+= xmax;
        
index a153f79..74063e0 100644 (file)
@@ -1442,6 +1442,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
                                }
                        }
                        
+                       ED_armature_sync_selection(arm->edbo);
                }
                else if(obedit->type==OB_LATTICE) {
                        do_lattice_box_select(&vc, &rect, val==LEFTMOUSE);
index 1d79c54..6f742d7 100644 (file)
@@ -125,7 +125,18 @@ static int ed_undo_step(bContext *C, int step)
 {      
        Object *obedit= CTX_data_edit_object(C);
        ScrArea *sa= CTX_wm_area(C);
-       
+
+       if(sa && sa->spacetype==SPACE_IMAGE) {
+               SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+               
+               if(G.f & G_TEXTUREPAINT || sima->flag & SI_DRAWTOOL) {
+                       undo_imagepaint_step(step);
+
+                       WM_event_add_notifier(C, NC_WINDOW, NULL);
+                       return OPERATOR_FINISHED;
+               }
+       }
+
        if(sa && sa->spacetype==SPACE_TEXT) {
                ED_text_undo_step(C, step);
        }
@@ -138,13 +149,6 @@ static int ed_undo_step(bContext *C, int step)
                
                if(G.f & G_TEXTUREPAINT)
                        undo_imagepaint_step(step);
-               else if(sa && sa->spacetype==SPACE_IMAGE) {
-                       SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
-                       if(sima->flag & SI_DRAWTOOL)
-                               undo_imagepaint_step(step);
-                       else
-                               do_glob_undo= 1;
-               }
                else if(G.f & G_PARTICLEEDIT) {
                        if(step==1)
                                PE_undo(CTX_data_scene(C));
index b811906..a58ee97 100644 (file)
@@ -121,7 +121,7 @@ static void draw_uvs_shadow(SpaceImage *sima, Object *obedit)
 {
        EditMesh *em;
        EditFace *efa;
-       TFace *tf;
+       MTFace *tf;
        
        em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
 
@@ -591,7 +591,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
                        break;
                case SI_UVDT_BLACK: /* black/white */
                case SI_UVDT_WHITE: 
-                       cpack((sima->dt_uv==SI_UVDT_WHITE) ? 0xFFFFFF : 0x0);
+                       if(sima->dt_uv==SI_UVDT_WHITE) glColor3f(1.0f, 1.0f, 1.0f);
+                       else glColor3f(0.0f, 0.0f, 0.0f);
 
                        for(efa= em->faces.first; efa; efa= efa->next) {
                                tf= (MTFace *)efa->tmp.p; /* visible faces cached */
index 44133b6..73ecade 100644 (file)
@@ -211,6 +211,7 @@ typedef struct ARegion {
 
 /* paneltype flag */
 #define PNL_DEFAULT_CLOSED             1
+#define PNL_NO_HEADER                  2
 
 /* screen handlers */
 #define SCREEN_MAXHANDLER              8
index 85a148b..69f5b5a 100644 (file)
@@ -81,6 +81,7 @@ PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *ide
 PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
 
 PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
+void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc);
 
 PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
 PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
index 923191c..98646ac 100644 (file)
@@ -149,8 +149,6 @@ typedef struct RawArray {
        int stride;
 } RawArray;
 
-/* Iterator Utility */
-
 typedef struct EnumPropertyItem {
        int value;
        const char *identifier;
@@ -159,6 +157,8 @@ typedef struct EnumPropertyItem {
        const char *description;
 } EnumPropertyItem;
 
+typedef EnumPropertyItem *(*EnumPropertyItemFunc)(PointerRNA *ptr);
+
 typedef struct PropertyRNA PropertyRNA;
 
 /* Parameter List */
index 715f03b..2916c1b 100644 (file)
@@ -1960,6 +1960,12 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co
        return prop;
 }
 
+void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
+{
+       EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+       eprop->itemf= itemfunc;
+}
+
 PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, 
        float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
 {
index 14db8ea..557d472 100644 (file)
@@ -547,6 +547,26 @@ static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
        return strlen(((EnumPropertyItem*)ptr->data)->name);
 }
 
+static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value)
+{
+       EnumPropertyItem *eprop= (EnumPropertyItem*)ptr->data;
+
+       if(eprop->description)
+               strcpy(value, eprop->description);
+       else
+               value[0]= '\0';
+}
+
+static int rna_EnumPropertyItem_description_length(PointerRNA *ptr)
+{
+       EnumPropertyItem *eprop= (EnumPropertyItem*)ptr->data;
+
+       if(eprop->description)
+               return strlen(eprop->description);
+       else
+               return 0;
+}
+
 static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
 {
        return ((EnumPropertyItem*)ptr->data)->value;
@@ -861,6 +881,11 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
        RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
        RNA_def_property_ui_text(prop, "Name", "Human readable name.");
 
+       prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get", "rna_EnumPropertyItem_description_length", NULL);
+       RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose.");
+
        prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
index eef221e..9da8c8b 100644 (file)
@@ -607,6 +607,10 @@ static void rna_def_panel(BlenderRNA *brna)
        prop= RNA_def_property(srna, "default_closed", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
        RNA_def_property_flag(prop, PROP_REGISTER);
+
+       prop= RNA_def_property(srna, "no_header", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
+       RNA_def_property_flag(prop, PROP_REGISTER);
 }
 
 static void rna_def_header(BlenderRNA *brna)
index f8ab3a8..9c9c256 100644 (file)
@@ -69,23 +69,23 @@ EnumPropertyItem event_type_items[] = {
        {YKEY, "Y", 0, "Y", ""},
        {ZKEY, "Z", 0, "Z", ""},
        
-       {ZEROKEY, "ZERO",       0, "Zero Key", ""},
-       {ONEKEY, "ONE",         0, "One Key", ""},
-       {TWOKEY, "TWO",         0, "Two Key", ""},
-       {THREEKEY, "THREE",     0, "Three Key", ""},
-       {FOURKEY, "FOUR",       0, "Four Key", ""},
-       {FIVEKEY, "FIVE",       0, "Five Key", ""},
-       {SIXKEY, "SIX",         0, "Six Key", ""},
-       {SEVENKEY, "SEVEN",     0, "Seven Key", ""},
-       {EIGHTKEY, "EIGHT",     0, "Eight Key", ""},
-       {NINEKEY, "NINE",       0, "Nine Key", ""},
+       {ZEROKEY, "ZERO",       0, "0", ""},
+       {ONEKEY, "ONE",         0, "1", ""},
+       {TWOKEY, "TWO",         0, "2", ""},
+       {THREEKEY, "THREE",     0, "3", ""},
+       {FOURKEY, "FOUR",       0, "4", ""},
+       {FIVEKEY, "FIVE",       0, "5", ""},
+       {SIXKEY, "SIX",         0, "6", ""},
+       {SEVENKEY, "SEVEN",     0, "7", ""},
+       {EIGHTKEY, "EIGHT",     0, "8", ""},
+       {NINEKEY, "NINE",       0, "9", ""},
        
        {LEFTCTRLKEY,   "LEFT_CTRL",    0, "Left Ctrl", ""},
        {LEFTALTKEY,    "LEFT_ALT",             0, "Left Alt", ""},
+       {LEFTSHIFTKEY,  "LEFT_SHIFT",   0, "Left Shift", ""},
        {RIGHTALTKEY,   "RIGHT_ALT",    0, "Right Alt", ""},
-       {RIGHTCTRLKEY,  "RIGHT_CTRL",   0, "Rightctrl", ""},
-       {RIGHTSHIFTKEY, "RIGHT_SHIFT",  0, "Rightshift", ""},
-       {LEFTSHIFTKEY,  "LEFT_SHIFT",   0, "Leftshift", ""},
+       {RIGHTCTRLKEY,  "RIGHT_CTRL",   0, "Right Ctrl", ""},
+       {RIGHTSHIFTKEY, "RIGHT_SHIFT",  0, "Right Shift", ""},
        
        {ESCKEY, "ESC", 0, "Esc", ""},
        {TABKEY, "TAB", 0, "Tab", ""},
@@ -94,17 +94,17 @@ EnumPropertyItem event_type_items[] = {
        {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
        {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", ""},
        {DELKEY, "DEL", 0, "Delete", ""},
-       {SEMICOLONKEY, "SEMI_COLON", 0, "Semicolon", ""},
-       {PERIODKEY, "PERIOD", 0, "Period", ""},
-       {COMMAKEY, "COMMA", 0, "Comma", ""},
-       {QUOTEKEY, "QUOTE", 0, "Quote", ""},
-       {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "Accentgrave", ""},
-       {MINUSKEY, "MINUS", 0, "Minus", ""},
-       {SLASHKEY, "SLASH", 0, "Slash", ""},
-       {BACKSLASHKEY, "BACK_SLASH", 0, "Backslash", ""},
-       {EQUALKEY, "EQUAL", 0, "Equal", ""},
-       {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "Leftbracket", ""},
-       {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "Rightbracket", ""},
+       {SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
+       {PERIODKEY, "PERIOD", 0, ".", ""},
+       {COMMAKEY, "COMMA", 0, ",", ""},
+       {QUOTEKEY, "QUOTE", 0, "\"", ""},
+       {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
+       {MINUSKEY, "MINUS", 0, "-", ""},
+       {SLASHKEY, "SLASH", 0, "/", ""},
+       {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
+       {EQUALKEY, "EQUAL", 0, "=", ""},
+       {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "]", ""},
+       {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "[", ""},
        {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", ""},
        {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", ""},
        {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", ""},
index f5eb81e..6732845 100644 (file)
@@ -377,7 +377,7 @@ void RNA_def_world(BlenderRNA *brna)
        prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "range");
        RNA_def_property_range(prop, 0.2, 5.0);
-       RNA_def_property_ui_text(prop, "Range", "The color rage that will be mapped to 0-1");
+       RNA_def_property_ui_text(prop, "Range", "The color range that will be mapped to 0-1.");
 
        /* sky type */
        prop= RNA_def_property(srna, "blend_sky", PROP_BOOLEAN, PROP_NONE);
index ffeb342..50ba2ae 100644 (file)
@@ -124,7 +124,7 @@ int                 WM_operator_filesel             (struct bContext *C, struct wmOperator *op, struct wm
                        /* poll callback, context checks */
 int                    WM_operator_winactive   (struct bContext *C);
                        /* invoke callback, exec + redo popup */
-int                    WM_operator_redo                (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int                    WM_operator_props_popup (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int                    WM_operator_redo_popup  (struct bContext *C, struct wmOperator *op);
 
                /* operator api */
index 7f9a215..d003f07 100644 (file)
@@ -296,7 +296,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
        return block;
 }
 
-int WM_operator_redo(bContext *C, wmOperator *op, wmEvent *event)
+int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
 {
        int retval= OPERATOR_CANCELLED;