[Bf-committers] Fix to [#21843] Manipulating Set Render Border sliders causes a crash (Already closed)

Ignacio Fernandez Moreno hellmoon666 at gmail.com
Mon Apr 5 11:55:53 CEST 2010


Hi,

I have a patch that fixes bug [#21843] wich is already closed by Matt Ebb
with this comment:

'Fixed' in SVN, just made the sliders do nothing and prevent
> a crash. There is still a deeper underlying issue with the ability
> for the operator properties panel to access other regions that
> aren't in its local context (such as a 3d view region). This
>
> is mentioned in other bugs though, so I'll close this one. It
> doesn't crash at least :)
>
>
My patch allways looks explicitly for the 3dview region inside the ScrArea
in the context when executing the "Set Border" operator so when in the tools
panel region you can also get data from the main region (the 3D view). In
his comment Matt suggests that there is not a "standard" way to do this yet
so my patch may not be "right" although it works. Can someone explain me
that "deeper underlying issue" so we may find a better way to do it?

I also found that the ED_view3d_context_rv3d() function also finds the
3dview region in the ScrArea context but it returns a RegionView3D object
when we need an ARegion one containing that RegionView3D so is useless here,
but that concept may be the key: A set of functions that look for specifics
regions inside an Area.

Regards,

Ignacio
-------------- next part --------------
Index: source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- source/blender/editors/space_view3d/view3d_edit.c	(revisión: 28000)
+++ source/blender/editors/space_view3d/view3d_edit.c	(copia de trabajo)
@@ -1481,12 +1481,21 @@
 static int render_border_exec(bContext *C, wmOperator *op)
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	ARegion *ar= CTX_wm_region(C);
+	ScrArea *sa = CTX_wm_area(C);
 	Scene *scene= CTX_data_scene(C);
+	ARegion *ar;
 
 	rcti rect;
 	rctf vb;
 
+	/* Search for ARegion (with regionview3D) in 3d window */
+
+	for(ar= sa->regionbase.first; ar; ar= ar->next){
+		if(ar->regiontype==RGN_TYPE_WINDOW){
+			break;
+		}
+	}
+
 	/* get border select values using rna */
 	rect.xmin= RNA_int_get(op->ptr, "xmin");
 	rect.ymin= RNA_int_get(op->ptr, "ymin");


More information about the Bf-committers mailing list