Revision: 38091
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38091
Author: jbakker
Date: 2011-07-04 18:48:36 +0000 (Mon, 04 Jul 2011)
Log Message:
-----------
====== Proposal: Nodes property windows enhancement ======
===== Situation before this patch =====
in the current situation inside the node editor there is a properties panel
(press 'n'-key). This pabel displays some information about the node, backdrop
and grease pencil. The UI of the property panel is typically vertical oriented.
Nodes in the other hand are not oriented in a direction. Both area's are draw
via the same draw function.
With some nodes this will create not user-friendly UI. Try the color-balance
for instance). The 3 color circles are drawn next to each other, it would be
better to draw them below each other.
When creating more complex nodes you don't want to display all handles in the
node-panel and in the properties panel. For instance fine-tuning handles you
only want to appear in the property panel to reduce place in the node itself.
===== Situation after this patch =====
This patch separates the draw functions of the property panel and the node
panel.
When no special draw function is created for the property panel, the draw
function of the node will be used as 'fallback'
===== Impact =====
==== BKE_node.h ====
add a new uifunc (called uifuncbut) to the bNodeType struct. The definition is
the same as the uifunc.
==== node_buttons.c ====
if the uifuncbut is set, call it. currently calls the uifunc method
==== drawnode.c ====
static void node_composit_set_butfunc(bNodeType *ntype). set the uifuncbut
function where needed. When at the end of the method uifuncbut is still empty,
set uifuncbut to the uifunc.
===== Final note =====
! PS. this is not limited to the compositor it also works for Materials and
Textures !
! PPS. For other branching creating their own node-tree. Please make sure that
your uifuncbut is set NULL or a valid draw function !
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_node.h
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/blender/editors/space_node/node_buttons.c
Modified: trunk/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_node.h 2011-07-04 18:14:41 UTC
(rev 38090)
+++ trunk/blender/source/blender/blenkernel/BKE_node.h 2011-07-04 18:48:36 UTC
(rev 38091)
@@ -87,8 +87,9 @@
void (*execfunc)(void *data, struct bNode *, struct bNodeStack **,
struct bNodeStack **);
/* this line is set on startup of blender */
- void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA
*ptr);
- const char *(*labelfunc)(struct bNode *);
+ void (*uifunc)(struct uiLayout *, struct bContext *C, struct
PointerRNA *ptr);
+ void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct
PointerRNA *ptr);
+ const char *(*labelfunc)(struct bNode *);
void (*initfunc)(struct bNode *);
void (*freestoragefunc)(struct bNode *);
Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c 2011-07-04
18:14:41 UTC (rev 38090)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c 2011-07-04
18:48:36 UTC (rev 38091)
@@ -423,6 +423,7 @@
/* only once called */
static void node_shader_set_butfunc(bNodeType *ntype)
{
+ ntype->uifuncbut = NULL;
switch(ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is
generated... see "XXX ugly hack" */
@@ -472,6 +473,7 @@
default:
ntype->uifunc= NULL;
}
+ if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
}
/* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */
@@ -1036,7 +1038,36 @@
}
}
+static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext
*UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "correction_method", 0, NULL, ICON_NONE);
+ if (RNA_enum_get(ptr, "correction_method")== 0) {
+
+ uiTemplateColorWheel(layout, ptr, "lift", 1, 1, 0, 1);
+ uiItemR(layout, ptr, "lift", 0, NULL, ICON_NONE);
+
+ uiTemplateColorWheel(layout, ptr, "gamma", 1, 1, 1, 1);
+ uiItemR(layout, ptr, "gamma", 0, NULL, ICON_NONE);
+
+ uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1);
+ uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE);
+
+ } else {
+
+ uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1);
+ uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
+
+ uiTemplateColorWheel(layout, ptr, "power", 1, 1, 0, 1);
+ uiItemR(layout, ptr, "power", 0, NULL, ICON_NONE);
+
+ uiTemplateColorWheel(layout, ptr, "slope", 1, 1, 0, 1);
+ uiItemR(layout, ptr, "slope", 0, NULL, ICON_NONE);
+ }
+
+}
+
+
static void node_composit_buts_huecorrect(uiLayout *layout, bContext
*UNUSED(C), PointerRNA *ptr)
{
uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
@@ -1050,6 +1081,7 @@
/* only once called */
static void node_composit_set_butfunc(bNodeType *ntype)
{
+ ntype->uifuncbut = NULL;
switch(ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is
generated... see "XXX ugly hack" */
@@ -1183,8 +1215,9 @@
ntype->uifunc=node_composit_buts_view_levels;
break;
case CMP_NODE_COLORBALANCE:
- ntype->uifunc=node_composit_buts_colorbalance;
- break;
+ ntype->uifunc=node_composit_buts_colorbalance;
+ ntype->uifuncbut=node_composit_buts_colorbalance_but;
+ break;
case CMP_NODE_HUECORRECT:
ntype->uifunc=node_composit_buts_huecorrect;
break;
@@ -1198,6 +1231,8 @@
default:
ntype->uifunc= NULL;
}
+ if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
+
}
/* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
@@ -1308,6 +1343,7 @@
/* only once called */
static void node_texture_set_butfunc(bNodeType *ntype)
{
+ ntype->uifuncbut = NULL;
if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
ntype->uifunc = node_texture_buts_proc;
}
@@ -1352,6 +1388,7 @@
default:
ntype->uifunc= NULL;
}
+ if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
}
/* ******* init draw callbacks for all tree types, only called in
usiblender.c, once ************* */
Modified: trunk/blender/source/blender/editors/space_node/node_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_buttons.c
2011-07-04 18:14:41 UTC (rev 38090)
+++ trunk/blender/source/blender/editors/space_node/node_buttons.c
2011-07-04 18:48:36 UTC (rev 38091)
@@ -118,8 +118,8 @@
uiItemS(layout);
/* draw this node's settings */
- if (node->typeinfo && node->typeinfo->uifunc)
- node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
+ if (node->typeinfo && node->typeinfo->uifuncbut)
+ node->typeinfo->uifuncbut(layout, (bContext *)C, &ptr);
}
/* ******************* node buttons registration ************** */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs