Commit: 6ab9af0083a947b88ef71b247ce1853145351890 Author: Luca Rood Date: Mon Feb 27 16:08:25 2017 -0300 Branches: blender2.8 https://developer.blender.org/rB6ab9af0083a947b88ef71b247ce1853145351890
Merge branch 'master' into blender2.8 =================================================================== =================================================================== diff --cc source/blender/editors/object/object_add.c index 97db8458d0,ae458c722f..f3142337f4 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@@ -63,8 -63,8 +63,9 @@@ #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_camera.h" +#include "BKE_collection.h" #include "BKE_context.h" + #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" @@@ -1366,9 -1378,10 +1367,9 @@@ static void make_object_duplilist_real( ob->proxy = NULL; ob->parent = NULL; - BLI_listbase_clear(&ob->constraints); + BKE_constraints_free(&ob->constraints); ob->curve_cache = NULL; ob->transflag &= ~OB_DUPLI; - ob->lay = base->lay; copy_m4_m4(ob->obmat, dob->mat); BKE_object_apply_mat4(ob, ob->obmat, false, false); diff --cc source/blender/editors/space_outliner/outliner_draw.c index f99ccd52bf,684a1f9fd6..83a7a1db85 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@@ -885,70 -1086,50 +885,71 @@@ static void tselem_draw_icon(uiBlock *b Object *ob = (Object *)tselem->id; ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr); switch ((ModifierType)md->type) { - case eModifierType_Subsurf: - UI_icon_draw(x, y, ICON_MOD_SUBSURF); break; - case eModifierType_Armature: - UI_icon_draw(x, y, ICON_MOD_ARMATURE); break; - case eModifierType_Lattice: - UI_icon_draw(x, y, ICON_MOD_LATTICE); break; - case eModifierType_Curve: - UI_icon_draw(x, y, ICON_MOD_CURVE); break; - case eModifierType_Build: - UI_icon_draw(x, y, ICON_MOD_BUILD); break; - case eModifierType_Mirror: - UI_icon_draw(x, y, ICON_MOD_MIRROR); break; - case eModifierType_Decimate: - UI_icon_draw(x, y, ICON_MOD_DECIM); break; - case eModifierType_Wave: - UI_icon_draw(x, y, ICON_MOD_WAVE); break; - case eModifierType_Hook: - UI_icon_draw(x, y, ICON_HOOK); break; - case eModifierType_Softbody: - UI_icon_draw(x, y, ICON_MOD_SOFT); break; - case eModifierType_Boolean: - UI_icon_draw(x, y, ICON_MOD_BOOLEAN); break; - case eModifierType_ParticleSystem: - UI_icon_draw(x, y, ICON_MOD_PARTICLES); break; + case eModifierType_Subsurf: + ICON_DRAW(ICON_MOD_SUBSURF); + break; + case eModifierType_Armature: + ICON_DRAW(ICON_MOD_ARMATURE); + break; + case eModifierType_Lattice: + ICON_DRAW(ICON_MOD_LATTICE); + break; + case eModifierType_Curve: + ICON_DRAW(ICON_MOD_CURVE); + break; + case eModifierType_Build: + ICON_DRAW(ICON_MOD_BUILD); + break; + case eModifierType_Mirror: + ICON_DRAW(ICON_MOD_MIRROR); + break; + case eModifierType_Decimate: + ICON_DRAW(ICON_MOD_DECIM); + break; + case eModifierType_Wave: + ICON_DRAW(ICON_MOD_WAVE); + break; + case eModifierType_Hook: + ICON_DRAW(ICON_HOOK); + break; + case eModifierType_Softbody: + ICON_DRAW(ICON_MOD_SOFT); + break; + case eModifierType_Boolean: + ICON_DRAW(ICON_MOD_BOOLEAN); + break; + case eModifierType_ParticleSystem: + ICON_DRAW(ICON_MOD_PARTICLES); + break; case eModifierType_ParticleInstance: - UI_icon_draw(x, y, ICON_MOD_PARTICLES); break; + ICON_DRAW(ICON_MOD_PARTICLES); + break; case eModifierType_EdgeSplit: - UI_icon_draw(x, y, ICON_MOD_EDGESPLIT); break; + ICON_DRAW(ICON_MOD_EDGESPLIT); + break; case eModifierType_Array: - UI_icon_draw(x, y, ICON_MOD_ARRAY); break; + ICON_DRAW(ICON_MOD_ARRAY); + break; case eModifierType_UVProject: case eModifierType_UVWarp: /* TODO, get own icon */ - UI_icon_draw(x, y, ICON_MOD_UVPROJECT); break; + ICON_DRAW(ICON_MOD_UVPROJECT); + break; case eModifierType_Displace: - UI_icon_draw(x, y, ICON_MOD_DISPLACE); break; + ICON_DRAW(ICON_MOD_DISPLACE); + break; case eModifierType_Shrinkwrap: - UI_icon_draw(x, y, ICON_MOD_SHRINKWRAP); break; + ICON_DRAW(ICON_MOD_SHRINKWRAP); + break; case eModifierType_Cast: - UI_icon_draw(x, y, ICON_MOD_CAST); break; + ICON_DRAW(ICON_MOD_CAST); + break; case eModifierType_MeshDeform: + case eModifierType_SurfaceDeform: - UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break; + ICON_DRAW(ICON_MOD_MESHDEFORM); + break; case eModifierType_Bevel: - UI_icon_draw(x, y, ICON_MOD_BEVEL); break; + ICON_DRAW(ICON_MOD_BEVEL); + break; case eModifierType_Smooth: case eModifierType_LaplacianSmooth: case eModifierType_CorrectiveSmooth: diff --cc source/blender/modifiers/intern/MOD_surfacedeform.c index 0000000000,5e852e8451..d0a68e9803 mode 000000,100644..100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@@ -1,0 -1,1189 +1,1173 @@@ + #include "DNA_object_types.h" + #include "DNA_scene_types.h" + + #include "BLI_alloca.h" + #include "BLI_math.h" + #include "BLI_math_geom.h" + #include "BLI_task.h" + + #include "BKE_cdderivedmesh.h" + #include "BKE_editmesh.h" + #include "BKE_library_query.h" + #include "BKE_modifier.h" + + #include "depsgraph_private.h" + + #include "MEM_guardedalloc.h" + + #include "MOD_util.h" + + typedef struct SDefAdjacency { + struct SDefAdjacency *next; + unsigned int index; + } SDefAdjacency; + + typedef struct SDefAdjacencyArray { + SDefAdjacency *first; + unsigned int num; /* Careful, this is twice the number of polygons (avoids an extra loop) */ + } SDefAdjacencyArray; + + typedef struct SDefEdgePolys { + unsigned int polys[2], num; + } SDefEdgePolys; + + typedef struct SDefBindCalcData { + BVHTreeFromMesh * const treeData; + const SDefAdjacencyArray * const vert_edges; + const SDefEdgePolys * const edge_polys; + SDefVert * const bind_verts; + const MLoopTri * const looptri; + const MPoly * const mpoly; + const MEdge * const medge; + const MLoop * const mloop; + const MVert * const mvert; + float (* const vertexCos)[3]; + const float falloff; + int success; + } SDefBindCalcData; + + typedef struct SDefBindPoly { + float (*coords)[3]; + float (*coords_v2)[2]; + float point_v2[2]; + float weight_angular; + float weight_dist_proj; + float weight_dist; + float weight; + float scales[2]; + float centroid[3]; + float centroid_v2[2]; + float normal[3]; + float cent_edgemid_vecs_v2[2][2]; + float edgemid_angle; + float point_edgemid_angles[2]; + float corner_edgemid_angles[2]; + float dominant_angle_weight; + unsigned int index; + unsigned int numverts; + unsigned int loopstart; + unsigned int edge_inds[2]; + unsigned int edge_vert_inds[2]; + unsigned int corner_ind; + unsigned int dominant_edge; + bool inside; + } SDefBindPoly; + + typedef struct SDefBindWeightData { + SDefBindPoly *bind_polys; + unsigned int numpoly; + unsigned int numbinds; + } SDefBindWeightData; + + typedef struct SDefDeformData { + const SDefVert * const bind_verts; + const MVert * const mvert; + float (* const vertexCos)[3]; + } SDefDeformData; + + /* Bind result values */ + enum { + MOD_SDEF_BIND_RESULT_SUCCESS = 1, + MOD_SDEF_BIND_RESULT_GENERIC_ERR = 0, + MOD_SDEF_BIND_RESULT_MEM_ERR = -1, + MOD_SDEF_BIND_RESULT_NONMANY_ERR = -2, + MOD_SDEF_BIND_RESULT_CONCAVE_ERR = -3, + MOD_SDEF_BIND_RESULT_OVERLAP_ERR = -4, + }; + + /* Infinite weight flags */ + enum { + MOD_SDEF_INFINITE_WEIGHT_ANGULAR = (1 << 0), + MOD_SDEF_INFINITE_WEIGHT_DIST_PROJ = (1 << 1), + MOD_SDEF_INFINITE_WEIGHT_DIST = (1 << 2), + }; + + static void initData(ModifierData *md) + { + SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; + smd->target = NULL; + smd->verts = NULL; + smd->flags = 0; + smd->falloff = 4.0f; + } + + static void freeData(ModifierData *md) + { + SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; + + if (smd->verts) { + for (int i = 0; i < smd->numverts; i++) { + if (smd->verts[i].binds) { + for (int j = 0; j < smd->verts[i].numbinds; j++) { + MEM_SAFE_FREE(smd->verts[i].binds[j].vert_inds); + MEM_SAFE_FREE(smd->verts[i].binds[j].vert_weights); + } + + MEM_freeN(smd->verts[i].binds); + } + } + + MEM_freeN(smd->verts); + smd->verts = NULL; + } + } + + static void copyData(ModifierData *md, ModifierData *target) + { + SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; + SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target; + + *tsmd = *smd; + + if (smd->verts) { + tsmd->verts = MEM_dupallocN(smd->verts); + + for (int i = 0; i < smd->numverts; i++) { + if (smd->verts[i].binds) { + tsmd->verts[i].binds = MEM_dupallocN(smd->verts[i].binds); + + for (int j = 0; j < smd->verts[i].numbinds; j++) { + if (smd->verts[i].binds[j].vert_inds) { + tsmd->verts[i].binds[j].vert_inds = MEM_dupallocN(smd->verts[i].binds[j].vert_inds); + } + + if (smd->verts[i].binds[j].vert_weights) { + tsmd->verts[i].binds[j].vert_weights = MEM_dupallocN(smd->verts[i].binds[j].vert_weights); + } + } + } + } + } + } + + static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData) + { + SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; + + walk(userData, ob, &smd->target, IDWALK_NOP); + } + -static void updateDepgraph(ModifierData *md, DagForest *forest, - struct Main *UNUSED(bmain), - struct Scene *UNUSED(scene), - Object *UNUSED(ob), - DagNode *obNode) -{ - SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; - - if (smd->target) { - DagNode *curNode = dag_get_node(forest, smd->target); - - dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA, "Surface Deform Modifier"); - } -} - + static void updateDepsgraph(ModifierData *md, + @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs