diff options
author | Ton Roosendaal <ton@blender.org> | 2009-06-26 19:48:09 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-06-26 19:48:09 +0400 |
commit | 524b8614373df3e1eb212939f048a79b75450c28 (patch) | |
tree | 999becd6f012b3625abd4748b35cd12e98d989b2 /source/blender/editors/space_view3d/view3d_toolbar.c | |
parent | 07e9c4ef2b221a245497d75336fd5ece12d98682 (diff) |
2.5
Part one (of probably many :) of Operator review/validation.
Nothing final nor defined, it's reseach :)
- Added tool buttons in "Toolbar" (Tkey). Just four examples
for objectmode, and six for mesh editmode.
(Review in progress is operator internal state vs context, what
do redo exactly, undo vs redo syncing, when op->invoke or not,
etc. This has to be pinned down exactly and frozen asap)
- On undo, clear redo-operator-stack for now (won't work)
- Added call to better detect active/current view3d region.
ED_view3d_context_rv3d(C)
- Fixed some operators that missed correct redo (add-prim etc).
Later more fun!
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_toolbar.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 15254ba505e..88af60ac0f4 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -134,7 +134,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) if(op==NULL) return; - if(op->type->poll && op->type->poll(C)==0) + if(op->type->poll && op->type->poll((bContext *)C)==0) return; uiBlockSetFunc(block, redo_cb, op, NULL); @@ -148,10 +148,59 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) uiDefAutoButsRNA(C, pa->layout, &ptr, 1); } +static void view3d_panel_tools(const bContext *C, Panel *pa) +{ + Object *obedit= CTX_data_edit_object(C); +// Object *obact = CTX_data_active_object(C); + uiLayout *col; + + if(obedit) { + if(obedit->type==OB_MESH) { + + // void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, IDProperty *properties, int context) + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "MESH_OT_delete", NULL, WM_OP_INVOKE_REGION_WIN); + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "MESH_OT_subdivide", NULL, WM_OP_INVOKE_REGION_WIN); + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "MESH_OT_primitive_monkey_add", NULL, WM_OP_INVOKE_REGION_WIN); + uiItemFullO(col, NULL, 0, "MESH_OT_primitive_uv_sphere_add", NULL, WM_OP_INVOKE_REGION_WIN); + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "MESH_OT_select_all_toggle", NULL, WM_OP_INVOKE_REGION_WIN); + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "MESH_OT_spin", NULL, WM_OP_INVOKE_REGION_WIN); + uiItemFullO(col, NULL, 0, "MESH_OT_screw", NULL, WM_OP_INVOKE_REGION_WIN); + + } + } + else { + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "OBJECT_OT_delete", NULL, WM_OP_INVOKE_REGION_WIN); + uiItemFullO(col, NULL, 0, "OBJECT_OT_primitive_add", NULL, WM_OP_INVOKE_REGION_WIN); + + col= uiLayoutColumn(pa->layout, 1); + uiItemFullO(col, NULL, 0, "OBJECT_OT_parent_set", NULL, WM_OP_INVOKE_REGION_WIN); + uiItemFullO(col, NULL, 0, "OBJECT_OT_parent_clear", NULL, WM_OP_INVOKE_REGION_WIN); + + } +} + + void view3d_toolbar_register(ARegionType *art) { PanelType *pt; + pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools"); + strcpy(pt->idname, "VIEW3D_PT_tools"); + strcpy(pt->label, "Tools"); + pt->draw= view3d_panel_tools; + BLI_addtail(&art->paneltypes, pt); + pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator"); strcpy(pt->idname, "VIEW3D_PT_last_operator"); strcpy(pt->label, "Last Operator"); |