[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19074] branches/blender2.5/blender/source /blender: 2.5
Ton Roosendaal
ton at blender.org
Sat Feb 21 19:33:19 CET 2009
Revision: 19074
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19074
Author: ton
Date: 2009-02-21 19:33:09 +0100 (Sat, 21 Feb 2009)
Log Message:
-----------
2.5
Useful goodies: most buttons for Image window back.
Not every button works! But what you can do:
- press Nkey to show/hide options
- use curves, with realtime updating
- image properties panel, load, browsing layers,
setting types
- paint panel
- plus new paint color picker panel! (why it wasn't
there in 2.4x is probably obvious, but now it can!)
Hrm... radial control should be added here too, and a nice
paint size cursor?
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
branches/blender2.5/blender/source/blender/editors/space_image/image_intern.h
branches/blender2.5/blender/source/blender/editors/space_image/image_ops.c
branches/blender2.5/blender/source/blender/editors/space_image/image_panels.c
branches/blender2.5/blender/source/blender/editors/space_image/space_image.c
branches/blender2.5/blender/source/blender/editors/space_node/node_edit.c
branches/blender2.5/blender/source/blender/windowmanager/WM_api.h
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_event_system.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-02-21 15:31:01 UTC (rev 19073)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-02-21 18:33:09 UTC (rev 19074)
@@ -243,7 +243,7 @@
void uiNewPanelHeight(uiBlock *block, int sizey)
{
- if(sizey<64) sizey= 64;
+ if(sizey<0) sizey= 0;
if(block->panel) {
block->panel->ofsy+= (block->panel->sizey - sizey);
Modified: branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c 2009-02-21 15:31:01 UTC (rev 19073)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c 2009-02-21 18:33:09 UTC (rev 19074)
@@ -337,6 +337,8 @@
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST_UI, ar->winx, ar->winy);
+ keymap= WM_keymap_listbase(wm, "View2D Buttons List", 0, 0);
+ WM_event_add_keymap_handler(&ar->handlers, keymap);
keymap= WM_keymap_listbase(wm, "GraphEdit Generic", SPACE_IPO, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
@@ -567,7 +569,7 @@
art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_UI;
art->minsizey= 160;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= NULL; // graph_region_listener;
art->init= graph_buttons_area_init;
art->draw= graph_buttons_area_draw;
Modified: branches/blender2.5/blender/source/blender/editors/space_image/image_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_image/image_intern.h 2009-02-21 15:31:01 UTC (rev 19073)
+++ branches/blender2.5/blender/source/blender/editors/space_image/image_intern.h 2009-02-21 18:33:09 UTC (rev 19074)
@@ -39,6 +39,7 @@
struct ImBuf;
struct wmOperatorType;
struct Scene;
+struct bNodeTree;
/* space_image.c */
struct ARegion *image_has_buttons_region(struct ScrArea *sa);
@@ -82,6 +83,7 @@
void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);
/* image_panels.c */
+struct ImageUser *ntree_get_active_iuser(struct bNodeTree *ntree);
void image_buttons_area_defbuts(const struct bContext *C, struct ARegion *ar);
void IMAGE_OT_properties(struct wmOperatorType *ot);
Modified: branches/blender2.5/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_image/image_ops.c 2009-02-21 15:31:01 UTC (rev 19073)
+++ branches/blender2.5/blender/source/blender/editors/space_image/image_ops.c 2009-02-21 18:33:09 UTC (rev 19074)
@@ -621,7 +621,6 @@
RNA_string_get(op->ptr, "filename", str);
ima= BKE_add_image_file(str, scene->r.cfra);
- MEM_freeN(str);
if(!ima)
return OPERATOR_CANCELLED;
Modified: branches/blender2.5/blender/source/blender/editors/space_image/image_panels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_image/image_panels.c 2009-02-21 15:31:01 UTC (rev 19073)
+++ branches/blender2.5/blender/source/blender/editors/space_image/image_panels.c 2009-02-21 18:33:09 UTC (rev 19074)
@@ -29,13 +29,17 @@
#include <string.h>
#include <stdio.h>
+#include "DNA_color_types.h"
#include "DNA_image_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h"
@@ -46,10 +50,18 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
+#include "BKE_customdata.h"
#include "BKE_image.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_packedfile.h"
#include "BKE_screen.h"
#include "BKE_utildefines.h"
+#include "RE_pipeline.h"
+
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -58,6 +70,7 @@
#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_uvedit.h"
+#include "ED_util.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -73,21 +86,140 @@
#include "image_intern.h"
+#define B_REDR 1
+#define B_IMAGECHANGED 2
+#define B_TRANS_IMAGE 3
+#define B_CURSOR_IMAGE 4
+#define B_NOP 0
+#define B_TWINANIM 5
+#define B_SIMAGETILE 6
+#define B_IDNAME 10
+#define B_FACESEL_PAINT_TEST 11
+#define B_SIMA_RECORD 12
+#define B_SIMA_PLAY 13
+#define B_SIMARANGE 14
+#define B_SIMACURVES 15
-#if 0
+#define B_SIMANOTHING 16
+#define B_SIMABRUSHCHANGE 17
+#define B_SIMABRUSHBROWSE 18
+#define B_SIMABRUSHLOCAL 19
+#define B_SIMABRUSHDELETE 20
+#define B_KEEPDATA 21
+#define B_SIMABTEXBROWSE 22
+#define B_SIMABTEXDELETE 23
+#define B_VPCOLSLI 24
+#define B_SIMACLONEBROWSE 25
+#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 */
+static void image_editvertex_buts(const bContext *C, uiBlock *block);
+static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block);
+
+
+static void do_image_panel_events(bContext *C, void *arg, int event)
+{
+ SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+ ARegion *ar= CTX_wm_region(C);
+
+ 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;
+ case B_CURSOR_IMAGE:
+ 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;
+
+ str[0]= 0;
+
+ if(ima==NULL) return;
+ if(ibuf==NULL) {
+ sprintf(str, "Can not get an image");
+ return;
+ }
+
+ if(ima->source==IMA_SRC_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+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
+
+ if(ibuf->rect_float) {
+ if(ibuf->channels!=4) {
+ sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
+ }
+ else if(ibuf->depth==32)
+ strcat(str, " RGBA float");
+ else
+ strcat(str, " RGB float");
+ }
+ else {
+ if(ibuf->depth==32)
+ strcat(str, " RGBA byte");
+ else
+ strcat(str, " RGB byte");
+ }
+ if(ibuf->zbuf || ibuf->zbuf_float)
+ strcat(str, " + Z");
+
+}
+
+/* gets active viewer user */
+struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
+{
+ bNode *node;
+
+ if(ntree)
+ for(node= ntree->nodes.first; node; node= node->next)
+ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ if(node->flag & NODE_DO_OUTPUT)
+ return node->storage;
+ return NULL;
+}
+
+
/* ************ panel stuff ************* */
/* this function gets the values for cursor and vertex number buttons */
-static void image_transform_but_attr(int *imx, int *imy, int *step, int *digits) /*, float *xcoord, float *ycoord)*/
+static void image_transform_but_attr(SpaceImage *sima, int *imx, int *imy, int *step, int *digits) /*, float *xcoord, float *ycoord)*/
{
- ImBuf *ibuf= imagewindow_get_ibuf(G.sima);
+ ImBuf *ibuf= ED_space_image_buffer(sima);
if(ibuf) {
*imx= ibuf->x;
*imy= ibuf->y;
}
- if (G.sima->flag & SI_COORDFLOATS) {
+ if (sima->flag & SI_COORDFLOATS) {
*step= 1;
*digits= 3;
}
@@ -99,20 +231,25 @@
/* is used for both read and write... */
-void image_editvertex_buts(uiBlock *block)
+static void image_editvertex_buts(const bContext *C, uiBlock *block)
{
+ SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
+ Object *obedit= CTX_data_edit_object(C);
static float ocent[2];
float cent[2]= {0.0, 0.0};
int imx= 256, imy= 256;
int nactive= 0, step, digits;
- EditMesh *em = G.editMesh;
+ EditMesh *em;
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(&imx, &imy, &step, &digits);
+ image_transform_but_attr(sima, &imx, &imy, &step, &digits);
+ em= ((Mesh *)obedit->data)->edit_mesh;
for (efa= em->faces.first; efa; efa= efa->next) {
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (simaFaceDraw_Check(efa, tf)) {
@@ -144,7 +281,7 @@
if (nactive) {
ocent[0]= cent[0]/nactive;
ocent[1]= cent[1]/nactive;
- if (G.sima->flag & SI_COORDFLOATS) {
+ if (sima->flag & SI_COORDFLOATS) {
} else {
ocent[0] *= imx;
ocent[1] *= imy;
@@ -168,7 +305,7 @@
cent[0]= cent[0]/nactive;
cent[1]= cent[1]/nactive;
- if (G.sima->flag & SI_COORDFLOATS) {
+ if (sima->flag & SI_COORDFLOATS) {
delta[0]= ocent[0]-cent[0];
delta[1]= ocent[1]-cent[1];
}
@@ -198,28 +335,28 @@
}
}
}
-
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWIMAGE, 0);
+
+ WM_event_add_notifier(C, NC_IMAGE, sima->image);
}
}
/* is used for both read and write... */
-void image_editcursor_buts(uiBlock *block)
+static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block)
{
+ SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
static float ocent[2];
int imx= 256, imy= 256;
int step, digits;
if( is_uv_tface_editing_allowed_silent()==0 ) return;
- image_transform_but_attr(&imx, &imy, &step, &digits);
+ image_transform_but_attr(sima, &imx, &imy, &step, &digits);
if(block) { // do the buttons
- ocent[0]= G.v2d->cursor[0];
- ocent[1]= G.v2d->cursor[1];
- if (G.sima->flag & SI_COORDFLOATS) {
+ ocent[0]= v2d->cursor[0];
+ ocent[1]= v2d->cursor[1];
+ if (sima->flag & SI_COORDFLOATS) {
} else {
ocent[0] *= imx;
ocent[1] *= imy;
@@ -231,169 +368,285 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list