diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-27 07:19:55 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-27 07:19:55 +0400 |
commit | bbf793472eb22349710c73888b969378ff99350d (patch) | |
tree | bba2d78bf566fa5c787f9d560d6e514e080c3618 /source/blender/editors/space_view3d | |
parent | 13d18c5f777710fc396adde64725ecc5ecee019b (diff) | |
parent | 222fe6b1a5d49f67177cbb762f55a0e482145f5d (diff) |
NLA SoC: Merge from 2.5 - 21146 to 21178
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 51 |
2 files changed, 68 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 0cb0fd90860..e9bba7a83c6 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -122,6 +122,24 @@ ARegion *view3d_has_tools_region(ScrArea *sa) return arnew; } +/* ****************************************************** */ + +/* function to always find a regionview3d context inside 3D window */ +RegionView3D *ED_view3d_context_rv3d(bContext *C) +{ + RegionView3D *rv3d= CTX_wm_region_view3d(C); + + if(rv3d==NULL) { + ScrArea *sa =CTX_wm_area(C); + if(sa->spacetype==SPACE_VIEW3D) { + ARegion *ar; + for(ar= sa->regionbase.first; ar; ar= ar->next) + if(ar->regiontype==RGN_TYPE_WINDOW) + return ar->regiondata; + } + } + return rv3d; +} /* ******************** default callbacks for view3d space ***************** */ 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"); |