Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/CMakeLists.txt15
-rw-r--r--source/blender/editors/space_image/SConscript3
-rw-r--r--source/blender/editors/space_image/image_buttons.c52
-rw-r--r--source/blender/editors/space_image/image_draw.c31
-rw-r--r--source/blender/editors/space_image/image_ops.c20
-rw-r--r--source/blender/editors/space_image/image_render.c179
-rw-r--r--source/blender/editors/space_image/space_image.c28
7 files changed, 50 insertions, 278 deletions
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index b23ab624faa..0d4408faf49 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -23,14 +23,17 @@ set(INC
../include
../../blenfont
../../blenkernel
- ../../blenloader
../../blenlib
+ ../../blenloader
../../imbuf
../../makesdna
../../makesrna
- ../../windowmanager
../../render/extern/include
+ ../../windowmanager
../../../../intern/guardedalloc
+)
+
+set(INC_SYS
${GLEW_INCLUDE_PATH}
)
@@ -38,7 +41,6 @@ set(SRC
image_buttons.c
image_draw.c
image_ops.c
- image_render.c
space_image.c
image_intern.h
@@ -60,9 +62,4 @@ if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
-if(WITH_LCMS)
- set(INC ${INC} ${LCMS_INCLUDE_DIR})
- add_definitions(-DWITH_LCMS)
-endif()
-
-blender_add_lib(bf_editor_space_image "${SRC}" "${INC}")
+blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index e84afcdaab1..27696e35701 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -9,9 +9,6 @@ incs += ' ../../render/extern/include ../../makesrna ../../blenloader'
defs = []
-if env['WITH_BF_LCMS']:
- defs.append('WITH_LCMS')
- incs += ' ' + env['BF_LCMS_INC']
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
if env['WITH_BF_OPENJPEG']:
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index c48078118a7..66e844e67a8 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -98,19 +98,6 @@
/* proto */
-static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event)
-{
- SpaceImage *sima= CTX_wm_space_image(C);
-
- switch(event) {
- case B_REDR:
- break;
- }
-
- /* all events now */
- WM_event_add_notifier(C, NC_IMAGE, sima->image);
-}
-
static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str)
{
int ofs= 0;
@@ -281,7 +268,7 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
rcti *disprect= &G.scene->r.disprect;
int winx= (G.scene->r.size*G.scene->r.xsch)/100;
int winy= (G.scene->r.size*G.scene->r.ysch)/100;
- short mval[2];
+ int mval[2];
if(G.scene->r.mode & R_BORDER) {
winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin);
@@ -569,20 +556,20 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
/* menu buts */
if(render_slot) {
strp= slot_menu();
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, 20, render_slot, 0,0,0,0, "Select Slot");
+ but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu1, UI_UNIT_Y, render_slot, 0,0,0,0, "Select Slot");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
}
if(rr) {
strp= layer_menu(rr, &iuser->layer);
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, 20, &iuser->layer, 0,0,0,0, "Select Layer");
+ but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0,0,0,0, "Select Layer");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
rl= BLI_findlink(&rr->layers, iuser->layer - (rr->rectf?1:0)); /* fake compo layer, return NULL is meant to be */
strp= pass_menu(rl, &iuser->pass);
- but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, 20, &iuser->pass, 0,0,0,0, "Select Pass");
+ but= uiDefButS(block, MENU, 0, strp, 0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0,0,0,0, "Select Pass");
uiButSetFunc(but, image_multi_cb, rr, iuser);
MEM_freeN(strp);
}
@@ -675,7 +662,6 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
block= uiLayoutGetBlock(layout);
-
imaptr= RNA_property_pointer_get(ptr, prop);
ima= imaptr.data;
iuser= userptr->data;
@@ -732,21 +718,17 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
}
}
else {
- row= uiLayoutRow(layout, 0);
- uiItemR(row, &imaptr, "source", 0, NULL, ICON_NONE);
+ uiItemR(layout, &imaptr, "source", 0, NULL, ICON_NONE);
if(ima->source != IMA_SRC_GENERATED) {
row= uiLayoutRow(layout, 1);
- split = uiLayoutSplit(row, 0.0, 0);
if (ima->packedfile)
- uiItemO(split, "", ICON_PACKAGE, "image.unpack");
+ uiItemO(row, "", ICON_PACKAGE, "image.unpack");
else
- uiItemO(split, "", ICON_UGLYPACKAGE, "image.pack");
+ uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
- split = uiLayoutSplit(row, 0.0, 0);
- row= uiLayoutRow(split, 1);
+ row= uiLayoutRow(row, 0);
uiLayoutSetEnabled(row, ima->packedfile==NULL);
-
uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
}
@@ -784,11 +766,10 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
col= uiLayoutColumn(split, 0);
uiItemR(col, &imaptr, "use_fields", 0, NULL, ICON_NONE);
row= uiLayoutRow(col, 0);
- uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
-
- col= uiLayoutColumn(split, 0);
- uiItemR(col, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
+ uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
+ uiItemR(split, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
}
}
@@ -800,10 +781,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
col= uiLayoutColumn(split, 0);
sprintf(str, "(%d) Frames", iuser->framenr);
- row= uiLayoutRow(col, 1);
uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
if(ima->anim) {
- block= uiLayoutGetBlock(row);
+ block= uiLayoutGetBlock(col);
but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence.");
uiButSetFunc(but, set_frames_cb, ima, iuser);
}
@@ -812,7 +792,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
col= uiLayoutColumn(split, 0);
- uiItemR(col, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
+ row= uiLayoutRow(col, 0);
+ uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
+ uiItemR(row, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
}
@@ -822,9 +804,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
col= uiLayoutColumn(split, 1);
uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
+ uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
- col= uiLayoutColumn(split, 0);
- uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 0f361b43de6..112359726ea 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -58,10 +58,6 @@
#include "BKE_image.h"
#include "BKE_paint.h"
-#ifdef WITH_LCMS
-#include "BKE_colortools.h"
-#endif
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -452,20 +448,6 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
// glColorMask(1, 1, 1, 1);
}
-#ifdef WITH_LCMS
-static int sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf)
-{
- colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */
-
- if(ibuf->crect) {
- glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect);
- return 1;
- }
-
- return 0;
-}
-#endif
-
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
{
/* zbuffer values are signed, so we need to shift color range */
@@ -544,17 +526,6 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
else if(ibuf->channels==1)
sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float);
}
-#ifdef WITH_LCMS
- else if(sima->flag & SI_COLOR_CORRECTION) {
- image_verify_buffer_float(ima, ibuf, color_manage);
-
- if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) {
- unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */
- sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2);
- }
-
- }
-#endif
else {
if(sima->flag & SI_USE_ALPHA) {
unsigned char col1[3]= {100, 100, 100}, col2[3]= {160, 160, 160};
@@ -702,7 +673,7 @@ static void draw_image_view_tool(Scene *scene)
{
ToolSettings *settings= scene->toolsettings;
Brush *brush= settings->imapaint.brush;
- short mval[2];
+ int mval[2];
float radius;
int draw= 0;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7d4aaf0c70e..d5515bd1cf8 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -500,7 +500,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene;
Object *obedit;
Image *ima;
- float size, min[2], max[2], d[2];
+ float size, min[2], max[2], d[2], aspx, aspy;
int width, height;
/* retrieve state */
@@ -511,6 +511,10 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
ima= ED_space_image(sima);
ED_space_image_size(sima, &width, &height);
+ ED_image_aspect(ima, &aspx, &aspy);
+
+ width= width*aspx;
+ height= height*aspy;
/* get bounds */
if(!ED_uvedit_minmax(scene, ima, obedit, min, max))
@@ -645,6 +649,9 @@ static const EnumPropertyItem image_file_type_items[] = {
{R_TARGA, "TARGA", 0, "Targa", ""},
{R_RAWTGA, "TARGA RAW", 0, "Targa Raw", ""},
{R_PNG, "PNG", 0, "PNG", ""},
+#ifdef WITH_DDS
+ {R_DDS, "DDS", 0, "DirectDraw Surface", ""},
+#endif
{R_BMP, "BMP", 0, "BMP", ""},
{R_JPEG90, "JPEG", 0, "Jpeg", ""},
#ifdef WITH_OPENJPEG
@@ -799,6 +806,7 @@ void IMAGE_OT_open(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Open Image";
+ ot->description= "Open image";
ot->idname= "IMAGE_OT_open";
/* api callbacks */
@@ -1342,6 +1350,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
/* identifiers */
ot->name= "New Image";
+ ot->description= "Create a new image";
ot->idname= "IMAGE_OT_new";
/* api callbacks */
@@ -1420,6 +1429,9 @@ static int image_invert_exec(bContext *C, wmOperator *op)
}
ibuf->userflags |= IB_BITMAPDIRTY;
+ if(ibuf->mipmap[0])
+ ibuf->userflags |= IB_MIPMAP_INVALID;
+
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
return OPERATOR_FINISHED;
}
@@ -1645,16 +1657,13 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
ImageSampleInfo *info= op->customdata;
float fx, fy;
- int mx, my;
if(ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
return;
}
- mx= event->x - ar->winrct.xmin;
- my= event->y - ar->winrct.ymin;
- UI_view2d_region_to_view(&ar->v2d, mx, my, &fx, &fy);
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
float *fp;
@@ -1920,6 +1929,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot)
ot->modal= WM_gesture_straightline_modal;
ot->exec= sample_line_exec;
ot->poll= space_image_main_area_poll;
+ ot->cancel= WM_gesture_straightline_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c
deleted file mode 100644
index 04b65af618e..00000000000
--- a/source/blender/editors/space_image/image_render.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * Contributor(s): Blender Foundation, 2002-2009
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_image/image_render.c
- * \ingroup spimage
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "BLI_utildefines.h"
-
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
-
-#include "BKE_context.h"
-#include "BKE_image.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-
-#include "RE_pipeline.h"
-
-
-#define HEADER_HEIGHT 18
-
-/* *********************** render callbacks ***************** */
-
-/* set on initialize render, only one render output to imagewindow can exist, so the global isnt dangerous yet :) */
-static ScrArea *image_area= NULL;
-
-/* can get as well the full picture, as the parts while rendering */
-/* XXX will be obsolete, here for reference now */
-static void imagewindow_progress(SpaceImage *sima, RenderResult *rr, volatile rcti *renrect)
-{
- float x1, y1, *rectf= NULL;
- unsigned int *rect32= NULL;
- int ymin, ymax, xmin, xmax;
-
- /* if renrect argument, we only display scanlines */
- if(renrect) {
- /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
- if(rr->renlay==NULL || renrect->ymax>=rr->recty)
- return;
-
- /* xmin here is first subrect x coord, xmax defines subrect width */
- xmin = renrect->xmin;
- xmax = renrect->xmax - xmin;
- if (xmax<2) return;
-
- ymin= renrect->ymin;
- ymax= renrect->ymax - ymin;
- if(ymax<2)
- return;
- renrect->ymin= renrect->ymax;
- }
- else {
- xmin = ymin = 0;
- xmax = rr->rectx - 2*rr->crop;
- ymax = rr->recty - 2*rr->crop;
- }
-
- /* image window cruft */
-
- /* find current float rect for display, first case is after composit... still weak */
- if(rr->rectf)
- rectf= rr->rectf;
- else {
- if(rr->rect32)
- rect32= (unsigned int *)rr->rect32;
- else {
- if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
- rectf= rr->renlay->rectf;
- }
- }
- if(rectf) {
- /* if scanline updates... */
- rectf+= 4*(rr->rectx*ymin + xmin);
-
- /* when rendering more pixels than needed, we crop away cruft */
- if(rr->crop)
- rectf+= 4*(rr->crop*rr->rectx + rr->crop);
- }
-
- /* tilerect defines drawing offset from (0,0) */
- /* however, tilerect (xmin, ymin) is first pixel */
- x1 = sima->centx + (rr->tilerect.xmin + rr->crop + xmin)*sima->zoom;
- y1 = sima->centy + (rr->tilerect.ymin + rr->crop + ymin)*sima->zoom;
-
- /* needed for gla draw */
- // XXX { rcti rct= ar->winrct; rct.ymax-= HEADER_HEIGHT; glaDefine2DArea(&rct);}
-
- glPixelZoom(sima->zoom, sima->zoom);
-
- if(rect32)
- glaDrawPixelsSafe(x1, y1, xmax, ymax, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect32);
- else
- glaDrawPixelsSafe_to32(x1, y1, xmax, ymax, rr->rectx, rectf, 0);
-
- glPixelZoom(1.0, 1.0);
-
-}
-
-
-/* coming from BIF_toggle_render_display() */
-static void imagewindow_toggle_render(bContext *C)
-{
- bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa;
-
- /* check if any imagewindow is showing temporal render output */
- for(sa=sc->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= sa->spacedata.first;
-
- if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
- if(sima->flag & (SI_PREVSPACE|SI_FULLWINDOW))
- break;
- }
- }
-
- if(sa) {
- // XXX addqueue(sa->win, ESCKEY, 1); /* also returns from fullscreen */
- }
- else {
-// sa= imagewindow_set_render_display(C);
- // XXX scrarea_queue_headredraw(sa);
- // XXX scrarea_queue_winredraw(sa);
- }
-}
-
-/* NOTE: called while render, so no malloc allowed! */
-static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs))
-{
- if(image_area) {
- // XXX BIF_make_render_text(rs);
-
- // XXX sima_draw_render_info(sima, ar);
-
- /* no screen_swapbuffers, prevent any other window to draw */
- // XXX myswapbuffers();
- }
-}
-
-static void ED_space_image_render_callbacks(bContext *C, Render *re)
-{
-
-// RE_display_init_cb(re, C, imagewindow_init_display_cb);
-// RE_display_draw_cb(re, C, imagewindow_progress_display_cb);
-// RE_display_clear_cb(re, C, imagewindow_clear_display_cb);
- RE_stats_draw_cb(re, C, imagewindow_renderinfo_cb);
-}
-
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 409ab4b2fc6..2e9544f5d20 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -328,16 +328,13 @@ static void image_scopes_tag_refresh(ScrArea *sa)
ARegion *image_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- return ar;
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if(ar) return ar;
/* add subdiv level; after header */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_HEADER)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
/* is error! */
if(ar==NULL) return NULL;
@@ -355,16 +352,13 @@ ARegion *image_has_buttons_region(ScrArea *sa)
ARegion *image_has_scope_region(ScrArea *sa)
{
ARegion *ar, *arnew;
-
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_PREVIEW)
- return ar;
-
+
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+ if(ar) return ar;
+
/* add subdiv level; after buttons */
- for(ar= sa->regionbase.first; ar; ar= ar->next)
- if(ar->regiontype==RGN_TYPE_UI)
- break;
-
+ ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+
/* is error! */
if(ar==NULL) return NULL;