Merge remote-tracking branch 'origin/master' into blender2.8
authorDalai Felinto <dfelinto@gmail.com>
Wed, 21 Jun 2017 13:14:42 +0000 (15:14 +0200)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 21 Jun 2017 13:14:42 +0000 (15:14 +0200)
16 files changed:
build_files/buildbot/config/blender_linux_player.cmake
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/mesh.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c
source/blender/modifiers/intern/MOD_dynamicpaint.c
source/blender/modifiers/intern/MOD_fluidsim.c
source/blender/modifiers/intern/MOD_fluidsim_util.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/modifiers/intern/MOD_ocean.c
source/blender/modifiers/intern/MOD_surfacedeform.c
source/blender/modifiers/intern/MOD_uvproject.c
tests/python/CMakeLists.txt
tests/python/alembic_tests.py
tests/python/bl_alembic_import_test.py
tests/python/bl_load_py_modules.py

index 2fb31192002c9ecb3c90d29b63b2dd165bfa9930..69ab984e386107026c31484fee92fad741a62d3b 100644 (file)
@@ -1,4 +1,4 @@
-# This is applied as an ovveride on top of blender_linux.config
+# This is applied as an override on top of blender_linux.config
 # Disables all the areas which are not needed for the player.
 set(WITH_COMPOSITOR          OFF CACHE BOOL "" FORCE)
 set(WITH_CYCLES              OFF CACHE BOOL "" FORCE)
index 9d054d0a81442f2e881208e4d123bf411ab2bd5f..b7f793ea6cf1a3339124c2edb0534e4060ba892b 100644 (file)
@@ -110,7 +110,8 @@ int BKE_mesh_nurbs_displist_to_mdata(
         struct MEdge **r_alledge, int *r_totedge,
         struct MLoop **r_allloop, struct MPoly **r_allpoly,
         struct MLoopUV **r_alluv, int *r_totloop, int *r_totpoly);
-void BKE_mesh_from_nurbs_displist(struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv);
+void BKE_mesh_from_nurbs_displist(
+        struct Object *ob, struct ListBase *dispbase, const bool use_orco_uv, const char *obdata_name);
 void BKE_mesh_from_nurbs(struct Object *ob);
 void BKE_mesh_to_curve_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test);
 void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob);
index 6a0c0c14a23f79f001fe2424021e6a8e97690f7d..9c0881e79ffb85ac6e1d25f88cc4d7b1f7f90410 100644 (file)
@@ -1337,7 +1337,7 @@ int BKE_mesh_nurbs_displist_to_mdata(
 
 
 /* this may fail replacing ob->data, be sure to check ob->type */
-void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use_orco_uv)
+void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use_orco_uv, const char *obdata_name)
 {
        Main *bmain = G.main;
        Object *ob1;
@@ -1364,7 +1364,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
                }
 
                /* make mesh */
-               me = BKE_mesh_add(bmain, "Mesh");
+               me = BKE_mesh_add(bmain, obdata_name);
                me->totvert = totvert;
                me->totedge = totedge;
                me->totloop = totloop;
@@ -1383,7 +1383,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
                BKE_mesh_calc_normals(me);
        }
        else {
-               me = BKE_mesh_add(bmain, "Mesh");
+               me = BKE_mesh_add(bmain, obdata_name);
                DM_to_mesh(dm, me, ob, CD_MASK_MESH, false);
        }
 
@@ -1425,7 +1425,7 @@ void BKE_mesh_from_nurbs(Object *ob)
                disp = ob->curve_cache->disp;
        }
 
-       BKE_mesh_from_nurbs_displist(ob, &disp, use_orco_uv);
+       BKE_mesh_from_nurbs_displist(ob, &disp, use_orco_uv, cu->id.name);
 }
 
 typedef struct EdgeLink {
@@ -2484,7 +2484,7 @@ Mesh *BKE_mesh_new_from_object(
 
                        /* convert object type to mesh */
                        uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0;
-                       BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco);
+                       BKE_mesh_from_nurbs_displist(tmpobj, &dispbase, uv_from_orco, tmpcu->id.name + 2);
 
                        tmpmesh = tmpobj->data;
 
@@ -2520,7 +2520,7 @@ Mesh *BKE_mesh_new_from_object(
                        if (ob != basis_ob)
                                return NULL;  /* only do basis metaball */
 
-                       tmpmesh = BKE_mesh_add(bmain, "Mesh");
+                       tmpmesh = BKE_mesh_add(bmain, ((ID *)ob->data)->name + 2);
                        /* BKE_mesh_add gives us a user count we don't need */
                        id_us_min(&tmpmesh->id);
 
@@ -2575,7 +2575,7 @@ Mesh *BKE_mesh_new_from_object(
                                else
                                        dm = mesh_create_derived_view(sce, ob, mask);
 
-                               tmpmesh = BKE_mesh_add(bmain, "Mesh");
+                               tmpmesh = BKE_mesh_add(bmain, ((ID *)ob->data)->name + 2);
                                DM_to_mesh(dm, tmpmesh, ob, mask, true);
 
                                /* Copy autosmooth settings from original mesh. */
index be37ba46f7f6ac29cb2d87a1dcafd30bd16ff9cc..d667a26cc89e9ac6159aabf12d9b7cb3ff589b4f 100644 (file)
@@ -3179,7 +3179,9 @@ static uiBut *ui_def_but(
        }
 
        if (block->flag & UI_BLOCK_RADIAL) {
-               but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
+               but->drawflag |= UI_BUT_TEXT_LEFT;
+               if (but->str && but->str[0])
+                       but->drawflag |= UI_BUT_ICON_LEFT;
        }
        else if ((block->flag & UI_BLOCK_LOOP) ||
                 ELEM(but->type,
index 5462043c96124c004cff5d439d725d1f87ddfb82..0b7f4b00c2de49ef366a7a7d07fe7bc6112f0ae4 100644 (file)
@@ -2318,8 +2318,10 @@ static void ui_litem_layout_radial(uiLayout *litem)
                                /* add a little bit more here to include number */
                                bitem->but->rect.xmax += 1.5f * UI_UNIT_X;
                                /* enable drawing as pie item if supported by widget */
-                               if (ui_item_is_radial_drawable(bitem))
+                               if (ui_item_is_radial_drawable(bitem)) {
                                        bitem->but->dt = UI_EMBOSS_RADIAL;
+                                       bitem->but->drawflag |= UI_BUT_ICON_LEFT;
+                               }
                        }
 
                        ui_item_size(item, &itemw, &itemh);
index 2497e0b9aab06a94c78f2adde18f7b4db2f7ecaa..b1fe353515445b9f4d679a01f313510c943c6774 100644 (file)
@@ -37,6 +37,7 @@
 #include "BKE_cdderivedmesh.h"
 #include "BKE_dynamicpaint.h"
 #include "BKE_layer.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_modifier.h"
 
@@ -58,6 +59,15 @@ static void copyData(ModifierData *md, ModifierData *target)
        DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
        
        dynamicPaint_Modifier_copy(pmd, tpmd);
+
+       if (tpmd->canvas) {
+               for (DynamicPaintSurface *surface = tpmd->canvas->surfaces.first; surface; surface = surface->next) {
+                       id_us_plus((ID *)surface->init_texture);
+               }
+       }
+       if (tpmd->brush) {
+               id_us_plus((ID *)tpmd->brush->mat);
+       }
 }
 
 static void freeData(ModifierData *md)
index 3e7141c3ce3107783c176b7bc3ba042ad10d72ca..85eb7b2ffc9b55cc85c22f8a178d63410db16d65 100644 (file)
@@ -68,12 +68,13 @@ static void copyData(ModifierData *md, ModifierData *target)
        FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
        FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;
        
-       if (tfluidmd->fss)
-               MEM_freeN(tfluidmd->fss);
-       
-       tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
-       if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
-               tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities);
+       fluidsim_free(tfluidmd);
+
+       if (fluidmd->fss) {
+               tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
+               if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
+                       tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities);
+               }
        }
 }
 
index 2ecf06057dbf65030c289f94493043eb07f0fab4..3684e947fe0202aa66c90a1350e89d83654c9834 100644 (file)
@@ -150,9 +150,8 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
        if (fluidmd && fluidmd->fss) {
                if (fluidmd->fss->meshVelocities) {
                        MEM_freeN(fluidmd->fss->meshVelocities);
-                       fluidmd->fss->meshVelocities = NULL;
                }
-               MEM_freeN(fluidmd->fss);
+               MEM_SAFE_FREE(fluidmd->fss);
        }
        
        return;
index b544710ace0da22d6e944be5a358e5f4e37084fc..3c05f8266f0f130468e79afca89e8ce3285374f1 100644 (file)
@@ -81,7 +81,7 @@ static void copyData(ModifierData *md, ModifierData *target)
        MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
        MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target;
 
-       *tmmd = *mmd;
+       modifier_copyData_generic(md, target);
 
        if (mmd->bindinfluences) tmmd->bindinfluences = MEM_dupallocN(mmd->bindinfluences);
        if (mmd->bindoffsets) tmmd->bindoffsets = MEM_dupallocN(mmd->bindoffsets);
@@ -89,8 +89,8 @@ static void copyData(ModifierData *md, ModifierData *target)
        if (mmd->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid);
        if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences);
        if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts);
-       if (mmd->bindweights) tmmd->dynverts = MEM_dupallocN(mmd->bindweights);  /* deprecated */
-       if (mmd->bindcos) tmmd->dynverts = MEM_dupallocN(mmd->bindcos);  /* deprecated */
+       if (mmd->bindweights) tmmd->bindweights = MEM_dupallocN(mmd->bindweights);  /* deprecated */
+       if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos);  /* deprecated */
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
index 4a6b79b71b6a03107503b3fa3198d1d7a06d3a7b..120337eb2eafdb106101b166324de6cc86aafbc5 100644 (file)
@@ -160,40 +160,19 @@ static void freeData(ModifierData *md)
 static void copyData(ModifierData *md, ModifierData *target)
 {
 #ifdef WITH_OCEANSIM
+#if 0
        OceanModifierData *omd = (OceanModifierData *) md;
+#endif
        OceanModifierData *tomd = (OceanModifierData *) target;
 
-       tomd->geometry_mode = omd->geometry_mode;
-       tomd->resolution = omd->resolution;
-       tomd->spatial_size = omd->spatial_size;
-
-       tomd->wind_velocity = omd->wind_velocity;
-
-       tomd->damp = omd->damp;
-       tomd->smallest_wave = omd->smallest_wave;
-       tomd->depth = omd->depth;
+       freeData(target);
 
-       tomd->wave_alignment = omd->wave_alignment;
-       tomd->wave_direction = omd->wave_direction;
-       tomd->wave_scale = omd->wave_scale;
-
-       tomd->chop_amount = omd->chop_amount;
-       tomd->foam_coverage = omd->foam_coverage;
-       tomd->time = omd->time;
-
-       tomd->seed = omd->seed;
-       tomd->flag = omd->flag;
+       modifier_copyData_generic(md, target);
 
        tomd->refresh = 0;
 
-       tomd->size = omd->size;
-       tomd->repeat_x = omd->repeat_x;
-       tomd->repeat_y = omd->repeat_y;
-
        /* XXX todo: copy cache runtime too */
        tomd->cached = 0;
-       tomd->bakestart = omd->bakestart;
-       tomd->bakeend = omd->bakeend;
        tomd->oceancache = NULL;
 
        tomd->ocean = BKE_ocean_add();
index f6288dc9be00eaa3ae3fd3b7fb90e9cfde2d69b9..9339d71524fe4cc229564851abad5d79fb9d4e5a 100644 (file)
@@ -136,7 +136,9 @@ static void copyData(ModifierData *md, ModifierData *target)
        SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
        SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target;
 
-       *tsmd = *smd;
+       freeData(target);
+
+       modifier_copyData_generic(md, target);
 
        if (smd->verts) {
                tsmd->verts = MEM_dupallocN(smd->verts);
index 362df031f9243fd4ee49c14728c22e8c6d0a25a3..cae83282238aeb17e2a30dfe2bc00284d07f77cb 100644 (file)
@@ -45,6 +45,7 @@
 
 
 #include "BKE_camera.h"
+#include "BKE_library.h"
 #include "BKE_library_query.h"
 #include "BKE_material.h"
 #include "BKE_mesh.h"
@@ -70,9 +71,12 @@ static void copyData(ModifierData *md, ModifierData *target)
 {
 #if 0
        UVProjectModifierData *umd = (UVProjectModifierData *) md;
-       UVProjectModifierData *tumd = (UVProjectModifierData *) target;
 #endif
+       UVProjectModifierData *tumd = (UVProjectModifierData *) target;
+
        modifier_copyData_generic(md, target);
+
+       id_us_plus((ID *)tumd->image);
 }
 
 static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
index dc0ad648ac2d92f4c512580d5b7d58c0f31bb504..20fa8257a32b072f739befca65ddbd6b4b4c5283 100644 (file)
@@ -468,12 +468,13 @@ if(WITH_ALEMBIC)
                        --testdir "${TEST_SRC_DIR}/alembic"
                        --alembic-root "${ALEMBIC_ROOT_DIR}"
                )
-               add_test(NAME script_alembic_import 
-                       COMMAND 
-                       "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS} 
+               add_test(NAME script_alembic_import
+                       COMMAND
+                       "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
                --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
                --
                --testdir "${TEST_SRC_DIR}/alembic"
+               --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
                )
 
        else()
@@ -487,6 +488,7 @@ if(WITH_ALEMBIC)
                --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
                --
                --testdir "${TEST_SRC_DIR}/alembic"
+               --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
                )
 
        endif()
index e36a6391298dd8e2e272c26d44cefe8450bd9823..96a68de9801f1de27c269436ed9a702fc1603eab 100755 (executable)
@@ -157,6 +157,8 @@ class AbstractAlembicTest(unittest.TestCase):
             if proptype == 'CompoundProperty':
                 # To read those, call self.abcprop() on it.
                 continue
+            if len(parts) < 2:
+                raise ValueError('Error parsing result from abcprop: %s', info.strip())
             valtype_and_arrsize, name_and_extent = parts[1:]
 
             # Parse name and extent
index e9dcbd80a3a9e0ddf4e421371379261d0a8a06e9..2f3daaefd44c98a14f6695a6fc3e60328b112407 100644 (file)
@@ -129,6 +129,9 @@ class SimpleImportTest(AbstractAlembicTest):
         bpy.data.cache_files[fname].filepath = relpath.replace('1.abc', '2.abc')
         bpy.context.scene.update()
 
+        if args.with_legacy_depsgraph:
+            bpy.context.scene.frame_set(10)
+
         x, y, z = cube.matrix_world.to_euler('XYZ')
         self.assertAlmostEqual(x, math.pi / 2, places=5)
         self.assertAlmostEqual(y, 0)
@@ -213,6 +216,8 @@ def main():
 
     parser = argparse.ArgumentParser()
     parser.add_argument('--testdir', required=True, type=pathlib.Path)
+    parser.add_argument('--with-legacy-depsgraph', default=False,
+                        type=lambda v: v in {'ON', 'YES', 'TRUE'})
     args, remaining = parser.parse_known_args(argv)
 
     unittest.main(argv=remaining)
index c13679d16f0f5956396de7b7ccabd344b8f5d111..4935491a6beef1d598d837960f90a204c75eaf9c 100644 (file)
@@ -36,6 +36,9 @@ BLACKLIST = {
     "cycles",
     "io_export_dxf",  # TODO, check on why this fails
     'io_import_dxf',  # Because of cydxfentity.so dependency
+
+    # The unpacked wheel is only loaded when actually used, not directly on import:
+    "io_blend_utils/blender_bam-unpacked.whl",
     }
 
 # Some modules need to add to the `sys.path`.
@@ -211,11 +214,10 @@ def load_modules():
          [(os.sep + f + ".py")  for f in BLACKLIST])
 
     for f in source_files:
-        ok = False
         for ignore in ignore_paths:
             if ignore in f:
-                ok = True
-        if not ok:
+                break
+        else:
             raise Exception("Source file %r not loaded in test" % f)
 
     print("loaded %d modules" % len(loaded_files))