- 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.
This commit is contained in:
2011-03-22 09:14:27 +00:00
parent a1567aa7c0
commit cfc904f3f1
4 changed files with 10 additions and 6 deletions

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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];

View File

@@ -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;