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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-06 14:25:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-06 14:25:59 +0400
commit870ba8aa13c87fdeb1724d0f3ad7b7a4b53a4d32 (patch)
treeb20f227ec19530eab04c9a54e8cf7faaf16f634d /source/blender/editors/space_node
parent2202aaa083b99a4c37c20fbaf34e370d4e78c839 (diff)
parent8849a789702a9be0c06ecc850845c3bb3af0d0fd (diff)
svn merge ^/trunk/blender -r47423:47506
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/drawnode.c88
-rw-r--r--source/blender/editors/space_node/node_edit.c16
-rw-r--r--source/blender/editors/space_node/node_select.c2
3 files changed, 63 insertions, 43 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 801b6c9001c..b75b3e6aeb3 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1114,7 +1114,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
glDisable(GL_BLEND);
/* outline active and selected emphasis */
- if( node->flag & (NODE_ACTIVE|SELECT) ) {
+ if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
glEnable( GL_LINE_SMOOTH );
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
@@ -1132,7 +1132,7 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
/* only draw input socket. as they all are placed on the same position.
* highlight also if node itself is selected, since we don't display the node body separately!
*/
- for(sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock= node->inputs.first; sock; sock= sock->next) {
node_socket_circle_draw(ntree, sock, socket_size, (sock->flag & SELECT) || (node->flag & SELECT));
}
@@ -1188,6 +1188,47 @@ static void node_common_set_butfunc(bNodeType *ntype)
}
/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
+
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imaptr, PointerRNA *iuserptr)
+{
+ uiLayout *col;
+ int source;
+
+ if(!imaptr->data)
+ return;
+
+ col = uiLayoutColumn(layout, 0);
+
+ uiItemR(col, imaptr, "source", 0, "", ICON_NONE);
+
+ source = RNA_enum_get(imaptr, "source");
+
+ if (source == IMA_SRC_SEQUENCE) {
+ /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
+ Scene *scene = CTX_data_scene(C);
+ ImageUser *iuser = iuserptr->data;
+ char numstr[32];
+ const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0);
+ BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr);
+ uiItemL(layout, numstr, ICON_NONE);
+ }
+
+ if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+ col = uiLayoutColumn(layout, 1);
+ uiItemR(col, iuserptr, "frame_duration", 0, NULL, ICON_NONE);
+ uiItemR(col, iuserptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(col, iuserptr, "frame_offset", 0, NULL, ICON_NONE);
+ uiItemR(col, iuserptr, "use_cyclic", 0, NULL, ICON_NONE);
+ uiItemR(col, iuserptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
+ }
+
+ col = uiLayoutColumn(layout, 0);
+
+ if (RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER)
+ uiItemR(col, iuserptr, "layer", 0, NULL, ICON_NONE);
+
+}
+
static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
bNode *node = ptr->data;
@@ -1259,16 +1300,25 @@ static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), Po
static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
+ PointerRNA imaptr = RNA_pointer_get(ptr, "image");
+ PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
+
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
-}
+ node_buts_image_user(layout, C, &imaptr, &iuserptr);
+}
static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
+ PointerRNA imaptr = RNA_pointer_get(ptr, "image");
+ PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
+
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
+
+ node_buts_image_user(layout, C, &imaptr, &iuserptr);
}
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1391,11 +1441,9 @@ static void node_shader_set_butfunc(bNodeType *ntype)
static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- uiLayout *col;
bNode *node = ptr->data;
PointerRNA imaptr;
PropertyRNA *prop;
- int source;
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
@@ -1405,35 +1453,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
if (!prop || RNA_property_type(prop) != PROP_POINTER) return;
imaptr = RNA_property_pointer_get(ptr, prop);
- col = uiLayoutColumn(layout, 0);
-
- uiItemR(col, &imaptr, "source", 0, NULL, ICON_NONE);
-
- source = RNA_enum_get(&imaptr, "source");
-
- if (source == IMA_SRC_SEQUENCE) {
- /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
- Scene *scene = CTX_data_scene(C);
- ImageUser *iuser = node->storage;
- char numstr[32];
- const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0);
- BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr);
- uiItemL(layout, numstr, ICON_NONE);
- }
-
- if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
- col = uiLayoutColumn(layout, 1);
- uiItemR(col, ptr, "frame_duration", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "use_cyclic", 0, NULL, ICON_NONE);
- uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
- }
-
- col = uiLayoutColumn(layout, 0);
-
- if (RNA_enum_get(&imaptr, "type") == IMA_TYPE_MULTILAYER)
- uiItemR(col, ptr, "layer", 0, NULL, ICON_NONE);
+ node_buts_image_user(layout, C, &imaptr, ptr);
}
static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 1b229c78e0f..b4e07546fa9 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2756,11 +2756,11 @@ static int add_reroute_intersect_check(bNodeLink *link, float mcoords[][2], int
float coord_array[LINK_RESOL+1][2];
int i, b;
- if(node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
+ if (node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
- for(i=0; i<tot-1; i++)
- for(b=0; b<LINK_RESOL; b++)
- if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0) {
+ for (i=0; i<tot-1; i++)
+ for (b=0; b<LINK_RESOL; b++)
+ if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0) {
result[0] = (mcoords[i][0]+mcoords[i+1][0])/2.0f;
result[1] = (mcoords[i][1]+mcoords[i+1][1])/2.0f;
return 1;
@@ -2783,18 +2783,18 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1],
&mcoords[i][0], &mcoords[i][1]);
i++;
- if(i>= 256) break;
+ if (i>= 256) break;
}
RNA_END;
- if(i>1) {
+ if (i>1) {
bNodeLink *link;
float insertPoint[2];
ED_preview_kill_jobs(C);
- for(link= snode->edittree->links.first; link; link=link->next) {
- if(add_reroute_intersect_check(link, mcoords, i, insertPoint)) {
+ for (link= snode->edittree->links.first; link; link=link->next) {
+ if (add_reroute_intersect_check(link, mcoords, i, insertPoint)) {
bNodeTemplate ntemp;
bNode *rerouteNode;
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 0a3678ca901..e7be750928d 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -76,7 +76,7 @@ static bNode *node_under_mouse_tweak(bNodeTree *ntree, int mx, int my)
{
bNode *node;
- for(node=ntree->nodes.last; node; node=node->prev) {
+ for (node=ntree->nodes.last; node; node=node->prev) {
if (node->typeinfo->tweak_area_func) {
if (node->typeinfo->tweak_area_func(node, mx, my))
return node;