From 40e76df0db2751aedf6d5b8387e167492b662482 Mon Sep 17 00:00:00 2001 From: Justin Dailey Date: Fri, 30 Nov 2012 22:46:28 +0000 Subject: fix [#33363] Text editor undo fail --- source/blender/blenkernel/intern/text.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index e6339d07e66..322b77e0462 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2019,8 +2019,14 @@ void txt_do_undo(Text *text) /* get and restore the cursors */ txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc); + txt_move_to(text, curln, curc, 0); - txt_move_to(text, curln, curc + linep, 1); + txt_move_to(text, selln, selc, 1); + + if ((curln == selln) && (curc == selc)) { + for (i = 0; i < linep; i++) + txt_move_right(text, 1); + } txt_delete_selected(text); @@ -2269,6 +2275,8 @@ void txt_split_curline(Text *text) txt_delete_sel(text); + if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n'); + /* Make the two half strings */ left = MEM_mallocN(text->curc + 1, "textline_string"); @@ -2300,7 +2308,6 @@ void txt_split_curline(Text *text) txt_clean_text(text); txt_pop_sel(text); - if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n'); } static void txt_delete_line(Text *text, TextLine *line) -- cgit v1.2.3 From eb490f3aaebb92f3eae232cec3bbc5776d52104b Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Sat, 1 Dec 2012 03:26:57 +0000 Subject: Bevel: fix spike in suzanne, bug 33354. Non-planar faces made some of the meet point code not work well, so now calculate local face norms. --- source/blender/bmesh/tools/bmesh_bevel.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index cb35616a1f7..f2ea5a5f341 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -375,8 +375,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, BMVert *v, BMFace *f1, BMFace *f2, float meetco[3]) { - float dir1[3], dir2[3], norm_perp1[3], norm_perp2[3], - off1a[3], off1b[3], off2a[3], off2b[3], isect2[3], co[3]; + float dir1[3], dir2[3], dirmid[3], norm_perp1[3], norm_perp2[3], + off1a[3], off1b[3], off2a[3], off2b[3], isect2[3], co[3], + f1no[3], f2no[3]; int iret; BLI_assert(f1 != NULL && f2 != NULL); @@ -384,17 +385,21 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, /* get direction vectors for two offset lines */ sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co); sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, v)->co, v->co); + sub_v3_v3v3(dirmid, BM_edge_other_vert(emid->e, v)->co, v->co); /* get directions into offset planes */ - cross_v3_v3v3(norm_perp1, dir1, f1->no); + /* calculate face normals at corner in case faces are nonplanar */ + cross_v3_v3v3(f1no, dirmid, dir1); + cross_v3_v3v3(f2no, dirmid, dir2); + cross_v3_v3v3(norm_perp1, dir1, f1no); normalize_v3(norm_perp1); - cross_v3_v3v3(norm_perp2, dir2, f2->no); + cross_v3_v3v3(norm_perp2, dir2, f2no); normalize_v3(norm_perp2); /* get points that are offset distances from each line, then another point on each line */ copy_v3_v3(off1a, v->co); madd_v3_v3fl(off1a, norm_perp1, e1->offset); - add_v3_v3v3(off1b, off1a, dir1); + sub_v3_v3v3(off1b, off1a, dir1); copy_v3_v3(off2a, v->co); madd_v3_v3fl(off2a, norm_perp2, e2->offset); add_v3_v3v3(off2b, off2a, dir2); @@ -404,7 +409,7 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, copy_v3_v3(meetco, off1a); } else { - iret =isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2); + iret = isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2); if (iret == 0) { /* lines colinear: another test says they are parallel. so shouldn't happen */ copy_v3_v3(meetco, off1a); -- cgit v1.2.3 From 2f97f929a5dcb8b13aec528103ebe0db088aa696 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Dec 2012 06:29:04 +0000 Subject: fix for bug in console indent, was not copying the null terminator. also add assert to catch this case more quickly. --- source/blender/editors/space_console/console_draw.c | 3 ++- source/blender/editors/space_console/console_ops.c | 2 +- source/gameengine/GamePlayer/common/bmfont.cpp | 3 --- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index f19835b7f85..a215b476094 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -146,7 +146,8 @@ static int console_textview_line_get(struct TextViewContext *tvc, const char **l ConsoleLine *cl = (ConsoleLine *)tvc->iter; *line = cl->line; *len = cl->len; - + // printf("'%s' %d\n", *line, cl->len); + BLI_assert(cl->line[cl->len] == '\0' && (cl->len == 0 || cl->line[cl->len - 1] != '\0')); return 1; } diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index bb46135545c..36716aeab95 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -444,7 +444,7 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op)) console_line_verify_length(ci, ci->len + len); - memmove(ci->line + len, ci->line, ci->len); + memmove(ci->line + len, ci->line, ci->len + 1); memset(ci->line, ' ', len); ci->len += len; BLI_assert(ci->len >= 0); diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp index fe6f2187138..8ffbe757222 100644 --- a/source/gameengine/GamePlayer/common/bmfont.cpp +++ b/source/gameengine/GamePlayer/common/bmfont.cpp @@ -73,9 +73,6 @@ void printfGlyph(bmGlyph * glyph) } */ -#define MAX2(x,y) ( (x)>(y) ? (x) : (y) ) -#define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) ) - void calcAlpha(ImBuf * ibuf) { int i; -- cgit v1.2.3 From b290f9a6cc465dd9ee4a8c12e5b959f41967165b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Dec 2012 07:16:08 +0000 Subject: add bmesh.free() to example & template --- doc/python_api/examples/bmesh.ops.1.py | 2 ++ release/scripts/templates/bmesh_simple.py | 1 + 2 files changed, 3 insertions(+) diff --git a/doc/python_api/examples/bmesh.ops.1.py b/doc/python_api/examples/bmesh.ops.1.py index 2eefb63a23d..abce087ceb3 100644 --- a/doc/python_api/examples/bmesh.ops.1.py +++ b/doc/python_api/examples/bmesh.ops.1.py @@ -95,6 +95,8 @@ bmesh.ops.rotate( # Finish up, write the bmesh into a new mesh me = bpy.data.meshes.new("Mesh") bm.to_mesh(me) +bm.free() + # Add the mesh to the scene scene = bpy.context.scene diff --git a/release/scripts/templates/bmesh_simple.py b/release/scripts/templates/bmesh_simple.py index 656febf4918..45e6b52d578 100644 --- a/release/scripts/templates/bmesh_simple.py +++ b/release/scripts/templates/bmesh_simple.py @@ -19,3 +19,4 @@ for v in bm.verts: # Finish up, write the bmesh back to the mesh bm.to_mesh(me) +bm.free() # free and prevent further access -- cgit v1.2.3 From 0da227cac105ef29ac431788a0bd33cb755013cc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Dec 2012 07:58:27 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/blender.c | 2 +- source/blender/blenlib/intern/bpath.c | 2 +- source/blender/editors/render/render_internal.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 03698736459..f0d201ea3f7 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -279,7 +279,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath /* this can happen when active scene was lib-linked, and doesn't exist anymore */ if (CTX_data_scene(C) == NULL) { /* in case we don't even have a local scene, add one */ - if(!G.main->scene.first) + if (!G.main->scene.first) BKE_scene_add("Scene"); CTX_data_scene_set(C, G.main->scene.first); diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 8209ce7e541..c650438a31e 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -500,7 +500,7 @@ void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int Material *ma = (Material *)id; bNodeTree *ntree = ma->nodetree; - if(ntree) { + if (ntree) { bNode *node; for (node = ntree->nodes.first; node; node = node->next) { diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 9a49a1970a0..f8154f4abda 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -560,10 +560,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) rj->iuser.ok = 1; rj->reports = op->reports; - if(v3d) { + if (v3d) { rj->lay = v3d->lay; - if(v3d->localvd) + if (v3d->localvd) rj->lay |= v3d->localvd->lay; } -- cgit v1.2.3 From ee08c27f95908f33a3ed4f97d1d147ca80922b65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 1 Dec 2012 08:47:39 +0000 Subject: fix [#33368] Crash with multilayer exr node --- source/blender/compositor/intern/COM_Node.cpp | 20 ++++++++++++++------ source/blender/compositor/intern/COM_Node.h | 4 ++++ source/blender/compositor/nodes/COM_ImageNode.cpp | 11 ++++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 300d7ef1952..d49bb5f96fb 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -137,18 +137,26 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke graph->addOperation(operation); } -/* when a node has no valid data (missing image or group pointer) */ +NodeOperation *Node::convertToOperations_invalid_index(ExecutionSystem *graph, int index) +{ + const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f}; + SetColorOperation *operation = new SetColorOperation(); + operation->setChannels(warning_color); + + /* link the operation */ + this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket()); + graph->addOperation(operation); + return operation; +} + +/* when a node has no valid data (missing image / group pointer, or missing renderlayer from EXR) */ void Node::convertToOperations_invalid(ExecutionSystem *graph, CompositorContext *context) { /* this is a really bad situation - bring on the pink! - so artists know this is bad */ - const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f}; int index; vector &outputsockets = this->getOutputSockets(); for (index = 0; index < outputsockets.size(); index++) { - SetColorOperation *operation = new SetColorOperation(); - this->getOutputSocket(index)->relinkConnections(operation->getOutputSocket()); - operation->setChannels(warning_color); - graph->addOperation(operation); + convertToOperations_invalid_index(graph, index); } } diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 468a95ed434..c098d6da32b 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -105,6 +105,10 @@ public: */ void addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex); + /** + * Create dummy warning operation, use when we can't get the source data. + */ + NodeOperation *convertToOperations_invalid_index(ExecutionSystem *graph, int index); /** * when a node has no valid data (missing image or a group nodes ID pointer is NULL) * call this function from #convertToOperations, this way the node sockets are converted diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 729cb1b70a0..4293e344c65 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -83,6 +83,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c is_multilayer_ok = true; for (index = 0; index < numberOfOutputs; index++) { + NodeOperation *operation = NULL; socket = this->getOutputSocket(index); if (socket->isConnected() || index == 0) { bNodeSocket *bnodeSocket = socket->getbNodeSocket(); @@ -91,7 +92,6 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex); if (rpass) { - NodeOperation *operation = NULL; imageuser->pass = passindex; switch (rpass->channels) { case 1: @@ -105,16 +105,21 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c case 4: operation = doMultilayerCheck(graph, rl, image, imageuser, framenumber, index, passindex, COM_DT_COLOR); break; - default: - /* XXX add a dummy operation? */ + /* dummy operation is added below */ break; } + if (index == 0 && operation) { addPreviewOperation(graph, context, operation->getOutputSocket()); } } } + + /* incase we can't load the layer */ + if (operation == NULL) { + convertToOperations_invalid_index(graph, index); + } } } } -- cgit v1.2.3 From 71c0b69e71b18d8d3da6d9de8b58ede0ab48f0d5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Dec 2012 13:56:34 +0000 Subject: Fix #33372: materials linked in node setups did not output alpha values unless the parent material also had alpha enabled. However it's useful to have it do this even if the main material does not need alpha, to mix textures. --- source/blender/nodes/shader/nodes/node_shader_material.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index bccf6d349cf..2902bf143c8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -85,7 +85,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, float col[4]; bNodeSocket *sock; char hasinput[NUM_MAT_IN] = {'\0'}; - int i; + int i, mode; /* note: cannot use the in[]->hasinput flags directly, as these are not necessarily * the constant input stack values (e.g. in case material node is inside a group). @@ -142,10 +142,18 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]); } + /* make alpha output give results even if transparency is only enabled on + * the material linked in this not and not on the parent material */ + mode = shi->mode; + if(shi->mat->mode & MA_TRANSP) + shi->mode |= MA_TRANSP; + shi->nodes= 1; /* temp hack to prevent trashadow recursion */ node_shader_lamp_loop(shi, &shrnode); /* clears shrnode */ shi->nodes= 0; + shi->mode = mode; + /* write to outputs */ if (node->custom1 & SH_NODE_MAT_DIFF) { copy_v3_v3(col, shrnode.combined); -- cgit v1.2.3 From c324895136f5d935b6c76b0fb9b9871b01973a62 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Sat, 1 Dec 2012 14:23:44 +0000 Subject: Bevel: fix crash bug 33362, when beveling one edge at valence 2 vertex. That special case should have been tested before - the code was wrong in about three different ways. --- source/blender/bmesh/tools/bmesh_bevel.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index f2ea5a5f341..86509acb1fb 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -431,10 +431,10 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, * from eh's direction. */ static void offset_in_plane(EdgeHalf *e, const float plane_no[3], int left, float r[3]) { - float dir[3], no[3]; + float dir[3], no[3], fdir[3]; BMVert *v; - v = e->is_rev ? e->e->v1 : e->e->v2; + v = e->is_rev ? e->e->v2 : e->e->v1; sub_v3_v3v3(dir, BM_edge_other_vert(e->e, v)->co, v->co); normalize_v3(dir); @@ -449,11 +449,12 @@ static void offset_in_plane(EdgeHalf *e, const float plane_no[3], int left, floa no[1] = 1.0f; } if (left) - cross_v3_v3v3(r, no, dir); + cross_v3_v3v3(fdir, dir, no); else - cross_v3_v3v3(r, dir, no); - normalize_v3(r); - mul_v3_fl(r, e->offset); + cross_v3_v3v3(fdir, no, dir); + normalize_v3(fdir); + copy_v3_v3(r, v->co); + madd_v3_v3fl(r, fdir, e->offset); } /* Calculate coordinates of a point a distance d from v on e->e and return it in slideco */ @@ -753,6 +754,7 @@ static void build_boundary(MemArena *mem_arena, BevVert *bv) slide_dist(e->next, bv->v, e->offset, co); v = add_new_bound_vert(mem_arena, vm, co); v->efirst = v->elast = e->next; + e->next->leftv = e->next->rightv = v; vm->mesh_kind = M_POLY; return; } @@ -844,7 +846,6 @@ static void build_boundary(MemArena *mem_arena, BevVert *bv) else { vm->mesh_kind = M_ADJ; } - /* TODO: if vm->count == 4 and bv->selcount == 4, use M_CROSS pattern */ } /* -- cgit v1.2.3 From 19e9571b1b1c55b8a8c0d558cef7e458020016d4 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 1 Dec 2012 18:07:45 +0000 Subject: Various "user-friendly" edits, mostly adding command-line args parsing... So now you can try to build OSL with just install_deps.sh --with-osl --- build_files/build_environment/install_deps.sh | 217 ++++++++++++++++++++++---- 1 file changed, 186 insertions(+), 31 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index f8cef63f301..b3d13af8af2 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -1,13 +1,20 @@ #!/bin/bash +# Parse command line! +ARGS=$( \ +getopt \ +-o s:i:t:h \ +--long source:,install:,threads:,help,with-osl,all-static,force-python,force-boost,\ +force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg \ +-- "$@" \ +) + DISTRO="" SRC="$HOME/src/blender-deps" INST="/opt/lib" CWD=$PWD -# OSL is horror for manual building even -# i would want it to be setteled for manual build first, -# and only then do it automatically +# Do not yet enable osl, use --build-osl option to try it. BUILD_OSL=false # Try to link everything statically. Use this to produce protable versions of blender. @@ -18,45 +25,52 @@ if [ -z "$THREADS" ]; then THREADS=1 fi -COMMON_INFO="Source code of dependencies needed to be compiled will be downloaded and extracted into '$SRC'. -Built libs of dependencies needed to be compiled will be installed into '$INST'. -Please edit \$SRC and/or \$INST variables at the begining of this script if you want to use other paths! - -Number of threads for building: $THREADS. -Building OSL: $BUILD_OSL (edit \$BUILD_OSL var to change this). -All static linking: $ALL_STATIC (edit \$ALL_STATIC var to change this)." +COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'. +Built libs of dependencies needed to be compiled will be installed into '\$INST'. +Please edit \\\$SRC and/or \\\$INST variables at the begining of this script, +or use --source/--install options, if you want to use other paths! +Number of threads for building: \$THREADS (automatically detected, use --threads= to override it). +Building OSL: \$BUILD_OSL (use --with-osl option to enable it). +All static linking: \$ALL_STATIC (use --all-static option to enable it).\"" PYTHON_VERSION="3.3.0" PYTHON_VERSION_MIN="3.3" PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2" +PYTHON_FORCE_REBUILD=false BOOST_VERSION="1.51.0" _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" BOOST_VERSION_MIN="1.49" +BOOST_FORCE_REBUILD=false OCIO_VERSION="1.0.7" OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" OCIO_VERSION_MIN="1.0" +OCIO_FORCE_REBUILD=false OIIO_VERSION="1.1.1" OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION" OIIO_VERSION_MIN="1.1" +OIIO_FORCE_REBUILD=false LLVM_VERSION="3.1" LLVM_VERSION_MIN="3.0" LLVM_VERSION_FOUND="" LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" +LLVM_FORCE_REBUILD=false # OSL needs to be compiled for now! OSL_VERSION="1.2.0" OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz" +OSL_FORCE_REBUILD=false FFMPEG_VERSION="1.0" FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" FFMPEG_VERSION_MIN="0.7.6" +FFMPEG_FORCE_REBUILD=false _ffmpeg_list_sep=";" # FFMPEG optional libs. @@ -84,14 +98,86 @@ LANG_BACK=$LANG LANG="" export LANG + +_echo() { + if [ "X$1" = "X-n" ]; then + shift; printf "%s" "$@" + else + printf "%s\n" "$@" + fi +} + ERROR() { - echo "${@}" + _echo "$@" } INFO() { - echo "${@}" + _echo "$@" } +# Finish parsing the commandline args. +eval set -- "$ARGS" +while true; do + case $1 in + -s|--source) + SRC="$2"; shift; shift; continue + ;; + -i|--install) + INST="$2"; shift; shift; continue + ;; + -t|--threads) + THREADS="$2"; shift; shift; continue + ;; + -h|--help) + INFO "" + INFO "USAGE:" + INFO "" + INFO "`eval _echo "$COMMON_INFO"`" + INFO "" + exit 0 + ;; + --with-osl) + BUILD_OSL=true; shift; continue + ;; + --all-static) + ALL_STATIC=true; shift; continue + ;; + --force-python) + PYTHON_FORCE_REBUILD=true; shift; continue + ;; + --force-boost) + BOOST_FORCE_REBUILD=true; shift; continue + ;; + --force-ocio) + OCIO_FORCE_REBUILD=true; shift; continue + ;; + --force-oiio) + OIIO_FORCE_REBUILD=true; shift; continue + ;; + --force-llvm) + LLVM_FORCE_REBUILD=true; shift; continue + ;; + --force-osl) + OSL_FORCE_REBUILD=true; shift; continue + ;; + --force-ffmpeg) + FFMPEG_FORCE_REBUILD=true; shift; continue + ;; + --) + # no more arguments to parse + break + ;; + *) + INFO "" + INFO "Wrong parameter! Usage:" + INFO "" + INFO "`eval _echo "$COMMON_INFO"`" + INFO "" + exit 1 + ;; + esac +done + # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1. # $1 and $2 should be version numbers made of numbers only. version_eq() { @@ -139,7 +225,7 @@ version_eq() { # $1 and $2 should be version numbers made of numbers only. version_ge() { version_eq $1 $2 - if [ $? -eq 1 -a $(echo -e "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then + if [ $? -eq 1 -a $(_echo "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then return 1 else return 0 @@ -221,7 +307,7 @@ compile_Python() { # Clean install if needed! magic_compile_check python-$PYTHON_VERSION $py_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $PYTHON_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -258,9 +344,10 @@ compile_Python() { magic_compile_set python-$PYTHON_VERSION $py_magic cd $CWD + INFO "Done compiling Python-$PYTHON_VERSION!" else INFO "Own Python-$PYTHON_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-python option." fi } @@ -273,7 +360,7 @@ compile_Boost() { # Clean install if needed! magic_compile_check boost-$BOOST_VERSION $boost_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $BOOST_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -307,10 +394,15 @@ compile_Boost() { magic_compile_set boost-$BOOST_VERSION $boost_magic + # Rebuild dependecies as well! + OIIO_FORCE_REBUILD=true + OSL_FORCE_REBUILD=true + cd $CWD + INFO "Done compiling Boost-$BOOST_VERSION!" else INFO "Own Boost-$BOOST_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-boost option." fi } @@ -323,7 +415,7 @@ compile_OCIO() { # Clean install if needed! magic_compile_check ocio-$OCIO_VERSION $ocio_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $OCIO_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -387,9 +479,10 @@ compile_OCIO() { magic_compile_set ocio-$OCIO_VERSION $ocio_magic cd $CWD + INFO "Done compiling OpenColorIO-$OCIO_VERSION!" else INFO "Own OpenColorIO-$OCIO_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-ocio option." fi } @@ -402,7 +495,7 @@ compile_OIIO() { # Clean install if needed! magic_compile_check oiio-$OIIO_VERSION $oiio_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $OIIO_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -495,10 +588,14 @@ EOF magic_compile_set oiio-$OIIO_VERSION $oiio_magic + # Rebuild dependecies as well! + OSL_FORCE_REBUILD=true + cd $CWD + INFO "Done compiling OpenImageIO-$OIIO_VERSION!" else INFO "Own OpenImageIO-$OIIO_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-oiio option." fi } @@ -512,7 +609,7 @@ compile_LLVM() { # Clean install if needed! magic_compile_check llvm-$LLVM_VERSION $llvm_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $LLVM_FORCE_REBUILD == true ]; then rm -rf $_inst rm -rf $_inst_clang fi @@ -588,10 +685,14 @@ EOF magic_compile_set llvm-$LLVM_VERSION $llvm_magic + # Rebuild dependecies as well! + OSL_FORCE_REBUILD=true + cd $CWD + INFO "Done compiling LLVM-$LLVM_VERSION (CLANG included)!" else INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-llvm option." fi } @@ -604,7 +705,7 @@ compile_OSL() { # Clean install if needed! magic_compile_check osl-$OSL_VERSION $osl_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -679,9 +780,10 @@ compile_OSL() { magic_compile_set osl-$OSL_VERSION $osl_magic cd $CWD + INFO "Done compiling OpenShadingLanguage-$OSL_VERSION!" else INFO "Own OpenShadingLanguage-$OSL_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-osl option." fi } @@ -694,7 +796,7 @@ compile_FFmpeg() { # Clean install if needed! magic_compile_check ffmpeg-$FFMPEG_VERSION $ffmpeg_magic - if [ $? -eq 1 ]; then + if [ $? -eq 1 -o $FFMPEG_FORCE_REBUILD == true ]; then rm -rf $_inst fi @@ -777,9 +879,10 @@ compile_FFmpeg() { magic_compile_set ffmpeg-$FFMPEG_VERSION $ffmpeg_magic cd $CWD + INFO "Done compiling ffmpeg-$FFMPEG_VERSION!" else INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!" - INFO "If you want to force rebuild of this lib, delete the '$_src' and '$_inst' directories." + INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option." fi } @@ -822,7 +925,8 @@ check_package_version_ge_DEB() { install_DEB() { INFO "" INFO "Installing dependencies for DEB-based distribution" - INFO "$COMMON_INFO" + INFO "" + INFO "`eval _echo "$COMMON_INFO"`" INFO "" if [ ! -z "`cat /etc/debian_version | grep ^6`" ]; then @@ -845,6 +949,7 @@ install_DEB() { INFO "Hit Enter to continue running the script, or hit Ctrl-C to abort the script" read + INFO "" fi fi @@ -858,6 +963,7 @@ install_DEB() { VORBIS_DEV="libvorbis-dev" THEORA_DEV="libtheora-dev" + INFO "" sudo apt-get install -y gawk cmake scons gcc g++ libjpeg-dev libpng-dev libtiff-dev \ libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev libncurses5-dev \ libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV libopenexr-dev libopenal-dev \ @@ -869,6 +975,7 @@ install_DEB() { VORBIS_USE=true THEORA_USE=true + INFO "" # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev! XVID_DEV="libxvidcore-dev" check_package_DEB $XVID_DEV @@ -884,6 +991,7 @@ install_DEB() { fi fi + INFO "" MP3LAME_DEV="libmp3lame-dev" check_package_DEB $MP3LAME_DEV if [ $? -eq 0 ]; then @@ -891,6 +999,7 @@ install_DEB() { MP3LAME_USE=true fi + INFO "" X264_DEV="libx264-dev" check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then @@ -898,6 +1007,7 @@ install_DEB() { X264_USE=true fi + INFO "" VPX_DEV="libvpx-dev" check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then @@ -905,11 +1015,13 @@ install_DEB() { VPX_USE=true fi + INFO "" check_package_DEB libspnav-dev if [ $? -eq 0 ]; then sudo apt-get install -y libspnav-dev fi + INFO "" check_package_DEB python3.3-dev if [ $? -eq 0 ]; then sudo apt-get install -y python3.3-dev @@ -917,6 +1029,7 @@ install_DEB() { compile_Python fi + INFO "" check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN if [ $? -eq 0 ]; then sudo apt-get install -y libboost-dev @@ -935,6 +1048,7 @@ install_DEB() { compile_Boost fi + INFO "" check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN if [ $? -eq 0 ]; then sudo apt-get install -y libopencolorio-dev @@ -942,6 +1056,7 @@ install_DEB() { compile_OCIO fi + INFO "" check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN if [ $? -eq 0 ]; then sudo apt-get install -y libopenimageio-dev @@ -952,6 +1067,7 @@ install_DEB() { if $BUILD_OSL; then have_llvm=false + INFO "" check_package_DEB llvm-$LLVM_VERSION-dev if [ $? -eq 0 ]; then sudo apt-get install -y llvm-$LLVM_VERSION-dev @@ -963,12 +1079,20 @@ install_DEB() { sudo apt-get install -y llvm-$LLVM_VERSION_MIN-dev have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION_MIN + else + sudo apt-get install -y libffi-dev + INFO "" + compile_LLVM + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION fi fi if $have_llvm; then + INFO "" sudo apt-get install -y clang flex bison libtbb-dev git # No package currently! + INFO "" compile_OSL fi fi @@ -988,6 +1112,7 @@ install_DEB() { # fi # fi # fi + INFO "" compile_FFmpeg } @@ -1030,7 +1155,8 @@ check_package_version_ge_RPM() { install_RPM() { INFO "" INFO "Installing dependencies for RPM-based distribution" - INFO "$COMMON_INFO" + INFO "" + INFO "`eval _echo "$COMMON_INFO"`" INFO "" sudo yum -y update @@ -1041,6 +1167,7 @@ install_RPM() { VORBIS_DEV="libvorbis-devel" THEORA_DEV="libtheora-devel" + INFO "" sudo yum -y install gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel \ freetype-devel libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \ readline-devel $OPENJPEG_DEV openexr-devel openal-soft-devel \ @@ -1053,6 +1180,7 @@ install_RPM() { VORBIS_USE=true THEORA_USE=true + INFO "" X264_DEV="x264-devel" check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then @@ -1060,6 +1188,7 @@ install_RPM() { X264_USE=true fi + INFO "" XVID_DEV="xvidcore-devel" check_package_RPM $XVID_DEV if [ $? -eq 0 ]; then @@ -1067,6 +1196,7 @@ install_RPM() { XVID_USE=true fi + INFO "" VPX_DEV="libvpx-devel" check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then @@ -1074,6 +1204,7 @@ install_RPM() { VPX_USE=true fi + INFO "" MP3LAME_DEV="lame-devel" check_package_RPM $MP3LAME_DEV if [ $? -eq 0 ]; then @@ -1081,6 +1212,7 @@ install_RPM() { MP3LAME_USE=true fi + INFO "" check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN if [ $? -eq 0 ]; then sudo yum install -y python3-devel @@ -1088,6 +1220,7 @@ install_RPM() { compile_Python fi + INFO "" check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN if [ $? -eq 0 ]; then sudo yum install -y boost-devel @@ -1095,6 +1228,7 @@ install_RPM() { compile_Boost fi + INFO "" check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN if [ $? -eq 0 ]; then sudo yum install -y OpenColorIO-devel @@ -1102,6 +1236,7 @@ install_RPM() { compile_OCIO fi + INFO "" check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN if [ $? -eq 0 ]; then sudo yum install -y OpenImageIO-devel @@ -1112,6 +1247,7 @@ install_RPM() { if $BUILD_OSL; then have_llvm=false + INFO "" check_package_RPM llvm-$LLVM_VERSION-devel if [ $? -eq 0 ]; then sudo yum install -y llvm-$LLVM_VERSION-devel @@ -1134,19 +1270,23 @@ install_RPM() { sudo yum install -y libffi-devel # XXX Stupid fedora puts ffi header into a darn stupid dir! _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` + INFO "" compile_LLVM have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION fi if $have_llvm; then + INFO "" sudo yum install -y flex bison clang tbb-devel git # No package currently! + INFO "" compile_OSL fi fi # Always for now, not sure which packages should be installed + INFO "" compile_FFmpeg } @@ -1189,7 +1329,8 @@ check_package_version_ge_SUSE() { install_SUSE() { INFO "" INFO "Installing dependencies for SuSE-based distribution" - INFO "$COMMON_INFO" + INFO "" + INFO "`eval _echo "$COMMON_INFO"`" INFO "" sudo zypper --non-interactive update --auto-agree-with-licenses @@ -1200,6 +1341,7 @@ install_SUSE() { VORBIS_DEV="libvorbis-devel" THEORA_DEV="libtheora-devel" + INFO "" sudo zypper --non-interactive install --auto-agree-with-licenses \ gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel \ freetype-devel libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \ @@ -1213,6 +1355,7 @@ install_SUSE() { VORBIS_USE=true THEORA_USE=true + INFO "" X264_DEV="x264-devel" check_package_version_ge_SUSE $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then @@ -1220,6 +1363,7 @@ install_SUSE() { X264_USE=true fi + INFO "" XVID_DEV="xvidcore-devel" check_package_SUSE $XVID_DEV if [ $? -eq 0 ]; then @@ -1227,6 +1371,7 @@ install_SUSE() { XVID_USE=true fi + INFO "" VPX_DEV="libvpx-devel" check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then @@ -1234,6 +1379,7 @@ install_SUSE() { VPX_USE=true fi + INFO "" # No mp3 in suse, it seems. MP3LAME_DEV="lame-devel" check_package_SUSE $MP3LAME_DEV @@ -1242,6 +1388,7 @@ install_SUSE() { MP3LAME_USE=true fi + INFO "" check_package_version_match_SUSE python3-devel 3.3. if [ $? -eq 0 ]; then sudo zypper --non-interactive install --auto-agree-with-licenses python3-devel @@ -1249,18 +1396,22 @@ install_SUSE() { compile_Python fi + INFO "" # No boost_locale currently available, so let's build own boost. compile_Boost + INFO "" # No ocio currently available, so let's build own boost. compile_OCIO + INFO "" # No oiio currently available, so let's build own boost. compile_OIIO if $BUILD_OSL; then have_llvm=false + INFO "" # Suse llvm package *_$SUCKS$_* (tm) !!! # check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN # if [ $? -eq 0 ]; then @@ -1270,19 +1421,23 @@ install_SUSE() { # fi sudo zypper --non-interactive install --auto-agree-with-licenses libffi47-devel + INFO "" compile_LLVM have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION if $have_llvm; then + INFO "" # XXX No tbb lib! sudo zypper --non-interactive install --auto-agree-with-licenses flex bison git # No package currently! + INFO "" compile_OSL fi fi # No ffmpeg currently available, so let's build own boost. + INFO "" compile_FFmpeg } @@ -1379,7 +1534,7 @@ print_info() { INFO " -D Boost_USE_ICU=ON" fi - if [ -d $INST/osl ]; then + if [ -d $INST/osl -a $BUILD_OSL == true ]; then INFO " -D CYCLES_OSL=$INST/osl" INFO " -D WITH_CYCLES_OSL=ON" INFO " -D LLVM_VERSION=$LLVM_VERSION_FOUND" -- cgit v1.2.3 From 807fd448a557fbacb70fcd9b5cae76529fdb9b80 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Dec 2012 19:14:55 +0000 Subject: UI: allow middlemouse in addition to leftmouse for clicking on various buttons, means that if you have emulate 3 button mouse enabled and still have alt pressed when clicking, it works. --- .../blender/editors/interface/interface_handlers.c | 91 +++++++++++----------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5f01255b8e0..ea53bbba70a 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1886,6 +1886,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval = WM_UI_HANDLER_BREAK; break; case LEFTMOUSE: + case MIDDLEMOUSE: { /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */ if (data->searchbox) @@ -2249,11 +2250,11 @@ int ui_button_open_menu_direction(uiBut *but) static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); return WM_UI_HANDLER_BREAK; } - else if (event->type == LEFTMOUSE && but->block->handle) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->block->handle) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } @@ -2263,7 +2264,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { if (!(but->flag & UI_SELECT)) data->cancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2277,7 +2278,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { but->drawstr[0] = 0; but->modifier_key = 0; button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); @@ -2338,7 +2339,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); return WM_UI_HANDLER_BREAK; } @@ -2363,7 +2364,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { if (but->dt == UI_EMBOSSN && !event->ctrl) { /* pass */ } @@ -2388,7 +2389,7 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { data->togdual = event->ctrl; data->togonly = !event->shift; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2404,7 +2405,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ - if (event->type == LEFTMOUSE && but->dragpoin) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->dragpoin) { if (ui_but_mouse_inside_icon(but, data->region, event)) { /* tell the button to wait and keep checking further events to @@ -2416,7 +2417,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE } } - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; /* XXX (a bit ugly) Special case handling for filebrowser drag button */ if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) { @@ -2436,7 +2437,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE /* If the mouse has been pressed and released, getting to * this point without triggering a drag, then clear the * drag state for this button and continue to pass on the event */ - if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_CONTINUE; } @@ -2678,11 +2679,11 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton click = 1; } else if (event->val == KM_PRESS) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (event->type == LEFTMOUSE) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { data->dragstartx = data->draglastx = ui_is_a_warp_but(but) ? screen_mx : mx; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; @@ -2705,7 +2706,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { if (data->dragchange) button_activate_state(C, but, BUTTON_STATE_EXIT); else @@ -2902,12 +2903,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton click = 2; } else if (event->val == KM_PRESS) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } /* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */ - else if (event->type == LEFTMOUSE && event->alt) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->alt) { int halfpos = BLI_rctf_cent_x(&but->rect); click = 2; if (mx < halfpos) @@ -2915,7 +2916,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton else mx = but->rect.xmax; } - else if (event->type == LEFTMOUSE) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { data->dragstartx = mx; data->draglastx = mx; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); @@ -2938,7 +2939,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { if (data->dragchange) button_activate_state(C, but, BUTTON_STATE_EXIT); else @@ -3030,7 +3031,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut if (data->state == BUTTON_STATE_HIGHLIGHT) { if (event->val == KM_PRESS) { - if (event->type == LEFTMOUSE) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { if (horizontal) { data->dragstartx = mx; data->draglastx = mx; @@ -3055,7 +3056,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->type == MOUSEMOVE) { @@ -3076,7 +3077,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ - if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->dragpoin && event->val == KM_PRESS) { if (ui_but_mouse_inside_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; @@ -3086,7 +3087,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm } /* regular open menu */ - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -3158,7 +3159,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm return WM_UI_HANDLER_BREAK; } - if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -3238,7 +3239,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3259,7 +3260,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3424,7 +3425,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3493,7 +3494,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3623,7 +3624,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3703,7 +3704,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -3745,7 +3746,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { coba = (ColorBand *)but->poin; if (event->ctrl) { @@ -3785,7 +3786,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3907,7 +3908,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; CurveMapPoint *cmp; @@ -4012,7 +4013,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { if (data->dragsel != -1) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; @@ -4089,7 +4090,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4123,7 +4124,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4172,7 +4173,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4206,7 +4207,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4247,7 +4248,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4273,7 +4274,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4297,7 +4298,7 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { /* Calculate the size of the button */ width = abs(BLI_rctf_size_x(&but->rect)); height = abs(BLI_rctf_size_y(&but->rect)); @@ -4393,18 +4394,18 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE VECCOPY2D(but->linkto, event->mval); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); return WM_UI_HANDLER_BREAK; } - else if (event->type == LEFTMOUSE && but->block->handle) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->block->handle) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { if (!(but->flag & UI_SELECT)) data->cancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4464,7 +4465,7 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4490,7 +4491,7 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan ui_numedit_apply(C, block, but, data); } } - else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { + else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -5000,7 +5001,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) } /* verify if we can edit this button */ - if (ELEM(event->type, LEFTMOUSE, RETKEY)) { + if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RETKEY)) { /* this should become disabled button .. */ if (but->lock == TRUE) { if (but->lockstr) { -- cgit v1.2.3 From 7c0a0bae79bb8f842a575fe83975c6d34d73c64a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Dec 2012 19:15:05 +0000 Subject: Fix #33375: OSL geom:trianglevertices gave wrong coordinates for static BVH. Also some simple OSL optimization, passing thread data pointer directly instead of via thread local storage, and creating ustrings for attribute lookup. --- intern/cycles/device/device_cpu.cpp | 47 +++++++----- intern/cycles/kernel/kernel.cpp | 32 -------- intern/cycles/kernel/kernel_attribute.h | 22 +----- intern/cycles/kernel/kernel_globals.h | 18 ++--- intern/cycles/kernel/kernel_path.h | 6 ++ intern/cycles/kernel/kernel_shader.h | 34 ++++----- intern/cycles/kernel/kernel_triangle.h | 3 - intern/cycles/kernel/kernel_types.h | 9 ++- intern/cycles/kernel/osl/osl_closures.cpp | 3 +- intern/cycles/kernel/osl/osl_globals.h | 26 +++---- intern/cycles/kernel/osl/osl_services.cpp | 121 +++++++++++++++++++----------- intern/cycles/kernel/osl/osl_services.h | 33 ++++++++ intern/cycles/kernel/osl/osl_shader.cpp | 111 ++++++++++++++------------- intern/cycles/kernel/osl/osl_shader.h | 21 +++--- intern/cycles/render/object.cpp | 21 ++++-- intern/cycles/render/object.h | 4 +- intern/cycles/render/osl.cpp | 14 +--- intern/cycles/render/osl.h | 2 - intern/cycles/util/util_thread.h | 31 -------- 19 files changed, 276 insertions(+), 282 deletions(-) diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index bc280616615..a1d7706a34e 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -23,9 +23,12 @@ #include "device_intern.h" #include "kernel.h" +#include "kernel_compat_cpu.h" #include "kernel_types.h" +#include "kernel_globals.h" #include "osl_shader.h" +#include "osl_globals.h" #include "buffers.h" @@ -43,11 +46,16 @@ class CPUDevice : public Device { public: TaskPool task_pool; - KernelGlobals *kg; + KernelGlobals kernel_globals; +#ifdef WITH_OSL + OSLGlobals osl_globals; +#endif CPUDevice(Stats &stats) : Device(stats) { - kg = kernel_globals_create(); +#ifdef WITH_OSL + kernel_globals.osl = &osl_globals; +#endif /* do now to avoid thread issues */ system_cpu_support_optimized(); @@ -56,7 +64,6 @@ public: ~CPUDevice() { task_pool.stop(); - kernel_globals_free(kg); } bool support_advanced_shading() @@ -95,12 +102,12 @@ public: void const_copy_to(const char *name, void *host, size_t size) { - kernel_const_copy(kg, name, host, size); + kernel_const_copy(&kernel_globals, name, host, size); } void tex_alloc(const char *name, device_memory& mem, bool interpolation, bool periodic) { - kernel_tex_copy(kg, name, mem.data_pointer, mem.data_width, mem.data_height); + kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height); mem.device_pointer = mem.data_pointer; stats.mem_alloc(mem.memory_size()); @@ -116,7 +123,7 @@ public: void *osl_memory() { #ifdef WITH_OSL - return kernel_osl_memory(kg); + return &osl_globals; #else return NULL; #endif @@ -148,9 +155,10 @@ public: return; } + KernelGlobals kg = kernel_globals; + #ifdef WITH_OSL - if(kernel_osl_use(kg)) - OSLShader::thread_init(kg); + OSLShader::thread_init(&kg, &kernel_globals, &osl_globals); #endif RenderTile tile; @@ -171,7 +179,7 @@ public: for(int y = tile.y; y < tile.y + tile.h; y++) { for(int x = tile.x; x < tile.x + tile.w; x++) { - kernel_cpu_optimized_path_trace(kg, render_buffer, rng_state, + kernel_cpu_optimized_path_trace(&kg, render_buffer, rng_state, sample, x, y, tile.offset, tile.stride); } } @@ -192,7 +200,7 @@ public: for(int y = tile.y; y < tile.y + tile.h; y++) { for(int x = tile.x; x < tile.x + tile.w; x++) { - kernel_cpu_path_trace(kg, render_buffer, rng_state, + kernel_cpu_path_trace(&kg, render_buffer, rng_state, sample, x, y, tile.offset, tile.stride); } } @@ -212,8 +220,7 @@ public: } #ifdef WITH_OSL - if(kernel_osl_use(kg)) - OSLShader::thread_free(kg); + OSLShader::thread_free(&kg); #endif } @@ -223,7 +230,7 @@ public: if(system_cpu_support_optimized()) { for(int y = task.y; y < task.y + task.h; y++) for(int x = task.x; x < task.x + task.w; x++) - kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer, + kernel_cpu_optimized_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer, task.sample, task.resolution, x, y, task.offset, task.stride); } else @@ -231,22 +238,23 @@ public: { for(int y = task.y; y < task.y + task.h; y++) for(int x = task.x; x < task.x + task.w; x++) - kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer, + kernel_cpu_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer, task.sample, task.resolution, x, y, task.offset, task.stride); } } void thread_shader(DeviceTask& task) { + KernelGlobals kg = kernel_globals; + #ifdef WITH_OSL - if(kernel_osl_use(kg)) - OSLShader::thread_init(kg); + OSLShader::thread_init(&kg, &kernel_globals, &osl_globals); #endif #ifdef WITH_OPTIMIZED_KERNEL if(system_cpu_support_optimized()) { for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) { - kernel_cpu_optimized_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x); + kernel_cpu_optimized_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x); if(task_pool.cancelled()) break; @@ -256,7 +264,7 @@ public: #endif { for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) { - kernel_cpu_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x); + kernel_cpu_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x); if(task_pool.cancelled()) break; @@ -264,8 +272,7 @@ public: } #ifdef WITH_OSL - if(kernel_osl_use(kg)) - OSLShader::thread_free(kg); + OSLShader::thread_free(&kg); #endif } diff --git a/intern/cycles/kernel/kernel.cpp b/intern/cycles/kernel/kernel.cpp index 62d79bdd946..d760e63a290 100644 --- a/intern/cycles/kernel/kernel.cpp +++ b/intern/cycles/kernel/kernel.cpp @@ -29,38 +29,6 @@ CCL_NAMESPACE_BEGIN -/* Globals */ - -KernelGlobals *kernel_globals_create() -{ - KernelGlobals *kg = new KernelGlobals(); -#ifdef WITH_OSL - kg->osl.use = false; -#endif - return kg; -} - -void kernel_globals_free(KernelGlobals *kg) -{ - delete kg; -} - -/* OSL */ - -#ifdef WITH_OSL - -void *kernel_osl_memory(KernelGlobals *kg) -{ - return (void*)&kg->osl; -} - -bool kernel_osl_use(KernelGlobals *kg) -{ - return kg->osl.use; -} - -#endif - /* Memory Copy */ void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size) diff --git a/intern/cycles/kernel/kernel_attribute.h b/intern/cycles/kernel/kernel_attribute.h index 2774f5e924b..b7ad731c883 100644 --- a/intern/cycles/kernel/kernel_attribute.h +++ b/intern/cycles/kernel/kernel_attribute.h @@ -19,13 +19,6 @@ #ifndef __KERNEL_ATTRIBUTE_CL__ #define __KERNEL_ATTRIBUTE_CL__ -#include "util_types.h" - -#ifdef __OSL__ -#include -#include "util_attribute.h" -#endif - CCL_NAMESPACE_BEGIN /* note: declared in kernel.h, have to add it here because kernel.h is not available */ @@ -33,20 +26,9 @@ bool kernel_osl_use(KernelGlobals *kg); __device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id) { - #ifdef __OSL__ - if (kernel_osl_use(kg)) { - /* for OSL, a hash map is used to lookup the attribute by name. */ - OSLGlobals::AttributeMap &attr_map = kg->osl.attribute_map[sd->object]; - ustring stdname(std::string("std::") + std::string(attribute_standard_name((AttributeStandard)id))); - OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname); - if (it != attr_map.end()) { - const OSLGlobals::Attribute &osl_attr = it->second; - /* return result */ - return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset; - } - else - return (int)ATTR_STD_NOT_FOUND; + if (kg->osl) { + return OSLShader::find_attribute(kg, sd, id); } else #endif diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index 1e56c11ab90..529b7b8768f 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -18,14 +18,6 @@ /* Constant Globals */ -#ifdef __KERNEL_CPU__ - -#ifdef __OSL__ -#include "osl_globals.h" -#endif - -#endif - CCL_NAMESPACE_BEGIN /* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in @@ -35,6 +27,12 @@ CCL_NAMESPACE_BEGIN #ifdef __KERNEL_CPU__ +#ifdef __OSL__ +struct OSLGlobals; +struct OSLThreadData; +struct OSLShadingSystem; +#endif + #define MAX_BYTE_IMAGES 512 #define MAX_FLOAT_IMAGES 5 @@ -51,7 +49,9 @@ typedef struct KernelGlobals { #ifdef __OSL__ /* On the CPU, we also have the OSL globals here. Most data structures are shared * with SVM, the difference is in the shaders and object/mesh attributes. */ - OSLGlobals osl; + OSLGlobals *osl; + OSLShadingSystem *osl_ss; + OSLThreadData *osl_tdata; #endif } KernelGlobals; diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 195291898c6..3588b09c790 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -16,10 +16,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef __OSL__ +#include "osl_shader.h" +#endif + #include "kernel_differential.h" #include "kernel_montecarlo.h" #include "kernel_projection.h" #include "kernel_object.h" +#include "kernel_attribute.h" +#include "kernel_projection.h" #include "kernel_triangle.h" #ifdef __QBVH__ #include "kernel_qbvh.h" diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 879160312cf..43ad4b1265a 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -26,10 +26,6 @@ * */ -#ifdef __OSL__ -#include "osl_shader.h" -#endif - #include "closure/bsdf.h" #include "closure/emissive.h" #include "closure/volume.h" @@ -61,7 +57,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::init(kg, sd); #endif @@ -147,7 +143,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, int shader, int object, int prim, float u, float v, float t, float time) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::init(kg, sd); #endif @@ -278,7 +274,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd, __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::init(kg, sd); #endif @@ -387,7 +383,7 @@ __device void shader_bsdf_eval(KernelGlobals *kg, const ShaderData *sd, bsdf_eval_init(eval, NBUILTIN_CLOSURES, make_float3(0.0f, 0.0f, 0.0f), kernel_data.film.use_light_pass); #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) return _shader_bsdf_multi_eval_osl(sd, omega_in, pdf, -1, eval, 0.0f, 0.0f); else #endif @@ -444,7 +440,7 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd, *pdf = 0.0f; #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf); else #endif @@ -456,7 +452,7 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd, if(sd->num_closure > 1) { float sweight = sc->sample_weight; #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) _shader_bsdf_multi_eval_osl(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight); else #endif @@ -483,7 +479,7 @@ __device int shader_bsdf_sample_closure(KernelGlobals *kg, const ShaderData *sd, *pdf = 0.0f; #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf); else #endif @@ -503,7 +499,7 @@ __device void shader_bsdf_blur(KernelGlobals *kg, ShaderData *sd, float roughnes if(CLOSURE_IS_BSDF(sc->type)) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::bsdf_blur(sc, roughness); else #endif @@ -650,7 +646,7 @@ __device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd) if(CLOSURE_IS_EMISSION(sc->type)) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) eval += OSLShader::emissive_eval(sd, sc)*sc->weight; else #endif @@ -694,7 +690,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::eval_surface(kg, sd, randb, path_flag); else #endif @@ -713,7 +709,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, __device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) return OSLShader::eval_background(kg, sd, path_flag); else #endif @@ -759,7 +755,7 @@ __device float3 shader_volume_eval_phase(KernelGlobals *kg, ShaderData *sd, if(CLOSURE_IS_VOLUME(sc->type)) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) eval += OSLShader::volume_eval_phase(sc, omega_in, omega_out); else #endif @@ -780,7 +776,7 @@ __device void shader_eval_volume(KernelGlobals *kg, ShaderData *sd, { #ifdef __SVM__ #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::eval_volume(kg, sd, randb, path_flag); else #endif @@ -795,7 +791,7 @@ __device void shader_eval_displacement(KernelGlobals *kg, ShaderData *sd) /* this will modify sd->P */ #ifdef __SVM__ #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::eval_displacement(kg, sd); else #endif @@ -851,7 +847,7 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd) __device void shader_release(KernelGlobals *kg, ShaderData *sd) { #ifdef __OSL__ - if (kernel_osl_use(kg)) + if (kg->osl) OSLShader::release(kg, sd); #endif } diff --git a/intern/cycles/kernel/kernel_triangle.h b/intern/cycles/kernel/kernel_triangle.h index e39ae1d4fbc..0db447289c8 100644 --- a/intern/cycles/kernel/kernel_triangle.h +++ b/intern/cycles/kernel/kernel_triangle.h @@ -16,9 +16,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "kernel_attribute.h" -#include "kernel_projection.h" - CCL_NAMESPACE_BEGIN /* Point on triangle for Moller-Trumbore triangles */ diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index f519fd989fa..e3a766e56b1 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -366,9 +366,6 @@ typedef struct ShaderClosure { float sample_weight; #endif -#ifdef __OSL__ - void *prim; -#endif float data0; float data1; @@ -377,6 +374,9 @@ typedef struct ShaderClosure { float3 T; #endif +#ifdef __OSL__ + void *prim; +#endif } ShaderClosure; /* Shader Data @@ -403,7 +403,8 @@ enum ShaderDataFlag { /* object flags */ SD_HOLDOUT_MASK = 4096, /* holdout for camera rays */ - SD_OBJECT_MOTION = 8192 /* has object motion blur */ + SD_OBJECT_MOTION = 8192, /* has object motion blur */ + SD_TRANSFORM_APPLIED = 16384 /* vertices have transform applied */ }; typedef struct ShaderData { diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index d42d65608c8..f95859d237d 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -153,8 +153,9 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O ss->register_closure(name, id, params, prepare, generic_closure_setup, generic_closure_compare); } -void OSLShader::register_closures(OSL::ShadingSystem *ss) +void OSLShader::register_closures(OSLShadingSystem *ss_) { + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)ss_; int id = 0; register_closure(ss, "diffuse", id++, diff --git a/intern/cycles/kernel/osl/osl_globals.h b/intern/cycles/kernel/osl/osl_globals.h index ce283023c5c..1a2a210de88 100644 --- a/intern/cycles/kernel/osl/osl_globals.h +++ b/intern/cycles/kernel/osl/osl_globals.h @@ -38,7 +38,14 @@ CCL_NAMESPACE_BEGIN class OSLRenderServices; struct OSLGlobals { - /* use */ + OSLGlobals() + { + ss = NULL; + ts = NULL; + services = NULL; + use = false; + } + bool use; /* shading system */ @@ -66,19 +73,12 @@ struct OSLGlobals { vector attribute_map; ObjectNameMap object_name_map; vector object_names; +}; - /* thread key for thread specific data lookup */ - struct ThreadData { - OSL::ShaderGlobals globals; - OSL::PerThreadInfo *thread_info; - }; - - static tls_ptr(ThreadData, thread_data); - static thread_mutex thread_data_mutex; - static volatile int thread_data_users; - - void thread_data_init(); - void thread_data_free(); +/* thread key for thread specific data lookup */ +struct OSLThreadData { + OSL::ShaderGlobals globals; + OSL::PerThreadInfo *thread_info; }; CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index e593387093c..b584a54b1b7 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -23,6 +23,7 @@ #include "scene.h" #include "osl_closures.h" +#include "osl_globals.h" #include "osl_services.h" #include "osl_shader.h" @@ -36,6 +37,8 @@ #include "kernel_differential.h" #include "kernel_object.h" #include "kernel_bvh.h" +#include "kernel_attribute.h" +#include "kernel_projection.h" #include "kernel_triangle.h" #include "kernel_accumulate.h" #include "kernel_shader.h" @@ -53,6 +56,34 @@ ustring OSLRenderServices::u_camera("camera"); ustring OSLRenderServices::u_screen("screen"); ustring OSLRenderServices::u_raster("raster"); ustring OSLRenderServices::u_ndc("NDC"); +ustring OSLRenderServices::u_object_location("object:location"); +ustring OSLRenderServices::u_object_index("object:index"); +ustring OSLRenderServices::u_geom_dupli_generated("geom:dupli_generated"); +ustring OSLRenderServices::u_geom_dupli_uv("geom:dupli_uv"); +ustring OSLRenderServices::u_material_index("material:index"); +ustring OSLRenderServices::u_object_random("object:random"); +ustring OSLRenderServices::u_particle_index("particle:index"); +ustring OSLRenderServices::u_particle_age("particle:age"); +ustring OSLRenderServices::u_particle_lifetime("particle:lifetime"); +ustring OSLRenderServices::u_particle_location("particle:location"); +ustring OSLRenderServices::u_particle_rotation("particle:rotation"); +ustring OSLRenderServices::u_particle_size("particle:size"); +ustring OSLRenderServices::u_particle_velocity("particle:velocity"); +ustring OSLRenderServices::u_particle_angular_velocity("particle:angular_velocity"); +ustring OSLRenderServices::u_geom_numpolyvertices("geom:numpolyvertices"); +ustring OSLRenderServices::u_geom_trianglevertices("geom:trianglevertices"); +ustring OSLRenderServices::u_geom_polyvertices("geom:polyvertices"); +ustring OSLRenderServices::u_geom_name("geom:name"); +ustring OSLRenderServices::u_path_ray_length("path:ray_length"); +ustring OSLRenderServices::u_trace("trace"); +ustring OSLRenderServices::u_hit("hit"); +ustring OSLRenderServices::u_hitdist("hitdist"); +ustring OSLRenderServices::u_N("N"); +ustring OSLRenderServices::u_Ng("Ng"); +ustring OSLRenderServices::u_P("P"); +ustring OSLRenderServices::u_I("I"); +ustring OSLRenderServices::u_u("u"); +ustring OSLRenderServices::u_v("v"); ustring OSLRenderServices::u_empty; OSLRenderServices::OSLRenderServices() @@ -488,104 +519,108 @@ static void get_object_attribute(const OSLGlobals::Attribute& attr, bool derivat memset((char *)val + datasize, 0, datasize * 2); } -static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, - TypeDesc type, bool derivatives, void *val) +bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, + TypeDesc type, bool derivatives, void *val) { - /* todo: turn this into hash table returning int, which can be used in switch */ + /* todo: turn this into hash table? */ /* Object Attributes */ - if (name == "object:location") { + if (name == u_object_location) { float3 f = object_location(kg, sd); return set_attribute_float3(f, type, derivatives, val); } - else if (name == "object:index") { + else if (name == u_object_index) { float f = object_pass_id(kg, sd->object); return set_attribute_float(f, type, derivatives, val); } - else if (name == "geom:dupli_generated") { + else if (name == u_geom_dupli_generated) { float3 f = object_dupli_generated(kg, sd->object); return set_attribute_float3(f, type, derivatives, val); } - else if (name == "geom:dupli_uv") { + else if (name == u_geom_dupli_uv) { float3 f = object_dupli_uv(kg, sd->object); return set_attribute_float3(f, type, derivatives, val); } - else if (name == "material:index") { + else if (name == u_material_index) { float f = shader_pass_id(kg, sd); return set_attribute_float(f, type, derivatives, val); } - else if (name == "object:random") { + else if (name == u_object_random) { float f = object_random_number(kg, sd->object); return set_attribute_float(f, type, derivatives, val); } /* Particle Attributes */ - else if (name == "particle:index") { + else if (name == u_particle_index) { uint particle_id = object_particle_id(kg, sd->object); float f = particle_index(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } - else if (name == "particle:age") { + else if (name == u_particle_age) { uint particle_id = object_particle_id(kg, sd->object); float f = particle_age(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } - else if (name == "particle:lifetime") { + else if (name == u_particle_lifetime) { uint particle_id = object_particle_id(kg, sd->object); float f= particle_lifetime(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } - else if (name == "particle:location") { + else if (name == u_particle_location) { uint particle_id = object_particle_id(kg, sd->object); float3 f = particle_location(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } #if 0 /* unsupported */ - else if (name == "particle:rotation") { + else if (name == u_particle_rotation) { uint particle_id = object_particle_id(kg, sd->object); float4 f = particle_rotation(kg, particle_id); return set_attribute_float4(f, type, derivatives, val); } #endif - else if (name == "particle:size") { + else if (name == u_particle_size) { uint particle_id = object_particle_id(kg, sd->object); float f = particle_size(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } - else if (name == "particle:velocity") { + else if (name == u_particle_velocity) { uint particle_id = object_particle_id(kg, sd->object); float3 f = particle_velocity(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } - else if (name == "particle:angular_velocity") { + else if (name == u_particle_angular_velocity) { uint particle_id = object_particle_id(kg, sd->object); float3 f = particle_angular_velocity(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } - else if (name == "geom:numpolyvertices") { + else if (name == u_geom_numpolyvertices) { return set_attribute_int(3, type, derivatives, val); } - else if (name == "geom:trianglevertices" || name == "geom:polyvertices") { + else if (name == u_geom_trianglevertices || name == u_geom_polyvertices) { float3 P[3]; triangle_vertices(kg, sd->prim, P); - object_position_transform(kg, sd, &P[0]); - object_position_transform(kg, sd, &P[1]); - object_position_transform(kg, sd, &P[2]); + + if(!(sd->flag & SD_TRANSFORM_APPLIED)) { + object_position_transform(kg, sd, &P[0]); + object_position_transform(kg, sd, &P[1]); + object_position_transform(kg, sd, &P[2]); + } + return set_attribute_float3_3(P, type, derivatives, val); } - else if(name == "geom:name") { - ustring object_name = kg->osl.object_names[sd->object]; + else if(name == u_geom_name) { + ustring object_name = kg->osl->object_names[sd->object]; return set_attribute_string(object_name, type, derivatives, val); } else return false; } -static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, - TypeDesc type, bool derivatives, void *val) +bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, + TypeDesc type, bool derivatives, void *val) { /* Ray Length */ - if (name == "path:ray_length") { + if (name == u_path_ray_length) { float f = sd->ray_length; return set_attribute_float(f, type, derivatives, val); } @@ -604,9 +639,9 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri /* lookup of attribute on another object */ if (object_name != u_empty) { - OSLGlobals::ObjectNameMap::iterator it = kg->osl.object_name_map.find(object_name); + OSLGlobals::ObjectNameMap::iterator it = kg->osl->object_name_map.find(object_name); - if (it == kg->osl.object_name_map.end()) + if (it == kg->osl->object_name_map.end()) return false; object = it->second; @@ -617,7 +652,7 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri } /* find attribute on object */ - OSLGlobals::AttributeMap& attribute_map = kg->osl.attribute_map[object]; + OSLGlobals::AttributeMap& attribute_map = kg->osl->attribute_map[object]; OSLGlobals::AttributeMap::iterator it = attribute_map.find(name); if (it != attribute_map.end()) { @@ -663,7 +698,7 @@ bool OSLRenderServices::texture(ustring filename, TextureOpt &options, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl.ts; + OSL::TextureSystem *ts = kernel_globals->osl->ts; bool status = ts->texture(filename, options, s, t, dsdx, dtdx, dsdy, dtdy, result); if(!status) { @@ -685,7 +720,7 @@ bool OSLRenderServices::texture3d(ustring filename, TextureOpt &options, const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &dPdz, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl.ts; + OSL::TextureSystem *ts = kernel_globals->osl->ts; bool status = ts->texture3d(filename, options, P, dPdx, dPdy, dPdz, result); if(!status) { @@ -707,7 +742,7 @@ bool OSLRenderServices::environment(ustring filename, TextureOpt &options, OSL::ShaderGlobals *sg, const OSL::Vec3 &R, const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy, float *result) { - OSL::TextureSystem *ts = kernel_globals->osl.ts; + OSL::TextureSystem *ts = kernel_globals->osl->ts; bool status = ts->environment(filename, options, R, dRdx, dRdy, result); if(!status) { @@ -728,7 +763,7 @@ bool OSLRenderServices::get_texture_info(ustring filename, int subimage, ustring dataname, TypeDesc datatype, void *data) { - OSL::TextureSystem *ts = kernel_globals->osl.ts; + OSL::TextureSystem *ts = kernel_globals->osl->ts; return ts->get_texture_info(filename, subimage, dataname, datatype, data); } @@ -798,12 +833,12 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri { TraceData *tracedata = (TraceData*)sg->tracedata; - if(source == "trace" && tracedata) { - if(name == "hit") { + if(source == u_trace && tracedata) { + if(name == u_hit) { return set_attribute_int((tracedata->isect.prim != ~0), type, derivatives, val); } else if(tracedata->isect.prim != ~0) { - if(name == "hitdist") { + if(name == u_hitdist) { float f[3] = {tracedata->isect.t, 0.0f, 0.0f}; return set_attribute_float(f, type, derivatives, val); } @@ -817,25 +852,25 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri tracedata->setup = true; } - if(name == "N") { + if(name == u_N) { return set_attribute_float3(sd->N, type, derivatives, val); } - else if(name == "Ng") { + else if(name == u_Ng) { return set_attribute_float3(sd->Ng, type, derivatives, val); } - else if(name == "P") { + else if(name == u_P) { float3 f[3] = {sd->P, sd->dP.dx, sd->dP.dy}; return set_attribute_float3(f, type, derivatives, val); } - else if(name == "I") { + else if(name == u_I) { float3 f[3] = {sd->I, sd->dI.dx, sd->dI.dy}; return set_attribute_float3(f, type, derivatives, val); } - else if(name == "u") { + else if(name == u_u) { float f[3] = {sd->u, sd->du.dx, sd->du.dy}; return set_attribute_float(f, type, derivatives, val); } - else if(name == "v") { + else if(name == u_v) { float f[3] = {sd->v, sd->dv.dx, sd->dv.dy}; return set_attribute_float(f, type, derivatives, val); } diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index b5a7bbae7e5..e687700b383 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -101,6 +101,11 @@ public: bool get_texture_info(ustring filename, int subimage, ustring dataname, TypeDesc datatype, void *data); + static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, + TypeDesc type, bool derivatives, void *val); + static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, + TypeDesc type, bool derivatives, void *val); + struct TraceData { Ray ray; Intersection isect; @@ -114,6 +119,34 @@ public: static ustring u_screen; static ustring u_raster; static ustring u_ndc; + static ustring u_object_location; + static ustring u_object_index; + static ustring u_geom_dupli_generated; + static ustring u_geom_dupli_uv; + static ustring u_material_index; + static ustring u_object_random; + static ustring u_particle_index; + static ustring u_particle_age; + static ustring u_particle_lifetime; + static ustring u_particle_location; + static ustring u_particle_rotation; + static ustring u_particle_size; + static ustring u_particle_velocity; + static ustring u_particle_angular_velocity; + static ustring u_geom_numpolyvertices; + static ustring u_geom_trianglevertices; + static ustring u_geom_polyvertices; + static ustring u_geom_name; + static ustring u_path_ray_length; + static ustring u_trace; + static ustring u_hit; + static ustring u_hitdist; + static ustring u_N; + static ustring u_Ng; + static ustring u_P; + static ustring u_I; + static ustring u_u; + static ustring u_v; static ustring u_empty; private: diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 2d025f12055..67a0e16419c 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -22,65 +22,56 @@ #include "kernel_object.h" #include "osl_closures.h" +#include "osl_globals.h" #include "osl_services.h" #include "osl_shader.h" +#include "util_attribute.h" #include "util_foreach.h" #include CCL_NAMESPACE_BEGIN -tls_ptr(OSLGlobals::ThreadData, OSLGlobals::thread_data); -volatile int OSLGlobals::thread_data_users = 0; -thread_mutex OSLGlobals::thread_data_mutex; - /* Threads */ -void OSLGlobals::thread_data_init() -{ - thread_scoped_lock thread_data_lock(thread_data_mutex); - - if(thread_data_users == 0) - tls_create(OSLGlobals::ThreadData, thread_data); - - thread_data_users++; -} - -void OSLGlobals::thread_data_free() +void OSLShader::thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OSLGlobals *osl_globals) { - /* thread local storage delete */ - thread_scoped_lock thread_data_lock(thread_data_mutex); + /* no osl used? */ + if(!osl_globals->use) { + kg->osl = NULL; + return; + } - thread_data_users--; + /* per thread kernel data init*/ + kg->osl = osl_globals; + kg->osl->services->thread_init(kernel_globals); - if(thread_data_users == 0) - tls_delete(OSLGlobals::ThreadData, thread_data); -} - -void OSLShader::thread_init(KernelGlobals *kg) -{ - OSL::ShadingSystem *ss = kg->osl.ss; - - OSLGlobals::ThreadData *tdata = new OSLGlobals::ThreadData(); + OSL::ShadingSystem *ss = kg->osl->ss; + OSLThreadData *tdata = new OSLThreadData(); memset(&tdata->globals, 0, sizeof(OSL::ShaderGlobals)); tdata->thread_info = ss->create_thread_info(); - tls_set(kg->osl.thread_data, tdata); - - kg->osl.services->thread_init(kg); + kg->osl_ss = (OSLShadingSystem*)ss; + kg->osl_tdata = tdata; } void OSLShader::thread_free(KernelGlobals *kg) { - OSL::ShadingSystem *ss = kg->osl.ss; + if(!kg->osl) + return; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; ss->destroy_thread_info(tdata->thread_info); delete tdata; + + kg->osl = NULL; + kg->osl_ss = NULL; + kg->osl_tdata = NULL; } /* Globals */ @@ -230,8 +221,8 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy, void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag) { /* gather pointers */ - OSL::ShadingSystem *ss = kg->osl.ss; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; OSL::ShaderGlobals *globals = &tdata->globals; OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx; @@ -241,8 +232,8 @@ void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int /* execute shader for this point */ int shader = sd->shader & SHADER_MASK; - if (kg->osl.surface_state[shader]) - ss->execute(*ctx, *(kg->osl.surface_state[shader]), *globals); + if (kg->osl->surface_state[shader]) + ss->execute(*ctx, *(kg->osl->surface_state[shader]), *globals); /* free trace data */ if(globals->tracedata) @@ -291,8 +282,8 @@ static float3 flatten_background_closure_tree(const OSL::ClosureColor *closure) float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag) { /* gather pointers */ - OSL::ShadingSystem *ss = kg->osl.ss; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; OSL::ShaderGlobals *globals = &tdata->globals; OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx; @@ -300,8 +291,8 @@ float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_fl shaderdata_to_shaderglobals(kg, sd, path_flag, globals); /* execute shader for this point */ - if (kg->osl.background_state) - ss->execute(*ctx, *(kg->osl.background_state), *globals); + if (kg->osl->background_state) + ss->execute(*ctx, *(kg->osl->background_state), *globals); /* free trace data */ if(globals->tracedata) @@ -371,8 +362,8 @@ static void flatten_volume_closure_tree(ShaderData *sd, void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag) { /* gather pointers */ - OSL::ShadingSystem *ss = kg->osl.ss; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; OSL::ShaderGlobals *globals = &tdata->globals; OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx; @@ -382,8 +373,8 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int /* execute shader */ int shader = sd->shader & SHADER_MASK; - if (kg->osl.volume_state[shader]) - ss->execute(*ctx, *(kg->osl.volume_state[shader]), *globals); + if (kg->osl->volume_state[shader]) + ss->execute(*ctx, *(kg->osl->volume_state[shader]), *globals); /* free trace data */ if(globals->tracedata) @@ -398,8 +389,8 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd) { /* gather pointers */ - OSL::ShadingSystem *ss = kg->osl.ss; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; OSL::ShaderGlobals *globals = &tdata->globals; OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx; @@ -409,8 +400,8 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd) /* execute shader */ int shader = sd->shader & SHADER_MASK; - if (kg->osl.displacement_state[shader]) - ss->execute(*ctx, *(kg->osl.displacement_state[shader]), *globals); + if (kg->osl->displacement_state[shader]) + ss->execute(*ctx, *(kg->osl->displacement_state[shader]), *globals); /* free trace data */ if(globals->tracedata) @@ -422,15 +413,15 @@ void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd) void OSLShader::init(KernelGlobals *kg, ShaderData *sd) { - OSL::ShadingSystem *ss = kg->osl.ss; - OSLGlobals::ThreadData *tdata = tls_get(OSLGlobals::ThreadData, kg->osl.thread_data); + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; + OSLThreadData *tdata = kg->osl_tdata; sd->osl_ctx = ss->get_context(tdata->thread_info); } void OSLShader::release(KernelGlobals *kg, ShaderData *sd) { - OSL::ShadingSystem *ss = kg->osl.ss; + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss; ss->release_context((OSL::ShadingContext *)sd->osl_ctx); } @@ -488,5 +479,23 @@ float3 OSLShader::volume_eval_phase(const ShaderClosure *sc, const float3 omega_ return TO_FLOAT3(volume_eval) * sc->weight; } +/* Attributes */ + +int OSLShader::find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id) +{ + /* for OSL, a hash map is used to lookup the attribute by name. */ + OSLGlobals::AttributeMap &attr_map = kg->osl->attribute_map[sd->object]; + ustring stdname(std::string("std::") + std::string(attribute_standard_name((AttributeStandard)id))); + OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname); + + if (it != attr_map.end()) { + const OSLGlobals::Attribute &osl_attr = it->second; + /* return result */ + return (osl_attr.elem == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : osl_attr.offset; + } + else + return (int)ATTR_STD_NOT_FOUND; +} + CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/osl_shader.h b/intern/cycles/kernel/osl/osl_shader.h index 9ff31e9160b..e614f240dc1 100644 --- a/intern/cycles/kernel/osl/osl_shader.h +++ b/intern/cycles/kernel/osl/osl_shader.h @@ -31,33 +31,27 @@ * This means no thread state must be passed along in the kernel itself. */ -#include -#include - #include "kernel_types.h" -#include "util_map.h" -#include "util_param.h" -#include "util_vector.h" - CCL_NAMESPACE_BEGIN -namespace OSL = ::OSL; - -class OSLRenderServices; class Scene; + struct ShaderClosure; struct ShaderData; struct differential3; struct KernelGlobals; +struct OSLGlobals; +struct OSLShadingSystem; + class OSLShader { public: /* init */ - static void register_closures(OSL::ShadingSystem *ss); + static void register_closures(OSLShadingSystem *ss); /* per thread data */ - static void thread_init(KernelGlobals *kg); + static void thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OSLGlobals *osl_globals); static void thread_free(KernelGlobals *kg); /* eval */ @@ -82,6 +76,9 @@ public: /* release */ static void init(KernelGlobals *kg, ShaderData *sd); static void release(KernelGlobals *kg, ShaderData *sd); + + /* attributes */ + static int find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id); }; CCL_NAMESPACE_END diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index d08cb07fc3c..bd9f16d64ef 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -148,10 +148,9 @@ ObjectManager::~ObjectManager() { } -void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) +void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress) { float4 *objects = dscene->objects.resize(OBJECT_SIZE*scene->objects.size()); - uint *object_flag = dscene->object_flag.resize(scene->objects.size()); int i = 0; map surface_area_map; Scene::MotionType need_motion = scene->need_motion(device->info.advanced_shading); @@ -257,7 +256,6 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene } device->tex_alloc("__objects", dscene->objects); - device->tex_alloc("__object_flag", dscene->object_flag); dscene->data.bvh.have_motion = have_motion; } @@ -272,9 +270,12 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc if(scene->objects.size() == 0) return; + /* object info flag */ + uint *object_flag = dscene->object_flag.resize(scene->objects.size()); + /* set object transform matrices, before applying static transforms */ progress.set_status("Updating Objects", "Copying Transformations to device"); - device_update_transforms(device, dscene, scene, progress); + device_update_transforms(device, dscene, scene, object_flag, progress); if(progress.get_cancel()) return; @@ -282,10 +283,11 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc /* todo: do before to support getting object level coords? */ if(scene->params.bvh_type == SceneParams::BVH_STATIC) { progress.set_status("Updating Objects", "Applying Static Transformations"); - apply_static_transforms(scene, progress); + apply_static_transforms(scene, object_flag, progress); } - if(progress.get_cancel()) return; + /* allocate object flag */ + device->tex_alloc("__object_flag", dscene->object_flag); need_update = false; } @@ -299,7 +301,7 @@ void ObjectManager::device_free(Device *device, DeviceScene *dscene) dscene->object_flag.clear(); } -void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress) +void ObjectManager::apply_static_transforms(Scene *scene, uint *object_flag, Progress& progress) { /* todo: normals and displacement should be done before applying transform! */ /* todo: create objects/meshes in right order! */ @@ -312,6 +314,7 @@ void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress) #else bool motion_blur = false; #endif + int i = 0; foreach(Object *object, scene->objects) { map::iterator it = mesh_users.find(object->mesh); @@ -334,8 +337,12 @@ void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress) if(progress.get_cancel()) return; } + + object_flag[i] |= SD_TRANSFORM_APPLIED; } } + + i++; } } diff --git a/intern/cycles/render/object.h b/intern/cycles/render/object.h index 922c886d961..9c9b11bc29c 100644 --- a/intern/cycles/render/object.h +++ b/intern/cycles/render/object.h @@ -73,12 +73,12 @@ public: ~ObjectManager(); void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress); - void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress); + void device_update_transforms(Device *device, DeviceScene *dscene, Scene *scene, uint *object_flag, Progress& progress); void device_free(Device *device, DeviceScene *dscene); void tag_update(Scene *scene); - void apply_static_transforms(Scene *scene, Progress& progress); + void apply_static_transforms(Scene *scene, uint *object_flag, Progress& progress); }; CCL_NAMESPACE_END diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 2ec7e3d3775..e4ee40d881e 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -45,8 +45,6 @@ CCL_NAMESPACE_BEGIN OSLShaderManager::OSLShaderManager() { - thread_data_initialized = false; - services = new OSLRenderServices(); shading_system_init(); @@ -103,11 +101,6 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene scene->image_manager->set_osl_texture_system((void*)ts); device_update_common(device, dscene, scene, progress); - - if(!thread_data_initialized) { - og->thread_data_init(); - thread_data_initialized = true; - } } void OSLShaderManager::device_free(Device *device, DeviceScene *dscene) @@ -125,11 +118,6 @@ void OSLShaderManager::device_free(Device *device, DeviceScene *dscene) og->volume_state.clear(); og->displacement_state.clear(); og->background_state.reset(); - - if(thread_data_initialized) { - og->thread_data_free(); - thread_data_initialized = false; - } } void OSLShaderManager::texture_system_init() @@ -170,7 +158,7 @@ void OSLShaderManager::shading_system_init() const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]); ss->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes); - OSLShader::register_closures(ss); + OSLShader::register_closures((OSLShadingSystem*)ss); loaded_shaders.clear(); } diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h index 17934765155..08b5f8b89fb 100644 --- a/intern/cycles/render/osl.h +++ b/intern/cycles/render/osl.h @@ -73,8 +73,6 @@ protected: OSLRenderServices *services; OSL::ErrorHandler errhandler; set loaded_shaders; - - bool thread_data_initialized; }; #endif diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index 751d22b2f63..d7e9ec03df3 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -70,37 +70,6 @@ protected: bool joined; }; -/* Thread Local Storage - * - * Boost implementation is a bit slow, and Mac OS X __thread is not supported - * but the pthreads implementation is optimized, so we use these macros. */ - -#if defined(__APPLE__) || defined(_WIN32) - -#define tls_ptr(type, name) \ - pthread_key_t name -#define tls_set(name, value) \ - pthread_setspecific(name, value) -#define tls_get(type, name) \ - ((type*)pthread_getspecific(name)) -#define tls_create(type, name) \ - pthread_key_create(&name, NULL) -#define tls_delete(type, name) \ - pthread_key_delete(name); - -#else - -#define tls_ptr(type, name) \ - __thread type *name -#define tls_set(name, value) \ - name = value -#define tls_get(type, name) \ - name -#define tls_create(type, name) -#define tls_delete(type, name) - -#endif - CCL_NAMESPACE_END #endif /* __UTIL_THREAD_H__ */ -- cgit v1.2.3 From 9865ee7637cd58622329c7dbe05c78bc4fe65308 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 1 Dec 2012 22:00:25 +0000 Subject: Fix another cycles SVM issue with closures, was not using correct sample weight leading to some extra noise compared to a few revisions ago. --- intern/cycles/kernel/svm/svm_closure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 564c0957c68..b5bd2b42cb4 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -73,7 +73,7 @@ __device_inline ShaderClosure *svm_node_closure_get_bsdf(ShaderData *sd, float m #ifdef __MULTI_CLOSURE__ ShaderClosure *sc = &sd->closure[sd->num_closure]; float3 weight = sc->weight * mix_weight; - float sample_weight = fabsf(average(sc->weight)); + float sample_weight = fabsf(average(weight)); if(sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) { sc->weight = weight; -- cgit v1.2.3 From f7f4148b4004c225a30bb80794094b574fbea744 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Dec 2012 04:51:15 +0000 Subject: change uiButGetStrInfo() to use a trailing NULL arg rather then passing the number of args as an arg. --- doc/python_api/rst/info_tips_and_tricks.rst | 8 ++++++++ source/blender/editors/include/UI_interface.h | 2 +- source/blender/editors/interface/interface.c | 8 ++++---- source/blender/editors/interface/interface_handlers.c | 4 ++-- source/blender/editors/interface/interface_ops.c | 5 ++--- source/blender/editors/interface/interface_regions.c | 12 +++++++----- source/blender/python/mathutils/mathutils.c | 2 +- source/blender/python/mathutils/mathutils.h | 2 +- 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst index 521031f5e61..4dcbf431724 100644 --- a/doc/python_api/rst/info_tips_and_tricks.rst +++ b/doc/python_api/rst/info_tips_and_tricks.rst @@ -218,6 +218,14 @@ The next example is an equivalent single line version of the script above which ``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution. +If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have. + +.. code-block:: python + + import IPython + IPython.embed() + + Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know. .. note:: diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f5c943fbb87..12db9b93772 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -542,7 +542,7 @@ typedef struct uiStringInfo { /* Note: Expects pointers to uiStringInfo structs as parameters. * Will fill them with translated strings, when possible. * Strings in uiStringInfo must be MEM_freeN'ed by caller. */ -void uiButGetStrInfo(struct bContext *C, uiBut *but, int nbr, ...); +void uiButGetStrInfo(struct bContext *C, uiBut *but, ...); /* Edit i18n stuff. */ /* Name of the main py op from i18n addon. */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 9037afc472a..ce82e064531 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3797,16 +3797,16 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but) wm_event_add(win, &event); } -void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...) +void uiButGetStrInfo(bContext *C, uiBut *but, ...) { va_list args; + uiStringInfo *si; EnumPropertyItem *items = NULL, *item = NULL; int totitems, free_items = FALSE; - va_start(args, nbr); - while (nbr--) { - uiStringInfo *si = (uiStringInfo *) va_arg(args, void *); + va_start(args, but); + while ((si = (uiStringInfo *) va_arg(args, void *))) { int type = si->type; char *tmp = NULL; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ea53bbba70a..8aa35acc33c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4634,7 +4634,7 @@ static int ui_but_menu(bContext *C, uiBut *but) uiPopupMenu *pup; uiLayout *layout; int length; - char *name; + const char *name; uiStringInfo label = {BUT_GET_LABEL, NULL}; /* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/ @@ -4642,7 +4642,7 @@ static int ui_but_menu(bContext *C, uiBut *but) button_timers_tooltip_remove(C, but); - uiButGetStrInfo(C, but, 1, &label); + uiButGetStrInfo(C, but, &label, NULL); name = label.strinfo; pup = uiPupMenuBegin(C, name, ICON_NONE); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index e7a5f993d32..e57e52d74b6 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -960,7 +960,6 @@ static int edittranslation_exec(bContext *C, wmOperator *op) const char *root = U.i18ndir; const char *uilng = BLF_lang_get(); - const int bufs_nbr = 10; uiStringInfo but_label = {BUT_GET_LABEL, NULL}; uiStringInfo rna_label = {BUT_GET_RNA_LABEL, NULL}; uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL}; @@ -990,8 +989,8 @@ static int edittranslation_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - uiButGetStrInfo(C, but, bufs_nbr, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, - &rna_struct, &rna_prop, &rna_enum, &rna_ctxt); + uiButGetStrInfo(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, + &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); WM_operator_properties_create(&ptr, EDTSRC_I18N_OP_NAME); RNA_string_set(&ptr, "lang", uilng); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 7c099de9c1e..2c4f2e1d33b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -426,7 +426,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) rctf rect_fl; rcti rect_i; - const int nbr_info = 6; uiStringInfo but_tip = {BUT_GET_TIP, NULL}; uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL}; uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL}; @@ -440,7 +439,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - uiButGetStrInfo(C, but, nbr_info, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop); + uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop, NULL); /* special case, enum rna buttons only have enum item description, * use general enum description too before the specific one */ @@ -616,13 +615,16 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } #else if ((U.flag & USER_TOOLTIPS_PYTHON) == 0 && !but->optype && rna_struct.strinfo) { - if (rna_prop.strinfo) + if (rna_prop.strinfo) { /* Struct and prop */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), rna_struct.strinfo, rna_prop.strinfo); - else + } + else { /* Only struct (e.g. menus) */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), rna_struct.strinfo); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), + TIP_("Python: %s"), rna_struct.strinfo); + } data->color_id[data->totline] = UI_TIP_LC_PYTHON; data->totline++; } diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index a4a4010005a..bc9b747f05e 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -302,7 +302,7 @@ int EXPP_FloatsAreEqual(float af, float bf, int maxDiff) /*---------------------- EXPP_VectorsAreEqual ------------------------- * Builds on EXPP_FloatsAreEqual to test vectors */ -int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps) +int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps) { int x; for (x = 0; x < size; x++) { diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index d4673d14823..92a4aac7093 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -74,7 +74,7 @@ void BaseMathObject_dealloc(BaseMathObject * self); PyMODINIT_FUNC PyInit_mathutils(void); int EXPP_FloatsAreEqual(float A, float B, int floatSteps); -int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps); +int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int floatSteps); #define Py_NEW 1 #define Py_WRAP 2 -- cgit v1.2.3 From 04c27843ea7234b33569d3b993775cc83857020b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 2 Dec 2012 05:27:03 +0000 Subject: UI: revert the previous fix for middle click on button, conflicts with panning. --- .../blender/editors/interface/interface_handlers.c | 91 +++++++++++----------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 8aa35acc33c..b80025e0d77 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1886,7 +1886,6 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval = WM_UI_HANDLER_BREAK; break; case LEFTMOUSE: - case MIDDLEMOUSE: { /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */ if (data->searchbox) @@ -2250,11 +2249,11 @@ int ui_button_open_menu_direction(uiBut *but) static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->block->handle) { + else if (event->type == LEFTMOUSE && but->block->handle) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } @@ -2264,7 +2263,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + if (event->type == LEFTMOUSE && event->val != KM_PRESS) { if (!(but->flag & UI_SELECT)) data->cancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2278,7 +2277,7 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { but->drawstr[0] = 0; but->modifier_key = 0; button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); @@ -2339,7 +2338,7 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT); return WM_UI_HANDLER_BREAK; } @@ -2364,7 +2363,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { if (but->dt == UI_EMBOSSN && !event->ctrl) { /* pass */ } @@ -2389,7 +2388,7 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { data->togdual = event->ctrl; data->togonly = !event->shift; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2405,7 +2404,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->dragpoin) { + if (event->type == LEFTMOUSE && but->dragpoin) { if (ui_but_mouse_inside_icon(but, data->region, event)) { /* tell the button to wait and keep checking further events to @@ -2417,7 +2416,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE } } - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { int ret = WM_UI_HANDLER_BREAK; /* XXX (a bit ugly) Special case handling for filebrowser drag button */ if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) { @@ -2437,7 +2436,7 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE /* If the mouse has been pressed and released, getting to * this point without triggering a drag, then clear the * drag state for this button and continue to pass on the event */ - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_RELEASE) { + if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_CONTINUE; } @@ -2679,11 +2678,11 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton click = 1; } else if (event->val == KM_PRESS) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { + else if (event->type == LEFTMOUSE) { data->dragstartx = data->draglastx = ui_is_a_warp_but(but) ? screen_mx : mx; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); retval = WM_UI_HANDLER_BREAK; @@ -2706,7 +2705,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { if (data->dragchange) button_activate_state(C, but, BUTTON_STATE_EXIT); else @@ -2903,12 +2902,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton click = 2; } else if (event->val == KM_PRESS) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->ctrl) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); retval = WM_UI_HANDLER_BREAK; } /* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */ - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->alt) { + else if (event->type == LEFTMOUSE && event->alt) { int halfpos = BLI_rctf_cent_x(&but->rect); click = 2; if (mx < halfpos) @@ -2916,7 +2915,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton else mx = but->rect.xmax; } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { + else if (event->type == LEFTMOUSE) { data->dragstartx = mx; data->draglastx = mx; button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); @@ -2939,7 +2938,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { if (data->dragchange) button_activate_state(C, but, BUTTON_STATE_EXIT); else @@ -3031,7 +3030,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut if (data->state == BUTTON_STATE_HIGHLIGHT) { if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE)) { + if (event->type == LEFTMOUSE) { if (horizontal) { data->dragstartx = mx; data->draglastx = mx; @@ -3056,7 +3055,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } else if (event->type == MOUSEMOVE) { @@ -3077,7 +3076,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->dragpoin && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { if (ui_but_mouse_inside_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; @@ -3087,7 +3086,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm } /* regular open menu */ - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -3159,7 +3158,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm return WM_UI_HANDLER_BREAK; } - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_RELEASE) { + if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -3239,7 +3238,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3260,7 +3259,7 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3425,7 +3424,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3494,7 +3493,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3624,7 +3623,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -3704,7 +3703,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -3746,7 +3745,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { coba = (ColorBand *)but->poin; if (event->ctrl) { @@ -3786,7 +3785,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3908,7 +3907,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; CurveMapPoint *cmp; @@ -4013,7 +4012,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { if (data->dragsel != -1) { CurveMapping *cumap = (CurveMapping *)but->poin; CurveMap *cuma = cumap->cm + cumap->cur; @@ -4090,7 +4089,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4124,7 +4123,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4173,7 +4172,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4207,7 +4206,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4248,7 +4247,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4274,7 +4273,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -4298,7 +4297,7 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM4(event->type, LEFTMOUSE, MIDDLEMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { /* Calculate the size of the button */ width = abs(BLI_rctf_size_x(&but->rect)); height = abs(BLI_rctf_size_y(&but->rect)); @@ -4394,18 +4393,18 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE VECCOPY2D(but->linkto, event->mval); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); return WM_UI_HANDLER_BREAK; } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && but->block->handle) { + else if (event->type == LEFTMOUSE && but->block->handle) { button_activate_state(C, but, BUTTON_STATE_EXIT); return WM_UI_HANDLER_BREAK; } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + if (event->type == LEFTMOUSE && event->val != KM_PRESS) { if (!(but->flag & UI_SELECT)) data->cancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4465,7 +4464,7 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan ui_window_to_block(data->region, block, &mx, &my); if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val == KM_PRESS) { + if (event->type == LEFTMOUSE && event->val == KM_PRESS) { data->dragstartx = mx; data->dragstarty = my; data->draglastx = mx; @@ -4491,7 +4490,7 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan ui_numedit_apply(C, block, but, data); } } - else if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE) && event->val != KM_PRESS) { + else if (event->type == LEFTMOUSE && event->val != KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_EXIT); } return WM_UI_HANDLER_BREAK; @@ -5001,7 +5000,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) } /* verify if we can edit this button */ - if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RETKEY)) { + if (ELEM(event->type, LEFTMOUSE, RETKEY)) { /* this should become disabled button .. */ if (but->lock == TRUE) { if (but->lockstr) { -- cgit v1.2.3 From 82fc3319599b9c03ae37f09afc826fed7188df8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Dec 2012 07:13:19 +0000 Subject: There was no way of knowing what ID type a property comes from by the tooltip, (since copying the Data-Path doesn't include the ID the user had to guess). Now include the full python path to the property in the tool-tip. --- .../blender/editors/interface/interface_regions.c | 118 +++++++-------------- .../blender/editors/space_console/space_console.c | 9 +- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_access.c | 13 +++ 4 files changed, 56 insertions(+), 85 deletions(-) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 2c4f2e1d33b..c13aadee069 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -46,6 +46,7 @@ #include "BKE_context.h" #include "BKE_screen.h" +#include "BKE_idcode.h" #include "BKE_global.h" #include "WM_api.h" @@ -443,46 +444,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* special case, enum rna buttons only have enum item description, * use general enum description too before the specific one */ -#if 0 - if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { - const char *descr = RNA_property_description(but->rnaprop); - if (descr && descr[0]) { - BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0])); - data->color_id[data->totline] = UI_TIP_LC_MAIN; - data->totline++; - } - - if (ELEM(but->type, ROW, MENU)) { - EnumPropertyItem *item; - int totitem, free; - int value = (but->type == ROW) ? (int)but->hardmax : (int)ui_get_but_val(but); - - RNA_property_enum_items_gettexted(C, &but->rnapoin, but->rnaprop, &item, &totitem, &free); - - for (i = 0; i < totitem; i++) { - if (item[i].identifier[0] && item[i].value == value) { - if (item[i].description && item[i].description[0]) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", - item[i].name, item[i].description); - data->color_id[data->totline] = UI_TIP_LC_SUBMENU; - data->totline++; - } - break; - } - } - if (free) { - MEM_freeN(item); - } - } - } - - if (but->tip && but->tip[0] != '\0') { - BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0])); - data->color_id[data->totline] = UI_TIP_LC_MAIN; - data->totline++; - } -#else /* Tip */ if (but_tip.strinfo) { BLI_strncpy(data->lines[data->totline], but_tip.strinfo, sizeof(data->lines[0])); @@ -496,29 +458,13 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->color_id[data->totline] = UI_TIP_LC_SUBMENU; data->totline++; } -#endif -#if 0 - if (but->optype && !(but->block->flag & UI_BLOCK_LOOP)) { - /* operator keymap (not menus, they already have it) */ - prop = (but->opptr) ? but->opptr->data : NULL; - - if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE, - buf, sizeof(buf))) - { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); - data->color_id[data->totline] = UI_TIP_LC_NORMAL; - data->totline++; - } - } -#else /* Op shortcut */ if (op_keymap.strinfo) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), op_keymap.strinfo); data->color_id[data->totline] = UI_TIP_LC_NORMAL; data->totline++; } -#endif if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { /* full string */ @@ -552,15 +498,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->totline++; } } -#if 0 - /* rna info */ - if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), - RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); - data->color_id[data->totline] = UI_TIP_LC_PYTHON; - data->totline++; - } -#endif + if (but->rnapoin.id.data) { ID *id = but->rnapoin.id.data; if (id->lib && id->lib->name) { @@ -602,23 +540,12 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } } } -#if 0 - else if (ELEM(but->type, MENU, PULLDOWN)) { - if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - MenuType *mt = uiButGetMenuType(but); - if (mt) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname); - data->color_id[data->totline] = UI_TIP_LC_PYTHON; - data->totline++; - } - } - } -#else if ((U.flag & USER_TOOLTIPS_PYTHON) == 0 && !but->optype && rna_struct.strinfo) { if (rna_prop.strinfo) { /* Struct and prop */ BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), - TIP_("Python: %s.%s"), rna_struct.strinfo, rna_prop.strinfo); + TIP_("Python: %s.%s"), + rna_struct.strinfo, rna_prop.strinfo); } else { /* Only struct (e.g. menus) */ @@ -627,8 +554,41 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) } data->color_id[data->totline] = UI_TIP_LC_PYTHON; data->totline++; + + if (but->rnapoin.id.data) { + /* this could get its own 'BUT_GET_...' type */ + PointerRNA *ptr = &but->rnapoin; + PropertyRNA *prop = but->rnaprop; + ID *id = ptr->id.data; + + char *id_path; + char *data_path = NULL; + + /* never fails */ + id_path = RNA_path_from_ID_python(id); + + if (ptr->id.data && ptr->data && prop) { + data_path = RNA_path_from_ID_to_property(ptr, prop); + } + + if (data_path) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), + "%s.%s", /* no need to translate */ + id_path, data_path); + MEM_freeN(data_path); + } + else if (prop) { + /* can't find the path. be explicit in our ignorance "..." */ + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), + "%s ... %s", /* no need to translate */ + id_path, rna_prop.strinfo ? rna_prop.strinfo : RNA_property_identifier(prop)); + } + MEM_freeN(id_path); + + data->color_id[data->totline] = UI_TIP_LC_PYTHON; + data->totline++; + } } -#endif /* Free strinfo's... */ if (but_tip.strinfo) @@ -644,7 +604,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (rna_prop.strinfo) MEM_freeN(rna_prop.strinfo); - assert(data->totline < MAX_TOOLTIP_LINES); + BLI_assert(data->totline < MAX_TOOLTIP_LINES); if (data->totline == 0) { MEM_freeN(data); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 75add570708..be8febdab23 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -170,16 +170,13 @@ static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event static void id_drop_copy(wmDrag *drag, wmDropBox *drop) { - char text[64]; + char *text; ID *id = drag->poin; - char id_esc[(sizeof(id->name) - 2) * 2]; - - BLI_strescape(id_esc, id->name + 2, sizeof(id_esc)); - - BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); /* copy drag path to properties */ + text = RNA_path_from_ID_python(id); RNA_string_set(drop->ptr, "text", text); + MEM_freeN(text); } static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 2b68cc8bdc1..0e5f9c5fa5f 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -862,6 +862,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, char *RNA_path_from_ID_to_struct(PointerRNA *ptr); char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop); +char *RNA_path_from_ID_python(struct ID *id); /* Quick name based property access * diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 470e87daeea..7ec9aebab3b 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4163,6 +4163,19 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop) return path; } +/** + * Get the ID as a python representation, eg: + * bpy.data.foo["bar"] + */ +char *RNA_path_from_ID_python(ID *id) +{ + char id_esc[(sizeof(id->name) - 2) * 2]; + + BLI_strescape(id_esc, id->name + 2, sizeof(id_esc)); + + return BLI_sprintfN("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); +} + /* Quick name based property access */ int RNA_boolean_get(PointerRNA *ptr, const char *name) -- cgit v1.2.3 From b8d822eb354a593584aa382d716cec8dd197aeb8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 2 Dec 2012 08:25:40 +0000 Subject: Fix performance issue in OSL geometry node, compiler fails to optimize out the tangent computation, tweaked the code so this works. --- intern/cycles/kernel/shaders/node_geometry.osl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl index 3940b98eec1..5a784f951bb 100644 --- a/intern/cycles/kernel/shaders/node_geometry.osl +++ b/intern/cycles/kernel/shaders/node_geometry.osl @@ -51,7 +51,12 @@ shader node_geometry( /* try to create spherical tangent from generated coordinates */ if (getattribute("geom:generated", generated)) { - vector T = vector(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0); + matrix project = matrix(0.0, 1.0, 0.0, 0.0, + -1.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.5, -0.5, 0.0, 1.0); + + vector T = transform(project, generated); T = transform("object", "world", T); Tangent = cross(Normal, normalize(cross(T, Normal))); } -- cgit v1.2.3 From 6b03e9bc4720c8fc9e0aabd8ceea18792c2bde2c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 2 Dec 2012 08:25:53 +0000 Subject: Fix #33376: non-square DDS textures were mapped wrong in the viewport / game engine. --- source/blender/gpu/intern/gpu_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index f2ddedcd76c..bcdbfe781f8 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -721,8 +721,8 @@ int GPU_upload_dxt_texture(ImBuf *ibuf) GLint format = 0; int blocksize, height, width, i, size, offset = 0; - height = ibuf->x; - width = ibuf->y; + width = ibuf->x; + height = ibuf->y; if (GLEW_EXT_texture_compression_s3tc) { if (ibuf->dds_data.fourcc == FOURCC_DXT1) -- cgit v1.2.3 From 3d6bc1e1f4d33f28b88111ed909b6a95c9c15843 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 2 Dec 2012 09:54:44 +0000 Subject: Fix warning about missing BKE_idcode_to_name_plural. --- source/blender/makesrna/intern/rna_access.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 7ec9aebab3b..488dbffc3db 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -46,6 +46,7 @@ #include "BKE_animsys.h" #include "BKE_context.h" +#include "BKE_idcode.h" #include "BKE_idprop.h" #include "BKE_main.h" #include "BKE_report.h" -- cgit v1.2.3 From 1d09d0a9c5afdc371e47a80b92ee439db12dafd1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 2 Dec 2012 13:35:33 +0000 Subject: Silent some warnings (the one in bmesh_operator.c was even preventing build in -Werror mode). --- intern/ghost/intern/GHOST_NDOFManagerX11.cpp | 4 ++-- source/blender/bmesh/intern/bmesh_operators.c | 2 +- source/blender/collada/TransformReader.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp index 49e7def8730..468a37de633 100644 --- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp +++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp @@ -90,8 +90,8 @@ bool GHOST_NDOFManagerX11::processEvents() case SPNAV_EVENT_MOTION: { /* convert to blender view coords */ - short t[3] = {e.motion.x, e.motion.y, -e.motion.z}; - short r[3] = {-e.motion.rx, -e.motion.ry, e.motion.rz}; + short t[3] = {(short)e.motion.x, (short)e.motion.y, (short)-e.motion.z}; + short r[3] = {(short)-e.motion.rx, (short)-e.motion.ry, (short)e.motion.rz}; updateTranslation(t, now); updateRotation(r, now); diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index ba38f230f0b..baec0b7745d 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -256,7 +256,7 @@ BMOpSlot *BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identif if (UNLIKELY(slot_code < 0)) { //return &BMOpEmptySlot; BLI_assert(0); - NULL; /* better crash */ + return NULL; /* better crash */ } return &slot_args[slot_code]; diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index d10cd7378e9..61793589422 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -84,7 +84,7 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[ COLLADAFW::Rotate *ro = (COLLADAFW::Rotate *)tm; COLLADABU::Math::Vector3& axis = ro->getRotationAxis(); const float angle = (float)DEG2RAD(ro->getRotationAngle()); - const float ax[] = {axis[0], axis[1], axis[2]}; + const float ax[] = {(float)axis[0], (float)axis[1], (float)axis[2]}; // float quat[4]; // axis_angle_to_quat(quat, axis, angle); // quat_to_mat4(m, quat); -- cgit v1.2.3 From bc3f34b4e8fb6139a51b0c101c80bed3aca91146 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 2 Dec 2012 14:41:42 +0000 Subject: =?UTF-8?q?Compositor:=20*=20Change=20default=20blur=20type=20(Blu?= =?UTF-8?q?r=20Node)=20to=20Gaussian.=20Feature=20Request=20by=20Sebastian?= =?UTF-8?q?=20K=C3=B6nig.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Troy Sobotka, approved by Campbell, Sergey and myself. --- source/blender/nodes/composite/nodes/node_composite_blur.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index b9b2406631b..40c94150ab5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -726,7 +726,9 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) { - node->storage = MEM_callocN(sizeof(NodeBlurData), "node blur data"); + NodeBlurData* pNodeBlurData = MEM_callocN(sizeof(NodeBlurData), "node blur data"); + pNodeBlurData->filtertype = R_FILTER_GAUSS; + node->storage = pNodeBlurData; } void register_node_type_cmp_blur(bNodeTreeType *ttype) -- cgit v1.2.3 From d7960b8fd4adf5e066e0040203d1595d9b6dfc52 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Dec 2012 15:15:00 +0000 Subject: code cleanup --- source/blender/nodes/composite/nodes/node_composite_blur.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c index 40c94150ab5..eb7f7763afb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.c +++ b/source/blender/nodes/composite/nodes/node_composite_blur.c @@ -726,9 +726,9 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp)) { - NodeBlurData* pNodeBlurData = MEM_callocN(sizeof(NodeBlurData), "node blur data"); - pNodeBlurData->filtertype = R_FILTER_GAUSS; - node->storage = pNodeBlurData; + NodeBlurData *data = MEM_callocN(sizeof(NodeBlurData), "node blur data"); + data->filtertype = R_FILTER_GAUSS; + node->storage = data; } void register_node_type_cmp_blur(bNodeTreeType *ttype) -- cgit v1.2.3 From ecf89326e1f2650fe8fcd792f9bdabf3397e460d Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 2 Dec 2012 15:15:44 +0000 Subject: == FFMPEG == This fixes a memory leak caused by the last packet on stream EOF not freed. (Memory leak occurs on ffmpeg heap managed by av_malloc / av_free, so it is invisible to Blender) Also: clean up the code a little bit (anim->next_packet was never really used, so could be moved into a local variable) --- source/blender/imbuf/intern/IMB_anim.h | 1 - source/blender/imbuf/intern/anim_movie.c | 59 +++++++++++++------------------- source/blender/imbuf/intern/indexer.c | 9 +++-- 3 files changed, 30 insertions(+), 39 deletions(-) diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index ed349e8f7eb..684a1476e44 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -178,7 +178,6 @@ struct anim { struct ImBuf *last_frame; int64_t last_pts; int64_t next_pts; - AVPacket next_packet; #endif #ifdef WITH_REDCODE diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 5b64416c309..900ad6c6313 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -557,7 +557,6 @@ static int startffmpeg(struct anim *anim) anim->last_frame = 0; anim->last_pts = -1; anim->next_pts = -1; - anim->next_packet.stream_index = -1; anim->pFormatCtx = pFormatCtx; anim->pCodecCtx = pCodecCtx; @@ -764,41 +763,39 @@ static void ffmpeg_postprocess(struct anim *anim) } } -/* decode one video frame also considering the packet read into next_packet */ +/* decode one video frame */ static int ffmpeg_decode_video_frame(struct anim *anim) { int rval = 0; + AVPacket next_packet; + + memset(&next_packet, 0, sizeof(AVPacket)); av_log(anim->pFormatCtx, AV_LOG_DEBUG, " DECODE VIDEO FRAME\n"); - if (anim->next_packet.stream_index == anim->videoStream) { - av_free_packet(&anim->next_packet); - anim->next_packet.stream_index = -1; - } - - while ((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) { + while ((rval = av_read_frame(anim->pFormatCtx, &next_packet)) >= 0) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, "%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld " "%s\n", - (anim->next_packet.stream_index == anim->videoStream) + (next_packet.stream_index == anim->videoStream) ? "->" : " ", - anim->next_packet.stream_index, + next_packet.stream_index, anim->videoStream, - (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1 : - (long long int)anim->next_packet.dts, - (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1 : - (long long int)anim->next_packet.pts, - (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? + (next_packet.dts == AV_NOPTS_VALUE) ? -1 : + (long long int)next_packet.dts, + (next_packet.pts == AV_NOPTS_VALUE) ? -1 : + (long long int)next_packet.pts, + (next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); - if (anim->next_packet.stream_index == anim->videoStream) { + if (next_packet.stream_index == anim->videoStream) { anim->pFrameComplete = 0; avcodec_decode_video2( anim->pCodecCtx, anim->pFrame, &anim->pFrameComplete, - &anim->next_packet); + &next_packet); if (anim->pFrameComplete) { anim->next_pts = av_get_pts_from_frame( @@ -816,20 +813,24 @@ static int ffmpeg_decode_video_frame(struct anim *anim) break; } } - av_free_packet(&anim->next_packet); - anim->next_packet.stream_index = -1; + av_free_packet(&next_packet); } + + /* this sets size and data fields to zero, + which is necessary to decode the remaining data + in the decoder engine after EOF. It also prevents a memory + leak, since av_read_frame spills out a full size packet even + on EOF... (and: it's save to call on NULL packets) */ + + av_free_packet(&next_packet); if (rval == AVERROR_EOF) { - anim->next_packet.size = 0; - anim->next_packet.data = 0; - anim->pFrameComplete = 0; avcodec_decode_video2( anim->pCodecCtx, anim->pFrame, &anim->pFrameComplete, - &anim->next_packet); + &next_packet); if (anim->pFrameComplete) { anim->next_pts = av_get_pts_from_frame( @@ -849,8 +850,6 @@ static int ffmpeg_decode_video_frame(struct anim *anim) } if (rval < 0) { - anim->next_packet.stream_index = -1; - av_log(anim->pFormatCtx, AV_LOG_ERROR, " DECODE READ FAILED: av_read_frame() " "returned error: %d\n", rval); @@ -1087,13 +1086,6 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, anim->next_pts = -1; - if (anim->next_packet.stream_index == anim->videoStream) { - av_free_packet(&anim->next_packet); - anim->next_packet.stream_index = -1; - } - - /* memset(anim->pFrame, ...) ?? */ - if (ret >= 0) { ffmpeg_decode_video_frame_scan(anim, pts_to_search); } @@ -1140,9 +1132,6 @@ static void free_anim_ffmpeg(struct anim *anim) av_free(anim->pFrameDeinterlaced); sws_freeContext(anim->img_convert_ctx); IMB_freeImBuf(anim->last_frame); - if (anim->next_packet.stream_index != -1) { - av_free_packet(&anim->next_packet); - } } anim->duration = 0; } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 38bd28452f3..277f50bcdbc 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -912,6 +912,8 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, AVPacket next_packet; uint64_t stream_size; + memset(&next_packet, 0, sizeof(AVPacket)); + in_frame = avcodec_alloc_frame(); stream_size = avio_size(context->iFormatCtx->pb); @@ -959,12 +961,13 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, * according to ffmpeg docs using 0-size packets. * * At least, if we haven't already stopped... */ + + /* this creates the 0-size packet and prevents a memory leak. */ + av_free_packet(&next_packet); + if (!*stop) { int frame_finished; - next_packet.size = 0; - next_packet.data = 0; - do { frame_finished = 0; -- cgit v1.2.3 From 432193552c43b9ab4546b72064390a373a3293e1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Dec 2012 15:58:26 +0000 Subject: fix GhostSDL displaying text in multiple views. add support for multi-sample. --- intern/ghost/intern/GHOST_SystemSDL.cpp | 2 +- intern/ghost/intern/GHOST_WindowSDL.cpp | 28 +++++++++++++++++------- source/blender/editors/space_view3d/drawobject.c | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index 237d4c0f787..fdc4f33b784 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -73,7 +73,7 @@ GHOST_SystemSDL::createWindow(const STR_String& title, { GHOST_WindowSDL *window = NULL; - window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1); + window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, numOfAASamples); if (window) { if (GHOST_kWindowStateFullScreen == state) { diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp index 369fc4ace14..6641b28a20e 100644 --- a/intern/ghost/intern/GHOST_WindowSDL.cpp +++ b/intern/ghost/intern/GHOST_WindowSDL.cpp @@ -26,6 +26,7 @@ #include "GHOST_WindowSDL.h" #include "SDL_mouse.h" +#include #include static SDL_GLContext s_firstContext = NULL; @@ -48,6 +49,20 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system, m_invalid_window(false), m_sdl_custom_cursor(NULL) { + SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); + + if (numOfAASamples) { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, numOfAASamples); + } + + /* creating the window _must_ come after setting attributes */ m_sdl_win = SDL_CreateWindow(title, left, top, @@ -55,14 +70,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system, height, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); + m_sdl_glcontext = SDL_GL_CreateContext(m_sdl_win); @@ -164,6 +172,10 @@ GHOST_WindowSDL::activateDrawingContext() if (m_sdl_glcontext != NULL) { int status = SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext); (void)status; + /* Disable AA by default */ + if (m_numOfAASamples > 0) { + glDisable(GL_MULTISAMPLE_ARB); + } return GHOST_kSuccess; } return GHOST_kFailure; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 08ba4fb59bc..4a89deca162 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2579,7 +2579,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS BMIter iter; int i; - /* make the precision of the pronted value proportionate to the gridsize */ + /* make the precision of the display value proportionate to the gridsize */ if (grid < 0.01f) conv_float = "%.6g"; else if (grid < 0.1f) conv_float = "%.5g"; -- cgit v1.2.3 From 818a345be3fd8378df7ec85501f0401bd0728845 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 2 Dec 2012 16:01:06 +0000 Subject: Silent a bunch of gcc warnings (usually dummy, but noisy!). --- .../audaspace/intern/AUD_LinearResampleReader.cpp | 2 +- source/blender/blenkernel/intern/dynamicpaint.c | 4 ++- source/blender/blenkernel/intern/editderivedmesh.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 12 ++++++-- source/blender/bmesh/operators/bmo_extrude.c | 4 +-- source/blender/bmesh/operators/bmo_symmetrize.c | 1 + source/blender/bmesh/operators/bmo_utils.c | 32 +++++++++++----------- source/blender/bmesh/tools/bmesh_bevel.c | 3 ++ .../blender/bmesh/tools/bmesh_decimate_collapse.c | 1 + source/blender/collada/collada_utils.cpp | 4 +-- source/blender/compositor/nodes/COM_ScaleNode.cpp | 2 +- .../editors/interface/interface_templates.c | 11 +++----- .../editors/transform/transform_conversions.c | 4 +-- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- source/blender/imbuf/intern/divers.c | 2 +- .../composite/nodes/node_composite_outputFile.c | 2 +- 16 files changed, 49 insertions(+), 39 deletions(-) diff --git a/intern/audaspace/intern/AUD_LinearResampleReader.cpp b/intern/audaspace/intern/AUD_LinearResampleReader.cpp index 6aa0faed863..b342b8f31fb 100644 --- a/intern/audaspace/intern/AUD_LinearResampleReader.cpp +++ b/intern/audaspace/intern/AUD_LinearResampleReader.cpp @@ -81,7 +81,7 @@ void AUD_LinearResampleReader::read(int& length, bool& eos, sample_t* buffer) int samplesize = AUD_SAMPLE_SIZE(specs); int size = length; float factor = m_rate / m_reader->getSpecs().rate; - float spos; + float spos = 0.0f; sample_t low, high; eos = false; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index bb3836e3c08..ed85e5b627b 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3366,7 +3366,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, (!hit_found || (brush->flags & MOD_DPAINT_INVERSE_PROX))) { float proxDist = -1.0f; - float hitCo[3]; + float hitCo[3] = {0.0f, 0.0f, 0.0f}; short hQuad; int face; @@ -3723,6 +3723,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, float smooth_range = smooth * (1.0f - strength), dist; /* calculate max range that can have particles with higher influence than the nearest one */ float max_range = smooth - strength * smooth + solidradius; + /* Make gcc happy! */ + dist = max_range; particles = BLI_kdtree_range_search(tree, max_range, bData->realCoord[bData->s_pos[index]].v, NULL, &nearest); diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 321a61ce238..d7b29a262a0 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -189,7 +189,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm) #endif /* USE_TESSFACE_SPEEDUP */ else { - ScanFillVert *sf_vert, *sf_vert_last = NULL, *sf_vert_first = NULL; + ScanFillVert *sf_vert = NULL, *sf_vert_last = NULL, *sf_vert_first = NULL; /* ScanFillEdge *e; */ /* UNUSED */ ScanFillFace *sf_tri; int totfilltri; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index a780a9e8684..90889d7c09e 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2140,16 +2140,22 @@ static void psys_update_effectors(ParticleSimulationData *sim) precalc_guides(sim, sim->psys->effectors); } -static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, void (*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), void *forcedata) +static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, + void (*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), + void *forcedata) { +#define ZERO_F43 {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}} + ParticleKey states[5]; - float force[3],acceleration[3],impulse[3],dx[4][3],dv[4][3],oldpos[3]; + float force[3], acceleration[3], impulse[3], dx[4][3] = ZERO_F43, dv[4][3] = ZERO_F43, oldpos[3]; float pa_mass= (part->flag & PART_SIZEMASS ? part->mass * pa->size : part->mass); int i, steps=1; int integrator = part->integrator; +#undef ZERO_F43 + copy_v3_v3(oldpos, pa->state.co); - + /* Verlet integration behaves strangely with moving emitters, so do first step with euler. */ if (pa->prev_state.time < 0.f && integrator == PART_INT_VERLET) integrator = PART_INT_EULER; diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 065a1b57737..45c937d8bba 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -55,8 +55,8 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op) BMIter liter, liter2; BMFace *f, *f2, *f3; BMLoop *l, *l2, *l3, *l4, *l_tmp; - BMEdge **edges = NULL, *e, *laste; - BMVert *v, *lastv, *firstv; + BMEdge **edges = NULL, *e, *laste = NULL; + BMVert *v = NULL, *lastv, *firstv; BLI_array_declare(edges); int i; diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c index 248c7268ac6..ee0717d177b 100644 --- a/source/blender/bmesh/operators/bmo_symmetrize.c +++ b/source/blender/bmesh/operators/bmo_symmetrize.c @@ -178,6 +178,7 @@ static void symm_split_asymmetric_edges(Symm *symm) plane_co[symm->axis][2], &lambda, TRUE); BLI_assert(r); + (void)r; madd_v3_v3v3fl(co, e->v1->co, edge_dir, lambda); co[symm->axis] = 0; diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 64dbf0cc0e7..34b2e96f82d 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -494,10 +494,10 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op) BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) { if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) { if (use_ccw == FALSE) { /* same loops direction */ - BMLoop *lf; /* current face loops */ - MLoopUV *f_luv; /* first face loop uv */ - float p_uv[2]; /* previous uvs */ - float t_uv[2]; /* tmp uvs */ + BMLoop *lf; /* current face loops */ + MLoopUV *f_luv = NULL; /* first face loop uv */ + float p_uv[2] = {0.0f, 0.0f}; /* previous uvs */ + float t_uv[2]; /* tmp uvs */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -518,10 +518,10 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op) copy_v2_v2(f_luv->uv, p_uv); } else { /* counter loop direction */ - BMLoop *lf; /* current face loops */ - MLoopUV *p_luv; /* previous loop uv */ - MLoopUV *luv; - float t_uv[2]; /* current uvs */ + BMLoop *lf; /* current face loops */ + MLoopUV *p_luv; /* previous loop uv */ + MLoopUV *luv = NULL; + float t_uv[2] = {0.0f, 0.0f}; /* current uvs */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -599,10 +599,10 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op) BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) { if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) { if (use_ccw == FALSE) { /* same loops direction */ - BMLoop *lf; /* current face loops */ - MLoopCol *f_lcol; /* first face loop color */ - MLoopCol p_col; /* previous color */ - MLoopCol t_col; /* tmp color */ + BMLoop *lf; /* current face loops */ + MLoopCol *f_lcol = NULL; /* first face loop color */ + MLoopCol p_col; /* previous color */ + MLoopCol t_col; /* tmp color */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -623,10 +623,10 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op) *f_lcol = p_col; } else { /* counter loop direction */ - BMLoop *lf; /* current face loops */ - MLoopCol *p_lcol; /* previous loop color */ - MLoopCol *lcol; - MLoopCol t_col; /* current color */ + BMLoop *lf; /* current face loops */ + MLoopCol *p_lcol; /* previous loop color */ + MLoopCol *lcol = NULL; + MLoopCol t_col; /* current color */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 86509acb1fb..b52525c1780 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -381,6 +381,8 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, int iret; BLI_assert(f1 != NULL && f2 != NULL); + (void)f1; + (void)f2; /* get direction vectors for two offset lines */ sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co); @@ -879,6 +881,7 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) ns = vm->seg; ns2 = ns / 2; BLI_assert(n > 2 && ns > 1); + (void)n; /* Make initial rings, going between points on neighbors. * After this loop, will have coords for all (i, r, k) where * BoundVert for i has a bevel, 0 <= r <= ns2, 0 <= k <= ns */ diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 7c054d84405..35bf176518c 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -703,6 +703,7 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e ok = BM_edge_loop_pair(e_clear, &l_a, &l_b); BLI_assert(ok == TRUE); + (void)ok; BLI_assert(l_a->f->len == 3); BLI_assert(l_b->f->len == 3); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 35844b549de..7bdda387d5e 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -139,7 +139,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e { Mesh *tmpmesh; CustomDataMask mask = CD_MASK_MESH; - DerivedMesh *dm; + DerivedMesh *dm = NULL; switch (export_mesh_type) { case BC_MESH_TYPE_VIEW: { dm = mesh_create_derived_view(scene, ob, mask); @@ -151,7 +151,7 @@ Mesh *bc_to_mesh_apply_modifiers(Scene *scene, Object *ob, BC_export_mesh_type e } } - tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here + tmpmesh = BKE_mesh_add("ColladaMesh"); // name is not important here DM_to_mesh(dm, tmpmesh, ob); dm->release(dm); return tmpmesh; diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp index d535e71a33c..6f7bd33db6f 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cpp +++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp @@ -39,7 +39,7 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c InputSocket *inputXSocket = this->getInputSocket(1); InputSocket *inputYSocket = this->getInputSocket(2); OutputSocket *outputSocket = this->getOutputSocket(0); - BaseScaleOperation *scaleoperation; + BaseScaleOperation *scaleoperation = NULL; bNode *bnode = this->getbNode(); switch (bnode->custom1) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 61d14bf3bb7..e01e6bdd49e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2084,19 +2084,19 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna PropertyRNA *prop = RNA_struct_find_property(ptr, propname); uiBlock *block = uiLayoutGetBlock(layout); uiLayout *col, *row; - uiBut *but; + uiBut *but = NULL; float softmin, softmax, step, precision; - + if (!prop) { RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); - + col = uiLayoutColumn(layout, TRUE); row = uiLayoutRow(col, TRUE); - + switch (U.color_picker_type) { case USER_CP_CIRCLE: but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, @@ -2115,7 +2115,6 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna -1, 0.0, 0.0, UI_GRAD_HV, 0, ""); break; } - if (lock) { but->flag |= UI_BUT_COLOR_LOCK; @@ -2133,7 +2132,6 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna if (value_slider) { - switch (U.color_picker_type) { case USER_CP_CIRCLE: uiItemS(row); @@ -2156,7 +2154,6 @@ void uiTemplateColorPicker(uiLayout *layout, PointerRNA *ptr, const char *propna -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); break; } - } } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 51efa2b0e40..9a5f32a8772 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2367,8 +2367,8 @@ static void createTransUVs(bContext *C, TransInfo *t) BMFace *efa; BMLoop *l; BMIter iter, liter; - UvElementMap *elementmap; - char *island_enabled; + UvElementMap *elementmap = NULL; + char *island_enabled = NULL; int count = 0, countsel = 0, count_rejected = 0; int propmode = t->flag & T_PROP_EDIT; int propconnected = t->flag & T_PROP_CONNECTED; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 1eec06eee75..1f3f21967f4 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -232,7 +232,7 @@ static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh BLI_srand(0); BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first; + ScanFillVert *sf_vert = NULL, *sf_vert_last, *sf_vert_first; ScanFillFace *sf_tri; ParamKey key, vkeys[4]; ParamBool pin[4], select[4]; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 8d289de9970..f049c404e2d 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -196,7 +196,7 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from, { float tmp[4]; int x, y; - DitherContext *di; + DitherContext *di = NULL; /* we need valid profiles */ BLI_assert(profile_to != IB_PROFILE_NONE); diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 656e2a72c03..214617c91e5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -242,7 +242,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack ImageFormatData *format = (sockdata->use_node_format ? &nimf->format : &sockdata->format); char path[FILE_MAX]; char filename[FILE_MAX]; - CompBuf *cbuf; + CompBuf *cbuf = NULL; ImBuf *ibuf; switch (format->planes) { -- cgit v1.2.3 From e8331327e51cda1d853e7111e9da2df45193e948 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Sun, 2 Dec 2012 19:20:19 +0000 Subject: Bugfix [#33387] Smoke: Animating Smoke Type from Flow to None crashes blender This property was never intended to be animatable. Workaround: Animate density. TODO for 2.66: Introduce on/off property for flow and collision objects --- source/blender/makesrna/intern/rna_modifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 06df6c5afbc..a2b0945fb46 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2207,6 +2207,7 @@ static void rna_def_modifier_smoke(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_smoke_type_items); RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Smoke_set_type"); } -- cgit v1.2.3 From 4e7a4960f701ffef5665872e0e6ace6bb25e68a9 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 2 Dec 2012 20:08:11 +0000 Subject: get rid of annoying redefinition warning on cycles compilation for mingw64 --- intern/cycles/util/util_types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index fe530d727ad..3d246104ddc 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -41,7 +41,9 @@ #define __align(...) __declspec(align(__VA_ARGS__)) #else #define __device_inline static inline __attribute__((always_inline)) +#ifndef FREE_WINDOWS64 #define __forceinline inline __attribute__((always_inline)) +#endif #define __align(...) __attribute__((aligned(__VA_ARGS__))) #endif -- cgit v1.2.3 From 11e87d118ee157537fb3f107227563c279ffaea6 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Mon, 3 Dec 2012 01:46:37 +0000 Subject: Bevel: fix for bulging part of bug 33280. Bulging still happens, but fixed the cases where it was obvious because it destroys an otherwise straight 'pipe' by snapping the vertex mesh points to that pipe. --- source/blender/bmesh/tools/bmesh_bevel.c | 241 ++++++++++++++++--------------- 1 file changed, 126 insertions(+), 115 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index b52525c1780..aafba124c92 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -571,100 +571,11 @@ static void get_point_on_round_edge(const float uv[2], #else /* USE_ALTERNATE_ADJ */ -#ifdef OLD_ROUND_EDGE -/* - * calculation of points on the round profile - * r - result, coordinate of point on round profile - * method: - * Inscribe a circle in angle va - v -vb - * such that it touches the arms at offset from v. - * Rotate the center-va segment by (i/n) of the - * angle va - center -vb, and put the endpoint - * of that segment in r. - */ -static void get_point_on_round_profile(float r_co[3], float offset, int k, int count, - const float va[3], const float v[3], const float vb[3]) -{ - float vva[3], vvb[3], angle, center[3], rv[3], axis[3], co[3]; - - sub_v3_v3v3(vva, va, v); - sub_v3_v3v3(vvb, vb, v); - normalize_v3(vva); - normalize_v3(vvb); - angle = angle_normalized_v3v3(vva, vvb); - - add_v3_v3v3(center, vva, vvb); - normalize_v3(center); - mul_v3_fl(center, offset * (1.0f / cosf(0.5f * angle))); - add_v3_v3(center, v); /* coordinates of the center of the inscribed circle */ - - - sub_v3_v3v3(rv, va, center); /* radius vector */ - - - sub_v3_v3v3(co, v, center); - cross_v3_v3v3(axis, rv, co); /* calculate axis */ - - sub_v3_v3v3(vva, va, center); - sub_v3_v3v3(vvb, vb, center); - angle = angle_v3v3(vva, vvb); - - rotate_v3_v3v3fl(co, rv, axis, angle * (float)k / (float)count); - - add_v3_v3(co, center); - copy_v3_v3(r_co, co); -} - -/* - * Find the point (/n) of the way around the round profile for e, - * where start point is va, midarc point is vmid, and end point is vb. - * Return the answer in profileco. - * Method: - * Adjust va and vb (along edge direction) so that they are perpendicular - * to edge at v, then use get_point_on_round_profile, then project - * back onto original va - vmid - vb plane. - * If va, vmid, and vb are all on the same plane, just interpolate between va and vb. - */ -static void get_point_on_round_edge(EdgeHalf *e, int k, - const float va[3], const float vmid[3], const float vb[3], - float r_co[3]) -{ - float vva[3], vvb[3], point[3], dir[3], vaadj[3], vbadj[3], p2[3], pn[3]; - int n = e->seg; - - sub_v3_v3v3(vva, va, vmid); - sub_v3_v3v3(vvb, vb, vmid); - if (e->is_rev) - sub_v3_v3v3(dir, e->e->v1->co, e->e->v2->co); - else - sub_v3_v3v3(dir, e->e->v2->co, e->e->v1->co); - normalize_v3(dir); - if (fabsf(angle_v3v3(vva, vvb) - (float)M_PI) > 100.f *(float)BEVEL_EPSILON) { - copy_v3_v3(vaadj, va); - madd_v3_v3fl(vaadj, dir, -len_v3(vva) * cosf(angle_v3v3(vva, dir))); - copy_v3_v3(vbadj, vb); - madd_v3_v3fl(vbadj, dir, -len_v3(vvb) * cosf(angle_v3v3(vvb, dir))); - - get_point_on_round_profile(point, e->offset, k, n, vaadj, vmid, vbadj); - - add_v3_v3v3(p2, point, dir); - cross_v3_v3v3(pn, vva, vvb); - if (!isect_line_plane_v3(r_co, point, p2, vmid, pn, 0)) { - /* TODO: track down why this sometimes fails */ - copy_v3_v3(r_co, point); - } - } - else { - /* planar case */ - interp_v3_v3v3(r_co, va, vb, (float)k / (float)n); - } -} -#else - -/* - * Find the point (/n) of the way around the round profile for e, - * where start point is va, midarc point is vmid, and end point is vb. - * Return the answer in profileco. +/* Fill matrix r_mat so that a point in the sheared parallelogram with corners + * va, vmid, vb (and the 4th that is implied by it being a parallelogram) + * is transformed to the unit square by multiplication with r_mat. + * If it can't be done because the parallelogram is degenerate, return FALSE + * else return TRUE. * Method: * Find vo, the origin of the parallelogram with other three points va, vmid, vb. * Also find vd, which is in direction normal to parallelogram and 1 unit away @@ -676,16 +587,14 @@ static void get_point_on_round_edge(EdgeHalf *e, int k, * (1,1,0) -> vmid * (1,0,0) -> vb * (0,1,1) -> vd - * However if va -- vmid -- vb is approximately a straight line, just - * interpolate along the line. - */ -static void get_point_on_round_edge(EdgeHalf *e, int k, - const float va[3], const float vmid[3], const float vb[3], - float r_co[3]) + * We want M to make M*A=B where A has the left side above, as columns + * and B has the right side as columns - both extended into homogeneous coords. + * So M = B*(Ainverse). Doing Ainverse by hand gives the code below. +*/ +static int make_unit_square_map(const float va[3], const float vmid[3], const float vb[3], + float r_mat[4][4]) { - float vo[3], vd[3], vb_vmid[3], va_vmid[3], vddir[3], p[3], angle; - float m[4][4] = MAT4_UNITY; - int n = e->seg; + float vo[3], vd[3], vb_vmid[3], va_vmid[3], vddir[3]; sub_v3_v3v3(va_vmid, vmid, va); sub_v3_v3v3(vb_vmid, vmid, vb); @@ -698,15 +607,41 @@ static void get_point_on_round_edge(EdgeHalf *e, int k, /* The cols of m are: {vmid - va, vmid - vb, vmid + vd - va -vb, va + vb - vmid; * blender transform matrices are stored such that m[i][*] is ith column; * the last elements of each col remain as they are in unity matrix */ - sub_v3_v3v3(&m[0][0], vmid, va); - sub_v3_v3v3(&m[1][0], vmid, vb); - add_v3_v3v3(&m[2][0], vmid, vd); - sub_v3_v3(&m[2][0], va); - sub_v3_v3(&m[2][0], vb); - add_v3_v3v3(&m[3][0], va, vb); - sub_v3_v3(&m[3][0], vmid); - - /* Now find point k/(e->seg) along quarter circle from (0,1,0) to (1,0,0) */ + sub_v3_v3v3(&r_mat[0][0], vmid, va); + r_mat[0][3] = 0.0f; + sub_v3_v3v3(&r_mat[1][0], vmid, vb); + r_mat[1][3] = 0.0f; + add_v3_v3v3(&r_mat[2][0], vmid, vd); + sub_v3_v3(&r_mat[2][0], va); + sub_v3_v3(&r_mat[2][0], vb); + r_mat[2][3] = 0.0f; + add_v3_v3v3(&r_mat[3][0], va, vb); + sub_v3_v3(&r_mat[3][0], vmid); + r_mat[3][3] = 1.0f; + + return TRUE; + } + else + return FALSE; +} + +/* + * Find the point (/n) of the way around the round profile for e, + * where start point is va, midarc point is vmid, and end point is vb. + * Return the answer in profileco. + * If va -- vmid -- vb is approximately a straight line, just + * interpolate along the line. + */ +static void get_point_on_round_edge(EdgeHalf *e, int k, + const float va[3], const float vmid[3], const float vb[3], + float r_co[3]) +{ + float p[3], angle; + float m[4][4]; + int n = e->seg; + + if (make_unit_square_map(va, vmid, vb, m)) { + /* Find point k/(e->seg) along quarter circle from (0,1,0) to (1,0,0) */ angle = (float)M_PI * (float)k / (2.0f * (float)n); /* angle from y axis */ p[0] = sinf(angle); p[1] = cosf(angle); @@ -714,11 +649,47 @@ static void get_point_on_round_edge(EdgeHalf *e, int k, mul_v3_m4v3(r_co, m, p); } else { - /* planar case */ + /* degenerate case: profile is a line */ interp_v3_v3v3(r_co, va, vb, (float)k / (float)n); } } -#endif /* ! OLD_ROUND_EDGE */ + +/* Calculate a snapped point to the transformed profile of edge e, extended as + * in a cylinder-like surface in the direction of e. + * co is the point to snap and is modified in place. + * va and vb are the limits of the profile (with peak on e). */ +static void snap_to_edge_profile(EdgeHalf *e, const float va[3], const float vb[3], + float co[3]) +{ + float m[4][4], minv[4][4]; + float edir[3], va0[3], vb0[3], vmid0[3], p[3], snap[3]; + + sub_v3_v3v3(edir, e->e->v1->co, e->e->v2->co); + normalize_v3(edir); + + /* project va and vb onto plane P, with normal edir and containing co */ + closest_to_plane_v3(va0, co, edir, va); + closest_to_plane_v3(vb0, co, edir, vb); + project_to_edge(e->e, va0, vb0, vmid0); + if (make_unit_square_map(va0, vmid0, vb0, m)) { + /* Transform co and project it onto the unit circle. + * Projecting is in fact just normalizing the transformed co */ + if (!invert_m4_m4(minv, m)) { + /* shouldn't happen, by angle test and construction of vd */ + BLI_assert(!"failed inverse during profile snap"); + return; + } + mul_v3_m4v3(p, minv, co); + normalize_v3(p); + mul_v3_m4v3(snap, m, p); + copy_v3_v3(co, snap); + } + else { + /* planar case: just snap to line va--vb */ + closest_to_line_segment_v3(p, co, va, vb); + copy_v3_v3(co, p); + } +} #endif /* !USE_ALTERNATE_ADJ */ @@ -860,9 +831,11 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) VMesh *vm = bv->vmesh; BoundVert *v, *vprev, *vnext; NewVert *nv, *nvprev, *nvnext; + EdgeHalf *e1, *e2, *epipe; BMVert *bmv, *bmv1, *bmv2, *bmv3, *bmv4; BMFace *f; - float co[3], coa[3], cob[3], midco[3]; + float co[3], coa[3], cob[3], midco[3], dir1[3], dir2[3]; + float va_pipe[3], vb_pipe[3]; #ifdef USE_ALTERNATE_ADJ /* ordered as follows (orig, prev, center, next)*/ @@ -882,6 +855,27 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) ns2 = ns / 2; BLI_assert(n > 2 && ns > 1); (void)n; + + /* special case: two beveled edges are in line and share a face, making a "pipe" */ + epipe = NULL; + if (bv->selcount > 2) { + for (e1 = &bv->edges[0]; epipe == NULL && e1 != &bv->edges[bv->edgecount]; e1++) { + if (e1->is_bev) { + for (e2 = &bv->edges[0]; e2 != &bv->edges[bv->edgecount]; e2++) { + if (e1 != e2 && e2->is_bev) { + sub_v3_v3v3(dir1, bv->v->co, BM_edge_other_vert(e1->e, bv->v)->co); + sub_v3_v3v3(dir2,BM_edge_other_vert(e2->e, bv->v)->co, bv->v->co); + if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON && + (e1->fnext == e2->fprev || e1->fprev == e2->fnext)) { + epipe = e1; + break; + } + } + } + } + } + } + /* Make initial rings, going between points on neighbors. * After this loop, will have coords for all (i, r, k) where * BoundVert for i has a bevel, 0 <= r <= ns2, 0 <= k <= ns */ @@ -952,6 +946,12 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) get_point_on_round_edge(v->ebev, k, coa, midco, cob, co); copy_v3_v3(mesh_vert(vm, i, ring, k)->co, co); } + + if (v->ebev == epipe) { + /* save profile extremes for later snapping */ + copy_v3_v3(va_pipe, mesh_vert(vm, i, 0, 0)->co); + copy_v3_v3(vb_pipe, mesh_vert(vm, i, 0, ns)->co); + } #endif } } while ((v = v->next) != vm->boundstart); @@ -977,6 +977,9 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) nv = mesh_vert(vm, i, ring, k); nvprev = mesh_vert(vm, vprev->index, k, ns - ring); mid_v3_v3v3(co, nv->co, nvprev->co); + if (epipe) + snap_to_edge_profile(epipe, va_pipe, vb_pipe, co); + #ifndef USE_ALTERNATE_ADJ copy_v3_v3(nv->co, co); #endif @@ -1026,6 +1029,8 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) nvnext = mesh_vert(vm, vnext->index, ns2, k); if (vprev->ebev && vnext->ebev) { mid_v3_v3v3v3(co, nvprev->co, nv->co, nvnext->co); + if (epipe) + snap_to_edge_profile(epipe, va_pipe, vb_pipe, co); #ifndef USE_ALTERNATE_ADJ copy_v3_v3(nv->co, co); #endif @@ -1036,6 +1041,8 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) } else if (vprev->ebev) { mid_v3_v3v3(co, nvprev->co, nv->co); + if (epipe) + snap_to_edge_profile(epipe, va_pipe, vb_pipe, co); #ifndef USE_ALTERNATE_ADJ copy_v3_v3(nv->co, co); #endif @@ -1046,6 +1053,8 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) } else if (vnext->ebev) { mid_v3_v3v3(co, nv->co, nvnext->co); + if (epipe) + snap_to_edge_profile(epipe, va_pipe, vb_pipe, co); #ifndef USE_ALTERNATE_ADJ copy_v3_v3(nv->co, co); #endif @@ -1073,6 +1082,8 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) } } while ((v = v->next) != vm->boundstart); mul_v3_fl(midco, 1.0f / nn); + if (epipe) + snap_to_edge_profile(epipe, va_pipe, vb_pipe, midco); bmv = BM_vert_create(bm, midco, NULL, 0); v = vm->boundstart; do { -- cgit v1.2.3 From 61da29996a99b690a89f00418f0ef05a27524a2f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 02:26:13 +0000 Subject: fix own mistake with recent commit to skip calculating tessface. If you were already in editmode the tessfaces wouldn't get recalculated. also minor edits to bmesh rst. --- doc/python_api/rst/include__bmesh.rst | 7 +++++++ source/blender/editors/mesh/editmesh_add.c | 7 +++++-- source/blender/python/bmesh/bmesh_py_api.c | 7 ------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst index a55bf71b60f..d804b889e20 100644 --- a/doc/python_api/rst/include__bmesh.rst +++ b/doc/python_api/rst/include__bmesh.rst @@ -4,6 +4,13 @@ ./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../ +Submodules: + +* :mod:`bmesh.ops` +* :mod:`bmesh.types` +* :mod:`bmesh.utils` + + Intro ----- diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index cd6063b12d0..eed72935b3c 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -55,6 +55,8 @@ /* ********* add primitive operators ************* */ +/* BMESH_TODO: 'state' is not a good name, should be flipped and called 'was_editmode', + * or at least something more descriptive */ static Object *make_prim_init(bContext *C, const char *idname, float *dia, float mat[][4], int *state, const float loc[3], const float rot[3], const unsigned int layer) @@ -81,16 +83,17 @@ static Object *make_prim_init(bContext *C, const char *idname, static void make_prim_finish(bContext *C, Object *obedit, int *state, int enter_editmode) { BMEditMesh *em = BMEdit_FromObject(obedit); + const int exit_editmode = (*state && !enter_editmode); /* Primitive has all verts selected, use vert select flush * to push this up to edges & faces. */ EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX); /* only recalc editmode tessface if we are staying in editmode */ - EDBM_update_generic(C, em, enter_editmode); + EDBM_update_generic(C, em, !exit_editmode); /* userdef */ - if (*state && !enter_editmode) { + if (exit_editmode) { ED_object_exit_editmode(C, EM_FREEDATA); /* adding EM_DO_UNDO messes up operator redo */ } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index 697a9259b37..18f5d895132 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -153,13 +153,6 @@ static struct PyMethodDef BPy_BM_methods[] = { PyDoc_STRVAR(BPy_BM_doc, "This module provides access to blenders bmesh data structures.\n" "\n" -"\n" -"Submodules:\n" -"\n" -"* :mod:`bmesh.utils`\n" -"* :mod:`bmesh.types`\n" -"\n" -"\n" ".. include:: include__bmesh.rst\n" ); static struct PyModuleDef BPy_BM_module_def = { -- cgit v1.2.3 From a490f4f7c4c9df15ededf6762864af9b8757ef70 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 04:53:30 +0000 Subject: fix [#33391] Bridge two Edgeloops fails in simple case --- source/blender/bmesh/operators/bmo_connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 12edffec213..bf508495479 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -389,6 +389,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) if (len < min) { min = len; starti = i; + dir1 = 1; } /* compute summed length between vertices in backward direction */ -- cgit v1.2.3 From 17c2621fd1dc3e9e9624bab747c7c91f8582b716 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 05:02:32 +0000 Subject: bridge tool - simple optimization, break early if edge loop length comparisons are worse then existing best loop test. --- source/blender/bmesh/operators/bmo_connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index bf508495479..c7cd1e742d8 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -382,7 +382,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) /* compute summed length between vertices in forward direction */ len = 0.0f; - for (j = 0; j < lenv2; j++) { + for (j = 0; (j < lenv2) && (len < min); j++) { len += len_v3v3(vv1[clamp_index(i + j, lenv1)]->co, vv2[j]->co); } @@ -394,7 +394,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) /* compute summed length between vertices in backward direction */ len = 0.0f; - for (j = 0; j < lenv2; j++) { + for (j = 0; (j < lenv2) && (len < min); j++) { len += len_v3v3(vv1[clamp_index(i - j, lenv1)]->co, vv2[j]->co); } -- cgit v1.2.3 From 48aa356b7b071307aff2e8835431d0e7474aee1d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 05:38:28 +0000 Subject: use const for bm_mesh_allocsize_default, bm_mesh_chunksize_default --- source/blender/bmesh/intern/bmesh_mesh.c | 6 +++--- source/blender/bmesh/intern/bmesh_mesh.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index ba5e7569c31..d304e18bfa5 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -42,8 +42,8 @@ #include "intern/bmesh_private.h" /* used as an extern, defined in bmesh.h */ -BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512}; -BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512}; +const BMAllocTemplate bm_mesh_allocsize_default = {512, 1024, 2048, 512}; +const BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512}; static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize) { @@ -109,7 +109,7 @@ void BM_mesh_elem_toolflags_clear(BMesh *bm) * * \note ob is needed by multires */ -BMesh *BM_mesh_create(BMAllocTemplate *allocsize) +BMesh *BM_mesh_create(const BMAllocTemplate *allocsize) { /* allocate the structure */ BMesh *bm = MEM_callocN(sizeof(BMesh), __func__); diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h index b592f863cd1..8baba568fb8 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.h +++ b/source/blender/bmesh/intern/bmesh_mesh.h @@ -31,7 +31,7 @@ struct BMAllocTemplate; void BM_mesh_elem_toolflags_ensure(BMesh *bm); void BM_mesh_elem_toolflags_clear(BMesh *bm); -BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize); +BMesh *BM_mesh_create(const struct BMAllocTemplate *allocsize); void BM_mesh_free(BMesh *bm); void BM_mesh_data_free(BMesh *bm); @@ -57,8 +57,8 @@ typedef struct BMAllocTemplate { int totvert, totedge, totloop, totface; } BMAllocTemplate; -extern BMAllocTemplate bm_mesh_allocsize_default; -extern BMAllocTemplate bm_mesh_chunksize_default; +extern const BMAllocTemplate bm_mesh_allocsize_default; +extern const BMAllocTemplate bm_mesh_chunksize_default; enum { BM_MESH_CREATE_USE_TOOLFLAGS = (1 << 0) -- cgit v1.2.3 From 671b871e7f5d3e031017aec4d976e8e3eaa9e50e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 05:40:48 +0000 Subject: fix [#33392] In-dev freeway generation addon crashes on recent builds. --- source/blender/bmesh/intern/bmesh_mesh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index d304e18bfa5..590edc45d07 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -206,6 +206,11 @@ void BM_mesh_clear(BMesh *bm) bm->stackdepth = 1; bm->totflags = 1; + + CustomData_reset(&bm->vdata); + CustomData_reset(&bm->edata); + CustomData_reset(&bm->ldata); + CustomData_reset(&bm->pdata); } /** -- cgit v1.2.3 From ca25fd0307f9387af34cfa3120cecb7e12575579 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 07:10:31 +0000 Subject: fix [#33389] Curve points restricted to 0..1 range, also added note on python3.3's faulthandler module. --- doc/python_api/rst/info_gotcha.rst | 7 +++++++ source/blender/editors/interface/interface_templates.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index e60f1e256cd..08548ea73e5 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -537,6 +537,13 @@ Here are some general hints to avoid running into these problems. * Crashes may not happen every time, they may happen more on some configurations/operating-systems. +.. note:: + + To find the line of your script that crashes you can use the ``faulthandler`` module. + See `faulthandler docs`_. + + While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash. + Undo/Redo --------- diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index e01e6bdd49e..19d4de8bce4 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2021,10 +2021,16 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe } if (cmp) { + const float range_clamp[2] = {0.0f, 1.0f}; + const float range_unclamp[2] = {-1000.0f, 1000.0f}; /* arbitrary limits here */ + const float *range = (cumap->flag & CUMA_DO_CLIP) ? range_clamp : range_unclamp; + uiLayoutRow(layout, TRUE); uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap); - bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, ""); - bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, ""); + bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, + &cmp->x, range[0], range[1], 1, 5, ""); + bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, + &cmp->y, range[0], range[1], 1, 5, ""); } /* black/white levels */ -- cgit v1.2.3 From 0526fcf13f6a05aa1a5b32549f566e8c15c47d5e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 08:11:04 +0000 Subject: revert part of r52720, Id rather leave these as-is, even if they give warnings under some configurations. --- source/blender/blenkernel/intern/editderivedmesh.c | 2 +- source/blender/bmesh/operators/bmo_extrude.c | 4 +-- source/blender/bmesh/operators/bmo_symmetrize.c | 1 - source/blender/bmesh/operators/bmo_utils.c | 32 +++++++++++----------- source/blender/bmesh/tools/bmesh_bevel.c | 3 -- .../blender/bmesh/tools/bmesh_decimate_collapse.c | 1 - .../editors/transform/transform_conversions.c | 4 +-- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index d7b29a262a0..321a61ce238 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -189,7 +189,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm) #endif /* USE_TESSFACE_SPEEDUP */ else { - ScanFillVert *sf_vert = NULL, *sf_vert_last = NULL, *sf_vert_first = NULL; + ScanFillVert *sf_vert, *sf_vert_last = NULL, *sf_vert_first = NULL; /* ScanFillEdge *e; */ /* UNUSED */ ScanFillFace *sf_tri; int totfilltri; diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 45c937d8bba..065a1b57737 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -55,8 +55,8 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op) BMIter liter, liter2; BMFace *f, *f2, *f3; BMLoop *l, *l2, *l3, *l4, *l_tmp; - BMEdge **edges = NULL, *e, *laste = NULL; - BMVert *v = NULL, *lastv, *firstv; + BMEdge **edges = NULL, *e, *laste; + BMVert *v, *lastv, *firstv; BLI_array_declare(edges); int i; diff --git a/source/blender/bmesh/operators/bmo_symmetrize.c b/source/blender/bmesh/operators/bmo_symmetrize.c index ee0717d177b..248c7268ac6 100644 --- a/source/blender/bmesh/operators/bmo_symmetrize.c +++ b/source/blender/bmesh/operators/bmo_symmetrize.c @@ -178,7 +178,6 @@ static void symm_split_asymmetric_edges(Symm *symm) plane_co[symm->axis][2], &lambda, TRUE); BLI_assert(r); - (void)r; madd_v3_v3v3fl(co, e->v1->co, edge_dir, lambda); co[symm->axis] = 0; diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 34b2e96f82d..64dbf0cc0e7 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -494,10 +494,10 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op) BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) { if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) { if (use_ccw == FALSE) { /* same loops direction */ - BMLoop *lf; /* current face loops */ - MLoopUV *f_luv = NULL; /* first face loop uv */ - float p_uv[2] = {0.0f, 0.0f}; /* previous uvs */ - float t_uv[2]; /* tmp uvs */ + BMLoop *lf; /* current face loops */ + MLoopUV *f_luv; /* first face loop uv */ + float p_uv[2]; /* previous uvs */ + float t_uv[2]; /* tmp uvs */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -518,10 +518,10 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op) copy_v2_v2(f_luv->uv, p_uv); } else { /* counter loop direction */ - BMLoop *lf; /* current face loops */ - MLoopUV *p_luv; /* previous loop uv */ - MLoopUV *luv = NULL; - float t_uv[2] = {0.0f, 0.0f}; /* current uvs */ + BMLoop *lf; /* current face loops */ + MLoopUV *p_luv; /* previous loop uv */ + MLoopUV *luv; + float t_uv[2]; /* current uvs */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -599,10 +599,10 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op) BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) { if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) { if (use_ccw == FALSE) { /* same loops direction */ - BMLoop *lf; /* current face loops */ - MLoopCol *f_lcol = NULL; /* first face loop color */ - MLoopCol p_col; /* previous color */ - MLoopCol t_col; /* tmp color */ + BMLoop *lf; /* current face loops */ + MLoopCol *f_lcol; /* first face loop color */ + MLoopCol p_col; /* previous color */ + MLoopCol t_col; /* tmp color */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { @@ -623,10 +623,10 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op) *f_lcol = p_col; } else { /* counter loop direction */ - BMLoop *lf; /* current face loops */ - MLoopCol *p_lcol; /* previous loop color */ - MLoopCol *lcol = NULL; - MLoopCol t_col; /* current color */ + BMLoop *lf; /* current face loops */ + MLoopCol *p_lcol; /* previous loop color */ + MLoopCol *lcol; + MLoopCol t_col; /* current color */ int n = 0; BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) { diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index aafba124c92..874707e23d3 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -381,8 +381,6 @@ static void offset_in_two_planes(EdgeHalf *e1, EdgeHalf *e2, EdgeHalf *emid, int iret; BLI_assert(f1 != NULL && f2 != NULL); - (void)f1; - (void)f2; /* get direction vectors for two offset lines */ sub_v3_v3v3(dir1, v->co, BM_edge_other_vert(e1->e, v)->co); @@ -854,7 +852,6 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) ns = vm->seg; ns2 = ns / 2; BLI_assert(n > 2 && ns > 1); - (void)n; /* special case: two beveled edges are in line and share a face, making a "pipe" */ epipe = NULL; diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 35bf176518c..7c054d84405 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -703,7 +703,6 @@ static int bm_edge_collapse(BMesh *bm, BMEdge *e_clear, BMVert *v_clear, int r_e ok = BM_edge_loop_pair(e_clear, &l_a, &l_b); BLI_assert(ok == TRUE); - (void)ok; BLI_assert(l_a->f->len == 3); BLI_assert(l_b->f->len == 3); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 9a5f32a8772..51efa2b0e40 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2367,8 +2367,8 @@ static void createTransUVs(bContext *C, TransInfo *t) BMFace *efa; BMLoop *l; BMIter iter, liter; - UvElementMap *elementmap = NULL; - char *island_enabled = NULL; + UvElementMap *elementmap; + char *island_enabled; int count = 0, countsel = 0, count_rejected = 0; int propmode = t->flag & T_PROP_EDIT; int propconnected = t->flag & T_PROP_CONNECTED; -- cgit v1.2.3 From 94f85c3c72ec0c117808b6cf87b554ae9b1e772a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 3 Dec 2012 08:31:16 +0000 Subject: Fix #33371: blender freezing in material draw mode. When FBO failed in a particular way it could cause the opengl draw buffer to be set wrong, effectively disabling all opengl drawing. The FBO error was caused by cycles GLSL materials with no nodes that would still use blender internal materials, which caused issues with lamp shadow buffers FBO. This also fixes a GLSL refresh issue when switching render engines. --- source/blender/editors/render/render_update.c | 4 ++++ source/blender/gpu/intern/gpu_extensions.c | 12 ++++++++++++ source/blender/gpu/intern/gpu_material.c | 21 +++++++++++++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index e9fbb3a0885..1ed1cbb2c6b 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -156,12 +156,16 @@ void ED_render_engine_changed(Main *bmain) /* on changing the render engine type, clear all running render engines */ bScreen *sc; ScrArea *sa; + Scene *scene; for (sc = bmain->screen.first; sc; sc = sc->id.next) for (sa = sc->areabase.first; sa; sa = sa->next) ED_render_engine_area_exit(sa); RE_FreePersistentData(); + + for (scene = bmain->scene.first; scene; scene = scene->id.next) + ED_render_id_flush_update(bmain, &scene->id); } /***************************** Updates *********************************** diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index cef664437b7..7a0ac29c9ab 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -253,6 +253,9 @@ static void GPU_print_framebuffer_error(GLenum status, char err_out[256]) switch (status) { case GL_FRAMEBUFFER_COMPLETE_EXT: break; + case GL_INVALID_OPERATION: + err= "Invalid operation"; + break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: err= "Incomplete attachment"; break; @@ -754,6 +757,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err { GLenum status; GLenum attachment; + GLenum error; if (tex->depth) attachment = GL_DEPTH_ATTACHMENT_EXT; @@ -766,6 +770,14 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, tex->target, tex->bindcode, 0); + error = glGetError(); + + if (error == GL_INVALID_OPERATION) { + GPU_framebuffer_restore(); + GPU_print_framebuffer_error(error, err_out); + return 0; + } + if (tex->depth) { glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 497105d94ec..9c48f74bf5f 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1497,6 +1497,16 @@ static GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma) return shr.combined; } +static GPUNodeLink *gpu_material_diffuse_bsdf(GPUMaterial *mat, Material *ma) +{ + static float roughness = 0.0f; + GPUNodeLink *outlink; + + GPU_link(mat, "node_bsdf_diffuse", GPU_uniform(&ma->r), GPU_uniform(&roughness), GPU_builtin(GPU_VIEW_NORMAL), &outlink); + + return outlink; +} + GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) { GPUMaterial *mat; @@ -1516,8 +1526,15 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) ntreeGPUMaterialNodes(ma->nodetree, mat); } else { - /* create material */ - outlink = GPU_blender_material(mat, ma); + if(BKE_scene_use_new_shading_nodes(scene)) { + /* create simple diffuse material instead of nodes */ + outlink = gpu_material_diffuse_bsdf(mat, ma); + } + else { + /* create blender material */ + outlink = GPU_blender_material(mat, ma); + } + GPU_material_output_link(mat, outlink); } -- cgit v1.2.3 From 1523fe0e11dc4c4de1cd1303e46948626d6eb205 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 08:37:43 +0000 Subject: Minor fix for "no mask keyframe copy" error message in dopesheet editor... --- source/blender/editors/space_action/action_edit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index ae78b71f2ad..5170914865c 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -493,7 +493,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; /* copy keyframes */ - if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { + if (ac.datatype == ANIMCONT_GPENCIL) { /* FIXME... */ BKE_report(op->reports, RPT_ERROR, "Keyframe pasting is not available for grease pencil mode"); return OPERATOR_CANCELLED; -- cgit v1.2.3 From 3ec39706b4994bcc77d056d42cf390466fd361eb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 09:08:53 +0000 Subject: fix [#33394] Skin modifier doesn't show generated skin mesh in EditMode with Texured Solid draw option --- source/blender/blenkernel/intern/cdderivedmesh.c | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 54f69a49e70..2fd922db888 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -653,12 +653,26 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, else { if (index_mf_to_mpoly) { orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i); - if (orig == ORIGINDEX_NONE) { if (nors) nors += 3; continue; } - if (drawParamsMapped) { draw_option = drawParamsMapped(userData, orig); } - else { if (nors) nors += 3; continue; } + if (orig == ORIGINDEX_NONE) { + draw_option = DM_DRAW_OPTION_NORMAL; + } + else if (drawParamsMapped) { + draw_option = drawParamsMapped(userData, orig); + } + else { + if (nors) { + nors += 3; continue; + } + } + } + else if (drawParamsMapped) { + draw_option = drawParamsMapped(userData, i); + } + else { + if (nors) { + nors += 3; continue; + } } - else if (drawParamsMapped) { draw_option = drawParamsMapped(userData, i); } - else { if (nors) nors += 3; continue; } } if (draw_option != DM_DRAW_OPTION_SKIP) { @@ -742,9 +756,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if (index_mf_to_mpoly) { orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, actualFace); if (orig == ORIGINDEX_NONE) { - continue; + draw_option = DM_DRAW_OPTION_NORMAL; } - if (drawParamsMapped) { + else if (drawParamsMapped) { draw_option = drawParamsMapped(userData, orig); } } -- cgit v1.2.3 From 1bcaeb3154b22e1e4850c9218b828b01f22396cf Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 09:36:22 +0000 Subject: Tsss tsss... Copy-pasting! :P --- source/blender/editors/mask/mask_editaction.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 561ad004a1d..a0e33d0c311 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -18,13 +18,13 @@ * The Original Code is Copyright (C) 2008, Blender Foundation * This is a new part of Blender * - * Contributor(s): Joshua Leung + * Contributor(s): Campbell Barton * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/editors/mask/mask_editaction.c - * \ingroup edgpencil + * \ingroup edmask */ #include @@ -52,14 +52,14 @@ /* ***************************************** */ /* NOTE ABOUT THIS FILE: - * This file contains code for editing Grease Pencil data in the Action Editor - * as a 'keyframes', so that a user can adjust the timing of Grease Pencil drawings. - * Therefore, this file mostly contains functions for selecting Grease-Pencil frames. + * This file contains code for editing Mask data in the Action Editor + * as a 'keyframes', so that a user can adjust the timing of Mask shapekeys. + * Therefore, this file mostly contains functions for selecting Mask frames (shapekeys). */ /* ***************************************** */ /* Generics - Loopers */ -/* Loops over the gp-frames for a gp-layer, and applies the given callback */ +/* Loops over the mask-frames for a mask-layer, and applies the given callback */ short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) { MaskLayerShape *masklay_shape; @@ -82,7 +82,7 @@ short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*maskl /* ****************************************** */ /* Data Conversion Tools */ -/* make a listing all the gp-frames in a layer as cfraelems */ +/* make a listing all the mask-frames in a layer as cfraelems */ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short onlysel) { MaskLayerShape *masklay_shape; @@ -92,7 +92,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short only if (ELEM(NULL, masklay, elems)) return; - /* loop through gp-frames, adding */ + /* loop through mask-frames, adding */ for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { if ((onlysel == 0) || (masklay_shape->flag & MASK_SHAPE_SELECT)) { ce = MEM_callocN(sizeof(CfraElem), "CfraElem"); @@ -127,7 +127,7 @@ short ED_masklayer_frame_select_check(MaskLayer *masklay) return 0; } -/* helper function - select gp-frame based on SELECT_* mode */ +/* helper function - select mask-frame based on SELECT_* mode */ static void masklayshape_select(MaskLayerShape *masklay_shape, short select_mode) { if (masklay_shape == NULL) @@ -223,7 +223,7 @@ void ED_masklayer_frames_delete(MaskLayer *masklay) } } -/* Duplicate selected frames from given gp-layer */ +/* Duplicate selected frames from given mask-layer */ void ED_masklayer_frames_duplicate(MaskLayer *masklay) { MaskLayerShape *masklay_shape, *gpfn; -- cgit v1.2.3 From 4302cde8ff88471e5e51fb9d7bf61fe6d59179e9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 10:01:09 +0000 Subject: re-apply a workaround for [#31555] Username with special chars in Windows 7 this time keep the stderr/stdout so there FD's are not closed (causing [#32720]). This workaround is ugly but saves us from using a patched python. --- source/blender/python/intern/bpy_interface.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 94cbee383ea..da40ded9a92 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -268,6 +268,19 @@ void BPY_python_start(int argc, const char **argv) Py_Initialize(); + /* THIS IS BAD: see http://bugs.python.org/issue16129 */ +#if 1 + /* until python provides a reliable way to set the env var */ + PyRun_SimpleString("import sys, io\n" + "sys.__backup_stdio__ = sys.__stdout__, sys.__stderr__\n" /* else we loose the FD's [#32720] */ + "sys.__stdout__ = sys.stdout = io.TextIOWrapper(io.open(sys.stdout.fileno(), 'wb', -1), " + "encoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n" + "sys.__stderr__ = sys.stderr = io.TextIOWrapper(io.open(sys.stderr.fileno(), 'wb', -1), " + "ncoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n"); +#endif + /* end the baddness */ + + // PySys_SetArgv(argc, argv); /* broken in py3, not a huge deal */ /* sigh, why do python guys not have a (char **) version anymore? */ { -- cgit v1.2.3 From 46d4d7559fa9f72a1040a30ca016a1674356cb71 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 3 Dec 2012 12:03:16 +0000 Subject: Image Editor / UV: * Bring back "Snap to Vertex", own regression introduced in r39460. Patch by Brecht (DNA, Transform) and myself (RNA, Script). --- release/scripts/startup/bl_ui/space_image.py | 4 +++- source/blender/editors/transform/transform_snap.c | 8 +++++++- source/blender/makesdna/DNA_scene_types.h | 2 +- source/blender/makesrna/intern/rna_scene.c | 12 ++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 358dc016219..1ea20d96386 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -414,7 +414,9 @@ class IMAGE_HT_header(Header): row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") - row.prop(toolsettings, "snap_target", text="") + row.prop(toolsettings, "snap_uv_element", text="", icon_only=True) + if toolsettings.snap_uv_element != 'INCREMENT': + row.prop(toolsettings, "snap_target", text="") mesh = context.edit_object.data layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="") diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index a6fb7e7ed00..2d95e2ecdc6 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -408,9 +408,15 @@ static void initSnappingMode(TransInfo *t) t->tsnap.mode = ts->snap_node_mode; } + else if (t->spacetype == SPACE_IMAGE) { + /* force project off when not supported */ + t->tsnap.project = 0; + + t->tsnap.mode = ts->snap_uv_mode; + } else { /* force project off when not supported */ - if (t->spacetype == SPACE_IMAGE || ts->snap_mode != SCE_SNAP_MODE_FACE) + if (ts->snap_mode != SCE_SNAP_MODE_FACE) t->tsnap.project = 0; t->tsnap.mode = ts->snap_mode; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 1eabe950e00..8e0a36a8a43 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1009,7 +1009,7 @@ typedef struct ToolSettings { /* Transform */ char snap_mode, snap_node_mode; - char pad3; + char snap_uv_mode; short snap_flag, snap_target; short proportional, prop_mode; char proportional_objects; /* proportional edit, object mode */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 664b7cb37a7..6f3a483cf7e 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -145,6 +145,11 @@ EnumPropertyItem snap_node_element_items[] = { {0, NULL, 0, NULL, NULL} }; +EnumPropertyItem snap_uv_element_items[] = { + {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"}, + {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, + {0, NULL, 0, NULL, NULL} +}; /* workaround for duplicate enums, * have each enum line as a defne then conditionally set it or not @@ -1642,6 +1647,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, snap_node_element_items); RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ + + /* image editor uses own set of snap modes */ + prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "snap_uv_mode"); + RNA_def_property_enum_items(prop, snap_uv_element_items); + RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "snap_target"); -- cgit v1.2.3 From f00a49baaaf4b2f8d8a6a6265255fa7085a79bf8 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 12:04:15 +0000 Subject: Add exhaustive command line options description in --help message... --- build_files/build_environment/install_deps.sh | 53 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index b3d13af8af2..80e8ae91e97 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -32,7 +32,56 @@ or use --source/--install options, if you want to use other paths! Number of threads for building: \$THREADS (automatically detected, use --threads= to override it). Building OSL: \$BUILD_OSL (use --with-osl option to enable it). -All static linking: \$ALL_STATIC (use --all-static option to enable it).\"" +All static linking: \$ALL_STATIC (use --all-static option to enable it). + +Use --help to show all available options!\"" + +ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: + -h, --help + Show this message and exit. + + -s , --source= + Use a specific path where to store downloaded libraries sources (defaults to '\$SRC'). + + -i , --install= + Use a specific path where to install built libraries (defaults to '\$INST'). + + -t n, --threads=n + Use a specific number of threads when building the libraries (auto-detected as '\$THREADS'). + + --with-osl + Try to install or build the OpenShadingLanguage libraries (and their dependencies). + Still experimental! + + --all-static + Build libraries as statically as possible, to create static builds of Blender. + + --force-python + Force the rebuild of Python. + + --force-boost + Force the rebuild of Boost. + + --force-ocio + Force the rebuild of OpenColorIO. + + --force-oiio + Force the rebuild of OpenImageIO. + + --force-llvm + Force the rebuild of LLVM. + + --force-osl + Force the rebuild of OpenShadingLanguage. + + --force-ffmpeg + Force the rebuild of FFMpeg. + + Note about the --force-foo options: + * They obviously only have an effect if those libraries are built by this script + (i.e. if there is no available and satisfatory package)! + * If the “force-rebuilt” library is a dependency of anothers, it will force the rebuild + of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).\"" PYTHON_VERSION="3.3.0" PYTHON_VERSION_MIN="3.3" @@ -134,6 +183,8 @@ while true; do INFO "" INFO "`eval _echo "$COMMON_INFO"`" INFO "" + INFO "`eval _echo "$ARGUMENTS_INFO"`" + INFO "" exit 0 ;; --with-osl) -- cgit v1.2.3 From 41f98978e3430a7d38684d49891505bb954375aa Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 3 Dec 2012 12:21:44 +0000 Subject: Fix cycles issue when NaN is used for RGB ramp, can access array out of bounds then. OSL noise() function is generating NaN's in certain cases, fix for that goes to our OSL branch. Also add missing minimum weight and max closure checks to OSL, forgot to add these when fixing another bug. --- intern/cycles/kernel/osl/osl_shader.cpp | 30 ++++++++++++++++---------- intern/cycles/kernel/shaders/node_rgb_ramp.osl | 3 +++ intern/cycles/kernel/svm/svm_ramp.h | 3 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 67a0e16419c..f72e4dd1384 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -150,13 +150,14 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy, /* sample weight */ float sample_weight = fabsf(average(weight)); - sd->flag |= bsdf->shaderdata_flag(); - sc.sample_weight = sample_weight; sc.type = bsdf->shaderclosure_type(); /* add */ - sd->closure[sd->num_closure++] = sc; + if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) { + sd->closure[sd->num_closure++] = sc; + sd->flag |= bsdf->shaderdata_flag(); + } break; } case OSL::ClosurePrimitive::Emissive: { @@ -170,9 +171,10 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy, sc.type = CLOSURE_EMISSION_ID; /* flag */ - sd->flag |= SD_EMISSION; - - sd->closure[sd->num_closure++] = sc; + if(sd->num_closure < MAX_CLOSURE) { + sd->closure[sd->num_closure++] = sc; + sd->flag |= SD_EMISSION; + } break; } case AmbientOcclusion: { @@ -185,8 +187,10 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy, sc.sample_weight = sample_weight; sc.type = CLOSURE_AMBIENT_OCCLUSION_ID; - sd->closure[sd->num_closure++] = sc; - sd->flag |= SD_AO; + if(sd->num_closure < MAX_CLOSURE) { + sd->closure[sd->num_closure++] = sc; + sd->flag |= SD_AO; + } break; } case OSL::ClosurePrimitive::Holdout: @@ -195,8 +199,11 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy, sc.sample_weight = 0.0f; sc.type = CLOSURE_HOLDOUT_ID; - sd->flag |= SD_HOLDOUT; - sd->closure[sd->num_closure++] = sc; + + if(sd->num_closure < MAX_CLOSURE) { + sd->closure[sd->num_closure++] = sc; + sd->flag |= SD_HOLDOUT; + } break; case OSL::ClosurePrimitive::BSSRDF: case OSL::ClosurePrimitive::Debug: @@ -334,7 +341,8 @@ static void flatten_volume_closure_tree(ShaderData *sd, sc.type = CLOSURE_VOLUME_ID; /* add */ - sd->closure[sd->num_closure++] = sc; + if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) + sd->closure[sd->num_closure++] = sc; break; } case OSL::ClosurePrimitive::Holdout: diff --git a/intern/cycles/kernel/shaders/node_rgb_ramp.osl b/intern/cycles/kernel/shaders/node_rgb_ramp.osl index a128ebbd1cf..c7bb53bfefc 100644 --- a/intern/cycles/kernel/shaders/node_rgb_ramp.osl +++ b/intern/cycles/kernel/shaders/node_rgb_ramp.osl @@ -29,7 +29,10 @@ shader node_rgb_ramp( { float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1); + /* clamp int as well in case of NaN */ int i = (int)f; + if(i < 0) i = 0; + if(i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE-1; float t = f - (float)i; Color = ramp_color[i]; diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h index 55c2b3f6af4..c64413cbe84 100644 --- a/intern/cycles/kernel/svm/svm_ramp.h +++ b/intern/cycles/kernel/svm/svm_ramp.h @@ -25,7 +25,8 @@ __device float4 rgb_ramp_lookup(KernelGlobals *kg, int offset, float f) { f = clamp(f, 0.0f, 1.0f)*(RAMP_TABLE_SIZE-1); - int i = (int)f; + /* clamp int as well in case of NaN */ + int i = clamp((int)f, 0, RAMP_TABLE_SIZE-1); float t = f - (float)i; float4 a = fetch_node_float(kg, offset+i); -- cgit v1.2.3 From 4f3fdb8d5a4a3b01de3c3660f6111cf911d9569f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 13:01:07 +0000 Subject: R/G/B icons in node space backgroud channel selector all had same color wheel icon which didnt make much sense. --- release/datafiles/blender_icons.png | Bin 229017 -> 189744 bytes source/blender/blenkernel/BKE_icons.h | 4 +--- source/blender/editors/include/UI_icons.h | 10 ++++++---- source/blender/makesrna/intern/rna_space.c | 7 +++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/release/datafiles/blender_icons.png b/release/datafiles/blender_icons.png index e09d7062780..b0d5e825738 100644 Binary files a/release/datafiles/blender_icons.png and b/release/datafiles/blender_icons.png differ diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index ebfbe94802a..9af0d96884a 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -30,9 +30,7 @@ /** \file BKE_icons.h * \ingroup bke - */ - -/* + * * Resizable Icons for Blender */ diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 10c585aa802..99f7f0856b3 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -97,7 +97,7 @@ DEF_ICON(PLUGIN) /* various ui */ DEF_ICON(HELP) DEF_ICON(GHOST_ENABLED) -DEF_ICON(COLOR) +DEF_ICON(COLOR) /* see COLOR_RED/GREEN/BLUE */ DEF_ICON(LINKED) DEF_ICON(UNLINKED) DEF_ICON(HAND) @@ -428,9 +428,11 @@ DEF_ICON(CURVE_PATH) DEF_ICON(BLANK646) DEF_ICON(BLANK647) DEF_ICON(BLANK648) - DEF_ICON(BLANK649) - DEF_ICON(BLANK650) - DEF_ICON(BLANK651) +#endif +DEF_ICON(COLOR_RED) +DEF_ICON(COLOR_GREEN) +DEF_ICON(COLOR_BLUE) +#ifndef DEF_ICON_BLANK_SKIP DEF_ICON(BLANK652) DEF_ICON(BLANK653) DEF_ICON(BLANK654) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index caa81dafa0e..2b2e8d97499 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2976,10 +2976,9 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, - /* XXX, we could use better icons here */ - {SNODE_SHOW_R, "RED", ICON_COLOR, "Red", ""}, - {SNODE_SHOW_G, "GREEN", ICON_COLOR, "Green", ""}, - {SNODE_SHOW_B, "BLUE", ICON_COLOR, "Blue", ""}, + {SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""}, + {SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""}, + {SNODE_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""}, {0, NULL, 0, NULL, NULL} }; -- cgit v1.2.3 From 582a9d1c45e5d75210a2d4010e55cd9a0f3673a2 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 13:07:43 +0000 Subject: Fix for [#33378] Grease pencil dopesheet fails on a few operations Snapping operator in action editor for grease pencil and mask wasn't implemented. We could probably re-enabled/fix/cleanup more things in this area (e.g. use a custom poll func for operators not supporting gp/mask, instead of silently doing nothing), but this is for after 2.65 imho). --- .../blender/editors/gpencil/editaction_gpencil.c | 19 ++++---- source/blender/editors/include/ED_gpencil.h | 3 +- source/blender/editors/include/ED_mask.h | 3 +- source/blender/editors/mask/mask_editaction.c | 55 ++++++++++++++++++++++ source/blender/editors/space_action/action_edit.c | 22 +++++---- 5 files changed, 81 insertions(+), 21 deletions(-) diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index a59a3f7a5ec..137ef50be3c 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -49,6 +49,7 @@ #include "ED_anim_api.h" #include "ED_gpencil.h" #include "ED_keyframes_edit.h" +#include "ED_markers.h" #include "gpencil_intern.h" @@ -460,11 +461,12 @@ void paste_gpdata(Scene *scene) /* undo and redraw stuff */ BIF_undo_push("Paste Grease Pencil Frames"); } +#endif /* XXX disabled until Grease Pencil code stabilises again... */ /* -------------------------------------- */ /* Snap Tools */ -static short snap_gpf_nearest(bGPDframe *gpf, Scene *scene) +static short snap_gpf_nearest(bGPDframe *gpf, Scene *UNUSED(scene)) { if (gpf->flag & GP_FRAME_SELECT) gpf->framenum = (int)(floor(gpf->framenum + 0.5)); @@ -489,33 +491,32 @@ static short snap_gpf_cframe(bGPDframe *gpf, Scene *scene) static short snap_gpf_nearmarker(bGPDframe *gpf, Scene *scene) { if (gpf->flag & GP_FRAME_SELECT) - gpf->framenum = (int)find_nearest_marker_time(&scene->markers, (float)gpf->framenum); + gpf->framenum = (int)ED_markers_find_nearest_marker_time(&scene->markers, (float)gpf->framenum); return 0; } - /* snap selected frames to ... */ -void snap_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode) +void ED_gplayer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { - case 1: /* snap to nearest frame */ + case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */ ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest); break; - case 2: /* snap to current frame */ + case SNAP_KEYS_CURFRAME: /* snap to current frame */ ED_gplayer_frames_looper(gpl, scene, snap_gpf_cframe); break; - case 3: /* snap to nearest marker */ + case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */ ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearmarker); break; - case 4: /* snap to nearest second */ + case SNAP_KEYS_NEARSEC: /* snap to nearest second */ ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearestsec); break; default: /* just in case */ - ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest); break; } } +#if 0 /* XXX disabled until grease pencil code stabilises again */ /* -------------------------------------- */ /* Mirror Tools */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 39dd8822267..5cc1ecade3e 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -97,12 +97,13 @@ void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode void ED_gplayer_frames_delete(struct bGPDlayer *gpl); void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); +void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); + #if 0 void free_gpcopybuf(void); void copy_gpdata(void); void paste_gpdata(void); -void snap_gplayer_frames(struct bGPDlayer *gpl, short mode); void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode); #endif diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 46ed9798d32..6644f59be94 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -83,12 +83,13 @@ void ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mod void ED_masklayer_frames_delete(struct MaskLayer *masklay); void ED_masklayer_frames_duplicate(struct MaskLayer *masklay); +void ED_masklayer_snap_frames(struct MaskLayer *masklay, struct Scene *scene, short mode); + #if 0 void free_gpcopybuf(void); void copy_gpdata(void); void paste_gpdata(void); -void snap_masklayer_frames(struct MaskLayer *masklay, short mode); void mirror_masklayer_frames(struct MaskLayer *masklay, short mode); #endif diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index a0e33d0c311..1d2cb1f9ff3 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -49,6 +49,7 @@ #include "ED_anim_api.h" #include "ED_keyframes_edit.h" #include "ED_mask.h" /* own include */ +#include "ED_markers.h" /* ***************************************** */ /* NOTE ABOUT THIS FILE: @@ -249,3 +250,57 @@ void ED_masklayer_frames_duplicate(MaskLayer *masklay) } } } + +/* -------------------------------------- */ +/* Snap Tools */ + +static short snap_masklayer_nearest(MaskLayerShape *masklay_shape, Scene *UNUSED(scene)) +{ + if (masklay_shape->flag & MASK_SHAPE_SELECT) + masklay_shape->frame = (int)(floor(masklay_shape->frame + 0.5)); + return 0; +} + +static short snap_masklayer_nearestsec(MaskLayerShape *masklay_shape, Scene *scene) +{ + float secf = (float)FPS; + if (masklay_shape->flag & MASK_SHAPE_SELECT) + masklay_shape->frame = (int)(floor(masklay_shape->frame / secf + 0.5f) * secf); + return 0; +} + +static short snap_masklayer_cframe(MaskLayerShape *masklay_shape, Scene *scene) +{ + if (masklay_shape->flag & MASK_SHAPE_SELECT) + masklay_shape->frame = (int)CFRA; + return 0; +} + +static short snap_masklayer_nearmarker(MaskLayerShape *masklay_shape, Scene *scene) +{ + if (masklay_shape->flag & MASK_SHAPE_SELECT) + masklay_shape->frame = (int)ED_markers_find_nearest_marker_time(&scene->markers, (float)masklay_shape->frame); + return 0; +} + +/* snap selected frames to ... */ +void ED_masklayer_snap_frames(MaskLayer *masklay, Scene *scene, short mode) +{ + switch (mode) { + case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */ + ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearest); + break; + case SNAP_KEYS_CURFRAME: /* snap to current frame */ + ED_masklayer_frames_looper(masklay, scene, snap_masklayer_cframe); + break; + case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */ + ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearmarker); + break; + case SNAP_KEYS_NEARSEC: /* snap to nearest second */ + ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearestsec); + break; + default: /* just in case */ + break; + } +} + diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 5170914865c..092b738bab9 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1412,15 +1412,20 @@ static void snap_action_keys(bAnimContext *ac, short mode) for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); - if (adt) { + if (ale->type == ANIMTYPE_GPLAYER) { + ED_gplayer_snap_frames(ale->data, ac->scene, mode); + } + else if (ale->type == ANIMTYPE_MASKLAYER) { + ED_masklayer_snap_frames(ale->data, ac->scene, mode); + } + else if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } - //else if (ale->type == ACTTYPE_GPLAYER) - // snap_gplayer_frames(ale->data, mode); - else + else { ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); + } } BLI_freelistN(&anim_data); @@ -1436,11 +1441,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - - /* XXX... */ - if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) - return OPERATOR_PASS_THROUGH; - + /* get snapping mode */ mode = RNA_enum_get(op->ptr, "type"); @@ -1448,7 +1449,8 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) snap_action_keys(&ac, mode); /* validate keyframes after editing */ - ANIM_editkeyframes_refresh(&ac); + if (!ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) + ANIM_editkeyframes_refresh(&ac); /* set notifier that keyframes have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); -- cgit v1.2.3 From 6213c6d69b43d11153fca69a50508c93c67dd05a Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 13:28:35 +0000 Subject: Add --force-all option to force rebuild of all built libraries. --- build_files/build_environment/install_deps.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 80e8ae91e97..17b1419b905 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -4,8 +4,8 @@ ARGS=$( \ getopt \ -o s:i:t:h \ ---long source:,install:,threads:,help,with-osl,all-static,force-python,force-boost,\ -force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg \ +--long source:,install:,threads:,help,with-osl,all-static,force-all,force-python, +force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg \ -- "$@" \ ) @@ -56,6 +56,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --all-static Build libraries as statically as possible, to create static builds of Blender. + --force-all + Force the rebuild of all built libraries. + --force-python Force the rebuild of Python. @@ -81,7 +84,8 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: * They obviously only have an effect if those libraries are built by this script (i.e. if there is no available and satisfatory package)! * If the “force-rebuilt” library is a dependency of anothers, it will force the rebuild - of those libraries too (e.g. --force-boost will also rebuild oiio and osl...).\"" + of those libraries too (e.g. --force-boost will also rebuild oiio and osl...). + * Do not forget --with-osl if you built it and still want it!\"" PYTHON_VERSION="3.3.0" PYTHON_VERSION_MIN="3.3" @@ -193,6 +197,16 @@ while true; do --all-static) ALL_STATIC=true; shift; continue ;; + --force-all) + PYTHON_FORCE_REBUILD=true + BOOST_FORCE_REBUILD=true + OCIO_FORCE_REBUILD=true + OIIO_FORCE_REBUILD=true + LLVM_FORCE_REBUILD=true + OSL_FORCE_REBUILD=true + FFMPEG_FORCE_REBUILD=true + shift; continue + ;; --force-python) PYTHON_FORCE_REBUILD=true; shift; continue ;; -- cgit v1.2.3 From 4a9c522125df9321c8337eaaf1933f540140d023 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 13:58:08 +0000 Subject: quiet float -> double conversion warnings and do some osl style edits. --- intern/cycles/kernel/shaders/node_environment_texture.osl | 8 ++++---- intern/cycles/kernel/shaders/node_geometry.osl | 6 +++--- intern/cycles/kernel/shaders/node_rgb_ramp.osl | 4 ++-- source/blender/editors/gpencil/editaction_gpencil.c | 2 +- source/blender/editors/mask/mask_editaction.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl index 4367f7f4994..c39830499fc 100644 --- a/intern/cycles/kernel/shaders/node_environment_texture.osl +++ b/intern/cycles/kernel/shaders/node_environment_texture.osl @@ -21,8 +21,8 @@ vector environment_texture_direction_to_equirectangular(vector dir) { - float u = -atan2(dir[1], dir[0])/(2.0*M_PI) + 0.5; - float v = atan2(dir[2], hypot(dir[0], dir[1]))/M_PI + 0.5; + float u = -atan2(dir[1], dir[0]) / (2.0 * M_PI) + 0.5; + float v = atan2(dir[2], hypot(dir[0], dir[1])) / M_PI + 0.5; return vector(u, v, 0.0); } @@ -31,8 +31,8 @@ vector environment_texture_direction_to_mirrorball(vector dir) { dir[1] -= 1.0; - float div = 2.0*sqrt(max(-0.5*dir[1], 0.0)); - if(div > 0.0) + float div = 2.0 * sqrt(max(-0.5 * dir[1], 0.0)); + if (div > 0.0) dir /= div; float u = 0.5*(dir[0] + 1.0); diff --git a/intern/cycles/kernel/shaders/node_geometry.osl b/intern/cycles/kernel/shaders/node_geometry.osl index 5a784f951bb..d1c11b70081 100644 --- a/intern/cycles/kernel/shaders/node_geometry.osl +++ b/intern/cycles/kernel/shaders/node_geometry.osl @@ -52,9 +52,9 @@ shader node_geometry( /* try to create spherical tangent from generated coordinates */ if (getattribute("geom:generated", generated)) { matrix project = matrix(0.0, 1.0, 0.0, 0.0, - -1.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.0, - 0.5, -0.5, 0.0, 1.0); + -1.0, 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0, 0.0, + 0.5, -0.5, 0.0, 1.0); vector T = transform(project, generated); T = transform("object", "world", T); diff --git a/intern/cycles/kernel/shaders/node_rgb_ramp.osl b/intern/cycles/kernel/shaders/node_rgb_ramp.osl index c7bb53bfefc..0df11bb38de 100644 --- a/intern/cycles/kernel/shaders/node_rgb_ramp.osl +++ b/intern/cycles/kernel/shaders/node_rgb_ramp.osl @@ -31,8 +31,8 @@ shader node_rgb_ramp( /* clamp int as well in case of NaN */ int i = (int)f; - if(i < 0) i = 0; - if(i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE-1; + if (i < 0) i = 0; + if (i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE - 1; float t = f - (float)i; Color = ramp_color[i]; diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 137ef50be3c..aee97f40c31 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -477,7 +477,7 @@ static short snap_gpf_nearestsec(bGPDframe *gpf, Scene *scene) { float secf = (float)FPS; if (gpf->flag & GP_FRAME_SELECT) - gpf->framenum = (int)(floor(gpf->framenum / secf + 0.5f) * secf); + gpf->framenum = (int)(floorf(gpf->framenum / secf + 0.5f) * secf); return 0; } diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 1d2cb1f9ff3..707622fa841 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -265,7 +265,7 @@ static short snap_masklayer_nearestsec(MaskLayerShape *masklay_shape, Scene *sce { float secf = (float)FPS; if (masklay_shape->flag & MASK_SHAPE_SELECT) - masklay_shape->frame = (int)(floor(masklay_shape->frame / secf + 0.5f) * secf); + masklay_shape->frame = (int)(floorf(masklay_shape->frame / secf + 0.5f) * secf); return 0; } -- cgit v1.2.3 From e33f9795fede567f941c2f222b1b672b29d1a02d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 14:12:40 +0000 Subject: Cleaning commented code in DM_update_weight_mcol (inactive since two releases at least...). --- source/blender/blenkernel/intern/DerivedMesh.c | 137 ++++++++----------------- 1 file changed, 41 insertions(+), 96 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 3736395313d..4169a24e7d9 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1159,119 +1159,64 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, ColorBand *coba = stored_cb; /* warning, not a local var */ unsigned char *wtcol_v; -#if 0 /* See coment below. */ - unsigned char *wtcol_f = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL); -#endif unsigned char(*wtcol_l)[4] = CustomData_get_layer(dm->getLoopDataLayout(dm), CD_PREVIEW_MLOOPCOL); -#if 0 /* See coment below. */ - MFace *mf = dm->getTessFaceArray(dm); -#endif MLoop *mloop = dm->getLoopArray(dm), *ml; MPoly *mp = dm->getPolyArray(dm); -#if 0 - int numFaces = dm->getNumTessFaces(dm); -#endif int numVerts = dm->getNumVerts(dm); int totloop; int i, j; -#if 0 /* See comment below */ - /* If no CD_PREVIEW_MCOL existed yet, add a new one! */ - if (!wtcol_f) - wtcol_f = CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces); - - if (wtcol_f) { - unsigned char *wtcol_f_step = wtcol_f; -# else -#if 0 - /* XXX We have to create a CD_PREVIEW_MCOL, else it might sigsev (after a SubSurf mod, eg)... */ - if (!dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL)) - CustomData_add_layer(&dm->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces); -#endif - - { -#endif - - /* Weights are given by caller. */ - if (weights) { - float *w = weights; - /* If indices is not NULL, it means we do not have weights for all vertices, - * so we must create them (and set them to zero)... */ - if (indices) { - w = MEM_callocN(sizeof(float) * numVerts, "Temp weight array DM_update_weight_mcol"); - i = num; - while (i--) - w[indices[i]] = weights[i]; - } - - /* Convert float weights to colors. */ - wtcol_v = calc_colors_from_weights_array(numVerts, w); - - if (indices) - MEM_freeN(w); + /* Weights are given by caller. */ + if (weights) { + float *w = weights; + /* If indices is not NULL, it means we do not have weights for all vertices, + * so we must create them (and set them to zero)... */ + if (indices) { + w = MEM_callocN(sizeof(float) * numVerts, "Temp weight array DM_update_weight_mcol"); + i = num; + while (i--) + w[indices[i]] = weights[i]; } - /* No weights given, take them from active vgroup(s). */ - else - wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba); + /* Convert float weights to colors. */ + wtcol_v = calc_colors_from_weights_array(numVerts, w); - /* Now copy colors in all face verts. */ - /* first add colors to the tessellation faces */ - /* XXX Why update that layer? We have to update WEIGHT_MLOOPCOL anyway, - * and tessellation recreates mface layers from mloop/mpoly ones, so no - * need to fill WEIGHT_MCOL here. */ -#if 0 - for (i = 0; i < numFaces; i++, mf++, wtcol_f_step += (4 * 4)) { - /*origindex being NULL means we're operating on original mesh data*/ -#if 0 - unsigned int fidx = mf->v4 ? 3 : 2; - -#else /* better zero out triangles 4th component. else valgrind complains when the buffer's copied */ - unsigned int fidx; - if (mf->v4) { - fidx = 3; - } - else { - fidx = 2; - *(int *)(&wtcol_f_step[3 * 4]) = 0; - } -#endif + if (indices) + MEM_freeN(w); + } - do { - copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4], - (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]); - } while (fidx--); - } -#endif - /*now add to loops, so the data can be passed through the modifier stack*/ - /* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */ - if (!wtcol_l) { - BLI_array_declare(wtcol_l); - totloop = 0; - for (i = 0; i < dm->numPolyData; i++, mp++) { - ml = mloop + mp->loopstart; - - BLI_array_grow_items(wtcol_l, mp->totloop); - for (j = 0; j < mp->totloop; j++, ml++, totloop++) { - copy_v4_v4_char((char *)&wtcol_l[totloop], - (char *)&wtcol_v[4 * ml->v]); - } + /* No weights given, take them from active vgroup(s). */ + else + wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba); + + /* now add to loops, so the data can be passed through the modifier stack */ + /* If no CD_PREVIEW_MLOOPCOL existed yet, we have to add a new one! */ + if (!wtcol_l) { + BLI_array_declare(wtcol_l); + totloop = 0; + for (i = 0; i < dm->numPolyData; i++, mp++) { + ml = mloop + mp->loopstart; + + BLI_array_grow_items(wtcol_l, mp->totloop); + for (j = 0; j < mp->totloop; j++, ml++, totloop++) { + copy_v4_v4_char((char *)&wtcol_l[totloop], + (char *)&wtcol_v[4 * ml->v]); } - CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop); } - else { - totloop = 0; - for (i = 0; i < dm->numPolyData; i++, mp++) { - ml = mloop + mp->loopstart; + CustomData_add_layer(&dm->loopData, CD_PREVIEW_MLOOPCOL, CD_ASSIGN, wtcol_l, totloop); + } + else { + totloop = 0; + for (i = 0; i < dm->numPolyData; i++, mp++) { + ml = mloop + mp->loopstart; - for (j = 0; j < mp->totloop; j++, ml++, totloop++) { - copy_v4_v4_char((char *)&wtcol_l[totloop], - (char *)&wtcol_v[4 * ml->v]); - } + for (j = 0; j < mp->totloop; j++, ml++, totloop++) { + copy_v4_v4_char((char *)&wtcol_l[totloop], + (char *)&wtcol_v[4 * ml->v]); } } - MEM_freeN(wtcol_v); } + MEM_freeN(wtcol_v); dm->dirty |= DM_DIRTY_TESS_CDLAYERS; } -- cgit v1.2.3 From 6ce73abde849ee49792219e3c8936bcadef38fdb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Dec 2012 15:09:33 +0000 Subject: fix [#33400] Knife ortho floating point error the green dot under the mouse would not draw under the mouse when clipping values were high (1000+) - which is common. use a different method which doesnt give these problems. --- source/blender/editors/mesh/editmesh_knife.c | 49 ++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 9dc68848c69..d5cf174b1a1 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -207,8 +207,12 @@ typedef struct KnifeTool_OpData { static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f); +#if 0 static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2], float r_origin[3], float r_ray[3]); +#endif +static void knife_input_ray_segment(KnifeTool_OpData *kcd, const int mval_i[2], const float ofs, + float r_origin[3], float r_dest[3]); static void knife_update_header(bContext *C, KnifeTool_OpData *kcd) { @@ -379,14 +383,13 @@ static void knife_start_cut(KnifeTool_OpData *kcd) if (kcd->prev.vert == NULL && kcd->prev.edge == NULL && is_zero_v3(kcd->prev.cage)) { /* Make prevcage a point on the view ray to mouse closest to a point on model: choose vertex 0 */ - float origin[3], ray[3], co[3]; + float origin[3], origin_ofs[3]; BMVert *v0; - knife_input_ray_cast(kcd, kcd->curr.mval, origin, ray); - add_v3_v3v3(co, origin, ray); + knife_input_ray_segment(kcd, kcd->curr.mval, 1.0f, origin, origin_ofs); v0 = BM_vert_at_index(kcd->em->bm, 0); if (v0) { - closest_to_line_v3(kcd->prev.cage, v0->co, co, origin); + closest_to_line_v3(kcd->prev.cage, v0->co, origin_ofs, origin); copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */ copy_v3_v3(kcd->curr.cage, kcd->prev.cage); copy_v3_v3(kcd->curr.co, kcd->prev.co); @@ -1403,6 +1406,8 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) BLI_smallhash_release(ehash); } +/* this works but gives numeric problems [#33400] */ +#if 0 static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2], float r_origin[3], float r_ray[3]) { @@ -1433,17 +1438,41 @@ static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2], mul_m4_v3(kcd->ob->imat, r_origin); mul_m3_v3(imat, r_ray); } +#endif + +static void knife_input_ray_segment(KnifeTool_OpData *kcd, const int mval_i[2], const float ofs, + float r_origin[3], float r_origin_ofs[3]) +{ + bglMats mats; + float mval[2]; + + knife_bgl_get_mats(kcd, &mats); + + mval[0] = (float)mval_i[0]; + mval[1] = (float)mval_i[1]; + + /* unproject to find view ray */ + ED_view3d_unproject(&mats, r_origin, mval[0], mval[1], 0.0f); + ED_view3d_unproject(&mats, r_origin_ofs, mval[0], mval[1], ofs); + + /* transform into object space */ + invert_m4_m4(kcd->ob->imat, kcd->ob->obmat); + + mul_m4_v3(kcd->ob->imat, r_origin); + mul_m4_v3(kcd->ob->imat, r_origin_ofs); +} static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float cageco[3], int *is_space) { BMFace *f; float dist = KMAXDIST; float origin[3]; + float origin_ofs[3]; float ray[3]; /* unproject to find view ray */ - knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray); - add_v3_v3v3(co, origin, ray); + knife_input_ray_segment(kcd, kcd->vc.mval, 1.0f, origin, origin_ofs); + sub_v3_v3v3(ray, origin_ofs, origin); f = BMBVH_RayCast(kcd->bmbvh, origin, ray, co, cageco); @@ -1768,12 +1797,12 @@ static int knife_update_active(KnifeTool_OpData *kcd) * Note that drawing lines in `free-space` isn't properly supported * but theres no guarantee (0, 0, 0) has any geometry either - campbell */ if (kcd->curr.vert == NULL && kcd->curr.edge == NULL) { - float origin[3], ray[3], co[3]; + float origin[3]; + float origin_ofs[3]; - knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray); - add_v3_v3v3(co, origin, ray); + knife_input_ray_segment(kcd, kcd->vc.mval, 1.0f, origin, origin_ofs); - closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, co, origin); + closest_to_line_v3(kcd->curr.cage, kcd->prev.cage, origin_ofs, origin); } if (kcd->mode == MODE_DRAGGING) { -- cgit v1.2.3 From 458131e3957d14d7440acd7fe12a0e381fbf936f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Dec 2012 16:19:38 +0000 Subject: Disable alpha pass for all painting modes It's not actually supported and gives artifacts when tried to be used. --- source/blender/editors/space_view3d/drawobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4a89deca162..5ac7327b93b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -229,7 +229,10 @@ static int check_alpha_pass(Base *base) if (G.f & G_PICKSEL) return 0; - + + if (base->object->mode & OB_MODE_ALL_PAINT) + return 0; + return (base->object->dtx & OB_DRAWTRANSP); } -- cgit v1.2.3 From 81a762e79f8391942026f8c8614fe5c364b85168 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 3 Dec 2012 16:21:43 +0000 Subject: Fix cycles viewport render getting stuck with driven/animated nodes, the updated flag would not get cleared due to the nodetree not being a real datablock. --- source/blender/blenkernel/BKE_node.h | 2 ++ source/blender/blenkernel/intern/depsgraph.c | 25 +++++++++++++++++++++---- source/blender/blenkernel/intern/node.c | 16 ++++++++++++++++ source/blender/blenloader/intern/readfile.c | 2 ++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 515bb37b249..b8f168cbdea 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -314,6 +314,8 @@ void ntreeUserIncrefID(struct bNodeTree *ntree); void ntreeUserDecrefID(struct bNodeTree *ntree); +struct bNodeTree *ntreeFromID(struct ID *id); + void ntreeMakeLocal(struct bNodeTree *ntree); int ntreeHasType(struct bNodeTree *ntree, int type); void ntreeUpdateTree(struct bNodeTree *ntree); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d23a608d31f..3ed759392b6 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1940,13 +1940,13 @@ void DAG_scene_sort(Main *bmain, Scene *sce) static void lib_id_recalc_tag(Main *bmain, ID *id) { id->flag |= LIB_ID_RECALC; - bmain->id_tag_update[id->name[0]] = 1; + DAG_id_type_tag(bmain, GS(id->name)); } static void lib_id_recalc_data_tag(Main *bmain, ID *id) { id->flag |= LIB_ID_RECALC_DATA; - bmain->id_tag_update[id->name[0]] = 1; + DAG_id_type_tag(bmain, GS(id->name)); } /* node was checked to have lasttime != curtime and is if type ID_OB */ @@ -2818,6 +2818,7 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time) void DAG_ids_clear_recalc(Main *bmain) { ListBase *lbarray[MAX_LIBARRAY]; + bNodeTree *ntree; int a; /* loop over all ID types */ @@ -2830,9 +2831,15 @@ void DAG_ids_clear_recalc(Main *bmain) /* we tag based on first ID type character to avoid * looping over all ID's in case there are no tags */ if (id && bmain->id_tag_update[id->name[0]]) { - for (; id; id = id->next) + for (; id; id = id->next) { if (id->flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA)) id->flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA); + + /* some ID's contain semi-datablock nodetree */ + ntree = ntreeFromID(id); + if (ntree && (ntree->id.flag & (LIB_ID_RECALC | LIB_ID_RECALC_DATA))) + ntree->id.flag &= ~(LIB_ID_RECALC | LIB_ID_RECALC_DATA); + } } } @@ -2899,8 +2906,18 @@ void DAG_id_tag_update(ID *id, short flag) } } -void DAG_id_type_tag(struct Main *bmain, short idtype) +void DAG_id_type_tag(Main *bmain, short idtype) { + if (idtype == ID_NT) { + /* stupid workaround so parent datablocks of nested nodetree get looped + * over when we loop over tagged datablock types */ + DAG_id_type_tag(bmain, ID_MA); + DAG_id_type_tag(bmain, ID_TE); + DAG_id_type_tag(bmain, ID_LA); + DAG_id_type_tag(bmain, ID_WO); + DAG_id_type_tag(bmain, ID_SCE); + } + bmain->id_tag_update[((char *)&idtype)[0]] = 1; } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 70867a45fd7..17dcf34b71f 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -38,9 +38,13 @@ #include "DNA_action_types.h" #include "DNA_anim_types.h" +#include "DNA_lamp_types.h" +#include "DNA_material_types.h" #include "DNA_node_types.h" #include "DNA_node_types.h" #include "DNA_scene_types.h" +#include "DNA_texture_types.h" +#include "DNA_world_types.h" #include "BLI_string.h" #include "BLI_math.h" @@ -1154,6 +1158,18 @@ void ntreeSetOutput(bNodeTree *ntree) * might be different for editor or for "real" use... */ } +bNodeTree *ntreeFromID(ID *id) +{ + switch (GS(id->name)) { + case ID_MA: return ((Material*)id)->nodetree; + case ID_LA: return ((Lamp*)id)->nodetree; + case ID_WO: return ((World*)id)->nodetree; + case ID_TE: return ((Tex*)id)->nodetree; + case ID_SCE: return ((Scene*)id)->nodetree; + default: return NULL; + } +} + typedef struct MakeLocalCallData { ID *group_id; ID *new_id; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 375b1cf47a2..2c3d3f631bd 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2409,6 +2409,8 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) ntree->adt = newdataadr(fd, ntree->adt); direct_link_animdata(fd, ntree->adt); + ntree->id.flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA); + link_list(fd, &ntree->nodes); for (node = ntree->nodes.first; node; node = node->next) { node->typeinfo = NULL; -- cgit v1.2.3 From a4e6da35806f40d9815732516c9102fe9e7e1ecb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Dec 2012 16:47:38 +0000 Subject: Fix #33398: Missed undo push when script execution failed Undo push was missed in cases when script failed to run with some error when using Run Script in text editor. As far as i can see it makes sense to skip undo push here only in cases live editing is enabled. Otherwise it's indeed annoying to return to previous scene state when debugging the script. --- source/blender/editors/space_text/text_ops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index cd6d8719544..5b7f92739ed 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -615,6 +615,8 @@ static int text_run_script(bContext *C, ReportList *reports) } BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now..."); + + return OPERATOR_FINISHED; } #else (void)C; -- cgit v1.2.3 From dbd44e3bf5bc2f9ce0ae8d65a285155b5798e48d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 3 Dec 2012 16:51:05 +0000 Subject: Fix scons not installing closure/ directory for runtime compiles of CUDA kernel. --- SConstruct | 10 ++++++++++ build_files/scons/tools/Blender.py | 2 +- intern/cycles/kernel/SConscript | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index d6972de8cab..c2bae0459ca 100644 --- a/SConstruct +++ b/SConstruct @@ -700,6 +700,8 @@ if env['OURPLATFORM']!='darwin': source.remove('kernel.cpp') source.remove('CMakeLists.txt') source.remove('svm') + source.remove('closure') + source.remove('shaders') source.remove('osl') source=['intern/cycles/kernel/'+s for s in source] source.append('intern/cycles/util/util_color.h') @@ -715,6 +717,14 @@ if env['OURPLATFORM']!='darwin': if '__pycache__' in source: source.remove('__pycache__') source=['intern/cycles/kernel/svm/'+s for s in source] scriptinstall.append(env.Install(dir=dir,source=source)) + # closure + dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'closure') + source=os.listdir('intern/cycles/kernel/closure') + if '.svn' in source: source.remove('.svn') + if '_svn' in source: source.remove('_svn') + if '__pycache__' in source: source.remove('__pycache__') + source=['intern/cycles/kernel/closure/'+s for s in source] + scriptinstall.append(env.Install(dir=dir,source=source)) # licenses dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license') diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 6805b5b0a96..94a9f1d9c24 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -651,7 +651,7 @@ def AppIt(target=None, source=None, env=None): commands.getoutput(cmd) cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir) commands.getoutput(cmd) - cmd = 'cp -R %s/kernel/svm %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, cinstalldir) + cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, cinstalldir) commands.getoutput(cmd) cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir) commands.getoutput(cmd) diff --git a/intern/cycles/kernel/SConscript b/intern/cycles/kernel/SConscript index 14890164a42..730f758194e 100644 --- a/intern/cycles/kernel/SConscript +++ b/intern/cycles/kernel/SConscript @@ -32,16 +32,17 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']: kernel_file = os.path.join(source_dir, "kernel.cu") util_dir = os.path.join(source_dir, "../util") svm_dir = os.path.join(source_dir, "../svm") + closure_dir = os.path.join(source_dir, "../closure") # nvcc flags nvcc_flags = "-m%s" % (bits) nvcc_flags += " --cubin --ptxas-options=\"-v\" --maxrregcount=24" nvcc_flags += " --opencc-options -OPT:Olimit=0" nvcc_flags += " -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC" - nvcc_flags += " -I \"%s\" -I \"%s\"" % (util_dir, svm_dir) + nvcc_flags += " -I \"%s\" -I \"%s\" -I \"%s\"" % (util_dir, svm_dir, closure_dir) # dependencies - dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('closure/*.h') last_cubin_file = None # add command for each cuda architecture -- cgit v1.2.3 From d6a09974e2e514c557fdc9e0e1d92f63a33aca84 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 17:22:52 +0000 Subject: Exit when package manager fails (exit status >= 1). --- build_files/build_environment/install_deps.sh | 112 ++++++++++++++++---------- 1 file changed, 68 insertions(+), 44 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 17b1419b905..98cc65aa20c 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -987,6 +987,14 @@ check_package_version_ge_DEB() { return $? } +install_packages_DEB() { + sudo apt-get install -y $@ + if [ $? -ge 1 ]; then + ERROR "apt-get failed to install requested packages, exiting." + exit 1 + fi +} + install_DEB() { INFO "" INFO "Installing dependencies for DEB-based distribution" @@ -1029,7 +1037,7 @@ install_DEB() { THEORA_DEV="libtheora-dev" INFO "" - sudo apt-get install -y gawk cmake scons gcc g++ libjpeg-dev libpng-dev libtiff-dev \ + install_packages_DEB gawk cmake scons gcc g++ libjpeg-dev libpng-dev libtiff-dev \ libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev libncurses5-dev \ libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV libopenexr-dev libopenal-dev \ libglew-dev yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libsdl1.2-dev \ @@ -1045,13 +1053,13 @@ install_DEB() { XVID_DEV="libxvidcore-dev" check_package_DEB $XVID_DEV if [ $? -eq 0 ]; then - sudo apt-get install -y $XVID_DEV + install_packages_DEB $XVID_DEV XVID_USE=true else XVID_DEV="libxvidcore4-dev" check_package_DEB $XVID_DEV if [ $? -eq 0 ]; then - sudo apt-get install -y $XVID_DEV + install_packages_DEB $XVID_DEV XVID_USE=true fi fi @@ -1060,7 +1068,7 @@ install_DEB() { MP3LAME_DEV="libmp3lame-dev" check_package_DEB $MP3LAME_DEV if [ $? -eq 0 ]; then - sudo apt-get install -y $MP3LAME_DEV + install_packages_DEB $MP3LAME_DEV MP3LAME_USE=true fi @@ -1068,7 +1076,7 @@ install_DEB() { X264_DEV="libx264-dev" check_package_version_ge_DEB $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then - sudo apt-get install -y $X264_DEV + install_packages_DEB $X264_DEV X264_USE=true fi @@ -1076,20 +1084,20 @@ install_DEB() { VPX_DEV="libvpx-dev" check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then - sudo apt-get install -y $VPX_DEV + install_packages_DEB $VPX_DEV VPX_USE=true fi INFO "" check_package_DEB libspnav-dev if [ $? -eq 0 ]; then - sudo apt-get install -y libspnav-dev + install_packages_DEB libspnav-dev fi INFO "" check_package_DEB python3.3-dev if [ $? -eq 0 ]; then - sudo apt-get install -y python3.3-dev + install_packages_DEB python3.3-dev else compile_Python fi @@ -1097,15 +1105,15 @@ install_DEB() { INFO "" check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN if [ $? -eq 0 ]; then - sudo apt-get install -y libboost-dev + install_packages_DEB libboost-dev boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') check_package_DEB libboost-locale$boost_version-dev if [ $? -eq 0 ]; then - sudo apt-get install -y libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ - libboost-regex$boost_version-dev libboost-system$boost_version-dev \ - libboost-thread$boost_version-dev + install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ + libboost-regex$boost_version-dev libboost-system$boost_version-dev \ + libboost-thread$boost_version-dev else compile_Boost fi @@ -1116,7 +1124,7 @@ install_DEB() { INFO "" check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN if [ $? -eq 0 ]; then - sudo apt-get install -y libopencolorio-dev + install_packages_DEB libopencolorio-dev else compile_OCIO fi @@ -1124,7 +1132,7 @@ install_DEB() { INFO "" check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN if [ $? -eq 0 ]; then - sudo apt-get install -y libopenimageio-dev + install_packages_DEB libopenimageio-dev else compile_OIIO fi @@ -1135,17 +1143,17 @@ install_DEB() { INFO "" check_package_DEB llvm-$LLVM_VERSION-dev if [ $? -eq 0 ]; then - sudo apt-get install -y llvm-$LLVM_VERSION-dev + install_packages_DEB llvm-$LLVM_VERSION-dev have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION else check_package_DEB llvm-$LLVM_VERSION_MIN-dev if [ $? -eq 0 ]; then - sudo apt-get install -y llvm-$LLVM_VERSION_MIN-dev + install_packages_DEB llvm-$LLVM_VERSION_MIN-dev have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION_MIN else - sudo apt-get install -y libffi-dev + install_packages_DEB libffi-dev INFO "" compile_LLVM have_llvm=true @@ -1155,7 +1163,7 @@ install_DEB() { if $have_llvm; then INFO "" - sudo apt-get install -y clang flex bison libtbb-dev git + install_packages_DEB clang flex bison libtbb-dev git # No package currently! INFO "" compile_OSL @@ -1166,12 +1174,12 @@ install_DEB() { # So for now, always build our own ffmpeg. # check_package_DEB ffmpeg # if [ $? -eq 0 ]; then -# sudo apt-get install -y ffmpeg +# install_packages_DEB ffmpeg # ffmpeg_version=`get_package_version_DEB ffmpeg` # INFO "ffmpeg version: $ffmpeg_version" # if [ ! -z "$ffmpeg_version" ]; then # if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then -# sudo apt-get install -y libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev +# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev # else # compile_FFmpeg # fi @@ -1217,6 +1225,14 @@ check_package_version_ge_RPM() { return $? } +install_packages_RPM() { + sudo yum install -y $@ + if [ $? -ge 1 ]; then + ERROR "yum failed to install requested packages, exiting." + exit 1 + fi +} + install_RPM() { INFO "" INFO "Installing dependencies for RPM-based distribution" @@ -1233,7 +1249,7 @@ install_RPM() { THEORA_DEV="libtheora-devel" INFO "" - sudo yum -y install gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel \ + install_packages_RPM gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel \ freetype-devel libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \ readline-devel $OPENJPEG_DEV openexr-devel openal-soft-devel \ glew-devel yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV SDL-devel \ @@ -1249,7 +1265,7 @@ install_RPM() { X264_DEV="x264-devel" check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y $X264_DEV + install_packages_RPM $X264_DEV X264_USE=true fi @@ -1257,7 +1273,7 @@ install_RPM() { XVID_DEV="xvidcore-devel" check_package_RPM $XVID_DEV if [ $? -eq 0 ]; then - sudo yum install -y $XVID_DEV + install_packages_RPM $XVID_DEV XVID_USE=true fi @@ -1265,7 +1281,7 @@ install_RPM() { VPX_DEV="libvpx-devel" check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y $VPX_DEV + install_packages_RPM $VPX_DEV VPX_USE=true fi @@ -1273,14 +1289,14 @@ install_RPM() { MP3LAME_DEV="lame-devel" check_package_RPM $MP3LAME_DEV if [ $? -eq 0 ]; then - sudo yum install -y $MP3LAME_DEV + install_packages_RPM $MP3LAME_DEV MP3LAME_USE=true fi INFO "" check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y python3-devel + install_packages_RPM python3-devel else compile_Python fi @@ -1288,7 +1304,7 @@ install_RPM() { INFO "" check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y boost-devel + install_packages_RPM boost-devel else compile_Boost fi @@ -1296,7 +1312,7 @@ install_RPM() { INFO "" check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y OpenColorIO-devel + install_packages_RPM OpenColorIO-devel else compile_OCIO fi @@ -1304,7 +1320,7 @@ install_RPM() { INFO "" check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN if [ $? -eq 0 ]; then - sudo yum install -y OpenImageIO-devel + install_packages_RPM OpenImageIO-devel else compile_OIIO fi @@ -1315,24 +1331,24 @@ install_RPM() { INFO "" check_package_RPM llvm-$LLVM_VERSION-devel if [ $? -eq 0 ]; then - sudo yum install -y llvm-$LLVM_VERSION-devel + install_packages_RPM llvm-$LLVM_VERSION-devel have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION else # check_package_RPM llvm-$LLVM_VERSION_MIN-devel # if [ $? -eq 0 ]; then -# sudo yum install -y llvm-$LLVM_VERSION_MIN-devel +# install_packages_RPM llvm-$LLVM_VERSION_MIN-devel # have_llvm=true # LLVM_VERSION_FOUND=$LLVM_VERSION_MIN # else # check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN # if [ $? -eq 0 ]; then -# sudo yum install -y llvm-devel +# install_packages_RPM llvm-devel # have_llvm=true # LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel` # fi # fi - sudo yum install -y libffi-devel + install_packages_RPM libffi-devel # XXX Stupid fedora puts ffi header into a darn stupid dir! _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` INFO "" @@ -1343,7 +1359,7 @@ install_RPM() { if $have_llvm; then INFO "" - sudo yum install -y flex bison clang tbb-devel git + install_packages_RPM flex bison clang tbb-devel git # No package currently! INFO "" compile_OSL @@ -1391,6 +1407,15 @@ check_package_version_ge_SUSE() { return $? } +install_packages_SUSE() { + sudo zypper --non-interactive install --auto-agree-with-licenses $@ + if [ $? -ge 1 ]; then + ERROR "zypper failed to install requested packages, exiting." + exit 1 + fi +} + + install_SUSE() { INFO "" INFO "Installing dependencies for SuSE-based distribution" @@ -1407,8 +1432,7 @@ install_SUSE() { THEORA_DEV="libtheora-devel" INFO "" - sudo zypper --non-interactive install --auto-agree-with-licenses \ - gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel \ + install_packages_SUSE gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel \ freetype-devel libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \ readline-devel $OPENJPEG_DEV libopenexr-devel openal-soft-devel \ glew-devel yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libSDL-devel \ @@ -1424,7 +1448,7 @@ install_SUSE() { X264_DEV="x264-devel" check_package_version_ge_SUSE $X264_DEV $X264_VERSION_MIN if [ $? -eq 0 ]; then - sudo zypper --non-interactive install --auto-agree-with-licenses $X264_DEV + install_packages_SUSE $X264_DEV X264_USE=true fi @@ -1432,7 +1456,7 @@ install_SUSE() { XVID_DEV="xvidcore-devel" check_package_SUSE $XVID_DEV if [ $? -eq 0 ]; then - sudo zypper --non-interactive install --auto-agree-with-licenses $XVID_DEV + install_packages_SUSE $XVID_DEV XVID_USE=true fi @@ -1440,7 +1464,7 @@ install_SUSE() { VPX_DEV="libvpx-devel" check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN if [ $? -eq 0 ]; then - sudo zypper --non-interactive install --auto-agree-with-licenses $VPX_DEV + install_packages_SUSE $VPX_DEV VPX_USE=true fi @@ -1449,14 +1473,14 @@ install_SUSE() { MP3LAME_DEV="lame-devel" check_package_SUSE $MP3LAME_DEV if [ $? -eq 0 ]; then - sudo zypper --non-interactive install --auto-agree-with-licenses $MP3LAME_DEV + install_packages_SUSE $MP3LAME_DEV MP3LAME_USE=true fi INFO "" check_package_version_match_SUSE python3-devel 3.3. if [ $? -eq 0 ]; then - sudo zypper --non-interactive install --auto-agree-with-licenses python3-devel + install_packages_SUSE python3-devel else compile_Python fi @@ -1480,12 +1504,12 @@ install_SUSE() { # Suse llvm package *_$SUCKS$_* (tm) !!! # check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN # if [ $? -eq 0 ]; then -# sudo zypper --non-interactive install --auto-agree-with-licenses llvm-devel +# install_packages_SUSE llvm-devel # have_llvm=true # LLVM_VERSION_FOUND=`get_package_version_SUSE llvm-devel` # fi - sudo zypper --non-interactive install --auto-agree-with-licenses libffi47-devel + install_packages_SUSE libffi47-devel INFO "" compile_LLVM have_llvm=true @@ -1494,7 +1518,7 @@ install_SUSE() { if $have_llvm; then INFO "" # XXX No tbb lib! - sudo zypper --non-interactive install --auto-agree-with-licenses flex bison git + install_packages_SUSE flex bison git # No package currently! INFO "" compile_OSL -- cgit v1.2.3 From eeece25d82b8e4485e0977dafd6de46f9ff2ba9f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 3 Dec 2012 17:53:01 +0000 Subject: Add libjeack0 as (Debian and co) dep. Also add --skip-foo args to command line. --- build_files/build_environment/install_deps.sh | 416 +++++++++++++++++--------- 1 file changed, 277 insertions(+), 139 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 98cc65aa20c..f7023603918 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -4,8 +4,9 @@ ARGS=$( \ getopt \ -o s:i:t:h \ ---long source:,install:,threads:,help,with-osl,all-static,force-all,force-python, -force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg \ +--long source:,install:,threads:,help,with-osl,all-static,force-all,force-python,\ +force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg,\ +skip-python,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg \ -- "$@" \ ) @@ -27,7 +28,7 @@ fi COMMON_INFO="\"Source code of dependencies needed to be compiled will be downloaded and extracted into '\$SRC'. Built libs of dependencies needed to be compiled will be installed into '\$INST'. -Please edit \\\$SRC and/or \\\$INST variables at the begining of this script, +Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script, or use --source/--install options, if you want to use other paths! Number of threads for building: \$THREADS (automatically detected, use --threads= to override it). @@ -82,31 +83,56 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: Note about the --force-foo options: * They obviously only have an effect if those libraries are built by this script - (i.e. if there is no available and satisfatory package)! - * If the “force-rebuilt” library is a dependency of anothers, it will force the rebuild + (i.e. if there is no available and satisfactory package)! + * If the “force-rebuilt” library is a dependency of others, it will force the rebuild of those libraries too (e.g. --force-boost will also rebuild oiio and osl...). - * Do not forget --with-osl if you built it and still want it!\"" + * Do not forget --with-osl if you built it and still want it! + + --skip-python + Unconditionally skip Python installation/building. + + --skip-boost + Unconditionally skip Boost installation/building. + + --skip-ocio + Unconditionally skip OpenColorIO installation/building. + + --skip-oiio + Unconditionally skip OpenImageIO installation/building. + + --skip-llvm + Unconditionally skip LLVM installation/building. + + --skip-osl + Unconditionally skip OpenShadingLanguage installation/building. + + --skip-ffmpeg + Unconditionally skip FFMpeg installation/building.\"" PYTHON_VERSION="3.3.0" PYTHON_VERSION_MIN="3.3" PYTHON_SOURCE="http://python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.bz2" PYTHON_FORCE_REBUILD=false +PYTHON_SKIP=false BOOST_VERSION="1.51.0" _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` BOOST_SOURCE="http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" BOOST_VERSION_MIN="1.49" BOOST_FORCE_REBUILD=false +BOOST_SKIP=false OCIO_VERSION="1.0.7" OCIO_SOURCE="https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" OCIO_VERSION_MIN="1.0" OCIO_FORCE_REBUILD=false +OCIO_SKIP=false OIIO_VERSION="1.1.1" OIIO_SOURCE="https://github.com/OpenImageIO/oiio/tarball/Release-$OIIO_VERSION" OIIO_VERSION_MIN="1.1" OIIO_FORCE_REBUILD=false +OIIO_SKIP=false LLVM_VERSION="3.1" LLVM_VERSION_MIN="3.0" @@ -114,16 +140,19 @@ LLVM_VERSION_FOUND="" LLVM_SOURCE="http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" LLVM_CLANG_SOURCE="http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" LLVM_FORCE_REBUILD=false +LLVM_SKIP=false # OSL needs to be compiled for now! OSL_VERSION="1.2.0" OSL_SOURCE="https://github.com/mont29/OpenShadingLanguage/archive/blender-fixes.tar.gz" OSL_FORCE_REBUILD=false +OSL_SKIP=false FFMPEG_VERSION="1.0" FFMPEG_SOURCE="http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" FFMPEG_VERSION_MIN="0.7.6" FFMPEG_FORCE_REBUILD=false +FFMPEG_SKIP=false _ffmpeg_list_sep=";" # FFMPEG optional libs. @@ -228,6 +257,27 @@ while true; do --force-ffmpeg) FFMPEG_FORCE_REBUILD=true; shift; continue ;; + --skip-python) + PYTHON_SKIP=true; shift; continue + ;; + --skip-boost) + BOOST_SKIP=true; shift; continue + ;; + --skip-ocio) + OCIO_SKIP=true; shift; continue + ;; + --skip-oiio) + OIIO_SKIP=true; shift; continue + ;; + --skip-llvm) + LLVM_SKIP=true; shift; continue + ;; + --skip-osl) + OSL_SKIP=true; shift; continue + ;; + --skip-ffmpeg) + FFMPEG_SKIP=true; shift; continue + ;; --) # no more arguments to parse break @@ -1041,7 +1091,7 @@ install_DEB() { libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev libncurses5-dev \ libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV libopenexr-dev libopenal-dev \ libglew-dev yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libsdl1.2-dev \ - libfftw3-dev libjack-dev python-dev patch bzip2 + libfftw3-dev libjack0 libjack-dev python-dev patch bzip2 OPENJPEG_USE=true SCHRO_USE=true @@ -1095,98 +1145,128 @@ install_DEB() { fi INFO "" - check_package_DEB python3.3-dev - if [ $? -eq 0 ]; then - install_packages_DEB python3.3-dev + if $PYTHON_SKIP; then + INFO "WARNING! Skipping Python installation, as requested..." else - compile_Python + check_package_DEB python3.3-dev + if [ $? -eq 0 ]; then + install_packages_DEB python3.3-dev + else + compile_Python + fi fi INFO "" - check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_DEB libboost-dev + if $BOOST_SKIP; then + INFO "WARNING! Skipping Boost installation, as requested..." + else + check_package_version_ge_DEB libboost-dev $BOOST_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_DEB libboost-dev - boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') + boost_version=$(echo `get_package_version_DEB libboost-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/') - check_package_DEB libboost-locale$boost_version-dev - if [ $? -eq 0 ]; then - install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ - libboost-regex$boost_version-dev libboost-system$boost_version-dev \ - libboost-thread$boost_version-dev + check_package_DEB libboost-locale$boost_version-dev + if [ $? -eq 0 ]; then + install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ + libboost-regex$boost_version-dev libboost-system$boost_version-dev \ + libboost-thread$boost_version-dev + else + compile_Boost + fi else compile_Boost fi - else - compile_Boost fi INFO "" - check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_DEB libopencolorio-dev + if $OCIO_SKIP; then + INFO "WARNING! Skipping OpenColorIO installation, as requested..." else - compile_OCIO + check_package_version_ge_DEB libopencolorio-dev $OCIO_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_DEB libopencolorio-dev + else + compile_OCIO + fi fi INFO "" - check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_DEB libopenimageio-dev + if $OIIO_SKIP; then + INFO "WARNING! Skipping OpenImageIO installation, as requested..." else - compile_OIIO + check_package_version_ge_DEB libopenimageio-dev $OIIO_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_DEB libopenimageio-dev + else + compile_OIIO + fi fi if $BUILD_OSL; then have_llvm=false - INFO "" - check_package_DEB llvm-$LLVM_VERSION-dev - if [ $? -eq 0 ]; then - install_packages_DEB llvm-$LLVM_VERSION-dev - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION + if $LLVM_SKIP; then + INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..." else - check_package_DEB llvm-$LLVM_VERSION_MIN-dev + INFO "" + check_package_DEB llvm-$LLVM_VERSION-dev if [ $? -eq 0 ]; then - install_packages_DEB llvm-$LLVM_VERSION_MIN-dev - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION_MIN - else - install_packages_DEB libffi-dev - INFO "" - compile_LLVM + install_packages_DEB llvm-$LLVM_VERSION-dev have_llvm=true LLVM_VERSION_FOUND=$LLVM_VERSION + else + check_package_DEB llvm-$LLVM_VERSION_MIN-dev + if [ $? -eq 0 ]; then + install_packages_DEB llvm-$LLVM_VERSION_MIN-dev + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION_MIN + else + install_packages_DEB libffi-dev + INFO "" + compile_LLVM + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION + fi fi fi - if $have_llvm; then + if $OSL_SKIP; then INFO "" - install_packages_DEB clang flex bison libtbb-dev git - # No package currently! - INFO "" - compile_OSL + INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..." + else + if $have_llvm; then + INFO "" + install_packages_DEB clang flex bison libtbb-dev git + # No package currently! + INFO "" + compile_OSL + fi fi fi -# XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/ -# So for now, always build our own ffmpeg. -# check_package_DEB ffmpeg -# if [ $? -eq 0 ]; then -# install_packages_DEB ffmpeg -# ffmpeg_version=`get_package_version_DEB ffmpeg` -# INFO "ffmpeg version: $ffmpeg_version" -# if [ ! -z "$ffmpeg_version" ]; then -# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then -# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev -# else -# compile_FFmpeg + + INFO "" + if $FFMPEG_SKIP; then + INFO "WARNING! Skipping FFMpeg installation, as requested..." + else +# XXX Debian features libav packages as ffmpeg, those are not really compatible with blender code currently :/ +# So for now, always build our own ffmpeg. +# check_package_DEB ffmpeg +# if [ $? -eq 0 ]; then +# install_packages_DEB ffmpeg +# ffmpeg_version=`get_package_version_DEB ffmpeg` +# INFO "ffmpeg version: $ffmpeg_version" +# if [ ! -z "$ffmpeg_version" ]; then +# if dpkg --compare-versions $ffmpeg_version gt 0.7.2; then +# install_packages_DEB libavfilter-dev libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev +# else +# compile_FFmpeg +# fi # fi # fi -# fi - INFO "" - compile_FFmpeg + compile_FFmpeg + fi } get_package_version_RPM() { @@ -1294,81 +1374,110 @@ install_RPM() { fi INFO "" - check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM python3-devel + if $PYTHON_SKIP; then + INFO "WARNING! Skipping Python installation, as requested..." else - compile_Python + check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM python3-devel + else + compile_Python + fi fi INFO "" - check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM boost-devel + if $BOOST_SKIP; then + INFO "WARNING! Skipping Boost installation, as requested..." else - compile_Boost + check_package_version_ge_RPM boost-devel $BOOST_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM boost-devel + else + compile_Boost + fi fi INFO "" - check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM OpenColorIO-devel + if $OCIO_SKIP; then + INFO "WARNING! Skipping OpenColorIO installation, as requested..." else - compile_OCIO + check_package_version_ge_RPM OpenColorIO-devel $OCIO_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM OpenColorIO-devel + else + compile_OCIO + fi fi INFO "" - check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM OpenImageIO-devel + if $OIIO_SKIP; then + INFO "WARNING! Skipping OpenImageIO installation, as requested..." else - compile_OIIO + check_package_version_ge_RPM OpenImageIO-devel $OIIO_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM OpenImageIO-devel + else + compile_OIIO + fi fi if $BUILD_OSL; then have_llvm=false INFO "" - check_package_RPM llvm-$LLVM_VERSION-devel - if [ $? -eq 0 ]; then - install_packages_RPM llvm-$LLVM_VERSION-devel - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION + if $LLVM_SKIP; then + INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..." else -# check_package_RPM llvm-$LLVM_VERSION_MIN-devel -# if [ $? -eq 0 ]; then -# install_packages_RPM llvm-$LLVM_VERSION_MIN-devel -# have_llvm=true -# LLVM_VERSION_FOUND=$LLVM_VERSION_MIN -# else -# check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN + check_package_RPM llvm-$LLVM_VERSION-devel + if [ $? -eq 0 ]; then + install_packages_RPM llvm-$LLVM_VERSION-devel + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION + else +# check_package_RPM llvm-$LLVM_VERSION_MIN-devel # if [ $? -eq 0 ]; then -# install_packages_RPM llvm-devel +# install_packages_RPM llvm-$LLVM_VERSION_MIN-devel # have_llvm=true -# LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel` +# LLVM_VERSION_FOUND=$LLVM_VERSION_MIN +# else +# check_package_version_ge_RPM llvm-devel $LLVM_VERSION_MIN +# if [ $? -eq 0 ]; then +# install_packages_RPM llvm-devel +# have_llvm=true +# LLVM_VERSION_FOUND=`get_package_version_RPM llvm-devel` +# fi # fi -# fi - install_packages_RPM libffi-devel - # XXX Stupid fedora puts ffi header into a darn stupid dir! - _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` - INFO "" - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION + install_packages_RPM libffi-devel + # XXX Stupid fedora puts ffi header into a darn stupid dir! + _FFI_INCLUDE_DIR=`rpm -ql libffi-devel | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'` + INFO "" + compile_LLVM + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION + fi fi - if $have_llvm; then + if $OSL_SKIP; then INFO "" - install_packages_RPM flex bison clang tbb-devel git - # No package currently! - INFO "" - compile_OSL + INFO "WARNING! Skipping OpenShadingLanguage installation, as requested..." + else + if $have_llvm; then + INFO "" + install_packages_RPM flex bison clang tbb-devel git + # No package currently! + INFO "" + compile_OSL + fi fi fi - # Always for now, not sure which packages should be installed INFO "" - compile_FFmpeg + if $FFMPEG_SKIP; then + INFO "WARNING! Skipping FFMpeg installation, as requested..." + else + # Always for now, not sure which packages should be installed + compile_FFmpeg + fi } get_package_version_SUSE() { @@ -1478,56 +1587,85 @@ install_SUSE() { fi INFO "" - check_package_version_match_SUSE python3-devel 3.3. - if [ $? -eq 0 ]; then - install_packages_SUSE python3-devel + if $PYTHON_SKIP; then + INFO "WARNING! Skipping Python installation, as requested..." else - compile_Python + check_package_version_match_SUSE python3-devel 3.3. + if [ $? -eq 0 ]; then + install_packages_SUSE python3-devel + else + compile_Python + fi fi INFO "" - # No boost_locale currently available, so let's build own boost. - compile_Boost + if $BOOST_SKIP; then + INFO "WARNING! Skipping Boost installation, as requested..." + else + # No boost_locale currently available, so let's build own boost. + compile_Boost + fi INFO "" - # No ocio currently available, so let's build own boost. - compile_OCIO + if $OCIO_SKIP; then + INFO "WARNING! Skipping OpenColorIO installation, as requested..." + else + # No ocio currently available, so let's build own boost. + compile_OCIO + fi INFO "" - # No oiio currently available, so let's build own boost. - compile_OIIO + if $OIIO_SKIP; then + INFO "WARNING! Skipping OpenImageIO installation, as requested..." + else + # No oiio currently available, so let's build own boost. + compile_OIIO + fi if $BUILD_OSL; then have_llvm=false INFO "" - # Suse llvm package *_$SUCKS$_* (tm) !!! -# check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN -# if [ $? -eq 0 ]; then -# install_packages_SUSE llvm-devel -# have_llvm=true -# LLVM_VERSION_FOUND=`get_package_version_SUSE llvm-devel` -# fi - - install_packages_SUSE libffi47-devel - INFO "" - compile_LLVM - have_llvm=true - LLVM_VERSION_FOUND=$LLVM_VERSION + if $LLVM_SKIP; then + INFO "WARNING! Skipping LLVM installation, as requested (this also implies skipping OSL!)..." + else + # Suse llvm package *_$SUCKS$_* (tm) !!! +# check_package_version_ge_SUSE llvm-devel $LLVM_VERSION_MIN +# if [ $? -eq 0 ]; then +# install_packages_SUSE llvm-devel +# have_llvm=true +# LLVM_VERSION_FOUND=`get_package_version_SUSE llvm-devel` +# fi - if $have_llvm; then + install_packages_SUSE libffi47-devel INFO "" - # XXX No tbb lib! - install_packages_SUSE flex bison git - # No package currently! + compile_LLVM + have_llvm=true + LLVM_VERSION_FOUND=$LLVM_VERSION + fi + + if $OSL_SKIP; then INFO "" - compile_OSL + INFO "WARNING! Skipping OpenShaderLanguage installation, as requested..." + else + if $have_llvm; then + INFO "" + # XXX No tbb lib! + install_packages_SUSE flex bison git + # No package currently! + INFO "" + compile_OSL + fi fi fi - # No ffmpeg currently available, so let's build own boost. INFO "" - compile_FFmpeg + if $FFMPEG_SKIP; then + INFO "WARNING! Skipping FFMpeg installation, as requested..." + else + # No ffmpeg currently available, so let's build own boost. + compile_FFmpeg + fi } print_info_ffmpeglink_DEB() { -- cgit v1.2.3 From c0078a987978348f200322764e06afbcc378b81f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 03:18:08 +0000 Subject: osl style cleanup and update man-page. --- doc/manpage/blender.1 | 14 +++++++++++-- .../kernel/shaders/node_convert_from_color.osl | 2 +- .../kernel/shaders/node_environment_texture.osl | 4 ++-- .../cycles/kernel/shaders/node_image_texture.osl | 24 +++++++++++----------- .../cycles/kernel/shaders/node_light_falloff.osl | 6 +++--- intern/cycles/kernel/shaders/node_normal_map.osl | 4 ++-- 6 files changed, 32 insertions(+), 22 deletions(-) diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index e7164fcb96b..2addb60c5f7 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -1,4 +1,4 @@ -.TH "BLENDER" "1" "October 04, 2012" "Blender Blender 2\&.64 (sub 0)" +.TH "BLENDER" "1" "December 04, 2012" "Blender Blender 2\&.65" .SH NAME blender \- a 3D modelling and rendering package @@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business http://www.blender.org .SH OPTIONS -Blender 2.64 (sub 0) +Blender 2.65 Usage: blender [args ...] [file] [args ...] .br .SS "Render Options:" @@ -145,6 +145,10 @@ Playback , only operates this way when not running in background. .br \-j Set frame step to .br + \-s Play from +.br + \-e Play until +.br .IP @@ -344,6 +348,12 @@ Enable debug messages for python Enable debug messages for the event system .br +.TP +.B \-\-debug\-handlers +.br +Enable debug messages for event handling +.br + .TP .B \-\-debug\-wm .br diff --git a/intern/cycles/kernel/shaders/node_convert_from_color.osl b/intern/cycles/kernel/shaders/node_convert_from_color.osl index e4982975c20..ea488c9ce4c 100644 --- a/intern/cycles/kernel/shaders/node_convert_from_color.osl +++ b/intern/cycles/kernel/shaders/node_convert_from_color.osl @@ -28,7 +28,7 @@ shader node_convert_from_color( output normal Normal = normal(0.0, 0.0, 0.0)) { Val = Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722; - ValInt = (int)(Color[0]*0.2126 + Color[1]*0.7152 + Color[2]*0.0722); + ValInt = (int)(Color[0] * 0.2126 + Color[1] * 0.7152 + Color[2] * 0.0722); Vector = vector(Color[0], Color[1], Color[2]); Point = point(Color[0], Color[1], Color[2]); Normal = normal(Color[0], Color[1], Color[2]); diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl index c39830499fc..7da336a53f0 100644 --- a/intern/cycles/kernel/shaders/node_environment_texture.osl +++ b/intern/cycles/kernel/shaders/node_environment_texture.osl @@ -35,8 +35,8 @@ vector environment_texture_direction_to_mirrorball(vector dir) if (div > 0.0) dir /= div; - float u = 0.5*(dir[0] + 1.0); - float v = 0.5*(dir[2] + 1.0); + float u = 0.5 * (dir[0] + 1.0); + float v = 0.5 * (dir[2] + 1.0); return vector(u, v, 0.0); } diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl index 53c4aeaeb5f..99074672a6a 100644 --- a/intern/cycles/kernel/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/shaders/node_image_texture.osl @@ -68,26 +68,26 @@ shader node_image_texture( vector weight = vector(0.0, 0.0, 0.0); float blend = projection_blend; - float limit = 0.5*(1.0 + blend); + float limit = 0.5 * (1.0 + blend); /* first test for corners with single texture */ - if (Nob[0] > limit*(Nob[0] + Nob[1]) && Nob[0] > limit*(Nob[0] + Nob[2])) { + if (Nob[0] > limit * (Nob[0] + Nob[1]) && Nob[0] > limit * (Nob[0] + Nob[2])) { weight[0] = 1.0; } - else if (Nob[1] > limit*(Nob[0] + Nob[1]) && Nob[1] > limit*(Nob[1] + Nob[2])) { + else if (Nob[1] > limit * (Nob[0] + Nob[1]) && Nob[1] > limit * (Nob[1] + Nob[2])) { weight[1] = 1.0; } - else if (Nob[2] > limit*(Nob[0] + Nob[2]) && Nob[2] > limit*(Nob[1] + Nob[2])) { + else if (Nob[2] > limit * (Nob[0] + Nob[2]) && Nob[2] > limit * (Nob[1] + Nob[2])) { weight[2] = 1.0; } else if (blend > 0.0) { /* in case of blending, test for mixes between two textures */ - if (Nob[2] < (1.0 - limit)*(Nob[1] + Nob[0])) { + if (Nob[2] < (1.0 - limit) * (Nob[1] + Nob[0])) { weight[0] = Nob[0] / (Nob[0] + Nob[1]); weight[0] = clamp((weight[0] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0); weight[1] = 1.0 - weight[0]; } - else if (Nob[0] < (1.0 - limit)*(Nob[1] + Nob[2])) { + else if (Nob[0] < (1.0 - limit) * (Nob[1] + Nob[2])) { weight[1] = Nob[1] / (Nob[1] + Nob[2]); weight[1] = clamp((weight[1] - 0.5 * (1.0 - blend)) / blend, 0.0, 1.0); weight[2] = 1.0 - weight[1]; @@ -111,16 +111,16 @@ shader node_image_texture( float tmp_alpha; if (weight[0] > 0.0) { - Color += weight[0]*image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha); - Alpha += weight[0]*tmp_alpha; + Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha); + Alpha += weight[0] * tmp_alpha; } if (weight[1] > 0.0) { - Color += weight[1]*image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha); - Alpha += weight[1]*tmp_alpha; + Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha); + Alpha += weight[1] * tmp_alpha; } if (weight[2] > 0.0) { - Color += weight[2]*image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha); - Alpha += weight[2]*tmp_alpha; + Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha); + Alpha += weight[2] * tmp_alpha; } } } diff --git a/intern/cycles/kernel/shaders/node_light_falloff.osl b/intern/cycles/kernel/shaders/node_light_falloff.osl index 7ffa6fe0ffb..a9d41604361 100644 --- a/intern/cycles/kernel/shaders/node_light_falloff.osl +++ b/intern/cycles/kernel/shaders/node_light_falloff.osl @@ -30,7 +30,7 @@ shader node_light_falloff( getattribute("path:ray_length", ray_length); if (Smooth > 0.0) { - float squared = ray_length*ray_length; + float squared = ray_length * ray_length; strength *= squared / (Smooth + squared); } @@ -38,9 +38,9 @@ shader node_light_falloff( Quadratic = strength; /* Linear */ - Linear = (strength*ray_length); + Linear = (strength * ray_length); /* Constant */ - Constant = (strength*ray_length*ray_length); + Constant = (strength * ray_length * ray_length); } diff --git a/intern/cycles/kernel/shaders/node_normal_map.osl b/intern/cycles/kernel/shaders/node_normal_map.osl index d101ee870b7..dc25eb8539f 100644 --- a/intern/cycles/kernel/shaders/node_normal_map.osl +++ b/intern/cycles/kernel/shaders/node_normal_map.osl @@ -27,7 +27,7 @@ shader node_normal_map( string attr_sign_name = "geom:tangent_sign", output normal Normal = NormalIn) { - color mcolor = 2.0*color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5); + color mcolor = 2.0 * color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5); if (space == "Tangent") { vector tangent; @@ -47,6 +47,6 @@ shader node_normal_map( Normal = normalize(vector(mcolor)); if (Strength != 1.0) - Normal = normalize(NormalIn + (Normal - NormalIn)*max(Strength, 0.0)); + Normal = normalize(NormalIn + (Normal - NormalIn) * max(Strength, 0.0)); } -- cgit v1.2.3 From a9d889cba412eaa4e02806e50b631ae621521e23 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 4 Dec 2012 07:48:09 +0000 Subject: Fix #33405: preview render getting stuck in a particular .blend file, ObjectKey operator< had wrong brackets, changed it now to be more clear. Fix #33404: crash GPU rendering with OSL option still enabled. There was a check to disable OSL in this case, but it shouldn't have modified scene->params because this is used for comparison in scene->modified(). --- intern/cycles/blender/blender_shader.cpp | 2 +- intern/cycles/blender/blender_util.h | 24 +++++++++++++++++++----- intern/cycles/kernel/kernel_shader.h | 2 +- intern/cycles/render/mesh.cpp | 2 +- intern/cycles/render/osl.h | 2 ++ intern/cycles/render/scene.cpp | 11 ++++++----- intern/cycles/render/shader.cpp | 4 ++-- intern/cycles/render/shader.h | 4 +++- 8 files changed, 35 insertions(+), 16 deletions(-) diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index da06f1d0a38..c9380d8d58b 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -445,7 +445,7 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen } case BL::ShaderNode::type_SCRIPT: { #ifdef WITH_OSL - if(scene->params.shadingsystem != SceneParams::OSL) + if(!scene->shader_manager->use_osl()) break; /* create script node */ diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 4feb8b556d5..0a9f2dd06aa 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -367,12 +367,22 @@ struct ObjectKey { bool operator<(const ObjectKey& k) const { - return (parent < k.parent) || - (parent == k.parent && (memcmp(id, k.id, sizeof(id)) < 0)) || - (memcmp(id, k.id, sizeof(id)) == 0 && ob < k.ob); + if(ob < k.ob) { + return true; + } + else if(ob == k.ob) { + if(parent < k.parent) + return true; + else if(parent == k.parent) + return memcmp(id, k.id, sizeof(id)) < 0; + } + + return false; } }; +/* Particle System Key */ + struct ParticleSystemKey { void *ob; int id[OBJECT_PERSISTENT_ID_SIZE]; @@ -389,8 +399,12 @@ struct ParticleSystemKey { bool operator<(const ParticleSystemKey& k) const { /* first id is particle index, we don't compare that */ - return (ob < k.ob) || - (ob == k.ob && (memcmp(id+1, k.id+1, sizeof(int)*(OBJECT_PERSISTENT_ID_SIZE-1)) < 0)); + if(ob < k.ob) + return true; + else if(ob == k.ob) + return memcmp(id+1, k.id+1, sizeof(int)*(OBJECT_PERSISTENT_ID_SIZE-1)) < 0; + + return false; } }; diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 43ad4b1265a..98a7ec59d7b 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -698,7 +698,7 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, #ifdef __SVM__ svm_eval_nodes(kg, sd, SHADER_TYPE_SURFACE, randb, path_flag); #else - bsdf_diffuse_setup(sd, &sd->closure); + bsdf_diffuse_setup(&sd->closure); sd->closure.weight = make_float3(0.8f, 0.8f, 0.8f); #endif } diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 1958cfc10f7..bc782a78c60 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -547,7 +547,7 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, } /* create attribute lookup maps */ - if(scene->params.shadingsystem == SceneParams::OSL) + if(scene->shader_manager->use_osl()) update_osl_attributes(device, scene, mesh_attributes); else update_svm_attributes(device, dscene, scene, mesh_attributes); diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h index 08b5f8b89fb..9b58745bd46 100644 --- a/intern/cycles/render/osl.h +++ b/intern/cycles/render/osl.h @@ -52,6 +52,8 @@ public: OSLShaderManager(); ~OSLShaderManager(); + bool use_osl() { return true; } + void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress); void device_free(Device *device, DeviceScene *dscene); diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp index 7834aa701ea..8085cfdd3e6 100644 --- a/intern/cycles/render/scene.cpp +++ b/intern/cycles/render/scene.cpp @@ -44,10 +44,6 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_) device = NULL; memset(&dscene.data, 0, sizeof(dscene.data)); - /* OSL only works on the CPU */ - if(device_info_.type != DEVICE_CPU) - params.shadingsystem = SceneParams::SVM; - camera = new Camera(); filter = new Filter(); film = new Film(); @@ -57,9 +53,14 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_) object_manager = new ObjectManager(); integrator = new Integrator(); image_manager = new ImageManager(); - shader_manager = ShaderManager::create(this); particle_system_manager = new ParticleSystemManager(); + /* OSL only works on the CPU */ + if(device_info_.type == DEVICE_CPU) + shader_manager = ShaderManager::create(this, params.shadingsystem); + else + shader_manager = ShaderManager::create(this, SceneParams::SVM); + if (device_info_.type == DEVICE_CPU) image_manager->set_extended_image_limits(); } diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 17f7fbd43d6..b9b49bf2989 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -121,12 +121,12 @@ ShaderManager::~ShaderManager() { } -ShaderManager *ShaderManager::create(Scene *scene) +ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem) { ShaderManager *manager; #ifdef WITH_OSL - if(scene->params.shadingsystem == SceneParams::OSL) + if(shadingsystem == SceneParams::OSL) manager = new OSLShaderManager(); else #endif diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index 373b3356f51..d4421002ceb 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -107,9 +107,11 @@ class ShaderManager { public: bool need_update; - static ShaderManager *create(Scene *scene); + static ShaderManager *create(Scene *scene, int shadingsystem); virtual ~ShaderManager(); + virtual bool use_osl() { return false; } + /* device update */ virtual void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) = 0; virtual void device_free(Device *device, DeviceScene *dscene) = 0; -- cgit v1.2.3 From 89d91f5a7d5187bb6fcdf5a4895cd5100a020f6a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 4 Dec 2012 08:10:53 +0000 Subject: Fix #33402: Compositor crashes when drag-dropping multilayer exr There was a missing image reload signal in node creation by drag-dropping, which lead to incorrectly set image type. Also fixed misusage of IMB_freeImBuf used to release buffer acquired by BKE_image_acquire_ibuf. --- source/blender/compositor/operations/COM_ImageOperation.cpp | 2 +- source/blender/editors/space_node/node_add.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index d4c35f5afaa..84557118a1c 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -109,7 +109,7 @@ void BaseImageOperation::determineResolution(unsigned int resolution[2], unsigne resolution[1] = stackbuf->y; } - IMB_freeImBuf(stackbuf); + BKE_image_release_ibuf(this->m_image, stackbuf, NULL); } void ImageOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 04d2947ce89..96ac716f383 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -386,6 +386,9 @@ static int node_add_file_exec(bContext *C, wmOperator *op) node->id = (ID *)ima; id_us_plus(node->id); + 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); -- cgit v1.2.3 From 38dcce2da2183f6273e1132252f71bdd6ed0dea1 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Tue, 4 Dec 2012 08:40:24 +0000 Subject: FIX: OSL mix shader clamps 2nd color component to 3rd one. Previously the OSL Mix shader node was clamping the 2nd color component (green) to the 3rd color component (blue). Now every component is clamped on its own. --- intern/cycles/kernel/shaders/node_mix.osl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/kernel/shaders/node_mix.osl b/intern/cycles/kernel/shaders/node_mix.osl index 69e68e5ed15..b2af36230f8 100644 --- a/intern/cycles/kernel/shaders/node_mix.osl +++ b/intern/cycles/kernel/shaders/node_mix.osl @@ -272,7 +272,7 @@ color node_mix_clamp(color col) color outcol = col; outcol[0] = clamp(col[0], 0.0, 1.0); - outcol[1] = clamp(col[2], 0.0, 1.0); + outcol[1] = clamp(col[1], 0.0, 1.0); outcol[2] = clamp(col[2], 0.0, 1.0); return outcol; -- cgit v1.2.3 From 3fd153ab88f9f8e539b32d84748341527f2987bf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 4 Dec 2012 09:07:44 +0000 Subject: Fix for double-freeing image buffers when rendering opengl animation into movie file. --- source/blender/editors/render/render_opengl.c | 43 +++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index effb984c083..73f8abdf15f 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -481,7 +481,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); OGLRender *oglrender = op->customdata; Scene *scene = oglrender->scene; - ImBuf *ibuf; + ImBuf *ibuf, *ibuf_save = NULL; void *lock; char name[FILE_MAX]; int ok = 0; @@ -549,47 +549,46 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if (ibuf) { int needs_free = FALSE; - if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) { - ImBuf *colormanage_ibuf; + ibuf_save = ibuf; - colormanage_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, - &scene->display_settings, &scene->r.im_format); + if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) { + ibuf_save = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, + &scene->display_settings, &scene->r.im_format); - // IMB_freeImBuf(ibuf); /* owned by the image */ - ibuf = colormanage_ibuf; needs_free = TRUE; } /* color -> grayscale */ /* editing directly would alter the render view */ if (scene->r.im_format.planes == R_IMF_PLANES_BW) { - ImBuf *ibuf_bw = IMB_dupImBuf(ibuf); + ImBuf *ibuf_bw = IMB_dupImBuf(ibuf_save); IMB_color_to_bw(ibuf_bw); if (needs_free) - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf_save); - ibuf = ibuf_bw; + ibuf_save = ibuf_bw; } else { /* this is lightweight & doesnt re-alloc the buffers, only do this * to save the correct bit depth since the image is always RGBA */ - ImBuf *ibuf_cpy = IMB_allocImBuf(ibuf->x, ibuf->y, scene->r.im_format.planes, 0); - ibuf_cpy->rect = ibuf->rect; - ibuf_cpy->rect_float = ibuf->rect_float; - ibuf_cpy->zbuf_float = ibuf->zbuf_float; + ImBuf *ibuf_cpy = IMB_allocImBuf(ibuf_save->x, ibuf_save->y, scene->r.im_format.planes, 0); + + ibuf_cpy->rect = ibuf_save->rect; + ibuf_cpy->rect_float = ibuf_save->rect_float; + ibuf_cpy->zbuf_float = ibuf_save->zbuf_float; if (needs_free) { - ibuf_cpy->mall = ibuf->mall; - ibuf->mall = 0; - IMB_freeImBuf(ibuf); + ibuf_cpy->mall = ibuf_save->mall; + ibuf_save->mall = 0; + IMB_freeImBuf(ibuf_save); } - ibuf = ibuf_cpy; + ibuf_save = ibuf_cpy; } if (is_movie) { - ok = oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int *)ibuf->rect, + ok = oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int *)ibuf_save->rect, oglrender->sizex, oglrender->sizey, oglrender->reports); if (ok) { printf("Append frame %d", scene->r.cfra); @@ -597,7 +596,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } else { - ok = BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format); + ok = BKE_imbuf_write_stamp(scene, camera, ibuf_save, name, &scene->r.im_format); if (ok == 0) { printf("Write error: cannot save %s\n", name); @@ -609,8 +608,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } - /* imbuf knows which rects are not part of ibuf */ - IMB_freeImBuf(ibuf); + if (needs_free) + IMB_freeImBuf(ibuf_save); } BKE_image_release_ibuf(oglrender->ima, ibuf, lock); -- cgit v1.2.3 From 46227675f3c1f9abe703a753064c6b534dd85eb1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 4 Dec 2012 09:45:38 +0000 Subject: Default PNG compression for new scenes is not 90% (same as default scene) --- source/blender/blenkernel/intern/scene.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9b1425584a7..9bb2fb2de52 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -401,6 +401,7 @@ Scene *BKE_scene_add(const char *name) sce->r.im_format.planes = R_IMF_PLANES_RGB; sce->r.im_format.imtype = R_IMF_IMTYPE_PNG; sce->r.im_format.quality = 90; + sce->r.im_format.compress = 90; sce->r.displaymode = R_OUTPUT_AREA; sce->r.framapto = 100; -- cgit v1.2.3 From 60cd5ee4122ee73e24c47bb8dfba708624bd5eba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 11:21:33 +0000 Subject: fix for typo when overwriting pythons stdout/stderr, also print errors if they happen here now. --- source/blender/python/intern/bpy_interface.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index da40ded9a92..c98322c7f52 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -276,7 +276,11 @@ void BPY_python_start(int argc, const char **argv) "sys.__stdout__ = sys.stdout = io.TextIOWrapper(io.open(sys.stdout.fileno(), 'wb', -1), " "encoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n" "sys.__stderr__ = sys.stderr = io.TextIOWrapper(io.open(sys.stderr.fileno(), 'wb', -1), " - "ncoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n"); + "encoding='utf-8', errors='surrogateescape', newline='\\n', line_buffering=True)\n"); + if (PyErr_Occurred()) { + PyErr_Print(); + PyErr_Clear(); + } #endif /* end the baddness */ -- cgit v1.2.3 From 1d0f0050938591541e34c03278ad45efa8f32bd1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 12:41:59 +0000 Subject: fix for WM_keymap_remove_item() writing to freed memory. --- source/blender/windowmanager/intern/wm_keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 4fe1e3b64ab..3739462ac2c 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -392,7 +392,7 @@ int WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi) } BLI_freelinkN(&keymap->items, kmi); - WM_keyconfig_update_tag(keymap, kmi); + WM_keyconfig_update_tag(keymap, NULL); return TRUE; } else { -- cgit v1.2.3 From 41b6e700e09bd936227f1aec51f8cbfaf6ee864b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 14:41:40 +0000 Subject: bevel: re-order checks so angle checks are done after quick sanity checks. --- source/blender/bmesh/tools/bmesh_bevel.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 874707e23d3..af67d26f6ac 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -590,7 +590,7 @@ static void get_point_on_round_edge(const float uv[2], * So M = B*(Ainverse). Doing Ainverse by hand gives the code below. */ static int make_unit_square_map(const float va[3], const float vmid[3], const float vb[3], - float r_mat[4][4]) + float r_mat[4][4]) { float vo[3], vd[3], vb_vmid[3], va_vmid[3], vddir[3]; @@ -603,8 +603,8 @@ static int make_unit_square_map(const float va[3], const float vmid[3], const fl add_v3_v3v3(vd, vo, vddir); /* The cols of m are: {vmid - va, vmid - vb, vmid + vd - va -vb, va + vb - vmid; - * blender transform matrices are stored such that m[i][*] is ith column; - * the last elements of each col remain as they are in unity matrix */ + * blender transform matrices are stored such that m[i][*] is ith column; + * the last elements of each col remain as they are in unity matrix */ sub_v3_v3v3(&r_mat[0][0], vmid, va); r_mat[0][3] = 0.0f; sub_v3_v3v3(&r_mat[1][0], vmid, vb); @@ -657,7 +657,7 @@ static void get_point_on_round_edge(EdgeHalf *e, int k, * co is the point to snap and is modified in place. * va and vb are the limits of the profile (with peak on e). */ static void snap_to_edge_profile(EdgeHalf *e, const float va[3], const float vb[3], - float co[3]) + float co[3]) { float m[4][4], minv[4][4]; float edir[3], va0[3], vb0[3], vmid0[3], p[3], snap[3]; @@ -832,7 +832,7 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) EdgeHalf *e1, *e2, *epipe; BMVert *bmv, *bmv1, *bmv2, *bmv3, *bmv4; BMFace *f; - float co[3], coa[3], cob[3], midco[3], dir1[3], dir2[3]; + float co[3], coa[3], cob[3], midco[3]; float va_pipe[3], vb_pipe[3]; #ifdef USE_ALTERNATE_ADJ @@ -860,12 +860,14 @@ static void bevel_build_rings(BMesh *bm, BevVert *bv) if (e1->is_bev) { for (e2 = &bv->edges[0]; e2 != &bv->edges[bv->edgecount]; e2++) { if (e1 != e2 && e2->is_bev) { - sub_v3_v3v3(dir1, bv->v->co, BM_edge_other_vert(e1->e, bv->v)->co); - sub_v3_v3v3(dir2,BM_edge_other_vert(e2->e, bv->v)->co, bv->v->co); - if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON && - (e1->fnext == e2->fprev || e1->fprev == e2->fnext)) { - epipe = e1; - break; + if ((e1->fnext == e2->fprev) || (e1->fprev == e2->fnext)) { + float dir1[3], dir2[3]; + sub_v3_v3v3(dir1, bv->v->co, BM_edge_other_vert(e1->e, bv->v)->co); + sub_v3_v3v3(dir2, BM_edge_other_vert(e2->e, bv->v)->co, bv->v->co); + if (angle_v3v3(dir1, dir2) < 100.0f * (float)BEVEL_EPSILON) { + epipe = e1; + break; + } } } } -- cgit v1.2.3 From 767bfba808b82eb4dcf0d9f27c1a6dd428b1447f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 14:43:42 +0000 Subject: cmake was missing some header files. --- extern/libmv/CMakeLists.txt | 3 +++ intern/cycles/util/CMakeLists.txt | 3 ++- intern/locale/CMakeLists.txt | 2 ++ source/blender/blenkernel/CMakeLists.txt | 14 +++++++------- source/blender/blenkernel/intern/constraint.c | 8 +------- source/blender/blenlib/CMakeLists.txt | 1 + source/blender/editors/object/object_relations.c | 4 ++-- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index 38be34add75..ebc5953d956 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -102,6 +102,8 @@ set(SRC libmv/multiview/conditioning.h libmv/multiview/euclidean_resection.h libmv/multiview/fundamental.h + libmv/multiview/homography.h + libmv/multiview/homography_parameterization.h libmv/multiview/nviewtriangulation.h libmv/multiview/projection.h libmv/multiview/resection.h @@ -131,6 +133,7 @@ set(SRC libmv/tracking/pyramid_region_tracker.h libmv/tracking/region_tracker.h libmv/tracking/retrack_region_tracker.h + libmv/tracking/track_region.h libmv/tracking/trklt_region_tracker.h third_party/fast/fast.h diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index bf5f791a245..dce417704cc 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -54,6 +54,7 @@ set(SRC_HEADERS util_path.h util_progress.h util_set.h + util_stats.h util_string.h util_system.h util_task.h @@ -61,8 +62,8 @@ set(SRC_HEADERS util_time.h util_transform.h util_types.h - util_view.h util_vector.h + util_view.h util_xml.h ) diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt index 3187639c844..1f14a0e7a6a 100644 --- a/intern/locale/CMakeLists.txt +++ b/intern/locale/CMakeLists.txt @@ -32,6 +32,8 @@ set(INC_SYS set(SRC boost_locale_wrapper.cpp + + boost_locale_wrapper.h ) if(WITH_INTERNATIONAL) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index c5dc7da8edf..2da9b402d59 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -255,13 +255,13 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -if(WITH_MOD_CLOTH_ELTOPO) - list(APPEND INC - ../../../extern/eltopo - ../../../extern/eltopo/eltopo3d - ) - add_definitions(-DWITH_ELTOPO) -endif() +#if(WITH_MOD_CLOTH_ELTOPO) +# list(APPEND INC +# ../../../extern/eltopo +# ../../../extern/eltopo/eltopo3d +# ) +# add_definitions(-DWITH_ELTOPO) +#endif() if(WITH_IMAGE_OPENEXR) add_definitions(-DWITH_OPENEXR) diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index e300b5e0f19..97d750854f4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -84,15 +84,9 @@ #include "BKE_movieclip.h" #ifdef WITH_PYTHON -#include "BPY_extern.h" +# include "BPY_extern.h" #endif -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - - - /* ************************ Constraints - General Utilities *************************** */ /* These functions here don't act on any specific constraints, and are therefore should/will * not require any of the special function-pointers afforded by the relevant constraint diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 10ae26d3757..8a3b1c9675b 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -128,6 +128,7 @@ set(SRC BLI_math_color.h BLI_math_geom.h BLI_math_inline.h + BLI_math_interp.h BLI_math_matrix.h BLI_math_rotation.h BLI_math_vector.h diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f886b52e2ce..0988a196fb1 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -643,8 +643,8 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object /* apply transformation of previous parenting */ if (keep_transform) { - /* was removed because of bug [#23577], - * but this can be handy in some cases too [#32616], so make optional */ + /* was removed because of bug [#23577], + * but this can be handy in some cases too [#32616], so make optional */ BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE); } -- cgit v1.2.3 From 576bc2e6e475508a79b41a318756d35b12a304fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 15:28:34 +0000 Subject: bevel - use tri-fan filling in the special case when a bevel edge meets a non bevel edge at a valence 2 vert. this is the topology tri-fan was intended to be used. --- source/blender/bmesh/tools/bmesh_bevel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index af67d26f6ac..3276361da87 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -726,7 +726,8 @@ static void build_boundary(MemArena *mem_arena, BevVert *bv) v = add_new_bound_vert(mem_arena, vm, co); v->efirst = v->elast = e->next; e->next->leftv = e->next->rightv = v; - vm->mesh_kind = M_POLY; + /* could use M_POLY too, but tri-fan looks nicer)*/ + vm->mesh_kind = M_TRI_FAN; return; } -- cgit v1.2.3 From 677c712b58d6a6aefe2dc13389558b5556ad9145 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 17:38:55 +0000 Subject: fix [#33412] Jump to next frame broken in grease pencil mode allow arrow keys while in grease pencil session, otherwise you can't change frames. also correct out-of-date comments. --- source/blender/editors/gpencil/gpencil_paint.c | 12 +++++++++--- source/blender/editors/space_view3d/view3d_select.c | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e04bbc1f2bf..8fdca730674 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1815,10 +1815,16 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event) * better in tools that immediately apply * in 3D space. */ - + /* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */ - if (ISKEYBOARD(event->type)) - estate = OPERATOR_RUNNING_MODAL; + if (ISKEYBOARD(event->type)) { + if (ELEM4(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY)) { + /* allow some keys - for frame changing: [#33412] */ + } + else { + estate = OPERATOR_RUNNING_MODAL; + } + } //printf("\tGP - handle modal event...\n"); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 53f983912ac..cffa53b5dfb 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -221,7 +221,7 @@ static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select) } -/* object mode, EM_ prefix is confusing here, rename? */ +/* object mode, edbm_ prefix is confusing here, rename? */ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select) { MVert *mv = me->mvert; @@ -237,8 +237,8 @@ static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select) } } } -/* object mode, EM_ prefix is confusing here, rename? */ +/* object mode, edbm_ prefix is confusing here, rename? */ static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select) { MPoly *mpoly = me->mpoly; -- cgit v1.2.3 From 77fdf426d60e7461cbb6450d712ed6bf8e7fba09 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 17:54:32 +0000 Subject: disable numpy warning with cmake, since we didnt end up bundling this with blender yet. --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0954d5ce878..1b642bb24c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1932,12 +1932,13 @@ if(WITH_PYTHON) if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) # set but invalid + # -- disabled until we make numpy bundled with blender - campbell if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "") - if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy") - message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' " - "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") - set(WITH_PYTHON_INSTALL_NUMPY OFF) - endif() +# if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy") +# message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' " +# "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python") +# set(WITH_PYTHON_INSTALL_NUMPY OFF) +# endif() # not set, so initialize else() string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}") -- cgit v1.2.3 From 302856f4b16896d19e2adf6bd42823a88684fd4a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 18:22:41 +0000 Subject: operator spacebar search menu wasn't ignoring internal operators, turns out there were copy-pasted functions for operator search popups which were identical except that one skipped internal ops. de-duplicate so both work the same now. --- source/blender/editors/include/UI_interface.h | 1 + .../editors/interface/interface_templates.c | 10 ++++- source/blender/windowmanager/intern/wm_operators.c | 45 +--------------------- 3 files changed, 11 insertions(+), 45 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 12db9b93772..2dc552d0fce 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -817,6 +817,7 @@ void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *pt void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C); +void uiOperatorSearch_But(uiBut *but); void uiTemplateOperatorSearch(uiLayout *layout); void uiTemplateHeader3D(uiLayout *layout, struct bContext *C); void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 19d4de8bce4..f7a53c6bab2 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2785,6 +2785,9 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { wmOperatorType *ot = BLI_ghashIterator_getValue(iter); + if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0) + continue; + if (BLI_strcasestr(ot->name, str)) { if (WM_operator_poll((bContext *)C, ot)) { char name[256]; @@ -2810,6 +2813,11 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char BLI_ghashIterator_free(iter); } +void uiOperatorSearch_But(uiBut *but) +{ + uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); +} + void uiTemplateOperatorSearch(uiLayout *layout) { uiBlock *block; @@ -2820,7 +2828,7 @@ void uiTemplateOperatorSearch(uiLayout *layout) uiBlockSetCurLayout(block, layout); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X * 6, UI_UNIT_Y, 0, 0, ""); - uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); + uiOperatorSearch_But(but); } /************************* Running Jobs Template **************************/ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 80ceb5700e5..c555f771a48 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1523,49 +1523,6 @@ static void WM_OT_splash(wmOperatorType *ot) /* ***************** Search menu ************************* */ -static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2) -{ - wmOperatorType *ot = arg2; - - if (ot) - WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); -} - -static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items) -{ - GHashIterator *iter = WM_operatortype_iter(); - - for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) { - wmOperatorType *ot = BLI_ghashIterator_getValue(iter); - - if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0) - continue; - - if (BLI_strcasestr(ot->name, str)) { - if (WM_operator_poll((bContext *)C, ot)) { - char name[256]; - int len = strlen(ot->name); - - /* display name for menu, can hold hotkey */ - BLI_strncpy(name, ot->name, sizeof(name)); - - /* check for hotkey */ - if (len < sizeof(name) - 6) { - if (WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, TRUE, - &name[len + 1], sizeof(name) - len - 1)) - { - name[len] = '|'; - } - } - - if (0 == uiSearchItemAdd(items, name, ot, 0)) - break; - } - } - } - BLI_ghashIterator_free(iter); -} - static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op)) { static char search[256] = ""; @@ -1578,7 +1535,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_ uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_SEARCH_MENU); but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, ""); - uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb, NULL); + uiOperatorSearch_But(but); /* fake button, it holds space for search items */ uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxHeight(), uiSearchBoxWidth(), uiSearchBoxHeight(), NULL, 0, 0, 0, 0, NULL); -- cgit v1.2.3 From d0667c70ddff3eba37921bda85b8303cf199ae72 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 19:58:13 +0000 Subject: fix for python button evaluation not restoring the __main__ module. --- source/blender/python/intern/bpy_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index c98322c7f52..cdecf64c93c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -618,7 +618,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve } } - PyC_MainModule_Backup(&main_mod); + PyC_MainModule_Restore(main_mod); bpy_context_clear(C, &gilstate); -- cgit v1.2.3 From 5b9f30980a3661566993841d78fd858c68197454 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 4 Dec 2012 20:09:07 +0000 Subject: update parse_syntax_error() from python3.3 - this is an internal python function that isn't exposed to the api. --- source/blender/python/intern/bpy_traceback.c | 64 ++++++++++++++++------------ 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c index f7aa6e0880b..48bf65a841b 100644 --- a/source/blender/python/intern/bpy_traceback.c +++ b/source/blender/python/intern/bpy_traceback.c @@ -39,70 +39,80 @@ static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce) return PyBytes_AS_STRING((*coerce = PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename))); } -/* copied from pythonrun.c, 3.2.0 */ +/* copied from pythonrun.c, 3.3.0 */ static int parse_syntax_error(PyObject *err, PyObject **message, const char **filename, int *lineno, int *offset, const char **text) { long hold; PyObject *v; + _Py_IDENTIFIER(msg); + _Py_IDENTIFIER(filename); + _Py_IDENTIFIER(lineno); + _Py_IDENTIFIER(offset); + _Py_IDENTIFIER(text); - /* old style errors */ - if (PyTuple_Check(err)) - return PyArg_ParseTuple(err, "O(ziiz)", message, filename, - lineno, offset, text); + *message = NULL; /* new style errors. `err' is an instance */ - - if (!(v = PyObject_GetAttrString(err, "msg"))) + *message = _PyObject_GetAttrId(err, &PyId_msg); + if (!*message) goto finally; - *message = v; - if (!(v = PyObject_GetAttrString(err, "filename"))) + v = _PyObject_GetAttrId(err, &PyId_filename); + if (!v) goto finally; - if (v == Py_None) + if (v == Py_None) { + Py_DECREF(v); *filename = NULL; - else if (!(*filename = _PyUnicode_AsString(v))) - goto finally; + } + else { + *filename = _PyUnicode_AsString(v); + Py_DECREF(v); + if (!*filename) + goto finally; + } - Py_DECREF(v); - if (!(v = PyObject_GetAttrString(err, "lineno"))) + v = _PyObject_GetAttrId(err, &PyId_lineno); + if (!v) goto finally; hold = PyLong_AsLong(v); Py_DECREF(v); - v = NULL; if (hold < 0 && PyErr_Occurred()) goto finally; *lineno = (int)hold; - if (!(v = PyObject_GetAttrString(err, "offset"))) + v = _PyObject_GetAttrId(err, &PyId_offset); + if (!v) goto finally; if (v == Py_None) { *offset = -1; Py_DECREF(v); - v = NULL; - } - else { + } else { hold = PyLong_AsLong(v); Py_DECREF(v); - v = NULL; if (hold < 0 && PyErr_Occurred()) goto finally; *offset = (int)hold; } - if (!(v = PyObject_GetAttrString(err, "text"))) + v = _PyObject_GetAttrId(err, &PyId_text); + if (!v) goto finally; - if (v == Py_None) + if (v == Py_None) { + Py_DECREF(v); *text = NULL; - else if (!PyUnicode_Check(v) || - !(*text = _PyUnicode_AsString(v))) - goto finally; - Py_DECREF(v); + } + else { + *text = _PyUnicode_AsString(v); + Py_DECREF(v); + if (!*text) + goto finally; + } return 1; finally: - Py_XDECREF(v); + Py_XDECREF(*message); return 0; } /* end copied function! */ -- cgit v1.2.3 From b095c31c87e86b8e27d9431c1a4bbd2b7dee977f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 4 Dec 2012 22:03:39 +0000 Subject: Can't stress how much I hate bash... This should fix a bug with version comparison (at least under fedora, debian looked OK :/ ). --- build_files/build_environment/install_deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index f7023603918..4277edeba3c 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -340,7 +340,7 @@ version_eq() { # $1 and $2 should be version numbers made of numbers only. version_ge() { version_eq $1 $2 - if [ $? -eq 1 -a $(_echo "$1\n$2" | sort --version-sort | head --lines=1) = "$1" ]; then + if [ $? -eq 1 -a $(_echo "$1" "$2" | sort --version-sort | head --lines=1) = "$1" ]; then return 1 else return 0 @@ -1730,7 +1730,7 @@ print_info_ffmpeglink() { _packages="$_packages $OPENJPEG_DEV" fi - # XXX At least under Debian, static schro give problem at blender linking time... :/ + # XXX At least under Debian, static schro gives problem at blender linking time... :/ if $SCHRO_USE && ! $ALL_STATIC; then _packages="$_packages $SCHRO_DEV" fi -- cgit v1.2.3 From af51827dda90e5402d9e4a476a8ada3f422dda13 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Dec 2012 01:02:41 +0000 Subject: add a message when solidify is used with only-edges, this isn't properly supported. also minor edits to py-api-ref -- This line, and those below, will be ignored-- M doc/python_api/sphinx_doc_gen.py M doc/python_api/rst/include__bmesh.rst M source/blender/modifiers/intern/MOD_solidify.c --- doc/python_api/rst/include__bmesh.rst | 1 - doc/python_api/sphinx_doc_gen.py | 4 ++-- source/blender/modifiers/intern/MOD_solidify.c | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst index d804b889e20..ef4a1c272b4 100644 --- a/doc/python_api/rst/include__bmesh.rst +++ b/doc/python_api/rst/include__bmesh.rst @@ -42,7 +42,6 @@ For an overview of BMesh data types and how they reference each other see: TODO items are... * add access to BMesh **walkers** - * add api for calling BMesh operators (unrelated to bpy.ops) * add custom-data manipulation functions add/remove/rename. Example Script diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 1814261fc71..1a1a4bf909b 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1538,8 +1538,8 @@ def write_rst_contents(basepath): "mathutils", "mathutils.geometry", "mathutils.noise", # misc "bgl", "blf", "gpu", "aud", "bpy_extras", - # bmesh - "bmesh", "bmesh.types", "bmesh.utils", "bmesh.ops", + # bmesh, submodules are in own page + "bmesh", ) for mod in standalone_modules: diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index fbd3c084e70..75e54d77b15 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -750,6 +750,10 @@ static DerivedMesh *applyModifier( CDDM_calc_normals(result); } + if (numFaces == 0 && numEdges != 0) { + modifier_setError(md, "Faces needed for useful output"); + } + return result; } -- cgit v1.2.3 From 57d7c1f226811d5f6f5d73d8bd498e2b72a603c2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Dec 2012 03:38:01 +0000 Subject: pydna experimental ctypes DNA api was broken with more recent python versions, and some minor doc edits. --- doc/python_api/rst/info_gotcha.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index 08548ea73e5..a48cb8fc15e 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -494,7 +494,7 @@ Heres an example of threading supported by Blender: t.join() -This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs (Unsupported). +This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs **(Unsupported)**. .. code-block:: python @@ -517,7 +517,7 @@ So far, no work has gone into making Blender's python integration thread safe, s .. note:: - Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with blender and make use of multiple CPU's too. + Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too. Help! My script crashes Blender @@ -540,7 +540,7 @@ Here are some general hints to avoid running into these problems. .. note:: To find the line of your script that crashes you can use the ``faulthandler`` module. - See `faulthandler docs`_. + See `faulthandler docs `_. While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash. @@ -548,7 +548,7 @@ Here are some general hints to avoid running into these problems. Undo/Redo --------- -Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh etc). +Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Lamp... etc). This example shows how you can tell undo changes the memory locations. @@ -666,9 +666,9 @@ But take care because this is limited to scripts accessing the variable which is sys.exit ======== -Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately. +Some python modules will call ``sys.exit()`` themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since ``sys.exit()`` will quit blender immediately. For example, the ``optparse`` module will print an error and exit if the arguments are invalid. -An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice. +An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit`` with your own function but manipulating python in this way is bad practice. -- cgit v1.2.3 From 690359eb8d91b34405f3188632d891fc29fe5164 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 5 Dec 2012 06:30:17 +0000 Subject: Fix crash opening some .blend files on OS X 10.8 with double click or drag and drop onto the application. It seems something changed in the operating which makes our method of releasing windows crash. Previously we called [m_window release], but on 10.8 this does not remove the window from [NSApp orderedWindows] and perhaps other places, leading to crashes. So instead we set setReleasedWhenClosed back to YES right before closing, which will then do the cleanup for us. --- intern/ghost/intern/GHOST_WindowCocoa.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 01705fe8f7b..7a5bb8ab604 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -609,9 +609,12 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa() [m_openGLView release]; if (m_window) { + // previously we called [m_window release], but on 10.8 this does not + // remove the window from [NSApp orderedWindows] and perhaps other + // places, leading to crashes. so instead we set setReleasedWhenClosed + // back to YES right before closing + [m_window setReleasedWhenClosed:YES]; [m_window close]; - [[m_window delegate] release]; - [m_window release]; m_window = nil; } -- cgit v1.2.3 From 5bb576e8e4cc3582ae4f5e9c1d50b073ac5f10e2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 5 Dec 2012 11:46:13 +0000 Subject: Fix #33417: add back GPU Mipmap Generation option, apparently with this disabled it takes up less memory on some cards, still unclear why. --- release/scripts/startup/bl_ui/space_userpref.py | 1 + source/blender/gpu/GPU_draw.h | 2 +- source/blender/gpu/intern/gpu_draw.c | 12 +++++++++--- source/blender/makesrna/intern/rna_userdef.c | 11 +++++++++++ source/blender/windowmanager/intern/wm_init_exit.c | 2 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 2 +- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index f6eaf421a7a..0bb25e98456 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -437,6 +437,7 @@ class USERPREF_PT_system(Panel): col.label(text="OpenGL:") col.prop(system, "gl_clip_alpha", slider=True) col.prop(system, "use_mipmaps") + col.prop(system, "use_gpu_mipmap") col.prop(system, "use_16bit_textures") col.label(text="Anisotropic Filtering") col.prop(system, "anisotropic_filter", text="") diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 5f6eb45ad70..b26c25558c3 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -116,7 +116,7 @@ void GPU_set_anisotropic(float value); float GPU_get_anisotropic(void); /* enable gpu mipmapping */ -void GPU_set_gpu_mipmapping(void); +void GPU_set_gpu_mipmapping(int gpu_mipmap); /* Image updates and free * - these deal with images bound as opengl textures */ diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index bcdbfe781f8..d466e59452b 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -240,10 +240,16 @@ static struct GPUTextureState { /* Mipmap settings */ -void GPU_set_gpu_mipmapping() +void GPU_set_gpu_mipmapping(int gpu_mipmap) { - /* always enable if it's supported */ - GTS.gpu_mipmap = GLEW_EXT_framebuffer_object; + int old_value = GTS.gpu_mipmap; + + /* only actually enable if it's supported */ + GTS.gpu_mipmap = gpu_mipmap && GLEW_EXT_framebuffer_object; + + if (old_value != GTS.gpu_mipmap) { + GPU_free_images(); + } } void GPU_set_mipmap(int mipmap) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index bd454bab25d..7be34c398ae 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -144,6 +144,12 @@ static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA rna_userdef_update(bmain, scene, ptr); } +static void rna_userdef_gl_gpu_mipmaps(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + GPU_set_gpu_mipmapping(U.use_gpu_mipmap); + rna_userdef_update(bmain, scene, ptr); +} + static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr) { GPU_free_images(); @@ -3218,6 +3224,11 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images"); RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures"); + prop = RNA_def_property(srna, "use_gpu_mipmap", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_gpu_mipmap", 1); + RNA_def_property_ui_text(prop, "GPU Mipmap Generation", "Generate Image Mipmaps on the GPU"); + RNA_def_property_update(prop, 0, "rna_userdef_gl_gpu_mipmaps"); + prop = RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO); RNA_def_property_ui_text(prop, "VBOs", diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 1b8bcd51564..c9f0bbffc63 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -183,7 +183,7 @@ void WM_init(bContext *C, int argc, const char **argv) GPU_extensions_init(); GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); GPU_set_anisotropic(U.anisotropic_filter); - GPU_set_gpu_mipmapping(); + GPU_set_gpu_mipmapping(U.use_gpu_mipmap); UI_init(); } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 475e139bfcc..a82f9ce1779 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -756,7 +756,7 @@ int main(int argc, char** argv) } GPU_set_anisotropic(U.anisotropic_filter); - GPU_set_gpu_mipmapping(); + GPU_set_gpu_mipmapping(U.use_gpu_mipmap); // Create the system if (GHOST_ISystem::createSystem() == GHOST_kSuccess) -- cgit v1.2.3 From c2405353b865fec24b6c243bc07924ed2b67d0a7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 5 Dec 2012 11:58:38 +0000 Subject: Make installation of some libs off by default (use --with-all option to re-enable them). Currently affected libs: *libspnav *liblame *libjack *libscrhoedinger *libvpx *libxvid --- build_files/build_environment/install_deps.sh | 251 +++++++++++++++----------- 1 file changed, 146 insertions(+), 105 deletions(-) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 4277edeba3c..072e999d827 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -4,7 +4,7 @@ ARGS=$( \ getopt \ -o s:i:t:h \ ---long source:,install:,threads:,help,with-osl,all-static,force-all,force-python,\ +--long source:,install:,threads:,help,with-all,with-osl,all-static,force-all,force-python,\ force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-ffmpeg,\ skip-python,skip-boost,skip-ocio,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg \ -- "$@" \ @@ -15,10 +15,13 @@ SRC="$HOME/src/blender-deps" INST="/opt/lib" CWD=$PWD -# Do not yet enable osl, use --build-osl option to try it. -BUILD_OSL=false +# Do not install some optional, potentially conflicting libs by default... +WITH_ALL=false -# Try to link everything statically. Use this to produce protable versions of blender. +# Do not yet enable osl, use --with-osl (or --with-all) option to try it. +WITH_OSL=false + +# Try to link everything statically. Use this to produce portable versions of blender. ALL_STATIC=false THREADS=`cat /proc/cpuinfo | grep cores | uniq | sed -e "s/.*: *\(.*\)/\\1/"` @@ -32,7 +35,8 @@ Please edit \\\$SRC and/or \\\$INST variables at the beginning of this script, or use --source/--install options, if you want to use other paths! Number of threads for building: \$THREADS (automatically detected, use --threads= to override it). -Building OSL: \$BUILD_OSL (use --with-osl option to enable it). +Full install: \$WITH_ALL (use --with-all option to enable it). +Building OSL: \$WITH_OSL (use --with-osl option to enable it). All static linking: \$ALL_STATIC (use --all-static option to enable it). Use --help to show all available options!\"" @@ -50,6 +54,12 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: -t n, --threads=n Use a specific number of threads when building the libraries (auto-detected as '\$THREADS'). + --with-all + By default, a number of optional and not-so-often needed libraries are not installed. + This option will try to install them, at the cost of potential conflicts (depending on + how your package system is set…). + Note this option also implies all other (more specific) --with-foo options below. + --with-osl Try to install or build the OpenShadingLanguage libraries (and their dependencies). Still experimental! @@ -220,8 +230,11 @@ while true; do INFO "" exit 0 ;; + --with-all) + WITH_ALL=true; shift; continue + ;; --with-osl) - BUILD_OSL=true; shift; continue + WITH_OSL=true; shift; continue ;; --all-static) ALL_STATIC=true; shift; continue @@ -293,6 +306,10 @@ while true; do esac done +if $WITH_ALL; then + WITH_OSL=true +fi + # Return 0 if $1 = $2 (i.e. 1.01.0 = 1.1, but 1.1.1 != 1.1), else 1. # $1 and $2 should be version numbers made of numbers only. version_eq() { @@ -1086,41 +1103,22 @@ install_DEB() { VORBIS_DEV="libvorbis-dev" THEORA_DEV="libtheora-dev" - INFO "" - install_packages_DEB gawk cmake scons gcc g++ libjpeg-dev libpng-dev libtiff-dev \ - libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev libncurses5-dev \ - libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV libopenexr-dev libopenal-dev \ - libglew-dev yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libsdl1.2-dev \ - libfftw3-dev libjack0 libjack-dev python-dev patch bzip2 - + _packages="gawk cmake scons build-essential libjpeg-dev libpng-dev libtiff-dev \ + libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \ + libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \ + libopenexr-dev libopenal-dev libglew-dev yasm $THEORA_DEV \ + $VORBIS_DEV libsdl1.2-dev libfftw3-dev python-dev patch bzip2" OPENJPEG_USE=true - SCHRO_USE=true VORBIS_USE=true THEORA_USE=true - INFO "" - # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev! - XVID_DEV="libxvidcore-dev" - check_package_DEB $XVID_DEV - if [ $? -eq 0 ]; then - install_packages_DEB $XVID_DEV - XVID_USE=true - else - XVID_DEV="libxvidcore4-dev" - check_package_DEB $XVID_DEV - if [ $? -eq 0 ]; then - install_packages_DEB $XVID_DEV - XVID_USE=true - fi + if $WITH_ALL; then + _packages="$_packages $SCHRO_DEV libjack0 libjack-dev" + SCHRO_USE=true fi INFO "" - MP3LAME_DEV="libmp3lame-dev" - check_package_DEB $MP3LAME_DEV - if [ $? -eq 0 ]; then - install_packages_DEB $MP3LAME_DEV - MP3LAME_USE=true - fi + install_packages_DEB $_packages INFO "" X264_DEV="libx264-dev" @@ -1130,18 +1128,44 @@ install_DEB() { X264_USE=true fi - INFO "" - VPX_DEV="libvpx-dev" - check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_DEB $VPX_DEV - VPX_USE=true - fi + if $WITH_ALL; then + INFO "" + # Grmpf, debian is libxvidcore-dev and ubuntu libxvidcore4-dev! + XVID_DEV="libxvidcore-dev" + check_package_DEB $XVID_DEV + if [ $? -eq 0 ]; then + install_packages_DEB $XVID_DEV + XVID_USE=true + else + XVID_DEV="libxvidcore4-dev" + check_package_DEB $XVID_DEV + if [ $? -eq 0 ]; then + install_packages_DEB $XVID_DEV + XVID_USE=true + fi + fi - INFO "" - check_package_DEB libspnav-dev - if [ $? -eq 0 ]; then - install_packages_DEB libspnav-dev + INFO "" + MP3LAME_DEV="libmp3lame-dev" + check_package_DEB $MP3LAME_DEV + if [ $? -eq 0 ]; then + install_packages_DEB $MP3LAME_DEV + MP3LAME_USE=true + fi + + INFO "" + VPX_DEV="libvpx-dev" + check_package_version_ge_DEB $VPX_DEV $VPX_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_DEB $VPX_DEV + VPX_USE=true + fi + + INFO "" + check_package_DEB libspnav-dev + if [ $? -eq 0 ]; then + install_packages_DEB libspnav-dev + fi fi INFO "" @@ -1203,7 +1227,7 @@ install_DEB() { fi fi - if $BUILD_OSL; then + if $WITH_OSL; then have_llvm=false if $LLVM_SKIP; then @@ -1328,19 +1352,23 @@ install_RPM() { VORBIS_DEV="libvorbis-devel" THEORA_DEV="libtheora-devel" - INFO "" - install_packages_RPM gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel \ - freetype-devel libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \ - readline-devel $OPENJPEG_DEV openexr-devel openal-soft-devel \ - glew-devel yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV SDL-devel \ - fftw-devel lame-libs jack-audio-connection-kit-devel libspnav-devel \ - libjpeg-devel patch python-devel - + _packages="gawk gcc gcc-c++ cmake scons libpng-devel libtiff-devel freetype-devel \ + libX11-devel libXi-devel wget libsqlite3x-devel ncurses-devel \ + readline-devel $OPENJPEG_DEV openexr-devel openal-soft-devel \ + glew-devel yasm $THEORA_DEV $VORBIS_DEV SDL-devel fftw-devel \ + lame-libs libjpeg-devel patch python-devel" OPENJPEG_USE=true - SCHRO_USE=true VORBIS_USE=true THEORA_USE=true + if $WITH_ALL; then + _packages="$_packages $SCHRO_DEV jack-audio-connection-kit-devel libspnav-devel" + SCHRO_USE=true + fi + + INFO "" + install_packages_RPM $_packages + INFO "" X264_DEV="x264-devel" check_package_version_ge_RPM $X264_DEV $X264_VERSION_MIN @@ -1349,28 +1377,30 @@ install_RPM() { X264_USE=true fi - INFO "" - XVID_DEV="xvidcore-devel" - check_package_RPM $XVID_DEV - if [ $? -eq 0 ]; then - install_packages_RPM $XVID_DEV - XVID_USE=true - fi + if $WITH_ALL; then + INFO "" + XVID_DEV="xvidcore-devel" + check_package_RPM $XVID_DEV + if [ $? -eq 0 ]; then + install_packages_RPM $XVID_DEV + XVID_USE=true + fi - INFO "" - VPX_DEV="libvpx-devel" - check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_RPM $VPX_DEV - VPX_USE=true - fi + INFO "" + VPX_DEV="libvpx-devel" + check_package_version_ge_RPM $VPX_DEV $VPX_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_RPM $VPX_DEV + VPX_USE=true + fi - INFO "" - MP3LAME_DEV="lame-devel" - check_package_RPM $MP3LAME_DEV - if [ $? -eq 0 ]; then - install_packages_RPM $MP3LAME_DEV - MP3LAME_USE=true + INFO "" + MP3LAME_DEV="lame-devel" + check_package_RPM $MP3LAME_DEV + if [ $? -eq 0 ]; then + install_packages_RPM $MP3LAME_DEV + MP3LAME_USE=true + fi fi INFO "" @@ -1421,7 +1451,7 @@ install_RPM() { fi fi - if $BUILD_OSL; then + if $WITH_OSL; then have_llvm=false INFO "" @@ -1540,13 +1570,22 @@ install_SUSE() { VORBIS_DEV="libvorbis-devel" THEORA_DEV="libtheora-devel" + _packages="gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel freetype-devel \ + libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \ + readline-devel $OPENJPEG_DEV libopenexr-devel openal-soft-devel \ + glew-devel yasm $THEORA_DEV $VORBIS_DEV libSDL-devel fftw3-devel \ + libjpeg62-devel patch python-devel" + OPENJPEG_USE=true + VORBIS_USE=true + THEORA_USE=true + + if $WITH_ALL; then + _packages="$_packages $SCHRO_DEV libjack-devel libspnav-devel" + SCHRO_USE=true + fi + INFO "" - install_packages_SUSE gawk gcc gcc-c++ cmake scons libpng12-devel libtiff-devel \ - freetype-devel libX11-devel libXi-devel wget sqlite3-devel ncurses-devel \ - readline-devel $OPENJPEG_DEV libopenexr-devel openal-soft-devel \ - glew-devel yasm $SCHRO_DEV $THEORA_DEV $VORBIS_DEV libSDL-devel \ - fftw3-devel libjack-devel libspnav-devel \ - libjpeg62-devel patch python-devel + install_packages_SUSE $_packages OPENJPEG_USE=true SCHRO_USE=true @@ -1561,29 +1600,31 @@ install_SUSE() { X264_USE=true fi - INFO "" - XVID_DEV="xvidcore-devel" - check_package_SUSE $XVID_DEV - if [ $? -eq 0 ]; then - install_packages_SUSE $XVID_DEV - XVID_USE=true - fi + if $WITH_ALL; then + INFO "" + XVID_DEV="xvidcore-devel" + check_package_SUSE $XVID_DEV + if [ $? -eq 0 ]; then + install_packages_SUSE $XVID_DEV + XVID_USE=true + fi - INFO "" - VPX_DEV="libvpx-devel" - check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN - if [ $? -eq 0 ]; then - install_packages_SUSE $VPX_DEV - VPX_USE=true - fi + INFO "" + VPX_DEV="libvpx-devel" + check_package_version_ge_SUSE $VPX_DEV $VPX_VERSION_MIN + if [ $? -eq 0 ]; then + install_packages_SUSE $VPX_DEV + VPX_USE=true + fi - INFO "" - # No mp3 in suse, it seems. - MP3LAME_DEV="lame-devel" - check_package_SUSE $MP3LAME_DEV - if [ $? -eq 0 ]; then - install_packages_SUSE $MP3LAME_DEV - MP3LAME_USE=true + INFO "" + # No mp3 in suse, it seems. + MP3LAME_DEV="lame-devel" + check_package_SUSE $MP3LAME_DEV + if [ $? -eq 0 ]; then + install_packages_SUSE $MP3LAME_DEV + MP3LAME_USE=true + fi fi INFO "" @@ -1622,7 +1663,7 @@ install_SUSE() { compile_OIIO fi - if $BUILD_OSL; then + if $WITH_OSL; then have_llvm=false INFO "" @@ -1761,7 +1802,7 @@ print_info() { INFO " -D Boost_USE_ICU=ON" fi - if [ -d $INST/osl -a $BUILD_OSL == true ]; then + if [ -d $INST/osl -a $WITH_OSL == true ]; then INFO " -D CYCLES_OSL=$INST/osl" INFO " -D WITH_CYCLES_OSL=ON" INFO " -D LLVM_VERSION=$LLVM_VERSION_FOUND" -- cgit v1.2.3 From 4742dc3fd747564636c36e40c88687ccc725a1c7 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 5 Dec 2012 14:27:51 +0000 Subject: Fix for crop operation using uninitialized bounds in cases input image resolution is zero. --- source/blender/compositor/operations/COM_CropOperation.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 16c19f3ebaa..4f9cd771988 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -58,6 +58,12 @@ void CropBaseOperation::updateArea() this->m_ymax = max(this->m_settings->y1, this->m_settings->y2) + 1; this->m_ymin = min(this->m_settings->y1, this->m_settings->y2); } + else { + this->m_xmax = 0; + this->m_xmin = 0; + this->m_ymax = 0; + this->m_ymin = 0; + } } void CropBaseOperation::initExecution() -- cgit v1.2.3 From 2b962212c8be78603dc49fecaf080f44614af8ee Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 5 Dec 2012 15:46:31 +0000 Subject: Fix #33411: crash baking smoke with FFT high resolution. CMake had FFTW disabled by default, and when FFTW was not enabled it lead to uninitialized memory usage. Now it falls back to wavelet if there is no FFTW, and I've enabled it by default in CMake. If it's not found on Linux it will get disabled automatically. --- CMakeLists.txt | 10 +++++----- intern/smoke/intern/WTURBULENCE.cpp | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b642bb24c6..23e9eba0cf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,7 @@ option(WITH_PYTHON_MODULE "Enable building as a python module which runs without option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON) option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON) option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON) -option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" OFF) +option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" ON) option(WITH_BULLET "Enable Bullet (Physics Engine)" ON) option(WITH_GAMEENGINE "Enable Game Engine" ON) option(WITH_PLAYER "Build Player" OFF) @@ -387,10 +387,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL) endif() -if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM) - message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON") -endif() - # may as well build python module without a UI if(WITH_PYTHON_MODULE) set(WITH_HEADLESS ON) @@ -1670,6 +1666,10 @@ if(APPLE OR WIN32) endif() endif() +if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM) + message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON") +endif() + if(WITH_CYCLES) if(NOT WITH_OPENIMAGEIO) message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES") diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp index 1c89f5d681b..5b6509afead 100644 --- a/intern/smoke/intern/WTURBULENCE.cpp +++ b/intern/smoke/intern/WTURBULENCE.cpp @@ -220,21 +220,25 @@ void WTURBULENCE::setNoise(int type) { if(type == (1<<1)) // FFT { +#ifdef WITH_FFTW3 // needs fft - #ifdef WITH_FFTW3 std::string noiseTileFilename = std::string("noise.fft"); generatTile_FFT(_noiseTile, noiseTileFilename); - #endif + return; +#else + fprintf(stderr, "FFTW not enabled, falling back to wavelet noise.\n"); +#endif } - else if(type == (1<<2)) // curl +#if 0 + if(type == (1<<2)) // curl { // TODO: not supported yet + return; } - else // standard - wavelet - { - std::string noiseTileFilename = std::string("noise.wavelets"); - generateTile_WAVELET(_noiseTile, noiseTileFilename); - } +#endif + + std::string noiseTileFilename = std::string("noise.wavelets"); + generateTile_WAVELET(_noiseTile, noiseTileFilename); } // init direct access functions from blender -- cgit v1.2.3 From 8b477463d109a48ac6ab67172c48fd207037c596 Mon Sep 17 00:00:00 2001 From: Miika Hamalainen Date: Wed, 5 Dec 2012 17:58:24 +0000 Subject: Fix #33411: Smoke simulator using uninitialized noise tile If loading an existing FFT noise tile failed the tile in memory was left uninitialized. --- intern/smoke/intern/FFT_NOISE.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intern/smoke/intern/FFT_NOISE.h b/intern/smoke/intern/FFT_NOISE.h index a087b4e1391..8b7e4f2728b 100644 --- a/intern/smoke/intern/FFT_NOISE.h +++ b/intern/smoke/intern/FFT_NOISE.h @@ -167,6 +167,8 @@ static void generatTile_FFT(float* const noiseTileData, std::string filename) for (int x = 0; x < xRes; x++, index++) noise[index] -= forward[index][0] / totalCells; + // fill noiseTileData + memcpy(noiseTileData, noise, sizeof(float) * totalCells); // save out the noise tile saveTile(noise, filename); -- cgit v1.2.3 From 5db4682e939845cbd3c17fdbed126ccff37c15f8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 5 Dec 2012 19:04:29 +0000 Subject: Fix #33419: incorrect color with projection painting in cases strength != 1.0 --- source/blender/editors/sculpt_paint/paint_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index a929c3ef585..b704414c321 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3937,7 +3937,7 @@ BLI_INLINE void rgba_float_to_uchar__mul_v3(unsigned char rgba_ub[4], const floa { rgba_ub[0] = f_to_char(rgba[0] * rgb[0]); rgba_ub[1] = f_to_char(rgba[1] * rgb[1]); - rgba_ub[2] = f_to_char(rgba[2] * rgb[3]); + rgba_ub[2] = f_to_char(rgba[2] * rgb[2]); rgba_ub[3] = f_to_char(rgba[3]); } -- cgit v1.2.3 From 4b102e93fb9a3cda97b5a5f5672a43807a19a18c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 02:38:39 +0000 Subject: fix [#33422] Change Path/Files problem - selected strip directory doesn't work --- source/blender/editors/space_sequencer/sequencer_edit.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 4e2bf982ff3..8cc1e31fee5 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3076,8 +3076,12 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN { Scene *scene = CTX_data_scene(C); Sequence *seq = BKE_sequencer_active_get(scene); + char filepath[FILE_MAX]; + + BLI_join_dirfile(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name); RNA_string_set(op->ptr, "directory", seq->strip->dir); + RNA_string_set(op->ptr, "filepath", filepath); /* set default display depending on seq type */ if (seq->type == SEQ_TYPE_IMAGE) { -- cgit v1.2.3 From a864259d5099d936e4b973d6469e033da1c72d49 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 02:42:42 +0000 Subject: bump python requirement to 3.3 --- source/blender/python/intern/bpy_util.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h index 6aa50cf88de..b5f679b741f 100644 --- a/source/blender/python/intern/bpy_util.h +++ b/source/blender/python/intern/bpy_util.h @@ -27,16 +27,8 @@ #ifndef __BPY_UTIL_H__ #define __BPY_UTIL_H__ -#if PY_VERSION_HEX < 0x03020000 -# error "Python 3.2 or greater is required, you'll need to update your python." -#endif - #if PY_VERSION_HEX < 0x03030000 -# ifdef _MSC_VER -# pragma message("Python 3.2 will be deprecated soon, upgrade to Python 3.3.") -# else -# warning "Python 3.2 will be deprecated soon, upgrade to Python 3.3." -# endif +# error "Python 3.3 or greater is required, you'll need to update your python." #endif struct EnumPropertyItem; -- cgit v1.2.3 From 7c2e4e28ba262199588ee234cbf991eed7983b0d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 03:09:06 +0000 Subject: bpy.ops module/caller classes incorrectly had __keys__ rather then __slots__. also added comments about texface drawing when theres no origindex. --- release/scripts/modules/bpy/ops.py | 4 ++-- source/blender/blenkernel/intern/cdderivedmesh.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/release/scripts/modules/bpy/ops.py b/release/scripts/modules/bpy/ops.py index 34beb6035ae..52bf1c04e65 100644 --- a/release/scripts/modules/bpy/ops.py +++ b/release/scripts/modules/bpy/ops.py @@ -74,7 +74,7 @@ class BPyOpsSubMod(object): eg. bpy.ops.object """ - __keys__ = ("module",) + __slots__ = ("module",) def __init__(self, module): self.module = module @@ -111,7 +111,7 @@ class BPyOpsSubModOp(object): eg. bpy.ops.object.somefunc """ - __keys__ = ("module", "func") + __slots__ = ("module", "func") def _get_doc(self): return op_as_string(self.idname()) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 2fd922db888..54bbe4bf495 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -654,6 +654,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if (index_mf_to_mpoly) { orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, i); if (orig == ORIGINDEX_NONE) { + /* XXX, this is not really correct + * it will draw the previous faces context for this one when we don't know its settings. + * but better then skipping it altogether. - campbell */ draw_option = DM_DRAW_OPTION_NORMAL; } else if (drawParamsMapped) { @@ -756,6 +759,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if (index_mf_to_mpoly) { orig = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, actualFace); if (orig == ORIGINDEX_NONE) { + /* XXX, this is not really correct + * it will draw the previous faces context for this one when we don't know its settings. + * but better then skipping it altogether. - campbell */ draw_option = DM_DRAW_OPTION_NORMAL; } else if (drawParamsMapped) { -- cgit v1.2.3 From e85935dddfed92926742367606dbacd0a7feda25 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 6 Dec 2012 05:48:51 +0000 Subject: Fix #33423: a few operators still allowed changing current frame during animation render, like cursor set in the graph editor, disabled that now. --- source/blender/editors/space_action/action_edit.c | 12 +++++++++++- source/blender/editors/space_graph/graph_edit.c | 12 +++++++++++- source/blender/editors/space_graph/graph_ops.c | 12 +++++++++++- source/blender/editors/space_sequencer/sequencer_edit.c | 11 ++++++++++- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 092b738bab9..a80d425b90a 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -52,6 +52,7 @@ #include "BKE_action.h" #include "BKE_fcurve.h" +#include "BKE_global.h" #include "BKE_nla.h" #include "BKE_context.h" #include "BKE_report.h" @@ -1308,6 +1309,15 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ +static int actkeys_framejump_poll(bContext *C) +{ + /* prevent changes during render */ + if (G.is_rendering) + return 0; + + return ED_operator_action_active(C); +} + /* snap current-frame indicator to 'average time' of selected keyframe */ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -1361,7 +1371,7 @@ void ACTION_OT_frame_jump(wmOperatorType *ot) /* api callbacks */ ot->exec = actkeys_framejump_exec; - ot->poll = ED_operator_action_active; + ot->poll = actkeys_framejump_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 453549ebf79..21b0ed99f0b 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -56,6 +56,7 @@ #include "BLF_translation.h" #include "BKE_fcurve.h" +#include "BKE_global.h" #include "BKE_nla.h" #include "BKE_context.h" #include "BKE_report.h" @@ -1763,6 +1764,15 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ +static int graphkeys_framejump_poll(bContext *C) +{ + /* prevent changes during render */ + if (G.is_rendering) + return 0; + + return graphop_visible_keyframes_poll(C); +} + /* snap current-frame indicator to 'average time' of selected keyframe */ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { @@ -1829,7 +1839,7 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot) /* api callbacks */ ot->exec = graphkeys_framejump_exec; - ot->poll = graphop_visible_keyframes_poll; + ot->poll = graphkeys_framejump_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 9b031c015a9..54b417e740a 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -39,6 +39,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_sound.h" @@ -66,6 +67,15 @@ * 2) Value Indicator (stored per Graph Editor instance) */ +static int graphview_cursor_poll(bContext *C) +{ + /* prevent changes during render */ + if (G.is_rendering) + return 0; + + return ED_operator_graphedit_active(C); +} + /* Set the new frame number */ static void graphview_cursor_apply(bContext *C, wmOperator *op) { @@ -172,7 +182,7 @@ static void GRAPH_OT_cursor_set(wmOperatorType *ot) ot->exec = graphview_cursor_exec; ot->invoke = graphview_cursor_invoke; ot->modal = graphview_cursor_modal; - ot->poll = ED_operator_graphedit_active; + ot->poll = graphview_cursor_poll; /* flags */ ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8cc1e31fee5..e7f77db3b9e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2405,6 +2405,15 @@ static int strip_jump_internal(Scene *scene, return change; } +static int sequencer_strip_jump_poll(bContext *C) +{ + /* prevent changes during render */ + if (G.is_rendering) + return 0; + + return sequencer_edit_poll(C); +} + /* jump frame to edit point operator */ static int sequencer_strip_jump_exec(bContext *C, wmOperator *op) { @@ -2431,7 +2440,7 @@ void SEQUENCER_OT_strip_jump(wmOperatorType *ot) /* api callbacks */ ot->exec = sequencer_strip_jump_exec; - ot->poll = sequencer_edit_poll; + ot->poll = sequencer_strip_jump_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -- cgit v1.2.3 From c9dd1b0f2c8795c86d64e716b06b2cf47ce5c343 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 06:01:15 +0000 Subject: fix playanim - up/down keys were not stepping 10 frames as intended. --- source/blender/windowmanager/intern/wm_playanim.c | 58 +++++++++++++---------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index d29d08a5431..8b387196da7 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -82,7 +82,7 @@ typedef struct PlayState { /* playback state */ short direction; - short next; + short next_frame; short once; short turbo; short pingpong; @@ -207,6 +207,21 @@ static int fromdisk = FALSE; static float zoomx = 1.0, zoomy = 1.0; static double ptottime = 0.0, swaptime = 0.04; +static PlayAnimPict *playanim_step(PlayAnimPict *playanim, int step) +{ + if (step > 0) { + while (step-- && playanim) { + playanim = playanim->next; + } + } + else if (step < 0) { + while (step++ && playanim) { + playanim = playanim->prev; + } + } + return playanim; +} + static int pupdate_time(void) { static double ltime; @@ -485,10 +500,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) ps->wait2 = FALSE; if (g_WS.qual & WS_QUAL_SHIFT) { ps->picture = picsbase.first; - ps->next = 0; + ps->next_frame = 0; } else { - ps->next = -1; + ps->next_frame = -1; } } break; @@ -496,10 +511,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) if (val) { ps->wait2 = FALSE; if (g_WS.qual & WS_QUAL_SHIFT) { - ps->next = ps->direction = -1; + ps->next_frame = ps->direction = -1; } else { - ps->next = -10; + ps->next_frame = -10; ps->sstep = TRUE; } } @@ -510,10 +525,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) ps->wait2 = FALSE; if (g_WS.qual & WS_QUAL_SHIFT) { ps->picture = picsbase.last; - ps->next = 0; + ps->next_frame = 0; } else { - ps->next = 1; + ps->next_frame = 1; } } break; @@ -521,10 +536,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) if (val) { ps->wait2 = FALSE; if (g_WS.qual & WS_QUAL_SHIFT) { - ps->next = ps->direction = 1; + ps->next_frame = ps->direction = 1; } else { - ps->next = 10; + ps->next_frame = 10; ps->sstep = TRUE; } } @@ -535,7 +550,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) if (val) { if (g_WS.qual & WS_QUAL_SHIFT) { if (ps->curframe_ibuf) - printf(" Name: %s | Speed: %.2f frames/s\n", ps->curframe_ibuf->name, ps->fstep / swaptime); + printf(" Name: %s | Speed: %.2f frames/s\n", + ps->curframe_ibuf->name, ps->fstep / swaptime); } else { swaptime = ps->fstep / 5.0; @@ -668,7 +684,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) } ps->sstep = TRUE; ps->wait2 = FALSE; - ps->next = 0; + ps->next_frame = 0; } break; } @@ -780,7 +796,7 @@ void WM_main_playanim(int argc, const char **argv) /* ps.doubleb = TRUE;*/ /* UNUSED */ ps.go = TRUE; ps.direction = TRUE; - ps.next = 1; + ps.next_frame = 1; ps.once = FALSE; ps.turbo = FALSE; ps.pingpong = FALSE; @@ -1033,7 +1049,7 @@ void WM_main_playanim(int argc, const char **argv) } } - ps.next = ps.direction; + ps.next_frame = ps.direction; while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0) || ps.wait2 != 0)) { @@ -1062,15 +1078,10 @@ void WM_main_playanim(int argc, const char **argv) pupdate_time(); - if (ps.picture && ps.next) { + if (ps.picture && ps.next_frame) { /* always at least set one step */ while (ps.picture) { - if (ps.next < 0) { - ps.picture = ps.picture->prev; - } - else { - ps.picture = ps.picture->next; - } + ps.picture = playanim_step(ps.picture, ps.next_frame); if (ps.once && ps.picture != NULL) { if (ps.picture->next == NULL) { @@ -1085,12 +1096,7 @@ void WM_main_playanim(int argc, const char **argv) ptottime -= swaptime; } if (ps.picture == NULL && ps.sstep) { - if (ps.next < 0) { - ps.picture = picsbase.last; - } - else if (ps.next > 0) { - ps.picture = picsbase.first; - } + ps.picture = playanim_step(ps.picture, ps.next_frame); } } if (ps.go == FALSE) { -- cgit v1.2.3 From ad394949dba655612338f3bf397e6281b90d31d1 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 6 Dec 2012 06:13:43 +0000 Subject: Fix #33421: collada import of a mesh with loose edges did not draw the edges in the viewport. --- source/blender/collada/MeshImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 8337a977b3b..de8d1e85eb9 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -589,7 +589,7 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me) for (int i = 0; i < edge_count; i++, med++) { med->bweight = 0; med->crease = 0; - med->flag = 0; + med->flag |= ME_LOOSEEDGE; med->v1 = indices[2 * i]; med->v2 = indices[2 * i + 1]; } -- cgit v1.2.3 From 8274848fa1fea25beccb0c36f10620150960e9ff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 08:10:24 +0000 Subject: fix [#31084] Dynamic Paint Blender File Crashes Blender. was incorrect assert which didnt consider having no faces. --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 4169a24e7d9..d09bea0f662 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -392,7 +392,7 @@ void DM_ensure_tessface(DerivedMesh *dm) } else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) { - BLI_assert(CustomData_has_layer(&dm->faceData, CD_ORIGINDEX)); + BLI_assert(CustomData_has_layer(&dm->faceData, CD_ORIGINDEX) || numTessFaces == 0); DM_update_tessface_data(dm); } -- cgit v1.2.3 From c20292f624de7b81353821c2d3eab70b4c17bbd0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 6 Dec 2012 09:13:57 +0000 Subject: Fix mapping node min/max not working OSL. --- intern/cycles/kernel/shaders/node_mapping.osl | 10 +++++++++- intern/cycles/render/nodes.cpp | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/intern/cycles/kernel/shaders/node_mapping.osl b/intern/cycles/kernel/shaders/node_mapping.osl index 2e720edfc7e..92df043b39d 100644 --- a/intern/cycles/kernel/shaders/node_mapping.osl +++ b/intern/cycles/kernel/shaders/node_mapping.osl @@ -20,9 +20,17 @@ shader node_mapping( matrix Matrix = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + point mapping_min = point(0.0, 0.0, 0.0), + point mapping_max = point(0.0, 0.0, 0.0), + int use_minmax = 0, point VectorIn = point(0.0, 0.0, 0.0), output point VectorOut = point(0.0, 0.0, 0.0)) { - VectorOut = transform(Matrix, VectorIn); + point p = transform(Matrix, VectorIn); + + if(use_minmax) + p = min(max(mapping_min, p), mapping_max); + + VectorOut = p; } diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 55fb9bf8a7e..3f8055b3540 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -1098,6 +1098,9 @@ void MappingNode::compile(OSLCompiler& compiler) { Transform tfm = transform_transpose(tex_mapping.compute_transform()); compiler.parameter("Matrix", tfm); + compiler.parameter_point("mapping_min", tex_mapping.min); + compiler.parameter_point("mapping_max", tex_mapping.max); + compiler.parameter("use_minmax", tex_mapping.use_minmax); compiler.add(this, "node_mapping"); } -- cgit v1.2.3 From 77efd71cf8df00cc0fa8f4512c23614fba4fa3ba Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 6 Dec 2012 16:18:35 +0000 Subject: Disable multisamples on windows for intel cards This doesn't work nice currently and there's no simple workaround for this, it'll require lots of statistics about cards and some further investigation on supported combination of draw methods and multisamples supports. For the release better be more stable and do not deliver dangerous option. --- intern/ghost/intern/GHOST_WindowWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index dded7dc256d..fead1884f8a 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -868,7 +868,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp } // Attempt to enable multisample - if (m_multisample && WGL_ARB_multisample && !m_multisampleEnabled) + if (m_multisample && WGL_ARB_multisample && !m_multisampleEnabled && !is_crappy_intel_card()) { success = initMultisample(preferredFormat); -- cgit v1.2.3 From 759e96164a8d3f0f3f5606ab5f4801859899dd50 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 6 Dec 2012 21:08:24 +0000 Subject: Fix #33433: Importing video files into movie clip editor crashes Blender This was a regression in svn rev52718 caused by the fact that we can not free packet fun until we've finished all manipulation with decoded frame since frame and packet could share same pointers. For now restored old behavior of next_packet which seems to be well tested and better not do bigger refactoring here so close to release. Memory leak fixed by that revision was fixed by calling av_free_packet just before avcodec_decode_video2 in cases we're at the end of file. Tested with valgrind and could not see any memory leaks in ffmpeg area. --- source/blender/imbuf/intern/IMB_anim.h | 1 + source/blender/imbuf/intern/anim_movie.c | 67 ++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 684a1476e44..ed349e8f7eb 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -178,6 +178,7 @@ struct anim { struct ImBuf *last_frame; int64_t last_pts; int64_t next_pts; + AVPacket next_packet; #endif #ifdef WITH_REDCODE diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 900ad6c6313..8dfdbd4fddc 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -557,6 +557,7 @@ static int startffmpeg(struct anim *anim) anim->last_frame = 0; anim->last_pts = -1; anim->next_pts = -1; + anim->next_packet.stream_index = -1; anim->pFormatCtx = pFormatCtx; anim->pCodecCtx = pCodecCtx; @@ -763,39 +764,41 @@ static void ffmpeg_postprocess(struct anim *anim) } } -/* decode one video frame */ +/* decode one video frame also considering the packet read into next_packet */ static int ffmpeg_decode_video_frame(struct anim *anim) { int rval = 0; - AVPacket next_packet; - - memset(&next_packet, 0, sizeof(AVPacket)); av_log(anim->pFormatCtx, AV_LOG_DEBUG, " DECODE VIDEO FRAME\n"); - while ((rval = av_read_frame(anim->pFormatCtx, &next_packet)) >= 0) { + if (anim->next_packet.stream_index == anim->videoStream) { + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; + } + + while ((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, "%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld " "%s\n", - (next_packet.stream_index == anim->videoStream) + (anim->next_packet.stream_index == anim->videoStream) ? "->" : " ", - next_packet.stream_index, + anim->next_packet.stream_index, anim->videoStream, - (next_packet.dts == AV_NOPTS_VALUE) ? -1 : - (long long int)next_packet.dts, - (next_packet.pts == AV_NOPTS_VALUE) ? -1 : - (long long int)next_packet.pts, - (next_packet.flags & AV_PKT_FLAG_KEY) ? + (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1 : + (long long int)anim->next_packet.dts, + (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1 : + (long long int)anim->next_packet.pts, + (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); - if (next_packet.stream_index == anim->videoStream) { + if (anim->next_packet.stream_index == anim->videoStream) { anim->pFrameComplete = 0; avcodec_decode_video2( anim->pCodecCtx, anim->pFrame, &anim->pFrameComplete, - &next_packet); + &anim->next_packet); if (anim->pFrameComplete) { anim->next_pts = av_get_pts_from_frame( @@ -813,24 +816,28 @@ static int ffmpeg_decode_video_frame(struct anim *anim) break; } } - av_free_packet(&next_packet); + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; } - - /* this sets size and data fields to zero, - which is necessary to decode the remaining data - in the decoder engine after EOF. It also prevents a memory - leak, since av_read_frame spills out a full size packet even - on EOF... (and: it's save to call on NULL packets) */ - - av_free_packet(&next_packet); if (rval == AVERROR_EOF) { + /* this sets size and data fields to zero, + which is necessary to decode the remaining data + in the decoder engine after EOF. It also prevents a memory + leak, since av_read_frame spills out a full size packet even + on EOF... (and: it's save to call on NULL packets) */ + + av_free_packet(&anim->next_packet); + + anim->next_packet.size = 0; + anim->next_packet.data = 0; + anim->pFrameComplete = 0; avcodec_decode_video2( anim->pCodecCtx, anim->pFrame, &anim->pFrameComplete, - &next_packet); + &anim->next_packet); if (anim->pFrameComplete) { anim->next_pts = av_get_pts_from_frame( @@ -850,6 +857,8 @@ static int ffmpeg_decode_video_frame(struct anim *anim) } if (rval < 0) { + anim->next_packet.stream_index = -1; + av_log(anim->pFormatCtx, AV_LOG_ERROR, " DECODE READ FAILED: av_read_frame() " "returned error: %d\n", rval); @@ -1086,6 +1095,13 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, anim->next_pts = -1; + if (anim->next_packet.stream_index == anim->videoStream) { + av_free_packet(&anim->next_packet); + anim->next_packet.stream_index = -1; + } + + /* memset(anim->pFrame, ...) ?? */ + if (ret >= 0) { ffmpeg_decode_video_frame_scan(anim, pts_to_search); } @@ -1132,6 +1148,9 @@ static void free_anim_ffmpeg(struct anim *anim) av_free(anim->pFrameDeinterlaced); sws_freeContext(anim->img_convert_ctx); IMB_freeImBuf(anim->last_frame); + if (anim->next_packet.stream_index != -1) { + av_free_packet(&anim->next_packet); + } } anim->duration = 0; } -- cgit v1.2.3 From bf0102ffa405027ed4111d6c1635c3995241bb20 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 6 Dec 2012 21:59:16 +0000 Subject: fix for texture_slot path, would give incorrect path when used with brushes which only have one texture slot. also quiet float/double warning. --- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/makesrna/intern/rna_texture.c | 31 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2c3d3f631bd..902d75ee67e 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8346,7 +8346,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (clip = main->movieclip.first; clip; clip = clip->id.next) { if (clip->tracking.settings.reconstruction_success_threshold == 0.0f) { - clip->tracking.settings.reconstruction_success_threshold = 1e-3; + clip->tracking.settings.reconstruction_success_threshold = 1e-3f; } } } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b212879512e..bdf9fa4e436 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -264,19 +264,24 @@ char *rna_TextureSlot_path(PointerRNA *ptr) * may be used multiple times in the same stack */ if (ptr->id.data) { - PointerRNA id_ptr; - PropertyRNA *prop; - - /* find the 'textures' property of the ID-struct */ - RNA_id_pointer_create(ptr->id.data, &id_ptr); - prop = RNA_struct_find_property(&id_ptr, "texture_slots"); - - /* get an iterator for this property, and try to find the relevant index */ - if (prop) { - int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr); - - if (index >= 0) - return BLI_sprintfN("texture_slots[%d]", index); + if (GS(((ID *)ptr->id.data)->name) == ID_BR) { + return BLI_strdup("texture_slot"); + } + else { + PointerRNA id_ptr; + PropertyRNA *prop; + + /* find the 'textures' property of the ID-struct */ + RNA_id_pointer_create(ptr->id.data, &id_ptr); + prop = RNA_struct_find_property(&id_ptr, "texture_slots"); + + /* get an iterator for this property, and try to find the relevant index */ + if (prop) { + int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr); + + if (index >= 0) + return BLI_sprintfN("texture_slots[%d]", index); + } } } -- cgit v1.2.3 From d261d65bda976988d35641f66c34955adbd30a0a Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Thu, 6 Dec 2012 22:23:58 +0000 Subject: Fix bug #33176: Deactivating both position and rotation target from iTaSC IK-Solver crashes Blender. No constraint is created for target in that case, just needed to add a check. --- source/blender/ikplugin/intern/itasc_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 5cf762af3e8..903080d5b79 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1636,7 +1636,7 @@ static void execute_scene(Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, fl // compute constraint error for (i = ikscene->targets.size(); i > 0; --i) { IK_Target *iktarget = ikscene->targets[i - 1]; - if (!(iktarget->blenderConstraint->flag & CONSTRAINT_OFF)) { + if (!(iktarget->blenderConstraint->flag & CONSTRAINT_OFF) && iktarget->constraint) { unsigned int nvalues; const iTaSC::ConstraintValues *values; values = iktarget->constraint->getControlParameters(&nvalues); -- cgit v1.2.3 From 4fd9df25c6d466a2fe0c97c325e1662b9902df96 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Dec 2012 05:27:09 +0000 Subject: Add 2 documents to the python api reference. - Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch - Blender/Python API Reference Usage: examples of how to use the API reference docs Thanks to John Nyquist for editing these docs and giving feedback. --- doc/python_api/rst/info_api_reference.rst | 305 +++++++++++++ doc/python_api/rst/info_gotcha.rst | 2 + doc/python_api/rst/info_overview.rst | 2 + doc/python_api/rst/info_quickstart.rst | 2 + doc/python_api/rst/info_tips_and_tricks.rst | 6 +- doc/python_api/rst/info_tutorial_addon.rst | 645 ++++++++++++++++++++++++++++ doc/python_api/sphinx_doc_gen.py | 7 + 7 files changed, 967 insertions(+), 2 deletions(-) create mode 100644 doc/python_api/rst/info_api_reference.rst create mode 100644 doc/python_api/rst/info_tutorial_addon.rst diff --git a/doc/python_api/rst/info_api_reference.rst b/doc/python_api/rst/info_api_reference.rst new file mode 100644 index 00000000000..ddee46dce11 --- /dev/null +++ b/doc/python_api/rst/info_api_reference.rst @@ -0,0 +1,305 @@ + +******************* +Reference API Usage +******************* + +Blender has many interlinking data types which have an auto-generated reference api which often has the information +you need to write a script, but can be difficult to use. + +This document is designed to help you understand how to use the reference api. + + +Reference API Scope +=================== + +The reference API covers :mod:`bpy.types`, which stores types accessed via :mod:`bpy.context` - *The user context* +or :mod:`bpy.data` - *Blend file data*. + +Other modules such as :mod:`bge`, :mod:`bmesh` and :mod:`aud` are not using Blenders data API +so this document doesn't apply to those modules. + + +Data Access +=========== + +The most common case for using the reference API is to find out how to access data in the blend file. + +Before going any further its best to be aware of ID Data-Blocks in Blender since you will often find properties +relative to them. + + +ID Data +------- + +ID Data-Blocks are used in Blender as top-level data containers. + +From the user interface this isn't so obvious, but when developing you need to know about ID Data-Blocks. + +ID data types include Scene, Group, Object, Mesh, Screen, World, Armature, Image and Texture. +for a full list see the sub-classes of :class:`bpy.types.ID` + +Here are some characteristics ID Data-Blocks share. + +- ID's are blend file data, so loading a new blend file reloads an entire new set of Data-Blocks. +- ID's can be accessed in Python from ``bpy.data.*`` +- Each data-block has a unique ``.name`` attribute, displayed in the interface. +- Animation data is stored in ID's ``.animation_data``. +- ID's are the only data types that can be linked between blend files. +- ID's can be added/copied and removed via Python. +- ID's have their own garbage-collection system which frees unused ID's when saving. +- When a data-block has a reference to some external data, this is typically an ID Data-Block. + + +Simple Data Access +------------------ + +Lets start with a simple case, say you wan't a python script to adjust the objects location. + +Start by finding this setting in the interface ``Properties Window -> Object -> Transform -> Location`` + +From the button you can right click and select **Online Python Reference**, this will link you to: +:class:`bpy.types.Object.location` + +Being an API reference, this link often gives little more information then the tool-tip, though some of the pages +include examples (normally at the top of the page). + +At this point you may say *Now what?* - you know that you have to use ``.location`` and that its an array of 3 floats +but you're still left wondering how to access this in a script. + +So the next step is to find out where to access objects, go down to the bottom of the page to the **References** +section, for objects there are many references, but one of the most common places to access objects is via the context. + +It's easy to be overwhelmed at this point since there ``Object`` get referenced in so many places - modifiers, +functions, textures and constraints. + +But if you want to access any data the user has selected +you typically only need to check the :mod:`bpy.context` references. + +Even then, in this case there are quite a few though if you read over these - most are mode specific. +If you happen to be writing a tool that only runs in weight paint mode, then using ``weight_paint_object`` +would be appropriate. +However to access an item the user last selected, look for the ``active`` members, +Having access to a single active member the user selects is a convention in Blender: eg. ``active_bone``, +``active_pose_bone``, ``active_node`` ... and in this case we can use - ``active_object``. + + +So now we have enough information to find the location of the active object. + +.. code-block:: python + + bpy.context.active_object.location + +You can type this into the python console to see the result. + +The other common place to access objects in the reference is :class:`bpy.types.BlendData.objects`. + +.. note:: + + This is **not** listed as :mod:`bpy.data.objects`, + this is because :mod:`bpy.data` is an instance of the :class:`bpy.types.BlendData` class, + so the documentation points there. + + +With :mod:`bpy.data.objects`, this is a collection of objects so you need to access one of its members. + +.. code-block:: python + + bpy.data.objects["Cube"].location + + +Nested Properties +----------------- + +The previous example is quite straightforward because ``location`` is a property of ``Object`` which can be accessed +from the context directly. + +Here are some more complex examples: + +.. code-block:: python + + # access a render layers samples + bpy.context.scene.render.layers["RenderLayer"].samples + + # access to the current weight paint brush size + bpy.context.tool_settings.weight_paint.brush.size + + # check if the window is fullscreen + bpy.context.window.screen.show_fullscreen + + +As you can see there are times when you want to access data which is nested +in a way that causes you to go through a few indirections. + +The properties are arranged to match how data is stored internally (in blenders C code) which is often logical but +not always quite what you would expect from using Blender. + +So this takes some time to learn, it helps you understand how data fits together in Blender which is important +to know when writing scripts. + + +When starting out scripting you will often run into the problem where you're not sure how to access the data you want. + +There are a few ways to do this. + +- Use the Python console's auto-complete to inspect properties. *This can be hit-and-miss but has the advantage + that you can easily see the values of properties and assign them to interactively see the results.* + +- Copy the Data-Path from the user interface. *Explained further in :ref:`Copy Data Path `* + +- Using the documentation to follow references. *Explained further in :ref:`Indirect Data Access `* + + +.. _info_data_path_copy + +Copy Data Path +-------------- + +Blender can compute the Python string to a property which is shown in the tool-tip, on the line below ``Python: ...``, +This saves having to use the API reference to click back up the references to find where data is accessed from. + +There is a user-interface feature to copy the data-path which gives the path from an :class:`bpy.types.ID` data-block, +to its property. + +To see how this works we'll get the path to the Subdivision-Surface modifiers subdivision setting. + +Start with the default scene and select the **Modifiers** tab, then add a **Subdivision-Surface** modifier to the cube. + +Now hover your mouse over the button labeled **View**, The tool-tip includes :class:`bpy.types.SubsurfModifier.levels` +but we want the path from the object to this property. + +Note that the text copied won't include the ``bpy.data.collection["name"].`` component since its assumed that +you won't be doing collection look-ups on every access and typically you'll want to use the context rather +then access each :class:`bpy.types.ID` instance by name. + + +Type in the ID path into a Python console :mod:`bpy.context.active_object`. Include the trailing dot and don't hit "enter", yet. + +Now right-click on the button and select **Copy Data Path**, then paste the result into the console. + +So now you should have the answer: + +.. code-block:: python + + bpy.context.active_object.modifiers["Subsurf"].levels + +Hit "enter" and you'll get the current value of 1. Now try changing the value to 2: + +.. code-block:: python + + bpy.context.active_object.modifiers["Subsurf"].levels = 2 + +You can see the value update in the Subdivision-Surface modifier's UI as well as the cube. + + +.. _info_data_path_indirect + +Indirect Data Access +-------------------- + +For this example we'll go over something more involved, showing the steps to access the active sculpt brushes texture. + +Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example. + +- Start in the default scene and enable 'Sculpt' mode from the 3D-View header. + +- From the toolbar expand the **Texture** panel and add a new texture. + + *Notice the texture button its self doesn't have very useful links (you can check the tool-tips).* + +- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel... + + - In the properties button select the Texture context. + + - Select the Brush icon to show the brush texture. + + - Expand the **Colors** panel to locate the **Contrast** button. + +- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast`` + +- Now we can see that ``contrast`` is a property of texture, so next we'll check on how to access the texture from the brush. + +- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take + some guess work to find the right one, but in this case its obviously ``Brush.texture``. + + *Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture`` + *but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.* + +- So the next step is to check on where brushes are accessed from via the **References**. + In this case there is simply ``bpy.context.brush`` which is all we need. + + +Now you can use the Python console to form the nested properties needed to access brush textures contrast, +logically we now know. + +*Context -> Brush -> Texture -> Contrast* + +Since the attribute for each is given along the way we can compose the data path in the python console: + +.. code-block:: python + + bpy.context.brush.texture.contrast + + +There can be multiple ways to access the same data, which you choose often depends on the task. + +An alternate path to access the same setting is... + +.. code-block:: python + + bpy.context.sculpt.brush.texture.contrast + +Or access the brush directly... + +.. code-block:: python + + bpy.data.brushes["BrushName"].texture.contrast + + +If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects +the tool to operate on what they have selected. + +For automation you are more likely to use :mod:`bpy.data` since you want to be able to access specific data and manipulate +it, no matter what the user currently has the view set at. + + +Operators +========= + +Most key-strokes and buttons in Blender call an operator which is also exposed to python via :mod:`bpy.ops`, + +To see the Python equivalent hover your mouse over the button and see the tool-tip, +eg ``Python: bpy.ops.render.render()``, +If there is no tool-tip or the ``Python:`` line is missing then this button is not using an operator and +can't be accessed from Python. + + +If you want to use this in a script you can press :kbd:`Control-C` while your mouse is over the button to copy it to the +clipboard. + +You can also right click on the button and view the **Online Python Reference**, this mainly shows arguments and +their defaults however operators written in Python show their file and line number which may be useful if you +are interested to check on the source code. + +.. note:: + + Not all operators can be called usefully from Python, for more on this see :ref:`using operators `. + + +Info View +--------- + +Blender records operators you run and displays them in the **Info** space. +This is located above the file-menu which can be dragged down to display its contents. + +Select the **Script** screen that comes default with Blender to see its output. +You can perform some actions and see them show up - delete a vertex for example. + +Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console. + +.. note:: + + Not all operators get registered for display, + zooming the view for example isn't so useful to repeat so its excluded from the output. + + To display *every* operator that runs see :ref:`Show All Operators ` + diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst index a48cb8fc15e..34145c2ac49 100644 --- a/doc/python_api/rst/info_gotcha.rst +++ b/doc/python_api/rst/info_gotcha.rst @@ -5,6 +5,8 @@ Gotchas This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability. +.. _using_operators: + Using Operators =============== diff --git a/doc/python_api/rst/info_overview.rst b/doc/python_api/rst/info_overview.rst index 818eb692be9..b2d524b74af 100644 --- a/doc/python_api/rst/info_overview.rst +++ b/doc/python_api/rst/info_overview.rst @@ -1,3 +1,5 @@ +.. _info_overview: + ******************* Python API Overview ******************* diff --git a/doc/python_api/rst/info_quickstart.rst b/doc/python_api/rst/info_quickstart.rst index 62ad4e9c4d8..e1264ae9d52 100644 --- a/doc/python_api/rst/info_quickstart.rst +++ b/doc/python_api/rst/info_quickstart.rst @@ -1,3 +1,5 @@ +.. _info_quickstart: + *********************** Quickstart Introduction *********************** diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst index 4dcbf431724..75e8ef61f6f 100644 --- a/doc/python_api/rst/info_tips_and_tricks.rst +++ b/doc/python_api/rst/info_tips_and_tricks.rst @@ -44,15 +44,17 @@ if this can't be generated, only the property name is copied. .. note:: - This uses the same method for creating the animation path used by :class:`FCurve.data_path` and :class:`DriverTarget.data_path` drivers. + This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers. +.. _info_show_all_operators + Show All Operators ================== While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``. -However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug`` argument when starting blender or by setting :mod:`bpy.app.debug` to True while blender is running. +However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running. Use an External Editor diff --git a/doc/python_api/rst/info_tutorial_addon.rst b/doc/python_api/rst/info_tutorial_addon.rst new file mode 100644 index 00000000000..2a101041227 --- /dev/null +++ b/doc/python_api/rst/info_tutorial_addon.rst @@ -0,0 +1,645 @@ + +Addon Tutorial +############## + +************ +Introduction +************ + + +Intended Audience +================= + +This tutorial is designed to help technical artists or developers learn to extend Blender. +An understanding of the basics of Python is expected for those working through this tutorial. + + +Prerequisites +------------- + +Before going through the tutorial you should... + +* Familiarity with the basics of working in Blender. + +* Know how to run a script in Blender's text editor (as documented in the quick-start) + +* Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set). + +* Be familiar with the concept of Python modules. + +* Basic understanding of classes (object orientation) in Python. + + +Suggested reading before starting this tutorial. + +* `Dive Into Python `_ sections (1, 2, 3, 4, and 7). +* :ref:`Blender API Quickstart ` + to help become familiar with Blender/Python basics. + + +To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal, +see :ref:`Use The Terminal `. + +Documentation Links +=================== + +While going through the tutorial you may want to look into our reference documentation. + +* :ref:`Blender API Overview `. - + *This document is rather detailed but helpful if you want to know more on a topic.* + +* :mod:`bpy.context` api reference. - + *Handy to have a list of available items your script may operate on.* + +* :class:`bpy.types.Operator`. - + *The following addons define operators, these docs give details and more examples of operators.* + + +****** +Addons +****** + + +What is an Addon? +================= + +An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful +information. + +To give an example, here is the simplest possible addon. + + +.. code-block:: python + + bl_info = {"name": "My Test Addon", "category": "Object"} + def register(): + print("Hello World") + def unregister(): + print("Goodbye World") + + +* ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the + user preferences addon list. +* ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without + activating the addon. +* ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled. + + + +Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example). + +This is a contrived example of an addon that serves to illustrate the point +that the base requirements of an addon are simple. + +An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this, +when executed from the text editor or even the interactive console - there is nothing inherently different about an +addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any +script to access. + +So an addon is just a way to encapsulate a Python module in a way a user can easily utilize. + +.. note:: + + Running this script within the text editor won't print anything, + to see the output it must be installed through the user preferences. + Messages will be printed when enabling and disabling. + + +Your First Addon +================ + +The simplest possible addon above was useful as an example but not much else. +This next addon is simple but shows how to integrate a script into Blender using an ``Operator`` +which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts. + +For the first example we'll make a script that simply moves all objects in a scene. + + +Write The Script +---------------- + +Add the following script to the text editor in Blender. + +.. code-block:: python + + import bpy + + scene = bpy.context.scene + for obj in scene.objects: + obj.location.x += 1.0 + + +.. image:: run_script.png + :width: 924px + :align: center + :height: 574px + :alt: Run Script button + +Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit. +Next we'll make this script into an addon. + + +Write the Addon (Simple) +------------------------ + +This addon takes the body of the script above, and adds them to an operator's ``execute()`` function. + + +.. code-block:: python + + bl_info = { + "name": "Move X Axis", + "category": "Object", + } + + import bpy + + + class ObjectMoveX(bpy.types.Operator): + """My Object Moving Script""" # blender will use this as a tooltip for menu items and buttons. + bl_idname = "object.move_x" # unique identifier for buttons and menu items to reference. + bl_label = "Move X by One" # display name in the interface. + bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator. + + def execute(self, context): # execute() is called by blender when running the operator. + + # The original script + scene = context.scene + for obj in scene.objects: + obj.location.x += 1.0 + + return {'FINISHED'} # this lets blender know the operator finished successfully. + + def register(): + bpy.utils.register_class(ObjectMoveX) + + + def unregister(): + bpy.utils.unregister_class(ObjectMoveX) + + + # This allows you to run the script directly from blenders text editor + # to test the addon without having to install it. + if __name__ == "__main__": + register() + + +.. note:: ``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items. + +.. note:: Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``. + In most cases these will be the same however in some cases operators will be passed a custom context + so script authors should prefer the ``context`` argument passed to operators. + + +To test the script you can copy and paste this into Blender text editor and run it, this will execute the script +directly and call register immediately. + +However running the script wont move any objects, for this you need to execute the newly registered operator. + +.. image:: spacebar.png + :width: 924px + :align: center + :height: 574px + :alt: Spacebar + +Do this by pressing ``SpaceBar`` to bring up the operator search dialog and type in "Move X by One" (the ``bl_label``), +then press ``Enter``. + + + +The objects should move as before. + +*Keep this addon open in Blender for the next step - Installing.* + +Install The Addon +----------------- + +Once you have your addon within in Blender's text editor, you will want to be able to install it so it can be enabled in +the user preferences to load on startup. + +Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later. + +To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming +restrictions that apply to Python modules and end with a ``.py`` extension. + +Once the file is on disk, you can install it as you would for an addon downloaded online. + +Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file. + +Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart, +press **Save as Default**. + +.. note:: + + The destination of the addon depends on your Blender configuration. + When installing an addon the source and destination path are printed in the console. + You can also find addon path locations by running this in the Python console. + + .. code-block:: python + + import addon_utils + print(addon_utils.paths()) + + More is written on this topic here: + `Directory Layout `_ + + +Your Second Addon +================= + +For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a +similar way to what you may have seen with the array modifier. + + +Write The Script +---------------- + +As before, first we will start with a script, develop it, then convert into an addon. + +.. code-block:: python + + import bpy + from bpy import context + + # Get the current scene + scene = context.scene + + # Get the 3D cursor + cursor = scene.cursor_location + + # Get the active object (assume we have one) + obj = scene.objects.active + + # Now make a copy of the object + obj_new = obj.copy() + + # The object won't automatically get into a new scene + scene.objects.link(obj_new) + + # Now we can place the object + obj_new.location = cursor + + +Now try copy this script into Blender and run it on the default cube. +Make sure you click to move the 3D cursor before running as the duplicate will appear at the cursor's location. + + +... go off and test ... + + +After running, notice that when you go into edit-mode to change the cube - all of the copies change, +in Blender this is known as *Linked-Duplicates*. + + +Next, we're going to do this in a loop, to make an array of objects between the active object and the cursor. + + +.. code-block:: python + + import bpy + from bpy import context + + scene = context.scene + cursor = scene.cursor_location + obj = scene.objects.active + + # Use a fixed value for now, eventually make this user adjustable + total = 10 + + # Add 'total' objects into the scene + for i in range(total): + obj_new = obj.copy() + scene.objects.link(obj_new) + + # Now place the object in between the cursor + # and the active object based on 'i' + factor = i / total + obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor)) + + +Try run this script with with the active object and the cursor spaced apart to see the result. + +With this script you'll notice we're doing some math with the object location and cursor, this works because both are +3D :class:`mathutils.Vector` instances, a convenient class provided by the :mod:`mathutils` module and +allows vectors to be multiplied by numbers and matrices. + +If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions +such as getting the angle between vectors, cross product, dot products +as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and +ray-triangle intersection. + +For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and +can help you with more advanced functionality later on. + + +Write the Addon +--------------- + +The first step is to convert the script as-is into an addon. + + +.. code-block:: python + + bl_info = { + "name": "Cursor Array", + "category": "Object", + } + + import bpy + + + class ObjectCursorArray(bpy.types.Operator): + """Object Cursor Array""" + bl_idname = "object.cursor_array" + bl_label = "Cursor Array" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + scene = context.scene + cursor = scene.cursor_location + obj = scene.objects.active + + total = 10 + + for i in range(total): + obj_new = obj.copy() + scene.objects.link(obj_new) + + factor = i / total + obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor)) + + return {'FINISHED'} + + def register(): + bpy.utils.register_class(ObjectCursorArray) + + + def unregister(): + bpy.utils.unregister_class(ObjectCursorArray) + + + if __name__ == "__main__": + register() + + +Everything here has been covered in the previous steps, you may want to try run the addon still +and consider what could be done to make it more useful. + + +... go off and test ... + + +The two of the most obvious missing things are - having the total fixed at 10, and having to access the operator from +space-bar is not very convenient. + +Both these additions are explained next, with the final script afterwards. + + +Operator Property +^^^^^^^^^^^^^^^^^ + +There are a variety of property types that are used for tool settings, common property types include: +int, float, vector, color, boolean and string. + +These properties are handled differently to typical Python class attributes +because Blender needs to be display them in the interface, +store their settings in key-maps and keep settings for re-use. + +While this is handled in a fairly Pythonic way, be mindful that you are in fact defining tool settings that +are loaded into Blender and accessed by other parts of Blender, outside of Python. + + +To get rid of the literal 10 for `total`, we'll us an operator property. +Operator properties are defined via bpy.props module, this is added to the class body. + +.. code-block:: python + + # moved assignment from execute() to the body of the class... + total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100) + + # and this is accessed on the class + # instance within the execute() function as... + self.total + + +These properties from :mod:`bpy.props` are handled specially by Blender when the class is registered +so they display as buttons in the user interface. +There are many arguments you can pass to properties to set limits, change the default and display a tooltip. + +.. seealso:: :mod:`bpy.props.IntProperty` + +This document doesn't go into details about using other property types, +however the link above includes examples of more advanced property usage. + + +Menu Item +^^^^^^^^^ + +Addons can add to the user interface of existing panels, headers and menus defined in Python. + +For this example we'll add to an existing menu. + +.. image:: menu_id.png + :width: 334px + :align: center + :height: 128px + :alt: Menu Identifier + +To find the identifier of a menu you can hover your mouse over the menu item and the identifier is displayed. + +The method used for adding a menu item is to append a draw function into an existing class. + + +.. code-block:: python + + def menu_func(self, context): + self.layout.operator(ObjectCursorArray.bl_idname) + + def register(): + bpy.types.VIEW3D_MT_object.append(menu_func) + + +For docs on extending menus see: :doc:`bpy.types.Menu`. + + +Keymap +^^^^^^ + +In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps. + +In the example below, a new object-mode :class:`bpy.types.KeyMap` is added, +then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator, +using :kbd:`Ctrl-Shift-Space` as the key shortcut to activate it. + + +.. code-block:: python + + # store keymaps here to access after registration + addon_keymaps = [] + + def register(): + + # handle the keymap + wm = bpy.context.window_manager + km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY') + + kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True) + kmi.properties.total = 4 + + addon_keymaps.append(km) + + + def unregister(): + + # handle the keymap + wm = bpy.context.window_manager + for km in addon_keymaps: + wm.keyconfigs.addon.keymaps.remove(km) + # clear the list + addon_keymaps.clear() + + +Notice how the key-map item can have a different ``total`` setting then the default set by the operator, +this allows you to have multiple keys accessing the same operator with different settings. + + +.. note:: + + While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't + overwrite each others keymaps, At least take care when assigning keys that they don't + conflict with important functionality within Blender. + +For API documentation on the functions listed above, see: +:class:`bpy.types.KeyMaps.new`, +:class:`bpy.types.KeyMap`, +:class:`bpy.types.KeyMapItems.new`, +:class:`bpy.types.KeyMapItem`. + + +Bringing it all together +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + bl_info = { + "name": "Cursor Array", + "category": "Object", + } + + import bpy + + + class ObjectCursorArray(bpy.types.Operator): + """Object Cursor Array""" + bl_idname = "object.cursor_array" + bl_label = "Cursor Array" + bl_options = {'REGISTER', 'UNDO'} + + total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100) + + def execute(self, context): + scene = context.scene + cursor = scene.cursor_location + obj = scene.objects.active + + for i in range(self.total): + obj_new = obj.copy() + scene.objects.link(obj_new) + + factor = i / self.total + obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor)) + + return {'FINISHED'} + + + def menu_func(self, context): + self.layout.operator(ObjectCursorArray.bl_idname) + + # store keymaps here to access after registration + addon_keymaps = [] + + + def register(): + bpy.utils.register_class(ObjectCursorArray) + bpy.types.VIEW3D_MT_object.append(menu_func) + + # handle the keymap + wm = bpy.context.window_manager + km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY') + kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True) + kmi.properties.total = 4 + addon_keymaps.append(km) + + def unregister(): + bpy.utils.unregister_class(ObjectCursorArray) + bpy.types.VIEW3D_MT_object.remove(menu_func) + + # handle the keymap + wm = bpy.context.window_manager + for km in addon_keymaps: + wm.keyconfigs.addon.keymaps.remove(km) + # clear the list + del addon_keymaps[:] + + + if __name__ == "__main__": + register() + +.. image:: in_menu.png + :width: 591px + :align: center + :height: 649px + :alt: In the menu + +Run the script (or save it and add it through the Preferences like before) and it will appear in the menu. + +.. image:: op_prop.png + :width: 669px + :align: center + :height: 644px + :alt: Operator Property + +After selecting it from the menu, you can choose how many instance of the cube you want created. + + +.. note:: + + Directly executing the script multiple times will add the menu each time too. + While not useful behavior, theres nothing to worry about since addons won't register them selves multiple + times when enabled through the user preferences. + + +Conclusions +=========== + +Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities +for others to use. + +While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without +having to dive into Blender's C/C++ code. + +The example given in the tutorial is limited, but shows the Blender API used for common tasks that you can expand on +to write your own tools. + + +Further Reading +--------------- + +Blender comes commented templates which are accessible from the text editor header, if you have specific areas +you want to see example code for, this is a good place to start. + + +Here are some sites you might like to check on after completing this tutorial. + +* :ref:`Blender/Python API Overview ` - + *For more background details on Blender/Python integration.* + +* `How to Think Like a Computer Scientist `_ - + *Great info for those who are still learning Python.* + +* `Blender Development (Wiki) `_ - + *Blender Development, general information and helpful links.* + +* `Blender Artists (Coding Section) `_ - + *forum where people ask Python development questions* + diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 1a1a4bf909b..441a6c04efe 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -316,6 +316,8 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst")) INFO_DOCS = ( ("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"), ("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"), + ("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"), + ("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"), ("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"), ("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"), ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"), @@ -1724,6 +1726,11 @@ def copy_handwritten_rsts(basepath): # changelog shutil.copy2(os.path.join(RST_DIR, "change_log.rst"), basepath) + # copy images, could be smarter but just glob for now. + for f in os.listdir(RST_DIR): + if f.endswith(".png"): + shutil.copy2(os.path.join(RST_DIR, f), basepath) + def rna2sphinx(basepath): -- cgit v1.2.3 From 369b9fcf0f3a53b01aaa15499dcacef00103eeb8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 7 Dec 2012 11:30:40 +0000 Subject: Fix missing mapping and influence panel for particles when cycles is selected as render engine. Still missing is colors and texture slots, but that's too tricky to fix this close to release. --- intern/cycles/blender/addon/ui.py | 2 ++ source/blender/editors/space_buttons/buttons_context.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 4a651eb5aab..ba931469e8a 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1026,6 +1026,8 @@ def get_panels(): bpy.types.TEXTURE_PT_voxeldata, bpy.types.TEXTURE_PT_pointdensity, bpy.types.TEXTURE_PT_pointdensity_turbulence, + bpy.types.TEXTURE_PT_mapping, + bpy.types.TEXTURE_PT_influence, bpy.types.PARTICLE_PT_context_particles, bpy.types.PARTICLE_PT_emission, bpy.types.PARTICLE_PT_hair_dynamics, diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 2da70468f0c..2a5b64cd6ed 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -822,12 +822,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r ButsContextTexture *ct = sbuts->texuser; PointerRNA *ptr; - if (ct) - return 0; /* new shading system */ - if ((ptr = get_pointer_type(path, &RNA_Material))) { Material *ma = ptr->data; + if (ct) + return 0; /* new shading system */ + /* if we have a node material, get slot from material in material node */ if (ma && ma->use_nodes && ma->nodetree) { /* if there's an active texture node in the node tree, @@ -848,12 +848,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r else if ((ptr = get_pointer_type(path, &RNA_Lamp))) { Lamp *la = ptr->data; + if (ct) + return 0; /* new shading system */ + if (la) CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]); } else if ((ptr = get_pointer_type(path, &RNA_World))) { World *wo = ptr->data; + if (ct) + return 0; /* new shading system */ + if (wo) CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]); } -- cgit v1.2.3 From 5ba213facd0735f90e8301a379970cd0c25d3002 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 7 Dec 2012 13:47:35 +0000 Subject: Camera tracking: fixed type in camera intrinsics update function Seems to be from the very beginning here, not sure why nobody noticed this is wrong. --- extern/libmv/libmv-capi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp index c1788cc9422..8e483abd386 100644 --- a/extern/libmv/libmv-capi.cpp +++ b/extern/libmv/libmv-capi.cpp @@ -900,7 +900,7 @@ void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics *libmvIntrinsics intrinsics->SetFocalLength(focal_length, focal_length); if (intrinsics->principal_point_x() != principal_x || intrinsics->principal_point_y() != principal_y) - intrinsics->SetFocalLength(focal_length, focal_length); + intrinsics->SetPrincipalPoint(principal_x, principal_y); if (intrinsics->k1() != k1 || intrinsics->k2() != k2 || intrinsics->k3() != k3) intrinsics->SetRadialDistortion(k1, k2, k3); -- cgit v1.2.3 From 0bca862e9c6a20bd5a69a370bee7c4da3e187e46 Mon Sep 17 00:00:00 2001 From: Howard Trickey Date: Fri, 7 Dec 2012 18:45:52 +0000 Subject: Bevel: fix 'causing artifacts' bug 33245. Really was caused by a previous bevel making a two-edged face, which caused other faces to be dropped when copying a bmesh. The quadstrip code needed to be more careful to avoid creating two-edge faces. --- source/blender/bmesh/tools/bmesh_bevel.c | 38 +++++++++++--------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 3276361da87..9125800d3e8 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -1295,39 +1295,27 @@ static void bevel_build_quadstrip(BMesh *bm, BevVert *bv) EdgeHalf *eh_b = next_bev(bv, eh_a->next); /* since (selcount == 2) we know this is valid */ BMLoop *l_a = BM_face_vert_share_loop(f, eh_a->rightv->nv.v); BMLoop *l_b = BM_face_vert_share_loop(f, eh_b->leftv->nv.v); - int seg_count = bv->vmesh->seg; /* ensure we don't walk past the segments */ + int split_count = bv->vmesh->seg + 1; /* ensure we don't walk past the segments */ - if (l_a == l_b) { - /* step once around if we hit the same loop */ - l_a = l_a->prev; - l_b = l_b->next; - seg_count--; - } - - BLI_assert(l_a != l_b); - - while (f->len > 4) { + while (f->len > 4 && split_count > 0) { BMLoop *l_new; BLI_assert(l_a->f == f); BLI_assert(l_b->f == f); - BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE); - if (seg_count-- == 0) { - break; + if (l_a-> v == l_b->v || l_a->next == l_b) { + /* l_a->v and l_b->v can be the same or such that we'd make a 2-vertex poly */ + l_a = l_a->prev; + l_b = l_b->next; } + else { + BM_face_split(bm, f, l_a->v, l_b->v, &l_new, NULL, FALSE); + f = l_new->f; - /* turns out we don't need this, - * because of how BM_face_split works we always get the loop of the next face */ -#if 0 - if (l_new->f->len < l_new->radial_next->f->len) { - l_new = l_new->radial_next; + /* walk around the new face to get the next verts to split */ + l_a = l_new->prev; + l_b = l_new->next->next; } -#endif - f = l_new->f; - - /* walk around the new face to get the next verts to split */ - l_a = l_new->prev; - l_b = l_new->next->next; + split_count--; } } } -- cgit v1.2.3 From adf7bfa8bb530db8baf7c07dd296851658ee925e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 8 Dec 2012 01:16:59 +0000 Subject: ifdef out dynstr so mathutils can be compiled as an external module again. --- source/blender/python/mathutils/mathutils.c | 7 ++++++- source/blender/python/mathutils/mathutils.h | 3 +++ source/blender/python/mathutils/mathutils_Color.c | 11 ++++++++++- source/blender/python/mathutils/mathutils_Euler.c | 11 ++++++++++- source/blender/python/mathutils/mathutils_Matrix.c | 11 ++++++++++- source/blender/python/mathutils/mathutils_Quaternion.c | 11 ++++++++++- source/blender/python/mathutils/mathutils_Vector.c | 12 ++++++++++-- source/blender/python/mathutils/mathutils_geometry.c | 6 ++++-- 8 files changed, 63 insertions(+), 9 deletions(-) diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c index bc9b747f05e..202598233b6 100644 --- a/source/blender/python/mathutils/mathutils.c +++ b/source/blender/python/mathutils/mathutils.c @@ -35,7 +35,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif PyDoc_STRVAR(M_Mathutils_doc, "This module provides access to matrices, eulers, quaternions and vectors." @@ -312,6 +315,7 @@ int EXPP_VectorsAreEqual(const float *vecA, const float *vecB, int size, int flo return 1; } +#ifndef MATH_STANDALONE /* dynstr as python string utility funcions, frees 'ds'! */ PyObject *mathutils_dynstr_to_py(struct DynStr *ds) { @@ -324,6 +328,7 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds) PyMem_Free(ds_buf); return ret; } +#endif /* silly function, we dont use arg. just check its compatible with __deepcopy__ */ int mathutils_deepcopy_args_check(PyObject *args) diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index 92a4aac7093..7b03b149459 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -120,8 +120,11 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject *mat); +#ifndef MATH_STANDALONE /* dynstr as python string utility funcions */ PyObject *mathutils_dynstr_to_py(struct DynStr *ds); +#endif + int mathutils_deepcopy_args_check(PyObject *args); #endif /* __MATHUTILS_H__ */ diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index f16b488f9d0..4a29e72418b 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -31,7 +31,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif #define COLOR_SIZE 3 @@ -131,6 +134,7 @@ static PyObject *Color_repr(ColorObject *self) return ret; } +#ifndef MATH_STANDALONE static PyObject *Color_str(ColorObject *self) { DynStr *ds; @@ -145,6 +149,7 @@ static PyObject *Color_str(ColorObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } +#endif /* ------------------------tp_richcmpr */ /* returns -1 exception, 0 false, 1 true */ @@ -820,7 +825,11 @@ PyTypeObject color_Type = { &Color_AsMapping, /* tp_as_mapping */ NULL, /* tp_hash */ NULL, /* tp_call */ +#ifndef MATH_STANDALONE (reprfunc) Color_str, /* tp_str */ +#else + NULL, /* tp_str */ +#endif NULL, /* tp_getattro */ NULL, /* tp_setattro */ NULL, /* tp_as_buffer */ diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 829d3ee27e1..1be8a5efe28 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -35,7 +35,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif #define EULER_SIZE 3 @@ -323,6 +326,7 @@ static PyObject *Euler_repr(EulerObject *self) return ret; } +#ifndef MATH_STANDALONE static PyObject *Euler_str(EulerObject *self) { DynStr *ds; @@ -337,6 +341,7 @@ static PyObject *Euler_str(EulerObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } +#endif static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op) { @@ -663,7 +668,11 @@ PyTypeObject euler_Type = { &Euler_AsMapping, /* tp_as_mapping */ NULL, /* tp_hash */ NULL, /* tp_call */ +#ifndef MATH_STANDALONE (reprfunc) Euler_str, /* tp_str */ +#else + NULL, /* tp_str */ +#endif NULL, /* tp_getattro */ NULL, /* tp_setattro */ NULL, /* tp_as_buffer */ diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 64112024dd1..05306f230d1 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -35,7 +35,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_string.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif typedef enum eMatrixAccess_t { MAT_ACCESS_ROW, @@ -1647,6 +1650,7 @@ static PyObject *Matrix_repr(MatrixObject *self) return NULL; } +#ifndef MATH_STANDALONE static PyObject *Matrix_str(MatrixObject *self) { DynStr *ds; @@ -1682,6 +1686,7 @@ static PyObject *Matrix_str(MatrixObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } +#endif static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op) { @@ -2418,7 +2423,11 @@ PyTypeObject matrix_Type = { &Matrix_AsMapping, /*tp_as_mapping*/ NULL, /*tp_hash*/ NULL, /*tp_call*/ +#ifndef MATH_STANDALONE (reprfunc) Matrix_str, /*tp_str*/ +#else + NULL, /*tp_str*/ +#endif NULL, /*tp_getattro*/ NULL, /*tp_setattro*/ NULL, /*tp_as_buffer*/ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index cda39932610..c28631e5045 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -35,7 +35,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif #define QUAT_SIZE 4 @@ -496,6 +499,7 @@ static PyObject *Quaternion_repr(QuaternionObject *self) return ret; } +#ifndef MATH_STANDALONE static PyObject *Quaternion_str(QuaternionObject *self) { DynStr *ds; @@ -510,6 +514,7 @@ static PyObject *Quaternion_str(QuaternionObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } +#endif static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op) { @@ -1202,7 +1207,11 @@ PyTypeObject quaternion_Type = { &Quaternion_AsMapping, /* tp_as_mapping */ NULL, /* tp_hash */ NULL, /* tp_call */ +#ifndef MATH_STANDALONE (reprfunc) Quaternion_str, /* tp_str */ +#else + NULL, /* tp_str */ +#endif NULL, /* tp_getattro */ NULL, /* tp_setattro */ NULL, /* tp_as_buffer */ diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index e98af997507..f8159f6f187 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -35,7 +35,10 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLI_dynstr.h" + +#ifndef MATH_STANDALONE +# include "BLI_dynstr.h" +#endif #define MAX_DIMENSIONS 4 @@ -1231,6 +1234,7 @@ static PyObject *Vector_repr(VectorObject *self) return ret; } +#ifndef MATH_STANDALONE static PyObject *Vector_str(VectorObject *self) { int i; @@ -1252,7 +1256,7 @@ static PyObject *Vector_str(VectorObject *self) return mathutils_dynstr_to_py(ds); /* frees ds */ } - +#endif /* Sequence Protocol */ /* sequence length len(vector) */ @@ -2816,7 +2820,11 @@ PyTypeObject vector_Type = { NULL, /* hashfunc tp_hash; */ NULL, /* ternaryfunc tp_call; */ +#ifndef MATH_STANDALONE (reprfunc)Vector_str, /* reprfunc tp_str; */ +#else + NULL, /* reprfunc tp_str; */ +#endif NULL, /* getattrofunc tp_getattro; */ NULL, /* setattrofunc tp_setattro; */ diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 22317636faa..1db0538eb07 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -973,12 +973,14 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a float n1n2[3], n2n3[3], n3n1[3]; float potentialVertex[3]; - char *planes_used = MEM_callocN(sizeof(char) * len, __func__); + char *planes_used = PyMem_Malloc(sizeof(char) * len); /* python */ PyObject *py_verts = PyList_New(0); PyObject *py_plene_index = PyList_New(0); + memset(planes_used, 0, sizeof(char) * len); + for (i = 0; i < len; i++) { const float *N1 = planes[i]; for (j = i + 1; j < len; j++) { @@ -1031,7 +1033,7 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a Py_DECREF(item); } } - MEM_freeN(planes_used); + PyMem_Free(planes_used); { PyObject *ret = PyTuple_New(2); -- cgit v1.2.3 From 7c64de3eb83568579ed0cc4878d8a0a508b010cd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 8 Dec 2012 02:16:17 +0000 Subject: update themes with update_themes.py --- .../presets/interface_theme/back_to_black.xml | 1379 +++++++++---------- .../presets/interface_theme/blender_24x.xml | 1325 +++++++++---------- .../scripts/presets/interface_theme/elsyiun.xml | 1381 ++++++++++---------- .../scripts/presets/interface_theme/hexagon.xml | 1345 +++++++++---------- .../presets/interface_theme/ubuntu_ambiance.xml | 1369 +++++++++---------- 5 files changed, 3407 insertions(+), 3392 deletions(-) diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml index 805aa9bd184..0a77aa132a8 100644 --- a/release/scripts/presets/interface_theme/back_to_black.xml +++ b/release/scripts/presets/interface_theme/back_to_black.xml @@ -1,849 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + bone_solid="#c8c8c8" + bone_pose="#50c8ff" + bone_pose_active="#8cffff" + frame_current="#60c040" + outline_width="1" + bundle_solid="#c8c8c8" + camera_path="#5a5a5a" + skin_root="#000000"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + button_text_hi="#ffffff"> - - - - - - + + - + handle_free="#808080" + handle_auto="#909000" + handle_vect="#409030" + handle_align="#803060" + handle_sel_free="#808080" + handle_sel_auto="#f0ff40" + handle_sel_vect="#40c030" + handle_sel_align="#f090a0" + handle_auto_clamped="#994030" + handle_sel_auto_clamped="#f0af90" + lastsel_point="#808080" + frame_current="#336622" + handle_vertex="#808080" + handle_vertex_select="#ff8500" + handle_vertex_size="3" + channel_group="#4f6549" + active_channels_group="#87b17d" + dopesheet_channel="#52606e" + dopesheet_subchannel="#7c8996"> - + button_text="#c3c3c3" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - - - - - - - - - - - - - - - - - + button_text="#c3c3c3" + button_text_hi="#ffffff"> - - + + + + + + - + frame_current="#2f6421"> - + button_text="#c3c3c3" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + button_text="#c3c3c3" + button_text_hi="#ffffff"> - + - - - - + + + + - - - - - - - - - + button_text="#c3c3c3" + button_text_hi="#ffffff"> - - + + - + meta_strip="#6d9183" + frame_current="#2f5f23" + keyframe="#ff8500" + draw_action="#50c8ff" + preview_back="#000000"> - + button_text="#dddddd" + button_text_hi="#ffffff"> + + + + + + + + - + syntax_string="#cc3535" + syntax_numbers="#3c68ff"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + button_title="#c5c5c5" + button_text="#c3c3c3" + button_text_hi="#ffffff"> - - - - + + + + - + + + + + + + + + text="#9b9b9b" + text_hi="#ffffff" + header="#000000" + header_text="#adadad" + header_text_hi="#ffffff" + button="#000000" + button_title="#c5c5c5" + button_text="#c3c3c3" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + text="#ffffff" + text_hi="#ffffff" + header="#000000" + header_text="#979797" + header_text_hi="#ffffff" + button="#070707" + button_title="#c5c5c5" + button_text="#c3c3c3" + button_text_hi="#ffffff"> - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml index 232276e300e..18ae3072208 100644 --- a/release/scripts/presets/interface_theme/blender_24x.xml +++ b/release/scripts/presets/interface_theme/blender_24x.xml @@ -1,849 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bone_solid="#c8c8c8" + bone_pose="#50c8ff" + bone_pose_active="#8cffff" + frame_current="#60c040" + outline_width="1" + bundle_solid="#c8c8c8" + camera_path="#000000" + skin_root="#000000"> - - - - - - - - - - - - - - - - - - - - - + button_title="#5a5a5a" + button_text="#5a5a5a" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + scroll_handle="#7f7070" + active_file="#828282" + active_file_text="#ffffff"> - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + + + + + + + + + + + + + header="#b4b4b4" + header_text="#000000" + header_text_hi="#ffffff" + button="#b4b4b4" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + preview_stitch_active="#e1d2c323"> - + button_text="#000000" + button_text_hi="#ffffff"> - - + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + + + + + + + + + header="#b4b4b4" + header_text="#000000" + header_text_hi="#ffffff" + button="#b4b4b4" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - + + - + group_node="#69756e" + frame_node="#9a9b9ba0" + noodle_curving="5"> - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml index 581f5ce82d6..c10eb108000 100644 --- a/release/scripts/presets/interface_theme/elsyiun.xml +++ b/release/scripts/presets/interface_theme/elsyiun.xml @@ -1,849 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bone_solid="#c8c8c8" + bone_pose="#50c8ff" + bone_pose_active="#8cffff" + frame_current="#60c040" + outline_width="1" + bundle_solid="#c8c8c8" + camera_path="#000000" + skin_root="#000000"> - + button_text="#979797" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + channel_group="#4f6549" + active_channels_group="#87b17d" + dopesheet_channel="#52606e" + dopesheet_subchannel="#545d66"> - + button_text="#8b8b8b" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - - - - - - - - - - - - - - - - - + button_text="#000000" + button_text_hi="#ffffff"> - - + + + + + + - + frame_current="#60c040"> - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + button="#aaaaaa" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - + list_text_hi="#ffffff"> - - - - + + + + - + + + + + + + + + header="#3b3b3b" + header_text="#000000" + header_text_hi="#ffffff" + button="#3b3b3b" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - + + - + button_text="#b8b8b8" + button_text_hi="#ffffff"> - - + + - + + + + + + + + + + + + + + + + + text="#dbdbdb" + text_hi="#ffffff" + header="#3b3b3b" + header_text="#000000" + header_text_hi="#ffffff" + button="#3b3b3b" + button_title="#8b8b8b" + button_text="#8b8b8b" + button_text_hi="#ffffff"> - - - - + + + + + + + + - + button_text="#8b8b8b" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - + text_hi="#000000" + header="#3b3b3b" + header_text="#000000" + header_text_hi="#000000" + button="#3b3b3b" + button_title="#000000" + button_text="#000000" + button_text_hi="#000000"> + + + + - + button_text="#000000" + button_text_hi="#ffffff"> + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml index 61730583396..ad514bbbafa 100644 --- a/release/scripts/presets/interface_theme/hexagon.xml +++ b/release/scripts/presets/interface_theme/hexagon.xml @@ -1,849 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bone_solid="#c8c8c8" + bone_pose="#50c8ff" + bone_pose_active="#8cffff" + frame_current="#60c040" + outline_width="1" + bundle_solid="#c8c8c8" + camera_path="#000000" + skin_root="#000000"> - + button_text="#d7d7d7" + button_text_hi="#ffffff"> - - + + - - - - - - - - - - - - - - - - - - - - - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + scroll_handle="#7f7070" + active_file="#859cb9" + active_file_text="#fafafa"> - + button_text="#d7d7d7" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + + + + + + + + + + + + + header="#5c606c" + header_text="#000000" + header_text_hi="#ffffff" + button="#6c717f" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + preview_stitch_active="#e1d2c323"> - + button_text="#eeeeee" + button_text_hi="#ffffff"> - - + + - + header="#5c606c" + header_text="#000000" + header_text_hi="#ffffff" + button="#646875" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button="#727272" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + + + + + + + + + header="#565863" + header_text="#000000" + header_text_hi="#ffffff" + button="#5a5e6a" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - + + - + group_node="#69756e" + frame_node="#9a9b9ba0" + noodle_curving="5"> - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - - - - - - - - - + button="#6c717f" + button_title="#d7d7d7" + button_text="#d7d7d7" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + header="#646875" + header_text="#dddddd" + header_text_hi="#ffffff" + button="#b4b4b4" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + + + + + + + + + header="#5c606c" + header_text="#000000" + header_text_hi="#ffffff" + button="#646875" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml index 05075f06239..8f4a42b6ab7 100644 --- a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml +++ b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml @@ -1,849 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bone_solid="#c8c8c8" + bone_pose="#50c8ff" + bone_pose_active="#8cffff" + frame_current="#60c040" + outline_width="2" + bundle_solid="#c8c8c8" + camera_path="#7dbd00" + skin_root="#000000"> - + button_text="#9c9c9c" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - + + - - - - - - - - - + button_text="#9c9c9c" + button_text_hi="#ffffff"> + list_text_hi="#f47421"> - - + + - + scroll_handle="#7f7070" + active_file="#eeedeb" + active_file_text="#ffffff"> - + button_text="#000000" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> - - + + - + + + + + + + + + + + + + text="#e7e7e7" + text_hi="#ffffff" + header="#464541" + header_text="#cacaca" + header_text_hi="#ffffff" + button="#3c3b37" + button_title="#9c9c9c" + button_text="#9c9c9c" + button_text_hi="#ffffff"> + list_text_hi="#f47421"> - - + + - + preview_stitch_active="#e1d2c323"> - + button_text="#b9b9b9" + button_text_hi="#ffffff"> - - + + - - - - - - - - - + button_text_hi="#ffffff"> - - - - + + + + - + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - - - + + + + - + + + + + + + + + + + + + + + + + header="#464541" + header_text="#acacac" + header_text_hi="#ffffff" + button="#353430" + button_title="#acacac" + button_text="#acacac" + button_text_hi="#ffffff"> + list_text_hi="#ffffff"> + + + + + + + + - + button_text="#000000" + button_text_hi="#f47421"> - - + + - - - - - - - - - + button_title="#eeedeb" + button_text="#eeedeb" + button_text_hi="#ffffff"> - - - - + + + + - + text="#ccccc8" + text_hi="#ffffff" + header="#3c3b37" + header_text="#d3d2cd" + header_text_hi="#ffffff" + button="#696965" + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - + + + + - + button_title="#000000" + button_text="#000000" + button_text_hi="#ffffff"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + header="#464541" + header_text="#9c9c9c" + header_text_hi="#ffffff" + button="#3c3b37" + button_title="#9c9c9c" + button_text="#ffffff" + button_text_hi="#ffffff"> - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + -- cgit v1.2.3 From a3ce9408a2f20e70c2f037a7b9d3f332713a6931 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 8 Dec 2012 07:35:54 +0000 Subject: fix [#33438] Bevel modifier "angle" mode is broken bevel modifier was making zero area faces & edges that made scanfill fail (since it no longer removes doubles when filling ngons) --- source/blender/bmesh/tools/BME_bevel.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index cdfd8372d61..3f2ca21bcee 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -689,8 +689,16 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_BEVEL)) { - max = 1.0f; - l = BME_bevel_vert(bm, l, value, options, up_vec, td); + /* avoid making double vertices [#33438] */ + BME_TransData *vtd; + vtd = BME_get_transdata(td, l->v); + if (vtd->weight == 0.0f) { + BMO_elem_flag_disable(bm, l->v, BME_BEVEL_BEVEL); + } + else { + max = 1.0f; + l = BME_bevel_vert(bm, l, value, options, up_vec, td); + } } } -- cgit v1.2.3 From 7b9adab594d1cc670d642b56ae8d76069ce91107 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 8 Dec 2012 09:43:02 +0000 Subject: fix [#33431] Impossible to add "None" string to a property --- release/scripts/startup/bl_operators/wm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 0945098bd1e..105b532ac38 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1049,6 +1049,8 @@ class WM_OT_properties_edit(Operator): try: value_eval = eval(value) + # assert else None -> None, not "None", see [#33431] + assert(type(value_eval) in {str, float, int, bool, tuple, list}) except: value_eval = value -- cgit v1.2.3