Fix [#36830] 'Reset to Default Value' on Current Area Type button causes crash
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 29 Sep 2013 13:25:42 +0000 (13:25 +0000)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 29 Sep 2013 13:25:42 +0000 (13:25 +0000)
Default default value for space types (0, i.e. SPACE_EMPTY) is not valid, use SPACE_VIEW3D instead.

source/blender/blenkernel/intern/screen.c
source/blender/editors/screen/area.c
source/blender/makesrna/intern/rna_screen.c

index efcbcacf9748d232e578dda99c9e83937f1a7959..c41c66ef5611767c9ba2199aba5ae2620ccf6fcb 100644 (file)
@@ -112,7 +112,7 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
                if (art->regionid == regionid)
                        return art;
        
                if (art->regionid == regionid)
                        return art;
        
-       printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
+       printf("Error, region type %d missing in - name:\"%s\", id:%d\n", regionid, st->name, st->spaceid);
        return st->regiontypes.first;
 }
 
        return st->regiontypes.first;
 }
 
index 91d1985cd001333bf5319f460a2c0b688c36bd77..fccce0357a4210e4e77d38f707cf0391c0d0a05c 100644 (file)
@@ -1446,7 +1446,6 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
                }
                
                if (sl) {
                }
                
                if (sl) {
-                       
                        /* swap regions */
                        slold->regionbase = sa->regionbase;
                        sa->regionbase = sl->regionbase;
                        /* swap regions */
                        slold->regionbase = sa->regionbase;
                        sa->regionbase = sl->regionbase;
index 49c6a07df786d2e65c54897ded5c11d0112038b0..b8269c428a1d24b4a550bd8f349a8dcf8e5cad9d 100644 (file)
@@ -213,6 +213,7 @@ static void rna_def_area(BlenderRNA *brna)
        prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "spacetype");
        RNA_def_property_enum_items(prop, space_type_items);
        prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "spacetype");
        RNA_def_property_enum_items(prop, space_type_items);
+       RNA_def_property_enum_default(prop, SPACE_VIEW3D);
        RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", "rna_Area_type_itemf");
        RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
        RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
        RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", "rna_Area_type_itemf");
        RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
        RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);