From 2c798fd86d9a9aed1c2459f5550bacb03d583f96 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Thu, 21 Jul 2011 21:34:08 +0000 Subject: [PATCH 01/14] Adding Shear transform to UV menu and Ctrl Alt Shift S hotkey (same as in 3D View) --- release/scripts/startup/bl_ui/space_image.py | 4 ++++ source/blender/editors/transform/transform_ops.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 722b46aba11..fa5579ea2e0 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -198,6 +198,10 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu): layout.operator("transform.rotate") layout.operator("transform.resize") + layout.separator() + + layout.operator("transform.shear") + class IMAGE_MT_uvs_snap(bpy.types.Menu): bl_label = "Snap" diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 7bdf6c909d9..2d0c1ac2818 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -954,6 +954,8 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0); + WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0); km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0); From e6604288c8886b2c236c1765734a6ed71b8f0ae8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Jul 2011 23:06:51 +0000 Subject: [PATCH 02/14] cmake - option to disable the frame server --- CMakeLists.txt | 1 + source/blender/blenkernel/CMakeLists.txt | 4 ++++ source/blender/blenkernel/SConscript | 1 + source/blender/blenkernel/intern/writeframeserver.c | 2 ++ source/blender/makesrna/intern/CMakeLists.txt | 4 ++++ source/blender/makesrna/intern/SConscript | 2 ++ source/blender/makesrna/intern/rna_scene.c | 2 ++ 7 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebf7aa8a6c0..d4489a8c76b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,7 @@ option(WITH_IMAGE_DDS "Enable DDS Image Support" ON) option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON) option(WITH_IMAGE_HDR "Enable HDR Image Support" ON) option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF) +option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON) # Audio/Video format support option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 9a384c40e24..defcef58463 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -279,6 +279,10 @@ if(WITH_IMAGE_CINEON) add_definitions(-DWITH_CINEON) endif() +if(WITH_IMAGE_FRAMESERVER) + add_definitions(-DWITH_FRAMESERVER) +endif() + if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 36afce7946c..5ea42ee65ae 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -22,6 +22,7 @@ incs += ' ' + env['BF_ZLIB_INC'] defs = [ 'GLEW_STATIC' ] defs.append('WITH_SMOKE') # TODO, make optional +defs.append('WITH_FRAMESERVER') # TODO, make optional if env['WITH_BF_PYTHON']: incs += ' ../python' diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index 2239f6d3147..d13d15d1269 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -22,6 +22,7 @@ * */ +#ifdef WITH_FRAMESERVER #include #include @@ -381,3 +382,4 @@ void end_frameserver(void) shutdown_socket_system(); } +#endif /* WITH_FRAMESERVER */ diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index c9865bf3df4..cb593e7deab 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -171,6 +171,10 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() +if(WITH_IMAGE_FRAMESERVER) + add_definitions(-DWITH_FRAMESERVER) +endif() + if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 421c3a60691..5e43ed9b2fb 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -54,6 +54,8 @@ if env['WITH_BF_CINEON']: if env['WITH_BF_HDR']: defs.append('WITH_HDR') +defs.append('WITH_FRAMESERVER') # TODO, make optional + if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') incs += ' ' + env['BF_FFMPEG_INC'] diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 662ce04552e..9f751da484e 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -135,7 +135,9 @@ EnumPropertyItem image_type_items[] = { #endif {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"}, {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"}, +#ifdef WITH_FRAMESERVER {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"}, +#endif #ifdef WITH_FFMPEG {R_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"}, {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"}, From 58895bee7bb1b877a7ba1e1648e75c9598706566 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Jul 2011 23:36:17 +0000 Subject: [PATCH 03/14] fix [#28052] PET: Shift-O cycling skips "random falloff" --- source/blender/editors/transform/transform.c | 2 +- source/blender/makesdna/DNA_scene_types.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d3a30991aa6..eea77e36f7c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -969,7 +969,7 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case OKEY: if (t->flag & T_PROP_EDIT && event->shift) { - t->prop_mode = (t->prop_mode + 1) % 6; + t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX; calculatePropRatio(t); t->redraw |= TREDRAW_HARD; } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3c14dacf973..8203a4dd77c 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1107,7 +1107,8 @@ typedef struct Scene { #define PROP_SHARP 3 #define PROP_LIN 4 #define PROP_CONST 5 -#define PROP_RANDOM 6 +#define PROP_RANDOM 6 +#define PROP_MODE_MAX 7 /* toolsettings->proportional */ #define PROP_EDIT_OFF 0 From 03bae345bebd01cd513e2b477e8409048c3f142c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jul 2011 00:31:24 +0000 Subject: [PATCH 04/14] fix [#28053] New material tooltip --- source/blender/editors/render/render_shading.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index fdd53d27b02..cfed2750e18 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -108,7 +108,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Material Slot"; ot->idname= "OBJECT_OT_material_slot_add"; - ot->description="Add a new material slot or duplicate the selected one"; + ot->description="Add a new material slot"; /* api callbacks */ ot->exec= material_slot_add_exec; From 6040a28f039dc73cc62372fd329fe38e25b8f31f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jul 2011 00:34:03 +0000 Subject: [PATCH 05/14] missed this file when adding option to disable frameserver --- source/blender/blenkernel/intern/writeavi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index ba7f9bdd415..769a3f9b11e 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -105,13 +105,18 @@ bMovieHandle *BKE_get_movie_handle(int imtype) mh.get_movie_path = filepath_ffmpeg; } #endif +#ifdef WITH_FRAMESERVER if (imtype == R_FRAMESERVER) { mh.start_movie = start_frameserver; mh.append_movie = append_frameserver; mh.end_movie = end_frameserver; mh.get_next_frame = frameserver_loop; } - +#endif + + /* incase all above are disabled */ + (void)imtype; + return &mh; } From 30da1336a8d7811fb9409c6e48209f7a533af1cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jul 2011 01:21:20 +0000 Subject: [PATCH 06/14] patch [#28045] Straighten tool from Simple Todos from Kyle Mills (khonkhortisan) --- source/blender/editors/uvedit/uvedit_ops.c | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index c09f8cff02d..d0393c970a6 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1057,6 +1057,134 @@ static void weld_align_uv(bContext *C, int tool) } } + if(tool == 's' || tool == 't' || tool == 'u') { + /* pass 1&2 variables */ + int i, j; + int starttmpl= -1, connectedtostarttmpl, startcorner; + int endtmpl= -1, connectedtoendtmpl, endcorner; + MTFace *startface, *endface; + int itmpl, jtmpl; + EditVert *eve; + int pass; /* first 2 passes find endpoints, 3rd pass moves middle points, 4th pass is fail-on-face-selected */ + EditFace *startefa, *endefa; + + /* pass 3 variables */ + float startx, starty, firstm, firstb, midx, midy; + float endx, endy, secondm, secondb, midmovedx, midmovedy; + float IsVertical_check= -1; + float IsHorizontal_check= -1; + + for(i= 0, eve= em->verts.first; eve; eve= eve->next, i++) /* give each point a unique name */ + eve->tmp.l= i; + for(pass= 1; pass <= 3; pass++) { /* do this for each endpoint */ + if(pass == 3){ /* calculate */ + startx= startface->uv[startcorner][0]; + starty= startface->uv[startcorner][1]; + endx= endface->uv[endcorner][0]; + endy= endface->uv[endcorner][1]; + firstm= (endy-starty)/(endx-startx); + firstb= starty-(firstm*startx); + secondm= -1.0f/firstm; + if(startx == endx) IsVertical_check= startx; + if(starty == endy) IsHorizontal_check= starty; + } + for(efa= em->faces.first; efa; efa= efa->next) { /* for each face */ + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); /* get face */ + if(uvedit_face_visible(scene, ima, efa, tf)) { /* if you can see it */ + if(uvedit_face_selected(scene, efa, tf)) { /* if the face is selected, get out now! */ + pass= 4; + break; + } + for(i= 0; (i < 3 || (i == 3 && efa->v4)); i++) { /* for each point of the face */ + itmpl= (*(&efa->v1 + i))->tmp.l; /* get unique name for points */ + if(pass == 3) { /* move */ + if(uvedit_uv_selected(scene, efa, tf, i)) { + if(!(itmpl == starttmpl || itmpl == endtmpl)) { + if(IsVertical_check != -1) tf->uv[i][0]= IsVertical_check; + if(IsHorizontal_check != -1) tf->uv[i][1]= IsHorizontal_check; + if((IsVertical_check == -1) && (IsHorizontal_check == -1)) { + midx= tf->uv[i][0]; + midy= tf->uv[i][1]; + if(tool == 's') { + secondb= midy-(secondm*midx); + midmovedx= (secondb-firstb)/(firstm-secondm); + midmovedy= (secondm*midmovedx)+secondb; + tf->uv[i][0]= midmovedx; + tf->uv[i][1]= midmovedy; + } + else if(tool == 't') { + tf->uv[i][0]= (midy-firstb)/firstm; /* midmovedx */ + } + else if(tool == 'u') { + tf->uv[i][1]= (firstm*midx)+firstb; /* midmovedy */ + } + } + } + } + } + else { + for(j= 0; (j < 3 || (j == 3 && efa->v4)); j++) { /* also for each point on the face */ + jtmpl= (*(&efa->v1 + j))->tmp.l; + if(i != j && (!efa->v4 || ABS(i-j) != 2)) { /* if the points are connected */ + /* quad (0,1,2,3) 0,1 0,3 1,0 1,2 2,1 2,3 3,0 3,2 + * triangle (0,1,2) 0,1 0,2 1,0 1,2 2,0 2,1 */ + if(uvedit_uv_selected(scene, efa, tf, i) && uvedit_uv_selected(scene, efa, tf, j)) { + /* if the edge is selected */ + if(pass == 1) { /* if finding first endpoint */ + if(starttmpl == -1) { /* if the first endpoint isn't found yet */ + starttmpl= itmpl; /* set unique name for endpoint */ + connectedtostarttmpl= jtmpl; + /* get point that endpoint is connected to */ + startface= tf; /* get face it's on */ + startcorner= i; /* what corner of the face? */ + startefa= efa; + efa= em->faces.first; + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + i= -1; + break; + } + if(starttmpl == itmpl && jtmpl != connectedtostarttmpl) { + starttmpl= -1; /* not an endpoint */ + efa= startefa; + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + i= startcorner; + break; + } + } + else if(pass == 2) { /* if finding second endpoint */ + if(endtmpl == -1 && itmpl != starttmpl) { + endtmpl= itmpl; + connectedtoendtmpl= jtmpl; + endface= tf; + endcorner= i; + endefa= efa; + efa= em->faces.first; + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + i= -1; + break; + } + if(endtmpl == itmpl && jtmpl != connectedtoendtmpl) { + endtmpl= -1; + efa= endefa; + tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + i= endcorner; + break; + } + } + } + } + } + } + } + } + } + if(pass == 2 && (starttmpl == -1 || endtmpl == -1)) { + /* if endpoints aren't found */ + pass=4; + } + } + } + uvedit_live_unwrap_update(sima, scene, obedit); DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -1074,6 +1202,9 @@ static int align_exec(bContext *C, wmOperator *op) static void UV_OT_align(wmOperatorType *ot) { static EnumPropertyItem axis_items[] = { + {'s', "ALIGN_S", 0, "Straighten", "Align UVs along the line defined by the endpoints"}, + {'t', "ALIGN_T", 0, "Straighten X", "Align UVs along the line defined by the endpoints along the X axis"}, + {'u', "ALIGN_U", 0, "Straighten Y", "Align UVs along the line defined by the endpoints along the Y axis"}, {'a', "ALIGN_AUTO", 0, "Align Auto", "Automatically choose the axis on which there is most alignment already"}, {'x', "ALIGN_X", 0, "Align X", "Align UVs on X axis"}, {'y', "ALIGN_Y", 0, "Align Y", "Align UVs on Y axis"}, From 0e933d089df3a17327caf8700c19df9f419a2973 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jul 2011 05:33:06 +0000 Subject: [PATCH 07/14] fix [#27910] baking ambient occlusion, do not consider closer object for blender 2.58a --- source/blender/render/intern/source/convertblender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 2a7fb468bfa..7782077604d 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5685,7 +5685,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, Object *camera; float mat[4][4]; float amb[3]; - const short onlyselected= !ELEM3(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW); + const short onlyselected= !ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW, RE_BAKE_AO); const short nolamps= ELEM3(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT); re->main= bmain; From 382050501dc0036dc28434b205215ebc21a0cf1b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 22 Jul 2011 11:21:01 +0000 Subject: [PATCH 08/14] remove duplicate function for printing the current file:line of a python script in the BGE. --- .../gameengine/Expressions/PyObjectPlus.cpp | 38 +------------------ source/gameengine/Expressions/PyObjectPlus.h | 1 + 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 3a25df73f9b..92be769ed71 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -1184,46 +1184,10 @@ void PyObjectPlus::SetDeprecationWarnings(bool ignoreDeprecationWarnings) m_ignore_deprecation_warnings = ignoreDeprecationWarnings; } -void PyDebugLine() -{ - // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno) - - PyObject *getframe, *frame; - PyObject *f_lineno, *f_code, *co_filename; - - getframe = PySys_GetObject((char *)"_getframe"); // borrowed - if (getframe) { - frame = PyObject_CallObject(getframe, NULL); - if (frame) { - f_lineno= PyObject_GetAttrString(frame, "f_lineno"); - f_code= PyObject_GetAttrString(frame, "f_code"); - if (f_lineno && f_code) { - co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */ - if (co_filename) { - - printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno)); - - Py_DECREF(f_lineno); - Py_DECREF(f_code); - Py_DECREF(frame); - return; - } - } - - Py_XDECREF(f_lineno); - Py_XDECREF(f_code); - Py_DECREF(frame); - } - - } - PyErr_Clear(); - printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n"); -} - void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* new_way) { printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way); - PyDebugLine(); + PyC_LineSpit(); } void PyObjectPlus::ClearDeprecationWarning() diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 587f3e4ef35..51cfb5471c0 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -55,6 +55,7 @@ #ifdef USE_MATHUTILS extern "C" { #include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/generic/py_capi_utils.h" /* for PyC_LineSpit only */ } #endif From ea90544d65a5b2549d5e0b4761de3bf0f2631688 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 22 Jul 2011 15:28:50 +0000 Subject: [PATCH 09/14] Need some fun once a while: On dragging a non-connected node on a noodle, it will insert it. Functionality tweaks are possible, but it already feels non-intrusive. Rules: - Insertion only when a single noodle is intersecting with node. - Default connects first matching socket type. - If no socket match, it connects the first. --- source/blender/editors/include/ED_node.h | 3 + source/blender/editors/space_node/drawnode.c | 15 ++- source/blender/editors/space_node/node_edit.c | 126 +++++++++++++++++- .../editors/transform/transform_conversions.c | 14 +- source/blender/makesdna/DNA_node_types.h | 4 + 5 files changed, 156 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 829ad3217a9..dfa457c22de 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -39,6 +39,7 @@ struct Tex; struct bContext; struct bNode; struct ID; +struct ScrArea; /* drawnode.c */ void ED_init_node_butfuncs(void); @@ -51,6 +52,8 @@ void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct void ED_node_shader_default(struct Material *ma); void ED_node_composit_default(struct Scene *sce); void ED_node_texture_default(struct Tex *tex); +void ED_node_link_intersect_test(struct ScrArea *sa, int test); +void ED_node_link_insert(struct ScrArea *sa); /* node ops.c */ void ED_operatormacros_node(void); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 1bf2c3d89bd..50e657bbb61 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1869,10 +1869,17 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) else { /* check cyclic */ if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) { - if(link->fromnode->flag & SELECT) - th_col1= TH_EDGE_SELECT; - if(link->tonode->flag & SELECT) - th_col2= TH_EDGE_SELECT; + /* special indicated link, on drop-node */ + if(link->flag & NODE_LINKFLAG_HILITE) { + th_col1= th_col2= TH_ACTIVE; + } + else { + /* regular link */ + if(link->fromnode->flag & SELECT) + th_col1= TH_EDGE_SELECT; + if(link->tonode->flag & SELECT) + th_col2= TH_EDGE_SELECT; + } do_shaded= 1; do_triple= 1; } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index abc7b273ec9..b5648b67d86 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2492,6 +2492,127 @@ void NODE_OT_links_cut(wmOperatorType *ot) RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } +/* ********************* automatic node insert on dragging ******************* */ + +static bNodeSocket *socket_best_match(ListBase *sockets, int type) +{ + bNodeSocket *sock; + + for(sock= sockets->first; sock; sock= sock->next) + if(type == sock->type) + return sock; + + return sockets->first; +} + +/* prevent duplicate testing code below */ +static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select) +{ + SpaceNode *snode= sa?sa->spacedata.first:NULL; + bNode *node; + bNodeLink *link; + + /* no unlucky accidents */ + if(sa==NULL || sa->spacetype!=SPACE_NODE) return NULL; + + *select= NULL; + + for(node= snode->edittree->nodes.first; node; node= node->next) { + if(node->flag & SELECT) { + if(*select) + break; + else + *select= node; + } + } + /* only one selected */ + if(node || *select==NULL) return NULL; + + /* correct node */ + if((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL; + + /* test node for links */ + for(link= snode->edittree->links.first; link; link=link->next) { + if(link->tonode == *select || link->fromnode == *select) + return NULL; + } + + return snode; +} + +/* assumes link with NODE_LINKFLAG_HILITE set */ +void ED_node_link_insert(ScrArea *sa) +{ + bNode *node, *select; + SpaceNode *snode= ed_node_link_conditions(sa, &select); + bNodeLink *link; + bNodeSocket *sockto; + + if(snode==NULL) return; + + /* get the link */ + for(link= snode->edittree->links.first; link; link=link->next) + if(link->flag & NODE_LINKFLAG_HILITE) + break; + + if(link) { + node= link->tonode; + sockto= link->tosock; + + link->tonode= select; + link->tosock= socket_best_match(&select->inputs, link->fromsock->type); + link->flag &= ~NODE_LINKFLAG_HILITE; + + nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto); + ntreeSolveOrder(snode->edittree); /* needed for pointers */ + snode_tag_changed(snode, select); + ED_node_changed_update(snode->id, select); + } +} + + +/* test == 0, clear all intersect flags */ +void ED_node_link_intersect_test(ScrArea *sa, int test) +{ + bNode *select; + SpaceNode *snode= ed_node_link_conditions(sa, &select); + bNodeLink *link, *selink=NULL; + float mcoords[4][2]; + + if(snode==NULL) return; + + /* clear flags */ + for(link= snode->edittree->links.first; link; link=link->next) + link->flag &= ~NODE_LINKFLAG_HILITE; + + if(test==0) return; + + /* okay, there's 1 node, without links, now intersect */ + mcoords[0][0]= select->totr.xmin; + mcoords[0][1]= select->totr.ymin; + mcoords[1][0]= select->totr.xmax; + mcoords[1][1]= select->totr.ymin; + mcoords[2][0]= select->totr.xmax; + mcoords[2][1]= select->totr.ymax; + mcoords[3][0]= select->totr.xmin; + mcoords[3][1]= select->totr.ymax; + + /* we only tag a single link for intersect now */ + /* idea; use header dist when more? */ + for(link= snode->edittree->links.first; link; link=link->next) { + + if(cut_links_intersect(link, mcoords, 4)) { + if(selink) + break; + selink= link; + } + } + + if(link==NULL && selink) + selink->flag |= NODE_LINKFLAG_HILITE; +} + + /* ******************************** */ // XXX some code needing updating to operators... @@ -2914,7 +3035,8 @@ void NODE_OT_delete(wmOperatorType *ot) /* note: in cmp_util.c is similar code, for node_compo_pass_on() */ /* used for disabling node (similar code in node_draw.c for disable line) */ -static void node_delete_reconnect(bNodeTree* tree, bNode* node) { +static void node_delete_reconnect(bNodeTree* tree, bNode* node) +{ bNodeLink *link, *next; bNodeSocket *valsocket= NULL, *colsocket= NULL, *vecsocket= NULL; bNodeSocket *deliveringvalsocket= NULL, *deliveringcolsocket= NULL, *deliveringvecsocket= NULL; @@ -3142,3 +3264,5 @@ void NODE_OT_add_file(wmOperatorType *ot) RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign."); } + + diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 16bfc75c979..0a5e290643a 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -87,6 +87,7 @@ #include "ED_object.h" #include "ED_markers.h" #include "ED_mesh.h" +#include "ED_node.h" #include "ED_types.h" #include "ED_uvedit.h" #include "ED_curve.h" /* for ED_curve_editnurbs */ @@ -2182,6 +2183,12 @@ void flushTransNodes(TransInfo *t) td->loc2d[0]= td->loc[0]; td->loc2d[1]= td->loc[1]; } + + /* handle intersection with noodles */ + if(t->total==1) { + ED_node_link_intersect_test(t->sa, 1); + } + } /* *** SEQUENCE EDITOR *** */ @@ -4756,7 +4763,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t) } else if (t->spacetype == SPACE_NODE) { - /* pass */ + if(cancelled == 0) + ED_node_link_insert(t->sa); + + /* clear link line */ + ED_node_link_intersect_test(t->sa, 0); + } else if (t->spacetype == SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 03387c3a63a..efaf30b02f6 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -179,6 +179,10 @@ typedef struct bNodeLink { } bNodeLink; + +/* link->flag */ +#define NODE_LINKFLAG_HILITE 1 + /* the basis for a Node tree, all links and nodes reside internal here */ /* only re-usable node trees are in the library though, materials and textures allocate own tree struct */ typedef struct bNodeTree { From 89c062038aaa43e14bc280062fe94e13435bef46 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Fri, 22 Jul 2011 15:54:54 +0000 Subject: [PATCH 10/14] Let's try default High Quality for object align, it's slow but it's simply the correct way, users can disable while tweaking the align modes and then enable again for final result IF they are working on *dense* meshes --- release/scripts/startup/bl_operators/object_align.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py index d215f3476cf..952a2328ca9 100644 --- a/release/scripts/startup/bl_operators/object_align.py +++ b/release/scripts/startup/bl_operators/object_align.py @@ -340,7 +340,7 @@ class AlignObjects(bpy.types.Operator): bb_quality = BoolProperty( name="High Quality", description="Enables high quality calculation of the bounding box for perfect results on complex shape meshes with rotation/scale (Slow)", - default=False) + default=True) align_mode = EnumProperty(items=( ('OPT_1', "Negative Sides", ""), @@ -380,4 +380,4 @@ class AlignObjects(bpy.types.Operator): self.report({'WARNING'}, "No objects with bound-box selected") return {'CANCELLED'} else: - return {'FINISHED'} \ No newline at end of file + return {'FINISHED'} From eed7702c9932653c68b72e291e30cbca3a741c16 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 22 Jul 2011 16:02:56 +0000 Subject: [PATCH 11/14] Small fix in drop-node-on-noodle: intersect code only did 3 edges of node. --- source/blender/editors/space_node/node_edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index b5648b67d86..8cb7528c4d7 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2577,7 +2577,7 @@ void ED_node_link_intersect_test(ScrArea *sa, int test) bNode *select; SpaceNode *snode= ed_node_link_conditions(sa, &select); bNodeLink *link, *selink=NULL; - float mcoords[4][2]; + float mcoords[5][2]; if(snode==NULL) return; @@ -2601,7 +2601,7 @@ void ED_node_link_intersect_test(ScrArea *sa, int test) /* idea; use header dist when more? */ for(link= snode->edittree->links.first; link; link=link->next) { - if(cut_links_intersect(link, mcoords, 4)) { + if(cut_links_intersect(link, mcoords, 5)) { /* 5 - silly intersect code */ if(selink) break; selink= link; From ffc490cbf1d93c7e0a9b97953f6f52e69b9bc8ec Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 22 Jul 2011 16:39:06 +0000 Subject: [PATCH 12/14] Two fixes in drop-node-on-noodle: - Intersection code was using undefined vector caused wrong lines to be picked - Code now also copes with hidden sockets. If all fails, is just unhides a good socket. --- source/blender/editors/space_node/node_edit.c | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 8cb7528c4d7..4230a43d2ec 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2494,13 +2494,33 @@ void NODE_OT_links_cut(wmOperatorType *ot) /* ********************* automatic node insert on dragging ******************* */ +/* assumes sockets in list */ static bNodeSocket *socket_best_match(ListBase *sockets, int type) { bNodeSocket *sock; + /* first, match type */ for(sock= sockets->first; sock; sock= sock->next) - if(type == sock->type) + if(!(sock->flag & SOCK_HIDDEN)) + if(type == sock->type) + return sock; + + /* then just use first unhidden socket */ + for(sock= sockets->first; sock; sock= sock->next) + if(!(sock->flag & SOCK_HIDDEN)) return sock; + + /* OK, let's unhide proper one */ + for(sock= sockets->first; sock; sock= sock->next) { + if(type == sock->type) { + sock->flag &= ~SOCK_HIDDEN; + return sock; + } + } + + /* just the first */ + sock= sockets->first; + sock->flag &= ~SOCK_HIDDEN; return sockets->first; } @@ -2577,7 +2597,7 @@ void ED_node_link_intersect_test(ScrArea *sa, int test) bNode *select; SpaceNode *snode= ed_node_link_conditions(sa, &select); bNodeLink *link, *selink=NULL; - float mcoords[5][2]; + float mcoords[6][2]; if(snode==NULL) return; @@ -2596,12 +2616,16 @@ void ED_node_link_intersect_test(ScrArea *sa, int test) mcoords[2][1]= select->totr.ymax; mcoords[3][0]= select->totr.xmin; mcoords[3][1]= select->totr.ymax; + mcoords[4][0]= select->totr.xmin; + mcoords[4][1]= select->totr.ymin; + mcoords[5][0]= select->totr.xmax; + mcoords[5][1]= select->totr.ymax; /* we only tag a single link for intersect now */ /* idea; use header dist when more? */ for(link= snode->edittree->links.first; link; link=link->next) { - if(cut_links_intersect(link, mcoords, 5)) { /* 5 - silly intersect code */ + if(cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */ if(selink) break; selink= link; From 8cbd88aeef2ece7fc1c436db5284ac115b230c57 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 23 Jul 2011 15:36:51 +0000 Subject: [PATCH 13/14] 2.5 UI: * Added back icon to open the Splash Screen in the info header, next to version string info. * Removed an unnecessary toggle argument for particle mode select buttons. The Toggle argument is only intended for booleans, not enums. --- release/scripts/startup/bl_ui/space_info.py | 6 ++++-- release/scripts/startup/bl_ui/space_view3d.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py index 2b12e75564c..cda37b3119a 100644 --- a/release/scripts/startup/bl_ui/space_info.py +++ b/release/scripts/startup/bl_ui/space_info.py @@ -60,8 +60,10 @@ class INFO_HT_header(bpy.types.Header): layout.template_running_jobs() layout.template_reports_banner() - - layout.label(text=scene.statistics()) + + row = layout.row(align=True) + row.operator("wm.splash", text="", icon='BLENDER', emboss=False) + row.label(text=scene.statistics()) # XXX: this should be right-aligned to the RHS of the region layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index aef6accb4e1..b5e813d16e7 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -68,7 +68,7 @@ class VIEW3D_HT_header(bpy.types.Header): if obj: # Particle edit if obj.mode == 'PARTICLE_EDIT': - row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True) + row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True) # Occlude geometry if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')): From f4a30e473b23425c13a755854cf7b22c22cca259 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 23 Jul 2011 16:08:37 +0000 Subject: [PATCH 14/14] =?UTF-8?q?Cherry=20pick=20merge:=20/branches/soc-20?= =?UTF-8?q?11-pepper/intern/audaspace/OpenAL:r38630=20Original=20log:=20Co?= =?UTF-8?q?rrected=20the=20OpenAL=20device's=20threading=20code.=20This=20?= =?UTF-8?q?is=20a=20bugfix=20for=20#27913,=20thanks=20to=20Juha=20M=C3=A4k?= =?UTF-8?q?i-Kanto=20for=20helping=20to=20resolve=20this.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- intern/audaspace/OpenAL/AUD_OpenALDevice.cpp | 18 +++++++++--------- intern/audaspace/OpenAL/AUD_OpenALDevice.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp index b9e30bbf62a..71e7b7677e8 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp @@ -105,12 +105,15 @@ void* AUD_openalRunThread(void* device) return NULL; } -void AUD_OpenALDevice::start() +void AUD_OpenALDevice::start(bool join) { lock(); if(!m_playing) { + if(join) + pthread_join(m_thread, NULL); + pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); @@ -271,8 +274,8 @@ void AUD_OpenALDevice::updateStreams() // stop thread if(m_playingSounds->empty() || (cerr != ALC_NO_ERROR)) { - unlock(); m_playing = false; + unlock(); pthread_exit(NULL); } @@ -366,6 +369,8 @@ AUD_OpenALDevice::AUD_OpenALDevice(AUD_DeviceSpecs specs, int buffersize) pthread_mutex_init(&m_mutex, &attr); pthread_mutexattr_destroy(&attr); + + start(false); } AUD_OpenALDevice::~AUD_OpenALDevice() @@ -414,13 +419,8 @@ AUD_OpenALDevice::~AUD_OpenALDevice() alcProcessContext(m_context); // wait for the thread to stop - if(m_playing) - { - unlock(); - pthread_join(m_thread, NULL); - } - else - unlock(); + unlock(); + pthread_join(m_thread, NULL); delete m_playingSounds; delete m_pausedSounds; diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h index 3bbbe85d7e6..127f69beca8 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h @@ -106,7 +106,7 @@ private: /** * Starts the streaming thread. */ - void start(); + void start(bool join = true); /** * Checks if a handle is valid.