diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-22 12:14:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-22 12:14:27 +0300 |
commit | cfc904f3f1a00556032e12bb72395e261574669b (patch) | |
tree | d59327ccc718a75a0435b27fa873c7e3f342ddc6 /source | |
parent | a1567aa7c081ce6a3c7b24b7a772323940faa437 (diff) |
- support transform operators running in backgruond mode (was crashing)
- fix for crash getting the extrude mode enum value when a non-mesh edit object was active.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 6 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e22dab2f3c8..b4378829456 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -761,7 +761,7 @@ static EnumPropertyItem extrude_items[] = { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) +static EnumPropertyItem *mesh_extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL; Object *obedit= CTX_data_edit_object(C); @@ -769,7 +769,7 @@ static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int int totitem= 0; - if(!obedit) + if(obedit==NULL || obedit->type != OB_MESH) return extrude_items; em = BKE_mesh_get_editmesh(obedit->data); @@ -849,7 +849,7 @@ void MESH_OT_extrude(wmOperatorType *ot) /* properties */ prop= RNA_def_enum(ot->srna, "type", extrude_items, 0, "Type", ""); RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_enum_funcs(prop, extrude_itemf); + RNA_def_enum_funcs(prop, mesh_extrude_itemf); ot->prop= prop; } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7af5064218e..4a54b0ab0e4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -431,7 +431,11 @@ void ED_area_tag_refresh(ScrArea *sa) void ED_area_headerprint(ScrArea *sa, const char *str) { ARegion *ar; - + + /* happens when running transform operators in backround mode */ + if(sa == NULL) + return; + for(ar= sa->regionbase.first; ar; ar= ar->next) { if(ar->regiontype==RGN_TYPE_HEADER) { if(str) { diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index e342ce6769a..0a055358902 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4298,7 +4298,7 @@ static int createSlideVerts(TransInfo *t) int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE); int uvlay_idx; TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL; - RegionView3D *v3d = t->ar->regiondata; + RegionView3D *v3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */ float projectMat[4][4]; float start[3] = {0.0f, 0.0f, 0.0f}, end[3] = {0.0f, 0.0f, 0.0f}; float vec[3]; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 1fb57f2820d..7358811a79c 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -964,7 +964,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->options |= CTX_EDGE; } - t->spacetype = sa->spacetype; + t->spacetype = sa ? sa->spacetype : SPACE_EMPTY; /* background mode */ if(t->spacetype == SPACE_VIEW3D) { View3D *v3d = sa->spacedata.first; |