diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-01-24 20:18:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-01-24 20:18:20 +0400 |
commit | 4af4863baf64e14959454a10443e0ae06b518e7e (patch) | |
tree | 06696b03fd54211a971e60f01fd176fcfe963fb9 | |
parent | 644e44e7b6f5d10915f44282fcd728153d71e4fe (diff) | |
parent | 1f9e25ac1a7851ab2503b88564c0d480b9e125cf (diff) |
svn merge ^/trunk/blender -r43639:43664
24 files changed, 325 insertions, 69 deletions
diff --git a/doc/python_api/examples/bge.constraints.py b/doc/python_api/examples/bge.constraints.py index de2f7e0a39d..e76fc3dd13b 100644 --- a/doc/python_api/examples/bge.constraints.py +++ b/doc/python_api/examples/bge.constraints.py @@ -1,6 +1,6 @@ """ Basic Physics Constraint -++++++++++++++++++++++ +++++++++++++++++++++++++ Example of how to create a hinge Physics Constraint between two objects. """ from bge import logic diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py index 918ffc9772d..fba369739f7 100644 --- a/doc/python_api/examples/bge.texture.1.py +++ b/doc/python_api/examples/bge.texture.1.py @@ -1,6 +1,6 @@ """ -Texture replacement -++++++++++++++++++++++ +Texture Replacement ++++++++++++++++++++ Example of how to replace a texture in game with an external image. createTexture() and removeTexture() are to be called from a module Python Controller. diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py index 70e4d6d9377..1ba0b99fc27 100644 --- a/doc/python_api/examples/bge.texture.py +++ b/doc/python_api/examples/bge.texture.py @@ -1,6 +1,6 @@ """ Basic Video Playback -++++++++++++++++++++++ +++++++++++++++++++++ Example of how to replace a texture in game with a video. It needs to run everyframe """ import bge diff --git a/doc/python_api/rst/bge.constraints.rst b/doc/python_api/rst/bge.constraints.rst index da0a358dfed..83f2a6b4950 100644 --- a/doc/python_api/rst/bge.constraints.rst +++ b/doc/python_api/rst/bge.constraints.rst @@ -5,6 +5,11 @@ Physics Constraints (bge.constraints) .. module:: bge.constraints .. literalinclude:: ../examples/bge.constraints.py + :language: rest + :lines: 2-4 + +.. literalinclude:: ../examples/bge.constraints.py + :lines: 6- .. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]]) diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst index 0abefcbea82..07d83f66bd4 100644 --- a/doc/python_api/rst/bge.texture.rst +++ b/doc/python_api/rst/bge.texture.rst @@ -37,8 +37,18 @@ When the texture object is deleted, the new texture is deleted and the old textu .. module:: bge.texture .. literalinclude:: ../examples/bge.texture.py + :language: rest + :lines: 2-4 + +.. literalinclude:: ../examples/bge.texture.py + :lines: 6- + +.. literalinclude:: ../examples/bge.texture.1.py + :language: rest + :lines: 2-6 .. literalinclude:: ../examples/bge.texture.1.py + :lines: 8- .. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0]) diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst index 6988f90cc1e..735ad037175 100644 --- a/doc/python_api/rst/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst @@ -954,7 +954,7 @@ Game Types (bge.types) .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. - :type: :class:`mathurils.Vector` + :type: :class:`mathutils.Vector` .. attribute:: orientation diff --git a/intern/boolop/intern/BOP_CarveInterface.cpp b/intern/boolop/intern/BOP_CarveInterface.cpp index 4db4fdd819d..274d9cac0cf 100644 --- a/intern/boolop/intern/BOP_CarveInterface.cpp +++ b/intern/boolop/intern/BOP_CarveInterface.cpp @@ -15,12 +15,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * The Original Code is Copyright (C) 2010 by the Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Ken Hughes, + * Sergey Sharybin. * * ***** END GPL LICENSE BLOCK ***** */ @@ -36,6 +37,9 @@ #include <carve/interpolator.hpp> #include <carve/rescale.hpp> +#include <iostream> + +using namespace carve::mesh; typedef unsigned int uint; #define MAX(x,y) ((x)>(y)?(x):(y)) @@ -61,10 +65,161 @@ static int isFacePlanar(CSG_IFace &face, std::vector<carve::geom3d::Vector> &ver return 1; } -static carve::mesh::MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor& face_it, - CSG_VertexIteratorDescriptor& vertex_it, - carve::interpolate::FaceAttr<uint> &oface_num, - uint &num_origfaces ) +static MeshSet<3> *Carve_meshSetFromMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes) +{ + std::vector<MeshSet<3>::mesh_t*> new_meshes; + + std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin(); + for(; it!=meshes.end(); it++) { + MeshSet<3>::mesh_t *mesh = *it; + MeshSet<3>::mesh_t *new_mesh = new MeshSet<3>::mesh_t(mesh->faces); + + new_meshes.push_back(new_mesh); + } + + return new MeshSet<3>(new_meshes); +} + +static void Carve_getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes, + std::vector<MeshSet<3>::aabb_t> &precomputedAABB, + MeshSet<3>::aabb_t &otherAABB, + std::vector<MeshSet<3>::mesh_t*> &operandMeshes) +{ + std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin(); + std::vector<MeshSet<3>::aabb_t>::iterator aabb_it = precomputedAABB.begin(); + std::vector<MeshSet<3>::aabb_t> usedAABB; + + while(it != meshes.end()) { + MeshSet<3>::mesh_t *mesh = *it; + MeshSet<3>::aabb_t aabb = mesh->getAABB(); + bool isIntersect = false; + + std::vector<MeshSet<3>::aabb_t>::iterator used_it = usedAABB.begin(); + for(; used_it!=usedAABB.end(); used_it++) { + MeshSet<3>::aabb_t usedAABB = *used_it; + + if(usedAABB.intersects(aabb) && usedAABB.intersects(otherAABB)) { + isIntersect = true; + break; + } + } + + if(!isIntersect) { + operandMeshes.push_back(mesh); + usedAABB.push_back(aabb); + + it = meshes.erase(it); + aabb_it = precomputedAABB.erase(aabb_it); + } + else { + it++; + aabb_it++; + } + } +} + +static MeshSet<3> *Carve_getIntersectedOperand(std::vector<MeshSet<3>::mesh_t*> &meshes, + std::vector<MeshSet<3>::aabb_t> &precomputedAABB, + MeshSet<3>::aabb_t &otherAABB) +{ + std::vector<MeshSet<3>::mesh_t*> operandMeshes; + Carve_getIntersectedOperandMeshes(meshes, precomputedAABB, otherAABB, operandMeshes); + + return Carve_meshSetFromMeshes(operandMeshes); +} + +static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly, + std::vector<MeshSet<3>::aabb_t> &precomputedAABB, + MeshSet<3>::aabb_t &otherAABB, + carve::interpolate::FaceAttr<uint> &oface_num) +{ + if(poly->meshes.size()<=1) + return poly; + + carve::csg::CSG csg; + + oface_num.installHooks(csg); + csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT); + + std::vector<MeshSet<3>::mesh_t*> orig_meshes = + std::vector<MeshSet<3>::mesh_t*>(poly->meshes.begin(), poly->meshes.end()); + + MeshSet<3> *left = Carve_getIntersectedOperand(orig_meshes, precomputedAABB, otherAABB); + + while(orig_meshes.size()) { + MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, precomputedAABB, otherAABB); + + try { + MeshSet<3> *result = csg.compute(left, right, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE); + + delete left; + delete right; + + left = result; + } + catch(carve::exception e) { + std::cerr << "CSG failed, exception " << e.str() << std::endl; + + delete right; + } + catch(...) { + delete left; + delete right; + + throw "Unknown error in Carve library"; + } + } + + return left; +} + +static MeshSet<3>::aabb_t Carve_computeAABB(MeshSet<3> *poly, + std::vector<MeshSet<3>::aabb_t> &precomputedAABB) +{ + MeshSet<3>::aabb_t overallAABB; + std::vector<MeshSet<3>::mesh_t*>::iterator it = poly->meshes.begin(); + + for(; it!=poly->meshes.end(); it++) { + MeshSet<3>::aabb_t aabb; + MeshSet<3>::mesh_t *mesh = *it; + + aabb = mesh->getAABB(); + precomputedAABB.push_back(aabb); + + overallAABB.unionAABB(aabb); + } + + return overallAABB; +} + +static void Carve_prepareOperands(MeshSet<3> **left_r, MeshSet<3> **right_r, + carve::interpolate::FaceAttr<uint> &oface_num) +{ + MeshSet<3> *left, *right; + + std::vector<MeshSet<3>::aabb_t> left_precomputedAABB; + std::vector<MeshSet<3>::aabb_t> right_precomputedAABB; + + MeshSet<3>::aabb_t leftAABB = Carve_computeAABB(*left_r, left_precomputedAABB); + MeshSet<3>::aabb_t rightAABB = Carve_computeAABB(*right_r, right_precomputedAABB); + + left = Carve_unionIntersectingMeshes(*left_r, left_precomputedAABB, rightAABB, oface_num); + right = Carve_unionIntersectingMeshes(*right_r, right_precomputedAABB, leftAABB, oface_num); + + if(left != *left_r) + delete *left_r; + + if(right != *right_r) + delete *right_r; + + *left_r = left; + *right_r = right; +} + +static MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor &face_it, + CSG_VertexIteratorDescriptor &vertex_it, + carve::interpolate::FaceAttr<uint> &oface_num, + uint &num_origfaces) { CSG_IVertex vertex; std::vector<carve::geom3d::Vector> vertices; @@ -126,12 +281,12 @@ static carve::mesh::MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor& face_i } } - carve::mesh::MeshSet<3> *poly = new carve::mesh::MeshSet<3> (vertices, numfaces, f); + MeshSet<3> *poly = new MeshSet<3> (vertices, numfaces, f); uint i; - carve::mesh::MeshSet<3>::face_iter face_iter = poly->faceBegin(); + MeshSet<3>::face_iter face_iter = poly->faceBegin(); for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) { - carve::mesh::MeshSet<3>::face_t *face = *face_iter; + MeshSet<3>::face_t *face = *face_iter; oface_num.setAttribute(face, forig[i]); } @@ -139,8 +294,8 @@ static carve::mesh::MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor& face_i } // check whether two faces share an edge, and if so merge them -static uint quadMerge(std::map<carve::mesh::MeshSet<3>::vertex_t*, uint> *vertexToIndex_map, - carve::mesh::MeshSet<3>::face_t *f1, carve::mesh::MeshSet<3>::face_t *f2, +static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map, + MeshSet<3>::face_t *f1, MeshSet<3>::face_t *f2, uint v, uint quad[4]) { uint current, n1, p1, n2, p2; @@ -188,23 +343,23 @@ static uint quadMerge(std::map<carve::mesh::MeshSet<3>::vertex_t*, uint> *vertex return 0; } -static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::interpolate::FaceAttr<uint> &oface_num, +static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::FaceAttr<uint> &oface_num, uint num_origfaces) { uint i; - BSP_CSGMesh* outputMesh = BSP_CSGMesh::New(); + BSP_CSGMesh *outputMesh = BSP_CSGMesh::New(); if (outputMesh == NULL) return NULL; - std::vector<BSP_MVertex>* vertices = new std::vector<BSP_MVertex>; + std::vector<BSP_MVertex> *vertices = new std::vector<BSP_MVertex>; outputMesh->SetVertices(vertices); - std::map<carve::mesh::MeshSet<3>::vertex_t*, uint> vertexToIndex_map; - std::vector<carve::mesh::MeshSet<3>::vertex_t>::iterator it = poly->vertex_storage.begin(); + std::map<MeshSet<3>::vertex_t*, uint> vertexToIndex_map; + std::vector<MeshSet<3>::vertex_t>::iterator it = poly->vertex_storage.begin(); for (i = 0; it != poly->vertex_storage.end(); ++i, ++it) { - carve::mesh::MeshSet<3>::vertex_t *vertex = &(*it); + MeshSet<3>::vertex_t *vertex = &(*it); vertexToIndex_map[vertex] = i; } @@ -217,13 +372,13 @@ static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::inte } // build vectors of faces for each original face and each vertex - std::vector< std::vector<uint> > vi(poly->vertex_storage.size()); - std::vector< std::vector<uint> > ofaces(num_origfaces); - carve::mesh::MeshSet<3>::face_iter face_iter = poly->faceBegin(); + std::vector<std::vector<uint> > vi(poly->vertex_storage.size()); + std::vector<std::vector<uint> > ofaces(num_origfaces); + MeshSet<3>::face_iter face_iter = poly->faceBegin(); for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) { - carve::mesh::MeshSet<3>::face_t *f = *face_iter; + MeshSet<3>::face_t *f = *face_iter; ofaces[oface_num.getAttribute(f)].push_back(i); - carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); + MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); for (; edge_iter != f->end(); ++edge_iter) { int index = vertexToIndex_map[edge_iter->vert]; vi[index].push_back(i); @@ -242,7 +397,7 @@ static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::inte uint findex = fl.back(); fl.pop_back(); - carve::mesh::MeshSet<3>::face_t *f = *(poly->faceBegin() + findex); + MeshSet<3>::face_t *f = *(poly->faceBegin() + findex); // add all information except vertices to the output mesh outputMesh->FaceSet().push_back(BSP_MFace()); @@ -256,7 +411,7 @@ static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::inte // the original face uint result = 0; - carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); + MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); for (; edge_iter != f->end(); ++edge_iter) { int v = vertexToIndex_map[edge_iter->vert]; for (uint pos2=0; !result && pos2 < vi[v].size();pos2++) { @@ -266,7 +421,7 @@ static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::inte if (findex == otherf) continue; - carve::mesh::MeshSet<3>::face_t *f2 = *(poly->faceBegin() + otherf); + MeshSet<3>::face_t *f2 = *(poly->faceBegin() + otherf); // if other face doesn't have the same original face, // ignore it also @@ -302,7 +457,7 @@ static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::inte outFace.m_verts.push_back(quadverts[2]); outFace.m_verts.push_back(quadverts[3]); } else { - carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); + MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin(); for (; edge_iter != f->end(); ++edge_iter) { //int index = ofacevert_num.getAttribute(f, edge_iter.idx()); int index = vertexToIndex_map[edge_iter->vert]; @@ -337,7 +492,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, CSG_VertexIteratorDescriptor obBVertices) { carve::csg::CSG::OP op; - carve::mesh::MeshSet<3> *left, *right, *output; + MeshSet<3> *left, *right, *output; carve::csg::CSG csg; carve::geom3d::Vector min, max; carve::interpolate::FaceAttr<uint> oface_num; @@ -360,6 +515,8 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, left = Carve_addMesh(obAFaces, obAVertices, oface_num, num_origfaces ); right = Carve_addMesh(obBFaces, obBVertices, oface_num, num_origfaces ); + Carve_prepareOperands(&left, &right, oface_num); + min.x = max.x = left->vertex_storage[0].v.x; min.y = max.y = left->vertex_storage[0].v.y; min.z = max.z = left->vertex_storage[0].v.z; @@ -390,13 +547,29 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT); oface_num.installHooks(csg); - output = csg.compute( left, right, op, NULL, carve::csg::CSG::CLASSIFY_EDGE); + + try { + output = csg.compute(left, right, op, NULL, carve::csg::CSG::CLASSIFY_EDGE); + } + catch(carve::exception e) { + std::cerr << "CSG failed, exception " << e.str() << std::endl; + } + catch(...) { + delete left; + delete right; + + throw "Unknown error in Carve library"; + } + delete left; delete right; + if(!output) + return BOP_ERROR; + output->transform(rev_r); - *outputMesh = Carve_exportMesh( output, oface_num, num_origfaces); + *outputMesh = Carve_exportMesh(output, oface_num, num_origfaces); delete output; return BOP_OK; diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index 5e68351d9e6..4e511f18cd4 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -911,7 +911,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures") split = layout.split(percentage=0.33) - split.label(text="Split uv's:") + split.label(text="Split UVs:") split.prop(part, "billboard_uv_split", text="Number of splits") if psys: diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 7cdd61e1402..e207334bd45 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2777,8 +2777,7 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * /* store Z orientation before destroying obmat */ normalize_v3_v3(zz, cob->matrix[2]); - dist = len_v3v3(cob->matrix[3], ct->matrix[3]); - /* XXX What was all that for??? Makes the constraint buggy with scaled objects, see #29940. */ + /* XXX That makes the constraint buggy with asymmetrically scaled objects, see #29940. */ /* sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);*/ /* vec[0] /= size[0];*/ /* vec[1] /= size[1];*/ @@ -2786,10 +2785,14 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * /* dist = normalize_v3(vec);*/ + dist = len_v3v3(cob->matrix[3], ct->matrix[3]); + /* Only Y constrained object axis scale should be used, to keep same length when scaling it. */ + dist /= size[1]; + /* data->orglength==0 occurs on first run, and after 'R' button is clicked */ - if (data->orglength == 0) + if (data->orglength == 0) data->orglength = dist; - if (data->bulge == 0) + if (data->bulge == 0) data->bulge = 1.0; scale[1] = dist/data->orglength; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 038e48f5769..cd2d4c0c1f8 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -77,6 +77,9 @@ #include "BKE_smoke.h" +/* UNUSED so far, may be enabled later */ +/* #define USE_SMOKE_COLLISION_DM */ + #ifdef WITH_SMOKE #ifdef _WIN32 @@ -617,9 +620,11 @@ static void smokeModifier_freeCollision(SmokeModifierData *smd) smd->coll->bvhtree = NULL; } +#ifdef USE_SMOKE_COLLISION_DM if(smd->coll->dm) smd->coll->dm->release(smd->coll->dm); smd->coll->dm = NULL; +#endif MEM_freeN(smd->coll); smd->coll = NULL; @@ -682,9 +687,11 @@ void smokeModifier_reset(struct SmokeModifierData *smd) smd->coll->bvhtree = NULL; } +#ifdef USE_SMOKE_COLLISION_DM if(smd->coll->dm) smd->coll->dm->release(smd->coll->dm); smd->coll->dm = NULL; +#endif } } @@ -772,7 +779,10 @@ void smokeModifier_createType(struct SmokeModifierData *smd) smd->coll->points = NULL; smd->coll->numpoints = 0; smd->coll->bvhtree = NULL; + +#ifdef USE_SMOKE_COLLISION_DM smd->coll->dm = NULL; +#endif } } } @@ -1339,11 +1349,13 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM { // XXX TODO smd->time = scene->r.cfra; - + +#ifdef USE_SMOKE_COLLISION_DM if(smd->coll->dm) smd->coll->dm->release(smd->coll->dm); smd->coll->dm = CDDM_copy(dm, 1); +#endif // rigid movement support copy_m4_m4(smd->coll->mat_old, smd->coll->mat); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 73170612ff7..0c3c43bebc3 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1062,7 +1062,7 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale) { BKE_tracking_disable_imbuf_channels(ibuf, track->flag&TRACK_DISABLE_RED, - track->flag&TRACK_DISABLE_GREEN, track->flag&TRACK_DISABLE_RED, grayscale); + track->flag&TRACK_DISABLE_GREEN, track->flag&TRACK_DISABLE_BLUE, grayscale); } static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index c2026b30ab2..757f501d296 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -359,7 +359,7 @@ static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot) extern EnumPropertyItem uv_sculpt_tool_items[]; /* identifiers */ ot->name = "UV Sculpt Tool Set"; - ot->description = "Set the uv sculpt tool"; + ot->description = "Set the UV sculpt tool"; ot->idname = "BRUSH_OT_uv_sculpt_tool_set"; /* api callbacks */ diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 6cf8a988571..7fcd761fc49 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1208,7 +1208,7 @@ static int track_count_markers(SpaceClip *sc, MovieClip *clip) track= tracksbase->first; while(track) { if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) { - MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, framenr); + MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr); if (!marker || (marker->flag&MARKER_DISABLED) == 0) tot++; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 12f4af3637e..562cbf45e86 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1689,7 +1689,7 @@ void OUTLINER_OT_parent_clear(wmOperatorType *ot) { /* identifiers */ ot->name= "Drop to Clear Parent"; - ot->description = "Drag to clear parent in outliner"; + ot->description = "Drag to clear parent in Outliner"; ot->idname= "OUTLINER_OT_parent_clear"; /* api callbacks */ diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 29583a9356e..5517f428678 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2412,7 +2412,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in { Text *text = st->text; int max = wrap_width(st, ar); /* view */ - int charp; /* mem */ + int charp = -1; /* mem */ int loop = 1, found = 0; /* flags */ char ch; @@ -2513,9 +2513,11 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in y--; } - - if(sel) { text->sell = linep; text->selc = charp; } - else { text->curl = linep; text->curc = charp; } + + if (linep && charp != -1) { + if(sel) { text->sell = linep; text->selc = charp; } + else { text->curl = linep; text->curc = charp; } + } } static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 65ef3273e30..bf1b1ddc18a 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -193,6 +193,10 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) col[0] = 1.0; col[1] = 0.1; col[2] = 0.75; col[3] = 0.1; break; + default: + BLI_assert(0); + col[0] = 1.0; col[1] = 0.0; col[2] = 1.0; + col[3] = 0.1; } glColor4fv(col); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index b4217441640..80fd404772e 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2460,6 +2460,7 @@ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int static void pose_circle_select(ViewContext *vc, int select, const int mval[2], float rad) { struct {ViewContext *vc; short select; int mval[2]; float radius; } data; + bArmature *arm = vc->obact->data; bPose *pose = vc->obact->pose; bPoseChannel *pchan; int change= FALSE; @@ -2478,6 +2479,10 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f short sco1[2], sco2[2], didpoint=0; float vec[3]; + /* skip invisible bones */ + if (PBONE_VISIBLE(arm, pchan->bone) == 0) + continue; + /* project head location to screenspace */ mul_v3_m4v3(vec, vc->obact->obmat, pchan->pose_head); project_short(vc->ar, vec, sco1); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 43fdcff2e61..8634aa90dd3 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -569,7 +569,7 @@ static void stitch_validate_stichability(UvElement *element, StitchState *state, static int stitch_process_data(StitchState *state, Scene *scene, int final) { int i; - StitchPreviewer *preview = uv_get_stitch_previewer(); + StitchPreviewer *preview; IslandStitchData *island_stitch_data = NULL; int previous_island = state->static_island; EditFace *efa; @@ -1458,11 +1458,15 @@ void UV_OT_stitch(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "use_limit", 0, "Use Limit", "Stitch UVs within a specified limit distance"); - RNA_def_boolean(ot->srna, "snap_islands", 1, "Snap Islands", "Snap islands together. On edge stitch mode, rotates the islands too"); - - RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, FLT_MAX, "Limit", "Limit distance in normalized coordinates", 0.0, FLT_MAX); - RNA_def_int(ot->srna, "static_island", 0, 0, INT_MAX, "Static Island", "Island that stays in place when stitching islands", 0, INT_MAX); - RNA_def_boolean(ot->srna, "midpoint_snap", 0, "Snap At Midpoint", "Uv's are stitched at midpoint instead of at static island"); + RNA_def_boolean(ot->srna, "snap_islands", 1, "Snap Islands", + "Snap islands together (on edge stitch mode, rotates the islands too)"); + + RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, FLT_MAX, "Limit", + "Limit distance in normalized coordinates", 0.0, FLT_MAX); + RNA_def_int(ot->srna, "static_island", 0, 0, INT_MAX, "Static Island", + "Island that stays in place when stitching islands", 0, INT_MAX); + RNA_def_boolean(ot->srna, "midpoint_snap", 0, "Snap At Midpoint", + "UVs are stitched at midpoint instead of at static island"); prop = RNA_def_collection_runtime(ot->srna, "selection", &RNA_SelectedUvElement, "Selection", ""); /* Selection should not be editable or viewed in toolbar */ RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 11ea0f12a9e..55e71b8ebcf 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -352,7 +352,6 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi MFace *face; MEdge *edge; EditVert *editVert; - MTFace *texface; EditFace *editFace, **editFaceTmp; EditEdge *editEdge, **editEdgeTmp; int i; @@ -367,7 +366,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi MVert *subsurfedVerts; MEdge *subsurfedEdges; MFace *subsurfedFaces; - MTFace *subsurfedTexfaces; + /* MTFace *subsurfedTexfaces; */ /* UNUSED */ /* number of vertices and faces for subsurfed mesh*/ int numOfEdges, numOfFaces; @@ -386,7 +385,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi if(eface) { float aspx, aspy; - texface= CustomData_em_get(&editMesh->fdata, eface->data, CD_MTFACE); + MTFace *texface= CustomData_em_get(&editMesh->fdata, eface->data, CD_MTFACE); ED_image_uv_aspect(texface->tpage, &aspx, &aspy); @@ -414,7 +413,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi origEdgeIndices = derivedMesh->getEdgeDataArray(derivedMesh, CD_ORIGINDEX); origFaceIndices = derivedMesh->getFaceDataArray(derivedMesh, CD_ORIGINDEX); - subsurfedTexfaces = derivedMesh->getFaceDataArray(derivedMesh, CD_MTFACE); + /* subsurfedTexfaces = derivedMesh->getFaceDataArray(derivedMesh, CD_MTFACE); */ /* UNUSED */ numOfEdges = derivedMesh->getNumEdges(derivedMesh); numOfFaces = derivedMesh->getNumFaces(derivedMesh); @@ -473,7 +472,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi } /* Now we feed the rest of the data from the subsurfed faces */ - texface= subsurfedTexfaces+i; + /* texface= subsurfedTexfaces+i; */ /* UNUSED */ /* We will not check for v4 here. Subsurfed mfaces always have 4 vertices. */ key = (ParamKey)face; @@ -1245,8 +1244,10 @@ void UV_OT_unwrap(wmOperatorType *ot) "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry"); RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect", "Map UVs taking image aspect ratio into account"); - RNA_def_boolean(ot->srna, "use_subsurf_data", 0, "Use Subsurf Data", "Map UV's taking vertex position after subsurf into account"); - RNA_def_int(ot->srna, "uv_subsurf_level", 1, 1, 6, "SubSurf Target", "Number of times to subdivide before calculating UV's", 1, 6); + RNA_def_boolean(ot->srna, "use_subsurf_data", 0, "Use Subsurf Data", + "Map UVs taking vertex position after subsurf into account"); + RNA_def_int(ot->srna, "uv_subsurf_level", 1, 1, 6, "SubSurf Target", + "Number of times to subdivide before calculating UVs", 1, 6); } /**************** Project From View operator **************/ diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h index ed764c4f644..753f1374774 100644 --- a/source/blender/makesdna/DNA_smoke_types.h +++ b/source/blender/makesdna/DNA_smoke_types.h @@ -138,7 +138,8 @@ typedef struct SmokeFlowSettings { typedef struct SmokeCollSettings { struct SmokeModifierData *smd; /* for fast RNA access */ struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */ - struct DerivedMesh *dm; + +// struct DerivedMesh *dm; // UNUSED, ifdef'd in code for now. float *points; float *points_old; float *vel; diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 839c67f6297..1327a205c19 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -292,7 +292,9 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "vel_damping", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_damping"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Velocity Damping", "Damp velocity to help cloth reach the resting position faster. [1.0 = no damping, 0.0 = fully dampened]"); + RNA_def_property_ui_text(prop, "Velocity Damping", + "Damp velocity to help cloth reach the resting position faster " + "(1.0 = no damping, 0.0 = fully dampened)"); RNA_def_property_update(prop, 0, "rna_cloth_update"); prop= RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 56167fe0dc7..a3712d17938 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1459,13 +1459,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1); - RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for uv sculpting"); + RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting"); RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update"); prop= RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS); - RNA_def_property_ui_text(prop, "Lock Borders", "Disables editing of boundary edges"); + RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges"); prop= RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS); @@ -3724,7 +3724,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", R_SIMPLE_NO_TRIANGULATE); - RNA_def_property_ui_text(prop, "Skip Quad to Triangles", "Disables non-planer quads being triangulated"); + RNA_def_property_ui_text(prop, "Skip Quad to Triangles", "Disable non-planar quads being triangulated"); /* Scene API */ RNA_api_scene_render(srna); @@ -3898,7 +3898,7 @@ static void rna_def_selected_uv_element(BlenderRNA *brna) PropertyRNA *prop; srna= RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup"); - RNA_def_struct_ui_text(srna, "Selected Uv Element", ""); + RNA_def_struct_ui_text(srna, "Selected UV Element", ""); /* store the index to the UV element selected */ prop= RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 4c17ee54fd2..345cba5d3d1 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -350,7 +350,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( GHash *material_hash = NULL; Mesh *me1= (Mesh*)ob1->data; Mesh *me2= (Mesh*)ob2->data; - int i; + int i, *origindex_layer; // create a new DerivedMesh result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0); @@ -379,6 +379,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( *totmat = 0; } + origindex_layer = result->getFaceDataArray(result, CD_ORIGINDEX); + // step through the face iterators for(i = 0; !face_it->Done(face_it->it); i++) { Mesh *orig_me; @@ -427,6 +429,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( (orig_me == me2)? mapmat: NULL); test_index_face(mface, &result->faceData, i, csgface.vertex_number); + + if(origindex_layer && orig_ob == ob2) + origindex_layer[i] = ORIGINDEX_NONE; } if (material_hash) @@ -523,7 +528,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern( CSG_FreeFaceDescriptor(&fd_o); } else - printf("Unknown internal error in boolean"); + printf("Unknown internal error in boolean\n"); CSG_FreeBooleanOperation(bool_op); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 7fe4b5ba5dd..efd73bf8c04 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -411,6 +411,34 @@ static void matrix_3x3_as_4x4(float mat[16]) /*-----------------------CLASS-METHODS----------------------------*/ //mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. +PyDoc_STRVAR(C_Matrix_Identity_doc, +".. classmethod:: Identity(size)\n" +"\n" +" Create an identity matrix.\n" +"\n" +" :arg size: The size of the identity matrix to construct [2, 4].\n" +" :type size: int\n" +" :return: A new identity matrix.\n" +" :rtype: :class:`Matrix`\n" +); +static PyObject *C_Matrix_Identity(PyObject *cls, PyObject *args) +{ + int matSize; + + if (!PyArg_ParseTuple(args, "i:Matrix.Identity", &matSize)) { + return NULL; + } + + if (matSize < 2 || matSize > 4) { + PyErr_SetString(PyExc_RuntimeError, + "Matrix.Identity(): " + "size must be between 2 and 4"); + return NULL; + } + + return Matrix_CreatePyObject(NULL, matSize, matSize, Py_NEW, (PyTypeObject *)cls); +} + PyDoc_STRVAR(C_Matrix_Rotation_doc, ".. classmethod:: Rotation(angle, size, axis)\n" "\n" @@ -2246,6 +2274,7 @@ static struct PyMethodDef Matrix_methods[] = { {"__copy__", (PyCFunction) Matrix_copy, METH_NOARGS, Matrix_copy_doc}, /* class methods */ + {"Identity", (PyCFunction) C_Matrix_Identity, METH_VARARGS | METH_CLASS, C_Matrix_Identity_doc}, {"Rotation", (PyCFunction) C_Matrix_Rotation, METH_VARARGS | METH_CLASS, C_Matrix_Rotation_doc}, {"Scale", (PyCFunction) C_Matrix_Scale, METH_VARARGS | METH_CLASS, C_Matrix_Scale_doc}, {"Shear", (PyCFunction) C_Matrix_Shear, METH_VARARGS | METH_CLASS, C_Matrix_Shear_doc}, |