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:
authorTon Roosendaal <ton@blender.org>2005-12-28 18:42:51 +0300
committerTon Roosendaal <ton@blender.org>2005-12-28 18:42:51 +0300
commit9df1460777cceed839721ea99fd9623aedbb26f5 (patch)
treef4ad7ebfb6294be13c01a3dba67e55354973818e /source/blender/include
parent7837866b1e226925b2a50041e3f0f56ac9e82021 (diff)
Christmas coding work!
********* Node editor work: - To enable Nodes for Materials, you have to set the "Use Nodes" button, in the new Material buttons "Nodes" Panel or in header of the Node editor. Doing this will disable Material-Layers. - Nodes now execute materials ("shaders"), but still only using the previewrender code. - Nodes have (optional) previews for rendered images. - Node headers allow to hide buttons and/or preview image - Nodes can be dragged larger/smaller (right-bottom corner) - Nodes can be hidden (minimized) with hotkey H - CTRL+click on an Input Socket gives a popup with default values. - Changing Material/Texture or Mix node will adjust Node title. - Click-drag outside of a Node changes cursor to "Knife' and allows to draw a rect where to cut Links. - Added new node types RGBtoBW, Texture, In/Output, ColorRamp - Material Nodes have options to ouput diffuse or specular, or to use a negative normal. The input socket 'Normal' will force the material to use that normal, otherwise it uses the normal from the Material that has the node tree. - When drawing a link between two not-matching sockets, Blender inserts a converting node (now only for value/rgb combos) - When drawing a link to an input socket that's already in use, the old link will either disappear or flip to another unused socket. - A click on a Material Node will activate it, and show all its settings in the Material Buttons. Active Material Nodes draw the material icon in red. - A click on any node will show its options in the Node Panel in the Material buttons. - Multiple Output Nodes can be used, to sample contents of a tree, but only one Output is the real one, which is indicated in a different color and red material icon. - Added ThemeColors for node types - ALT+C will convert existing Material-Layers to Node... this currently only adds the material/mix nodes and connects them. Dunno if this is worth a lot of coding work to make perfect? - Press C to call another "Solve order", which will show all possible cyclic conflicts (if there are). - Technical: nodes now use "Type" structs which define the structure of nodes and in/output sockets. The Type structs store all fixed info, callbacks, and allow to reconstruct saved Nodes to match what is required by Blender. - Defining (new) nodes now is as simple as filling in a fixed Type struct, plus code some callbacks. A doc will be made! - Node preview images are by default float ********* Icon drawing: - Cleanup of how old icons were implemented in new system, making them 16x16 too, correctly centered *and* scaled. - Made drawing Icons use float coordinates - Moved BIF_calcpreview_image() into interface_icons.c, renamed it icon_from_image(). Removed a lot of unneeded Imbuf magic here! :) - Skipped scaling and imbuf copying when icons are OK size ********* Preview render: - Huge cleanup of code.... - renaming BIF_xxx calls that only were used internally - BIF_previewrender() now accepts an argument for rendering method, so it supports icons, buttonwindow previewrender and node editor - Only a single BIF_preview_changed() call now exists, supporting all signals as needed for buttos and node editor ********* More stuff: - glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format argument for GL_FLOAT rects - Made the ColorBand become a built-in button for interface.c Was a load of cleanup work in buttons_shading.c... - removed a load of unneeded glBlendFunc() calls - Fixed bug in calculating text length for buttons (ancient!)
Diffstat (limited to 'source/blender/include')
-rw-r--r--source/blender/include/BIF_glutil.h6
-rw-r--r--source/blender/include/BIF_interface.h1
-rw-r--r--source/blender/include/BIF_interface_icons.h4
-rw-r--r--source/blender/include/BIF_previewrender.h33
-rw-r--r--source/blender/include/BIF_resources.h12
-rw-r--r--source/blender/include/BSE_node.h23
-rw-r--r--source/blender/include/blendef.h3
-rw-r--r--source/blender/include/butspace.h40
-rw-r--r--source/blender/include/interface.h2
9 files changed, 77 insertions, 47 deletions
diff --git a/source/blender/include/BIF_glutil.h b/source/blender/include/BIF_glutil.h
index 43fa758d3cf..b585f91ec3e 100644
--- a/source/blender/include/BIF_glutil.h
+++ b/source/blender/include/BIF_glutil.h
@@ -125,7 +125,7 @@ void glaRasterPosSafe2f (float x, float y, float known_good_x, float known_good
* to use the glScissor functionality if images are to be drawn
* with an inset view matrix.
*/
-void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, void *rect);
+void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, int format, void *rect);
/**
* Functions like a limited glDrawPixels, but actually draws the
@@ -135,11 +135,11 @@ void glaDrawPixelsSafe (float x, float y, int img_w, int img_h, void *rect);
* pixel unpacking parameters are _not_ respected.
* @attention This routine makes many assumptions: the rect data
- * is expected to be in RGBA unsigned byte format, and the
+ * is expected to be in RGBA byte or float format, and the
* modelview and projection matrices are assumed to define a
* 1-to-1 mapping to screen space.
*/
-void glaDrawPixelsTex (float x, float y, int img_w, int img_h, void *rect);
+void glaDrawPixelsTex (float x, float y, int img_w, int img_h, int format, void *rect);
/* 2D Drawing Assistance */
diff --git a/source/blender/include/BIF_interface.h b/source/blender/include/BIF_interface.h
index 70a7de4a84c..9ddab3305c8 100644
--- a/source/blender/include/BIF_interface.h
+++ b/source/blender/include/BIF_interface.h
@@ -153,6 +153,7 @@ struct ScrArea;
#define PULLDOWN (27<<9)
#define ROUNDBOX (28<<9)
#define CHARTAB (29<<9)
+#define BUT_COLORBAND (30<<9)
#define BUTTYPE (31<<9)
diff --git a/source/blender/include/BIF_interface_icons.h b/source/blender/include/BIF_interface_icons.h
index 2ec14b53cf2..ba5a119df7e 100644
--- a/source/blender/include/BIF_interface_icons.h
+++ b/source/blender/include/BIF_interface_icons.h
@@ -47,8 +47,8 @@ void BIF_icons_init(int first_dyn_id);
int BIF_icon_get_width(int icon_id);
int BIF_icon_get_height(int icon_id);
void BIF_icon_set_aspect(int icon_id, float aspect);
-void BIF_icon_draw(int x, int y, int icon_id);
-void BIF_icon_draw_blended(int x, int y, int icon_id, int colorid, int shade);
+void BIF_icon_draw(float x, float y, int icon_id);
+void BIF_icon_draw_blended(float x, float y, int icon_id, int colorid, int shade);
void BIF_icons_free();
void BIF_icons_free_drawinfo(void *drawinfo);
diff --git a/source/blender/include/BIF_previewrender.h b/source/blender/include/BIF_previewrender.h
index cb8041832b5..b8ed73505f5 100644
--- a/source/blender/include/BIF_previewrender.h
+++ b/source/blender/include/BIF_previewrender.h
@@ -35,6 +35,8 @@ struct RenderInfo;
struct Image;
struct ScrArea;
+#define PREVIEW_RENDERSIZE 140
+
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
/* stores rendered preview - is also used for icons */
@@ -45,22 +47,23 @@ typedef struct RenderInfo {
short cury;
} RenderInfo;
-/* Set the previewrect for drawing */
-void BIF_set_previewrect(int win, int xmin, int ymin, int xmax, int ymax, short pr_rectx, short pr_recty);
-void BIF_end_previewrect(void);
-
-void BIF_all_preview_changed(void);
-void BIF_preview_changed (struct SpaceButs *sbuts);
-void BIF_previewrender_buts (struct SpaceButs *sbuts);
/* Render the preview
- * a) into the ri->rect
- * b) draw it in the area using the block UIMat
- if doDraw is false, the preview is not drawn and the function is not dynamic,
- so no events are processed. Hopefully fast enough for 64x64 rendering or
- at least 32x32 */
-void BIF_previewrender (struct ID* id, struct RenderInfo *ri, struct ScrArea *area, int doDraw);
+pr_method:
+- PR_DRAW_RENDER: preview is rendered and drawn, as indicated by called context (buttons panel)
+- PR_ICON_RENDER: the preview is not drawn and the function is not dynamic,
+ so no events are processed. Hopefully fast enough for at least 32x32
+- PR_DO_RENDER: preview is rendered, not drawn, but events are processed for afterqueue,
+ in use for node editor now.
+*/
+
+#define PR_DRAW_RENDER 0
+#define PR_ICON_RENDER 1
+#define PR_DO_RENDER 2
+
+void BIF_previewrender (struct ID *id, struct RenderInfo *ri, struct ScrArea *area, int pr_method);
+void BIF_previewrender_buts (struct SpaceButs *sbuts);
void BIF_previewdraw (void);
-void BIF_previewdraw_render(struct RenderInfo* ri, struct ScrArea* area);
+void BIF_preview_changed(short id_code);
+
-void BIF_calcpreview_image(struct Image* img, struct RenderInfo* ri, unsigned int w, unsigned int h);
diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h
index 933c619f11f..3e366710992 100644
--- a/source/blender/include/BIF_resources.h
+++ b/source/blender/include/BIF_resources.h
@@ -182,8 +182,8 @@ typedef enum {
ICON_CHECKBOX_HLT,
ICON_LINK,
ICON_INLINK,
- ICON_BEVELBUT_HLT,
- ICON_BEVELBUT_DEHLT,
+ ICON_BLANK12,
+ ICON_BLANK13,
ICON_PASTEDOWN,
ICON_COPYDOWN,
ICON_CONSTANT,
@@ -456,7 +456,13 @@ enum {
TH_STRIP,
TH_STRIP_SELECT,
- TH_LAMP
+ TH_LAMP,
+
+ TH_NODE,
+ TH_NODE_IN_OUT,
+ TH_NODE_OPERATOR,
+ TH_NODE_GENERATOR,
+ TH_NODE_FREE,
};
/* XXX WARNING: previous is saved in file, so do not change order! */
diff --git a/source/blender/include/BSE_node.h b/source/blender/include/BSE_node.h
index 0cb8018c0d0..458887c91d1 100644
--- a/source/blender/include/BSE_node.h
+++ b/source/blender/include/BSE_node.h
@@ -30,27 +30,36 @@
#ifndef BSE_NODE_H
#define BSE_NODE_H
+/* ********** drawing sizes *********** */
#define NODE_DY 20
#define NODE_DYS 10
-#define NODE_SOCK 5
+#define NODE_SOCKSIZE 5
+#define BASIS_RAD 8.0f
+#define HIDDEN_RAD 15.0f
+
struct SpaceNode;
struct bNode;
-
-/* ************* button events *********** */
-
-#define B_NODE_EXEC 1
+struct Material;
/* ************* API for editnode.c *********** */
+void snode_tag_dirty(struct SpaceNode *snode);
+
+void snode_set_context(struct SpaceNode *snode);
void node_deselectall(struct SpaceNode *snode, int swap);
void node_transform_ext(int mode, int unused);
+void node_shader_default(struct Material *ma);
-/* ************* Shader nodes ***************** */
+/* ************* drawnode.c *************** */
+void node_draw_link(struct SpaceNode *snode, struct bNodeLink *link);
+
+void init_node_butfuncs(void);
-void node_shader_set_drawfunc(struct bNode *node);
+/* ************* Shader nodes ***************** */
+struct bNode *node_add_shadernode(struct SpaceNode *snode, int type, float locx, float locy);
#endif
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index 5963d5e3e14..e0061dc3403 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -374,7 +374,8 @@
#define B_NLAHOME 801
/* NODE: 851-900 */
-#define B_NODEHOME 851
+#define B_NODEHOME 851
+#define B_NODE_USEMAT 852
/* FREE 901 - 999 */
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index 713f9abf488..7dae5af58e3 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -37,7 +37,9 @@
struct Base;
struct Object;
struct ID;
-
+struct ColorBand;
+struct uiBlock;
+struct rctf;
/* buts->scaflag */
#define BUTS_SENS_SEL 1
@@ -87,6 +89,7 @@ extern void do_armbuts(unsigned short event);
extern char *get_vertexgroup_menustr(struct Object *ob); // used in object buttons
/* shading */
+extern void draw_colorband_buts_small(struct uiBlock *block, struct ColorBand *coba, rctf *rct, int event);
extern void material_panels(void);
extern void do_matbuts(unsigned short event);
extern void lamp_panels(void);
@@ -122,6 +125,7 @@ void test_matpoin_but(char *name, struct ID **idpp);
void test_scriptpoin_but(char *name, struct ID **idpp);
void test_actionpoin_but(char *name, ID **idpp);
void test_grouppoin_but(char *name, ID **idpp);
+void test_texpoin_but(char *name, ID **idpp);
void test_idbutton_cb(void *namev, void *arg2_unused);
@@ -169,20 +173,25 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_ACTCOL 1204
#define B_MATFROM 1205
#define B_MATPRV 1206
-#define B_MTEXCOL 1207
-#define B_TEXCLEAR 1208
-#define B_MATPRV_DRAW 1209
-#define B_MTEXPASTE 1210
-#define B_MTEXCOPY 1211
-#define B_MATLAY 1212
-#define B_MATHALO 1213
-#define B_MATZTRANSP 1214
-#define B_MATRAYTRANSP 1215
-#define B_MATCOLORBAND 1216
-/* yafray: material preset menu event */
-#define B_MAT_YF_PRESET 1217
-
-#define B_MAT_LAYERBROWSE 1218
+#define B_LAMPPRV 1207
+#define B_WORLDPRV 1208
+#define B_TEXPRV 1209
+#define B_MTEXCOL 1210
+#define B_TEXCLEAR 1211
+#define B_MTEXPASTE 1212
+#define B_MTEXCOPY 1213
+#define B_MATLAY 1214
+#define B_MATHALO 1215
+#define B_MATZTRANSP 1216
+#define B_MATRAYTRANSP 1217
+#define B_MATCOLORBAND 1218
+ /* yafray: material preset menu event */
+#define B_MAT_YF_PRESET 1219
+
+#define B_MAT_LAYERBROWSE 1220
+#define B_MAT_USENODES 1221
+ /* also handled in editnode.c */
+#define B_NODE_EXEC 1222
/* *********************** */
#define B_TEXBUTS 1400
@@ -207,7 +216,6 @@ void test_idbutton_cb(void *namev, void *arg2_unused);
#define B_REDRAWCBAND 1318
#define B_BANDCOL 1319
#define B_LOADTEXIMA1 1320
-#define B_TEXPRV 1321
#define B_PLUGBUT 1325
/* B_PLUGBUT reserves 24 buttons at least! */
diff --git a/source/blender/include/interface.h b/source/blender/include/interface.h
index 1c26a714c51..526f24e704e 100644
--- a/source/blender/include/interface.h
+++ b/source/blender/include/interface.h
@@ -223,6 +223,8 @@ extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, flo
extern void ui_set_embossfunc(uiBut *but, int drawtype);
extern void ui_draw_but(uiBut *but);
extern void ui_rasterpos_safe(float x, float y, float aspect);
+extern void ui_draw_tria_icon(float x, float y, float aspect, char dir);
+extern void ui_draw_anti_x(float x1, float y1, float x2, float y2);
#endif