diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-02-05 14:08:55 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-02-05 14:08:55 +0300 |
commit | 7414464e23d0f222987b6ae1ea2d55d9c5142025 (patch) | |
tree | ac1278cfd865f44f8abaec7530800985d0d666fa /source/blender/editors/space_node | |
parent | f902bbad83727ba8c35328aeb75583449eb84e6f (diff) | |
parent | 363a044b4c8223cb7bace020e31a3f2f7e3475a6 (diff) |
Merge branch 'master' into wiggly-widgets
Conflicts:
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_customdata_types.h
source/blender/makesrna/intern/rna_object.c
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 50 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_add.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 2 |
4 files changed, 68 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c7337f6c2ea..f26940aaf7b 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -38,6 +38,7 @@ #include "DNA_space_types.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" +#include "DNA_text_types.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -389,6 +390,7 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp float width, ascender; float x, y; const int font_size = data->label_size / aspect; + const float margin = (float)(NODE_DY / 4); nodeLabel(ntree, node, label, sizeof(label)); @@ -404,11 +406,42 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp /* 'x' doesn't need aspect correction */ x = BLI_rctf_cent_x(rct) - (0.5f * width); - y = rct->ymax - (((NODE_DY / 4) / aspect) + (ascender * aspect)); + y = rct->ymax - ((margin / aspect) + (ascender * aspect)); BLF_position(fontid, x, y, 0); BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX); + /* draw text body */ + if (node->id) { + Text *text = (Text *)node->id; + TextLine *line; + const float line_spacing = (BLF_height_max(fontid) * aspect) * 0.7f; + + /* 'x' doesn't need aspect correction */ + x = rct->xmin + margin; + y = rct->ymax - ((margin / aspect) + (ascender * aspect)); + y -= line_spacing; + + BLF_enable(fontid, BLF_CLIPPING); + BLF_clipping( + fontid, + rct->xmin, + rct->ymin, + rct->xmin + ((rct->xmax - rct->xmin) / aspect) - margin, + rct->ymax); + + for (line = text->lines.first; line; line = line->next) { + BLF_position(fontid, x, y, 0); + BLF_draw(fontid, line->line, line->len); + y -= line_spacing; + if (y < rct->ymin) { + break; + } + } + + BLF_disable(fontid, BLF_CLIPPING); + } + BLF_disable(fontid, BLF_ASPECT); } @@ -498,6 +531,7 @@ static void node_buts_frame_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA { uiItemR(layout, ptr, "label_size", 0, IFACE_("Label Size"), ICON_NONE); uiItemR(layout, ptr, "shrink", 0, IFACE_("Shrink"), ICON_NONE); + uiItemR(layout, ptr, "text", 0, NULL, ICON_NONE); } @@ -779,8 +813,8 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA uiLayoutSetContextPointer(layout, "image_user", &iuserptr); 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); uiItemR(layout, ptr, "interpolation", 0, "", ICON_NONE); + uiItemR(layout, ptr, "projection", 0, "", ICON_NONE); if (RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) { uiItemR(layout, ptr, "projection_blend", 0, "Blend", ICON_NONE); @@ -861,6 +895,7 @@ static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { + uiItemR(layout, ptr, "object", 0, NULL, 0); uiItemR(layout, ptr, "from_dupli", 0, NULL, 0); } @@ -2279,6 +2314,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; + NodePlaneTrackDeformData *data = node->storage; uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL); @@ -2307,6 +2343,12 @@ static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, P uiItemR(layout, ptr, "plane_track_name", 0, "", ICON_ANIM_DATA); } } + + uiItemR(layout, ptr, "use_motion_blur", 0, NULL, ICON_NONE); + if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { + uiItemR(layout, ptr, "motion_blur_samples", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_shutter", 0, NULL, ICON_NONE); + } } static void node_composit_buts_cornerpin(uiLayout *UNUSED(layout), bContext *UNUSED(C), PointerRNA *UNUSED(ptr)) @@ -3053,9 +3095,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b /* somehow the offset has to be calculated inverse */ glaDefine2DArea(&ar->winrct); - /* ortho at pixel level curarea */ - /* almost #wmOrtho2_region_pixelspace, but no +1 px */ - wmOrtho2_pixelspace(ar->winx, ar->winy); + wmOrtho2_region_pixelspace(ar); x = (ar->winx - snode->backdrop_zoom * ibuf->x) / 2 + snode->backdrop_offset[0]; y = (ar->winy - snode->backdrop_zoom * ibuf->y) / 2 + snode->backdrop_offset[1]; diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index c3064432131..b6fa4518ed6 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -334,9 +334,14 @@ static int node_add_file_exec(bContext *C, wmOperator *op) } node->id = (ID *)ima; - - BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); - WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); + + /* When adding new image file via drag-drop we need to load imbuf in order + * to get proper image source. + */ + if (RNA_struct_property_is_set(op->ptr, "filepath")) { + BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); + WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); + } snode_notify(C, snode); snode_dag_update(C, snode); @@ -374,7 +379,7 @@ void NODE_OT_add_file(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, + WM_operator_properties_filesel(ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY); RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); } @@ -448,8 +453,8 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) PointerRNA ptr, idptr; PropertyRNA *prop; const char *idname; - char _treename[MAX_ID_NAME - 2]; - char *treename = _treename; + char treename_buf[MAX_ID_NAME - 2]; + const char *treename; if (RNA_struct_property_is_set(op->ptr, "type")) { prop = RNA_struct_find_property(op->ptr, "type"); @@ -461,10 +466,11 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if (RNA_struct_property_is_set(op->ptr, "name")) { - RNA_string_get(op->ptr, "name", treename); + RNA_string_get(op->ptr, "name", treename_buf); + treename = treename_buf; } else { - treename = (char *)DATA_("NodeTree"); + treename = DATA_("NodeTree"); } if (!ntreeTypeFind(idname)) { diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index c2576e3ccc7..85b2186f53f 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1133,6 +1133,9 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree) { bNode *node; + /* make sure socket "used" tags are correct, for displaying value buttons */ + ntreeTagUsedSockets(ntree); + /* update nodes front to back, so children sizes get updated before parents */ for (node = ntree->nodes.last; node; node = node->prev) { node_update(C, ntree, node); @@ -1301,6 +1304,11 @@ void drawnodespace(const bContext *C, ARegion *ar) path = snode->treepath.last; + /* update tree path name (drawn in the bottom left) */ + if (snode->id && UNLIKELY(!STREQ(path->node_name, snode->id->name + 2))) { + BLI_strncpy(path->node_name, snode->id->name + 2, sizeof(path->node_name)); + } + /* current View2D center, will be set temporarily for parent node trees */ UI_view2d_center_get(v2d, ¢er[0], ¢er[1]); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 9d6c7d7aa33..0092dc87349 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -566,7 +566,7 @@ void snode_set_context(const bContext *C) return; } - if (snode->nodetree && strcmp(snode->nodetree->idname, snode->tree_idname) != 0) { + if (snode->nodetree && !STREQ(snode->nodetree->idname, snode->tree_idname)) { /* current tree does not match selected type, clear tree path */ ntree = NULL; id = NULL; |