[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23287] trunk/blender: Image Panels
Brecht Van Lommel
brecht at blender.org
Wed Sep 16 21:27:09 CEST 2009
Revision: 23287
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23287
Author: blendix
Date: 2009-09-16 21:27:08 +0200 (Wed, 16 Sep 2009)
Log Message:
-----------
Image Panels
* The image panels in the image editor and texture buttons
should be more complete now, with working new/open,
refreshes, and using the layout engine.
* Paint panels in image editor are now consistent with the
ones in the 3d view toolbar.
* Curves panel also uses layout engine, and doesn't look
squashed anymore.
Modified Paths:
--------------
trunk/blender/release/ui/space_image.py
trunk/blender/source/blender/blenkernel/intern/image.c
trunk/blender/source/blender/blenkernel/intern/paint.c
trunk/blender/source/blender/editors/include/ED_image.h
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/editors/space_image/image_buttons.c
trunk/blender/source/blender/editors/space_image/image_ops.c
trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
trunk/blender/source/blender/makesrna/intern/rna_color.c
trunk/blender/source/blender/makesrna/intern/rna_image.c
trunk/blender/source/blender/makesrna/intern/rna_space.c
trunk/blender/source/blender/makesrna/intern/rna_texture.c
trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
Modified: trunk/blender/release/ui/space_image.py
===================================================================
--- trunk/blender/release/ui/space_image.py 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/release/ui/space_image.py 2009-09-16 19:27:08 UTC (rev 23287)
@@ -277,6 +277,24 @@
if show_uvedit or sima.image_painting:
layout.itemR(sima, "update_automatically", text="")
+class IMAGE_PT_image_properties(bpy.types.Panel):
+ __space_type__ = 'IMAGE_EDITOR'
+ __region_type__ = 'UI'
+ __label__ = "Image"
+
+ def poll(self, context):
+ sima = context.space_data
+ return (sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+ iuser = sima.image_user
+
+ layout.template_image(sima, "image", iuser, compact=True)
+
class IMAGE_PT_game_properties(bpy.types.Panel):
__space_type__ = 'IMAGE_EDITOR'
__region_type__ = 'UI'
@@ -368,6 +386,92 @@
#col.itemR(uvedit, "draw_edges")
#col.itemR(uvedit, "draw_faces")
+class IMAGE_PT_paint(bpy.types.Panel):
+ __space_type__ = 'IMAGE_EDITOR'
+ __region_type__ = 'UI'
+ __label__ = "Paint"
+
+ def poll(self, context):
+ sima = context.space_data
+ return sima.show_paint
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings.image_paint
+ brush = settings.brush
+
+ col = layout.split().column()
+ row = col.row()
+ row.template_list(settings, "brushes", settings, "active_brush_index", rows=2)
+
+ col.template_ID(settings, "brush", new="brush.add")
+
+ row = layout.row(align=True)
+ row.item_enumR(settings, "tool", 'DRAW')
+ row.item_enumR(settings, "tool", 'SOFTEN')
+ row.item_enumR(settings, "tool", 'CLONE')
+ row.item_enumR(settings, "tool", 'SMEAR')
+
+ col = layout.column()
+ col.itemR(brush, "color", text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "size", slider=True)
+ row.itemR(brush, "size_pressure", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "strength", slider=True)
+ row.itemR(brush, "strength_pressure", toggle=True, text="")
+
+ col.itemR(brush, "blend", text="Blend")
+
+class IMAGE_PT_paint_stroke(bpy.types.Panel):
+ __space_type__ = 'IMAGE_EDITOR'
+ __region_type__ = 'UI'
+ __label__ = "Paint Stroke"
+ __default_closed__ = True
+
+ def poll(self, context):
+ sima = context.space_data
+ return sima.show_paint
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings.image_paint
+ brush = settings.brush
+
+ layout.itemR(brush, "airbrush")
+ col = layout.column()
+ col.active = brush.airbrush
+ col.itemR(brush, "rate", slider=True)
+
+ layout.itemR(brush, "space")
+ row = layout.row(align=True)
+ row.active = brush.space
+ row.itemR(brush, "spacing", text="Distance", slider=True)
+ row.itemR(brush, "spacing_pressure", toggle=True, text="")
+
+class IMAGE_PT_paint_curve(bpy.types.Panel):
+ __space_type__ = 'IMAGE_EDITOR'
+ __region_type__ = 'UI'
+ __label__ = "Paint Curve"
+ __default_closed__ = True
+
+ def poll(self, context):
+ sima = context.space_data
+ return sima.show_paint
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings.image_paint
+ brush = settings.brush
+
+ layout.template_curve_mapping(brush, "curve")
+ layout.item_menu_enumO("brush.curve_preset", property="shape")
+
bpy.types.register(IMAGE_MT_view)
bpy.types.register(IMAGE_MT_select)
bpy.types.register(IMAGE_MT_image)
@@ -377,5 +481,10 @@
bpy.types.register(IMAGE_MT_uvs_weldalign)
bpy.types.register(IMAGE_MT_uvs)
bpy.types.register(IMAGE_HT_header)
+bpy.types.register(IMAGE_PT_image_properties)
+bpy.types.register(IMAGE_PT_paint)
+bpy.types.register(IMAGE_PT_paint_stroke)
+bpy.types.register(IMAGE_PT_paint_curve)
bpy.types.register(IMAGE_PT_game_properties)
bpy.types.register(IMAGE_PT_view_properties)
+
Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/source/blender/blenkernel/intern/image.c 2009-09-16 19:27:08 UTC (rev 23287)
@@ -277,7 +277,7 @@
ima->xrep= ima->yrep= 1;
ima->aspx= ima->aspy= 1.0;
- ima->gen_x= 256; ima->gen_y= 256;
+ ima->gen_x= 1024; ima->gen_y= 1024;
ima->gen_type= 1; /* no defines yet? */
ima->source= source;
@@ -1472,9 +1472,11 @@
iuser->ok= 1;
break;
case IMA_SIGNAL_SRC_CHANGE:
- if(ima->type==IMA_TYPE_MULTILAYER)
- image_free_buffers(ima);
- else if(ima->source==IMA_SRC_GENERATED) {
+ if(ima->type == IMA_TYPE_UV_TEST)
+ if(ima->source != IMA_SRC_GENERATED)
+ ima->type= IMA_TYPE_IMAGE;
+
+ if(ima->source==IMA_SRC_GENERATED) {
if(ima->gen_x==0 || ima->gen_y==0) {
ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
if(ibuf) {
@@ -1483,6 +1485,9 @@
}
}
}
+
+ image_free_buffers(ima);
+
ima->ok= 1;
if(iuser)
iuser->ok= 1;
@@ -2090,8 +2095,8 @@
else if(ima->source == IMA_SRC_GENERATED) {
/* generated is: ibuf is allocated dynamically */
/* UV testgrid or black or solid etc */
- if(ima->gen_x==0) ima->gen_x= 256;
- if(ima->gen_y==0) ima->gen_y= 256;
+ if(ima->gen_x==0) ima->gen_x= 1024;
+ if(ima->gen_y==0) ima->gen_y= 1024;
ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 0, ima->gen_type, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok= IMA_OK_LOADED;
Modified: trunk/blender/source/blender/blenkernel/intern/paint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/paint.c 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/source/blender/blenkernel/intern/paint.c 2009-09-16 19:27:08 UTC (rev 23287)
@@ -46,19 +46,24 @@
Paint *paint_get_active(Scene *sce)
{
- if(sce && sce->basact && sce->basact->object) {
+ if(sce) {
ToolSettings *ts = sce->toolsettings;
+
+ if(sce->basact && sce->basact->object) {
+ switch(sce->basact->object->mode) {
+ case OB_MODE_SCULPT:
+ return &ts->sculpt->paint;
+ case OB_MODE_VERTEX_PAINT:
+ return &ts->vpaint->paint;
+ case OB_MODE_WEIGHT_PAINT:
+ return &ts->wpaint->paint;
+ case OB_MODE_TEXTURE_PAINT:
+ return &ts->imapaint.paint;
+ }
+ }
- switch(sce->basact->object->mode) {
- case OB_MODE_SCULPT:
- return &ts->sculpt->paint;
- case OB_MODE_VERTEX_PAINT:
- return &ts->vpaint->paint;
- case OB_MODE_WEIGHT_PAINT:
- return &ts->wpaint->paint;
- case OB_MODE_TEXTURE_PAINT:
- return &ts->imapaint.paint;
- }
+ /* default to image paint */
+ return &ts->imapaint.paint;
}
return NULL;
Modified: trunk/blender/source/blender/editors/include/ED_image.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_image.h 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/source/blender/editors/include/ED_image.h 2009-09-16 19:27:08 UTC (rev 23287)
@@ -53,9 +53,6 @@
int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit);
-void ED_image_uiblock_panel(const struct bContext *C, struct uiBlock *block, struct Image **ima_pp,
- struct ImageUser *iuser, short redraw, short imagechanged);
-
/* image_render.c, export for screen_ops.c, render operator */
void ED_space_image_output(struct bContext *C);
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c 2009-09-16 19:27:08 UTC (rev 23287)
@@ -2125,17 +2125,4 @@
uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_REC, "Anim Player", 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback");
}
-/************************* Image Template **************************/
-#include "ED_image.h"
-
-void uiTemplateTextureImage(uiLayout *layout, bContext *C, Tex *tex)
-{
- uiBlock *block;
-
- if(tex) {
- block= uiLayoutFreeBlock(layout);
- ED_image_uiblock_panel(C, block, &tex->ima, &tex->iuser, 0, 0);
- }
-}
-
Modified: trunk/blender/source/blender/editors/space_image/image_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_buttons.c 2009-09-16 18:59:13 UTC (rev 23286)
+++ trunk/blender/source/blender/editors/space_image/image_buttons.c 2009-09-16 19:27:08 UTC (rev 23287)
@@ -100,8 +100,6 @@
#define B_FACESEL_PAINT_TEST 11
#define B_SIMA_RECORD 12
#define B_SIMA_PLAY 13
-#define B_SIMARANGE 14
-#define B_SIMACURVES 15
#define B_SIMANOTHING 16
#define B_SIMABRUSHCHANGE 17
@@ -116,10 +114,8 @@
#define B_SIMACLONEDELETE 26
/* XXX */
-static int okee() {return 0;}
static int simaFaceDraw_Check() {return 0;}
static int simaUVSel_Check() {return 0;}
-static int is_uv_tface_editing_allowed_silent() {return 0;}
/* XXX */
/* proto */
@@ -135,13 +131,6 @@
switch(event) {
case B_REDR:
break;
- case B_SIMACURVES:
- curvemapping_do_ibuf(sima->cumap, ED_space_image_buffer(sima));
- break;
- case B_SIMARANGE:
- curvemapping_set_black_white(sima->cumap, NULL, NULL);
- curvemapping_do_ibuf(sima->cumap, ED_space_image_buffer(sima));
- break;
case B_TRANS_IMAGE:
image_editvertex_buts(C, NULL);
break;
@@ -149,12 +138,11 @@
image_editcursor_buts(C, &ar->v2d, NULL);
break;
}
+
/* all events now */
WM_event_add_notifier(C, NC_IMAGE, sima->image);
}
-
-
static void image_info(Image *ima, ImBuf *ibuf, char *str)
{
int ofs= 0;
@@ -168,12 +156,12 @@
}
if(ima->source==IMA_SRC_MOVIE) {
- ofs= sprintf(str, "Movie ");
+ ofs= sprintf(str, "Movie");
if(ima->anim)
ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
}
else
- ofs= sprintf(str, "Image ");
+ ofs= sprintf(str, "Image");
ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
@@ -246,10 +234,6 @@
EditFace *efa;
MTFace *tf;
- if(obedit==NULL || obedit->type!=OB_MESH) return;
-
- if( is_uv_tface_editing_allowed_silent()==0 ) return;
-
image_transform_but_attr(sima, &imx, &imy, &step, &digits);
em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
@@ -354,8 +338,6 @@
int imx= 256, imy= 256;
int step, digits;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list