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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-23 04:45:41 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-23 04:45:41 +0400
commit9fd605c0502d991af30a4d4b91681b4116658f45 (patch)
tree26cda9f5361b94fdf3c1d53edd72b0ee128e450f /source/blender/editors
parente2b6cea3b95ca41854661726ccea684421738c8f (diff)
2.5: Image Editor
* Menu and header more complete now. * Clean up Game Properties panel and moved View Properties panel to python. * Fix some drawing issues when combining tiles, repeat and aspect, some also from 2.4x, these options didn't work together 100%.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_icons.h2
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/space_image/image_buttons.c42
-rw-r--r--source/blender/editors/space_image/image_draw.c28
-rw-r--r--source/blender/editors/space_image/space_image.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c3
6 files changed, 54 insertions, 32 deletions
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 884020ae7dc..602e94838b7 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -658,12 +658,12 @@ DEF_ICON(ICON_SNAP_VERTEX)
DEF_ICON(ICON_SNAP_EDGE)
DEF_ICON(ICON_SNAP_FACE)
DEF_ICON(ICON_SNAP_VOLUME)
+DEF_ICON(ICON_UVS_FACE)
DEF_ICON(ICON_STICKY_UVS_LOC)
DEF_ICON(ICON_STICKY_UVS_DISABLE)
DEF_ICON(ICON_STICKY_UVS_VERT)
DEF_ICON(ICON_CLIPUV_DEHLT)
DEF_ICON(ICON_CLIPUV_HLT)
-DEF_ICON(ICON_BLANK219)
DEF_ICON(ICON_SNAP_PEEL_OBJECT)
DEF_ICON(ICON_BLANK221)
DEF_ICON(ICON_GRID)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 62469686e7f..80e57f5e5be 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -53,6 +53,8 @@ struct uiStyle;
struct uiFontStyle;
struct ColorBand;
struct CurveMapping;
+struct Image;
+struct ImageUser;
typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
@@ -614,6 +616,7 @@ void uiTemplatePreview(uiLayout *layout, struct ID *id);
void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname);
+void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
/* items */
void uiItemO(uiLayout *layout, char *name, int icon, char *opname);
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index b5df0257e71..8aa955f0b34 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -1023,42 +1023,53 @@ static void image_load_fs_cb(bContext *C, void *ima_pp_v, void *iuser_v)
static void image_multi_cb(bContext *C, void *rr_v, void *iuser_v)
{
BKE_image_multilayer_index(rr_v, iuser_v);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v)
{
RenderResult *rr= rr_v;
ImageUser *iuser= iuser_v;
int tot= BLI_countlist(&rr->layers) + (rr->rectf?1:0); /* fake compo result layer */
- if(iuser->layer<tot-1)
+
+ if(iuser->layer<tot-1) {
iuser->layer++;
- BKE_image_multilayer_index(rr, iuser);
+ BKE_image_multilayer_index(rr, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+ }
}
static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
- if(iuser->layer>0)
+
+ if(iuser->layer>0) {
iuser->layer--;
- BKE_image_multilayer_index(rr_v, iuser);
+ BKE_image_multilayer_index(rr_v, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+ }
}
static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v)
{
RenderResult *rr= rr_v;
ImageUser *iuser= iuser_v;
RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer);
+
if(rl) {
int tot= BLI_countlist(&rl->passes) + (rl->rectf?1:0); /* builtin render result has no combined pass in list */
if(iuser->pass<tot-1) {
iuser->pass++;
BKE_image_multilayer_index(rr, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
}
}
static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v)
{
ImageUser *iuser= iuser_v;
+
if(iuser->pass>0) {
iuser->pass--;
BKE_image_multilayer_index(rr_v, iuser);
+ WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
}
}
@@ -1353,6 +1364,23 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I
uiBlockEndAlign(block);
}
+void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
+{
+ uiBlock *block= uiLayoutFreeBlock(layout);
+ Scene *scene= CTX_data_scene(C);
+ RenderResult *rr;
+
+ /* render layers and passes */
+ if(ima && iuser) {
+ rr= BKE_image_get_renderresult(scene, ima);
+
+ if(rr) {
+ uiBlockBeginAlign(block);
+ uiblock_layer_pass_buttons(block, rr, iuser, 0, 0, 0, 160);
+ uiBlockEndAlign(block);
+ }
+ }
+}
static void image_panel_properties(const bContext *C, Panel *pa)
{
@@ -1377,12 +1405,6 @@ void image_buttons_register(ARegionType *art)
pt->draw= image_panel_properties;
BLI_addtail(&art->paneltypes, pt);
- pt= MEM_callocN(sizeof(PanelType), "spacetype image view properties");
- strcpy(pt->idname, "IMAGE_PT_view_properties");
- strcpy(pt->label, "View Properties");
- pt->draw= image_panel_view_properties;
- BLI_addtail(&art->paneltypes, pt);
-
pt= MEM_callocN(sizeof(PanelType), "spacetype image panel paint");
strcpy(pt->idname, "IMAGE_PT_paint");
strcpy(pt->label, "Paint");
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 122e298baaa..e61931f2fad 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -311,12 +311,14 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl
// glColorMask(1, 1, 1, 1);
}
+#ifdef WITH_LCMS
static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf)
{
colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */
glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect);
}
+#endif
static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti)
{
@@ -450,7 +452,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty,
return rectmain;
}
-static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
+static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy)
{
unsigned int *rect;
int dx, dy, sx, sy, x, y;
@@ -477,7 +479,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I
/* draw repeated */
for(sy=0; sy+dy<=ibuf->y; sy+= dy) {
for(sx=0; sx+dx<=ibuf->x; sx+= dx) {
- UI_view2d_view_to_region(&ar->v2d, (float)sx/(float)ibuf->x, (float)sy/(float)ibuf->y, &x, &y);
+ UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y);
glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect);
}
@@ -488,16 +490,19 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I
MEM_freeN(rect);
}
-static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy)
+static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
{
float x, y;
double time_current;
time_current = PIL_check_seconds_timer();
- for(x=ar->v2d.cur.xmin; x<ar->v2d.cur.xmax; x += zoomx) {
- for(y=ar->v2d.cur.ymin; y<ar->v2d.cur.ymax; y += zoomy) {
- draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy);
+ for(x=floor(ar->v2d.cur.xmin); x<ar->v2d.cur.xmax; x += 1.0f) {
+ for(y=floor(ar->v2d.cur.ymin); y<ar->v2d.cur.ymax; y += 1.0f) {
+ if(ima && (ima->tpageflag & IMA_TILES))
+ draw_image_buffer_tiled(sima, ar, ima, ibuf, x, y, zoomx, zoomy);
+ else
+ draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy);
/* only draw until running out of time */
if((PIL_check_seconds_timer() - time_current) > 0.25)
@@ -667,9 +672,9 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
if(ibuf==NULL)
draw_image_grid(ar, zoomx, zoomy);
else if(sima->flag & SI_DRAW_TILE)
- draw_image_buffer_repeated(sima, ar, scene, ibuf, zoomx, zoomy);
+ draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy);
else if(ima && (ima->tpageflag & IMA_TILES))
- draw_image_buffer_tiled(sima, ar, ima, ibuf, zoomx, zoomy);
+ draw_image_buffer_tiled(sima, ar, ima, ibuf, 0.0f, 0.0, zoomx, zoomy);
else
draw_image_buffer(sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy);
@@ -699,12 +704,5 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
}
}
#endif
-
-#if 0
- /* it is important to end a view in a transform compatible with buttons */
- bwin_scalematrix(sa->win, sima->blockscale, sima->blockscale, sima->blockscale);
- if(!(G.rendering && show_render))
- image_blockhandlers(sa);
-#endif
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 49f950fe67b..7d6faa00dfc 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -327,12 +327,10 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce
#endif
if(sima->image) {
ImBuf *ibuf= ED_space_image_buffer(sima);
- float xuser_asp, yuser_asp;
- ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
if(ibuf) {
- width= ibuf->x*xuser_asp;
- height= ibuf->y*yuser_asp;
+ width= ibuf->x;
+ height= ibuf->y;
}
else if(sima->image->type==IMA_TYPE_R_RESULT) {
/* not very important, just nice */
@@ -683,7 +681,7 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy)
*aspx= *aspy= 1.0;
if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
- (ima->tpageflag & IMA_TILES) || (ima->aspx==0.0 || ima->aspy==0.0))
+ (ima->aspx==0.0 || ima->aspy==0.0))
return;
/* x is always 1 */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index f4cb5afc3c2..e157d7f68f9 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -754,9 +754,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
{
+ SpaceImage *sima = sa->spacedata.first;
// XXX for now, get View2D from the active region
t->view = &ar->v2d;
- t->around = ar->v2d.around;
+ t->around = sima->around;
}
else
{