[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32868] trunk/blender/source/blender: bugfix [#24009] Crash when switching area types and performing ops
Campbell Barton
ideasman42 at gmail.com
Thu Nov 4 16:59:10 CET 2010
Revision: 32868
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32868
Author: campbellbarton
Date: 2010-11-04 16:59:09 +0100 (Thu, 04 Nov 2010)
Log Message:
-----------
bugfix [#24009] Crash when switching area types and performing ops
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/anim_markers.c
trunk/blender/source/blender/editors/animation/anim_ops.c
trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
trunk/blender/source/blender/editors/include/ED_screen.h
trunk/blender/source/blender/editors/interface/view2d_ops.c
trunk/blender/source/blender/editors/object/object_add.c
trunk/blender/source/blender/editors/object/object_constraint.c
trunk/blender/source/blender/editors/object/object_modifier.c
trunk/blender/source/blender/editors/render/render_shading.c
trunk/blender/source/blender/editors/screen/screen_ops.c
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
trunk/blender/source/blender/editors/space_text/text_ops.c
trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
trunk/blender/source/blender/windowmanager/intern/wm_operators.c
Modified: trunk/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_markers.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/animation/anim_markers.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -376,7 +376,7 @@
/* api callbacks */
ot->exec= ed_marker_add;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -667,7 +667,7 @@
ot->exec= ed_marker_move_exec;
ot->invoke= ed_marker_move_invoke;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -755,7 +755,7 @@
ot->exec= ed_marker_duplicate_exec;
ot->invoke= ed_marker_duplicate_invoke;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -870,7 +870,7 @@
/* api callbacks */
ot->invoke= ed_marker_select_invoke;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -958,7 +958,7 @@
ot->invoke= WM_border_select_invoke;
ot->modal= WM_border_select_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1021,7 +1021,7 @@
/* api callbacks */
ot->exec= ed_marker_select_all_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1069,7 +1069,7 @@
/* api callbacks */
ot->invoke= WM_operator_confirm;
ot->exec= ed_marker_delete_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1114,7 +1114,7 @@
/* api callbacks */
ot->exec= ed_marker_make_links_scene_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1163,7 +1163,7 @@
/* api callbacks */
ot->exec= ed_marker_camera_bind_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
Modified: trunk/blender/source/blender/editors/animation/anim_ops.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_ops.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/animation/anim_ops.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -217,7 +217,7 @@
ot->exec= previewrange_define_exec;
ot->modal= WM_border_select_modal;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -261,7 +261,7 @@
/* api callbacks */
ot->exec= previewrange_clear_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -328,7 +328,7 @@
/* api callbacks */
ot->exec= toggle_time_exec;
- ot->poll= ED_operator_areaactive;
+ ot->poll= ED_operator_animview_active;
}
/* ************************** registration **********************************/
Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -141,8 +141,20 @@
/* check if context is suitable for drawing */
static int gpencil_draw_poll (bContext *C)
{
- /* check if current context can support GPencil data */
- return (gpencil_data_get_pointers(C, NULL) != NULL);
+ if(ED_operator_regionactive(C)) {
+ /* check if current context can support GPencil data */
+ if(gpencil_data_get_pointers(C, NULL) != NULL) {
+ return 1;
+ }
+ else {
+ CTX_wm_operator_poll_msg_set(C, "failed to find grease pencil data to draw into");
+ }
+ }
+ else {
+ CTX_wm_operator_poll_msg_set(C, "active region not set");
+ }
+
+ return 0;
}
/* check if projecting strokes into 3d-geometry in the 3D-View */
Modified: trunk/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_screen.h 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/include/ED_screen.h 2010-11-04 15:59:09 UTC (rev 32868)
@@ -128,6 +128,7 @@
int ED_operator_view3d_active(struct bContext *C);
int ED_operator_region_view3d_active(struct bContext *C);
+int ED_operator_animview_active(struct bContext *C);
int ED_operator_timeline_active(struct bContext *C);
int ED_operator_outliner_active(struct bContext *C);
int ED_operator_outliner_active_no_editobject(struct bContext *C);
@@ -143,6 +144,7 @@
int ED_operator_object_active(struct bContext *C);
int ED_operator_object_active_editable(struct bContext *C);
+int ED_operator_object_active_editable_mesh(struct bContext *C);
int ED_operator_editmesh(struct bContext *C);
int ED_operator_editmesh_view3d(struct bContext *C);
int ED_operator_editmesh_region_view3d(struct bContext *C);
Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d_ops.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/interface/view2d_ops.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -689,7 +689,7 @@
/* api callbacks */
ot->invoke= view_zoomin_invoke;
- ot->exec= view_zoomin_exec;
+// ot->exec= view_zoomin_exec; // XXX, needs view_zoomdrag_init called first.
ot->poll= view_zoom_poll;
/* rna - must keep these in sync with the other operators */
@@ -746,7 +746,7 @@
/* api callbacks */
ot->invoke= view_zoomout_invoke;
- ot->exec= view_zoomout_exec;
+// ot->exec= view_zoomout_exec; // XXX, needs view_zoomdrag_init called first.
ot->poll= view_zoom_poll;
/* rna - must keep these in sync with the other operators */
Modified: trunk/blender/source/blender/editors/object/object_add.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_add.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/object/object_add.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -607,7 +607,7 @@
{
Object *obedit= CTX_data_edit_object(C);
View3D *v3d= CTX_wm_view3d(C);
- RegionView3D *rv3d= NULL;
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
int newob= 0;
int enter_editmode;
unsigned int layer;
@@ -629,9 +629,6 @@
return OPERATOR_CANCELLED;
}
- if(v3d)
- rv3d= CTX_wm_region(C)->regiondata;
-
/* v3d and rv3d are allowed to be NULL */
add_primitive_bone(CTX_data_scene(C), v3d, rv3d);
Modified: trunk/blender/source/blender/editors/object/object_constraint.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_constraint.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/object/object_constraint.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -726,6 +726,11 @@
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
+ if(data==NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Childof constraint not found.");
+ return OPERATOR_CANCELLED;
+ }
+
/* simply clear the matrix */
unit_m4(data->invmat);
Modified: trunk/blender/source/blender/editors/object/object_modifier.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_modifier.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/object/object_modifier.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -603,12 +603,13 @@
/************************ generic functions for operators using mod names and data context *********************/
-static int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type)
+static int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C);
if (!ob || ob->id.lib) return 0;
+ if (obtype_flag && ((1<<ob->type) & obtype_flag)==0) return 0;
if (ptr.data && ((ID*)ptr.id.data)->lib) return 0;
return 1;
@@ -616,7 +617,7 @@
static int edit_modifier_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_Modifier);
+ return edit_modifier_poll_generic(C, &RNA_Modifier, 0);
}
static void edit_modifier_properties(wmOperatorType *ot)
@@ -913,7 +914,7 @@
static int multires_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MultiresModifier);
+ return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1<<OB_MESH));
}
static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
@@ -1163,7 +1164,7 @@
static int meshdeform_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier);
+ return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, (1<<OB_MESH));
}
static int meshdeform_bind_exec(bContext *C, wmOperator *op)
@@ -1251,7 +1252,7 @@
static int explode_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_ExplodeModifier);
+ return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0);
}
static int explode_refresh_exec(bContext *C, wmOperator *op)
Modified: trunk/blender/source/blender/editors/render/render_shading.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_shading.c 2010-11-04 13:13:31 UTC (rev 32867)
+++ trunk/blender/source/blender/editors/render/render_shading.c 2010-11-04 15:59:09 UTC (rev 32868)
@@ -399,36 +399,38 @@
BezTriple *bezt;
int a;
- for(nu= nurbs->first; nu; nu=nu->next) {
- if(nu->mat_nr==ob->actcol-1) {
- if(nu->bezt) {
- a= nu->pntsu;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list