Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Hnidek <jiri.hnidek@tul.cz>2009-07-29 16:35:09 +0400
committerJiri Hnidek <jiri.hnidek@tul.cz>2009-07-29 16:35:09 +0400
commitf75005c2a89f6cc5f1bdac33e26341a14ed92888 (patch)
treef83839e709b1167ce9eac42dc8acacd2ec2943cb /source/blender/editors/space_view3d/view3d_header.c
parentb3d07534679e243759892f2a1206dc8756a1c004 (diff)
2.5 MetaBalls
- It is possible to work with MetaBalls in edit mode now - Added basic UI to the button window (feel free to change it :-)) - Header menus should work - Undo & redo should work - Removed global variable editelems and lastelem (moved it to the MetaBall struct) - All tools from old editmball.c was converted to the operators - Added lastelem to the RNA - Experimental: mb->editelems is only pointer at mb->elems or NULL (depends on Mode). ListBase of MetaElems is not duplicated in edit mode. Tested with scons at Linux and mac OS X TODO: - Recalc data after Undo or Redo - Solve issue with basic MetaBall and Python UI script (only base MetaBall object influence Wiresize and Threshold) - Fix orientation of manipulator in "Normal mode"
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_header.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c179
1 files changed, 32 insertions, 147 deletions
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 218011054d5..26ca5a07973 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -1069,58 +1069,14 @@ static void view3d_select_curvemenu(bContext *C, uiLayout *layout, void *arg_unu
#endif
}
-void do_view3d_select_metaballmenu(bContext *C, void *arg, int event)
+static void view3d_select_metaballmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
-#if 0
-
- switch(event) {
- case 0: /* border select */
- borderselect();
- break;
- case 2: /* Select/Deselect all */
- deselectall_mball();
- break;
- case 3: /* Inverse */
- selectinverse_mball();
- break;
- case 4: /* Select Random */
- selectrandom_mball();
- break;
- }
-#endif
-}
-
-
-static uiBlock *view3d_select_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "view3d_select_metaballmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_select_metaballmenu, 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", 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, 4, "");
-
- if(ar->alignment==RGN_ALIGN_TOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
+ uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border");
+ uiItemS(layout);
+ uiItemO(layout, NULL, 0, "MBALL_OT_select_deselect_all_metaelems");
+ uiItemO(layout, NULL, 0, "MBALL_OT_select_inverse_metaelems");
+ uiItemS(layout);
+ uiItemO(layout, NULL, 0, "MBALL_OT_select_random_metaelems");
}
static void view3d_select_latticemenu(bContext *C, uiLayout *layout, void *arg_unused)
@@ -2557,112 +2513,41 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse
uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_curve_showhidemenu);
}
-static void do_view3d_edit_mball_showhidemenu(bContext *C, void *arg, int event)
+static void view3d_edit_metaball_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused)
{
-#if 0
- switch(event) {
- case 10: /* show hidden control points */
- reveal_mball();
- break;
- case 11: /* hide selected control points */
- hide_mball(0);
- break;
- case 12: /* hide selected control points */
- hide_mball(1);
- break;
- }
-#endif
+ uiItemO(layout, NULL, 0, "MBALL_OT_hide_metaelems");
+ uiItemO(layout, NULL, 0, "MBALL_OT_reveal_metaelems");
+ uiItemBooleanO(layout, "Hide Unselected", 0, "MBALL_OT_hide_metaelems", "unselected", 1);
}
-static uiBlock *view3d_edit_mball_showhidemenu(bContext *C, ARegion *ar, void *arg_unused)
-{
- uiBlock *block;
- short yco = 20, menuwidth = 120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_mball_showhidemenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_mball_showhidemenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Unselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, "");
-
- uiBlockSetDirection(block, UI_RIGHT);
- uiTextBoundsBlock(block, 60);
- return block;
-}
-static void do_view3d_edit_metaballmenu(bContext *C, void *arg, int event)
+static void view3d_edit_metaballmenu(bContext *C, uiLayout *layout, void *arg_unused)
{
-#if 0
Scene *scene= CTX_data_scene(C);
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= sa->spacedata.first;
+ ToolSettings *ts= CTX_data_tool_settings(C);
+ PointerRNA tsptr;
- switch(event) {
- case 1: /* undo */
- BIF_undo();
- break;
- case 2: /* redo */
- BIF_redo();
- break;
- case 3: /* duplicate */
- duplicate_context_selected();
- break;
- case 4: /* delete */
- delete_context_selected();
- break;
- case 5: /* Shear */
- initTransform(TFM_SHEAR, CTX_NONE);
- Transform();
- break;
- case 6: /* Warp */
- initTransform(TFM_WARP, CTX_NONE);
- Transform();
- break;
- case 7: /* Transform Properties */
- add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, 0);
- break;
- }
-#endif
-}
+ RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr);
-static uiBlock *view3d_edit_metaballmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "view3d_edit_metaballmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_view3d_edit_metaballmenu, NULL);
+ uiItemO(layout, "Undo Editing", 0, "ED_OT_undo");
+ uiItemO(layout, "Redo Editing", 0, "ED_OT_redo");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Redo Editing|Shift Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
-// XXX uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, "");
+ uiItemS(layout);
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu);
- uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N",0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, "");
- uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
- uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
- // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
+ uiItemS(layout);
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiItemO(layout, NULL, 0, "MBALL_OT_delete_metaelems");
+ uiItemO(layout, NULL, 0, "MBALL_OT_duplicate_metaelems");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
-
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-
- uiDefIconTextBlockBut(block, view3d_edit_mball_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Hide MetaElems", 0, yco-=20, 120, 19, "");
-
- if(ar->alignment==RGN_ALIGN_TOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- return block;
+ uiItemS(layout);
+
+ uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O
+ uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O
+
+ uiItemS(layout);
+
+ uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_metaball_showhidemenu);
}
static void view3d_edit_text_charsmenu(bContext *C, uiLayout *layout, void *arg_unused)
@@ -3894,7 +3779,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
} 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, 20, "");
+ uiDefMenuBut(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, 20, "");
} else if (ob && ob->type == OB_ARMATURE) {
@@ -3936,7 +3821,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
xco+= xmax;
} else if (ob && ob->type == OB_MBALL) {
xmax= GetButStringLength("Metaball");
- uiDefPulldownBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,yco, xmax-3, 20, "");
+ uiDefMenuBut(block, view3d_edit_metaballmenu, NULL, "Metaball", xco,yco, xmax-3, 20, "");
xco+= xmax;
} else if (ob && ob->type == OB_LATTICE) {
xmax= GetButStringLength("Lattice");