Merge remote-tracking branch 'origin/master' into blender2.8

This commit is contained in:
Dalai Felinto
2017-06-21 15:14:42 +02:00
16 changed files with 66 additions and 55 deletions

View 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. # Disables all the areas which are not needed for the player.
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE) set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES OFF CACHE BOOL "" FORCE) set(WITH_CYCLES OFF CACHE BOOL "" FORCE)

View File

@@ -110,7 +110,8 @@ int BKE_mesh_nurbs_displist_to_mdata(
struct MEdge **r_alledge, int *r_totedge, struct MEdge **r_alledge, int *r_totedge,
struct MLoop **r_allloop, struct MPoly **r_allpoly, struct MLoop **r_allloop, struct MPoly **r_allpoly,
struct MLoopUV **r_alluv, int *r_totloop, int *r_totpoly); 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_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_nurblist(struct DerivedMesh *dm, struct ListBase *nurblist, const int edge_users_test);
void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob); void BKE_mesh_to_curve(struct Scene *scene, struct Object *ob);

View File

@@ -1337,7 +1337,7 @@ int BKE_mesh_nurbs_displist_to_mdata(
/* this may fail replacing ob->data, be sure to check ob->type */ /* 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; Main *bmain = G.main;
Object *ob1; Object *ob1;
@@ -1364,7 +1364,7 @@ void BKE_mesh_from_nurbs_displist(Object *ob, ListBase *dispbase, const bool use
} }
/* make mesh */ /* make mesh */
me = BKE_mesh_add(bmain, "Mesh"); me = BKE_mesh_add(bmain, obdata_name);
me->totvert = totvert; me->totvert = totvert;
me->totedge = totedge; me->totedge = totedge;
me->totloop = totloop; 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); BKE_mesh_calc_normals(me);
} }
else { else {
me = BKE_mesh_add(bmain, "Mesh"); me = BKE_mesh_add(bmain, obdata_name);
DM_to_mesh(dm, me, ob, CD_MASK_MESH, false); 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; 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 { typedef struct EdgeLink {
@@ -2484,7 +2484,7 @@ Mesh *BKE_mesh_new_from_object(
/* convert object type to mesh */ /* convert object type to mesh */
uv_from_orco = (tmpcu->flag & CU_UV_ORCO) != 0; 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; tmpmesh = tmpobj->data;
@@ -2520,7 +2520,7 @@ Mesh *BKE_mesh_new_from_object(
if (ob != basis_ob) if (ob != basis_ob)
return NULL; /* only do basis metaball */ 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 */ /* BKE_mesh_add gives us a user count we don't need */
id_us_min(&tmpmesh->id); id_us_min(&tmpmesh->id);
@@ -2575,7 +2575,7 @@ Mesh *BKE_mesh_new_from_object(
else else
dm = mesh_create_derived_view(sce, ob, mask); 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); DM_to_mesh(dm, tmpmesh, ob, mask, true);
/* Copy autosmooth settings from original mesh. */ /* Copy autosmooth settings from original mesh. */

View File

@@ -3179,7 +3179,9 @@ static uiBut *ui_def_but(
} }
if (block->flag & UI_BLOCK_RADIAL) { 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) || else if ((block->flag & UI_BLOCK_LOOP) ||
ELEM(but->type, ELEM(but->type,

View File

@@ -2318,8 +2318,10 @@ static void ui_litem_layout_radial(uiLayout *litem)
/* add a little bit more here to include number */ /* add a little bit more here to include number */
bitem->but->rect.xmax += 1.5f * UI_UNIT_X; bitem->but->rect.xmax += 1.5f * UI_UNIT_X;
/* enable drawing as pie item if supported by widget */ /* 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->dt = UI_EMBOSS_RADIAL;
bitem->but->drawflag |= UI_BUT_ICON_LEFT;
}
} }
ui_item_size(item, &itemw, &itemh); ui_item_size(item, &itemw, &itemh);

View File

@@ -37,6 +37,7 @@
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_dynamicpaint.h" #include "BKE_dynamicpaint.h"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_library_query.h" #include "BKE_library_query.h"
#include "BKE_modifier.h" #include "BKE_modifier.h"
@@ -58,6 +59,15 @@ static void copyData(ModifierData *md, ModifierData *target)
DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target; DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target;
dynamicPaint_Modifier_copy(pmd, tpmd); 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) static void freeData(ModifierData *md)

View File

@@ -68,12 +68,13 @@ static void copyData(ModifierData *md, ModifierData *target)
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target; FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target;
if (tfluidmd->fss) fluidsim_free(tfluidmd);
MEM_freeN(tfluidmd->fss);
if (fluidmd->fss) {
tfluidmd->fss = MEM_dupallocN(fluidmd->fss); tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) { if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) {
tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities); tfluidmd->fss->meshVelocities = MEM_dupallocN(tfluidmd->fss->meshVelocities);
}
} }
} }

View File

@@ -150,9 +150,8 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
if (fluidmd && fluidmd->fss) { if (fluidmd && fluidmd->fss) {
if (fluidmd->fss->meshVelocities) { if (fluidmd->fss->meshVelocities) {
MEM_freeN(fluidmd->fss->meshVelocities); MEM_freeN(fluidmd->fss->meshVelocities);
fluidmd->fss->meshVelocities = NULL;
} }
MEM_freeN(fluidmd->fss); MEM_SAFE_FREE(fluidmd->fss);
} }
return; return;

View File

@@ -81,7 +81,7 @@ static void copyData(ModifierData *md, ModifierData *target)
MeshDeformModifierData *mmd = (MeshDeformModifierData *) md; MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target; MeshDeformModifierData *tmmd = (MeshDeformModifierData *) target;
*tmmd = *mmd; modifier_copyData_generic(md, target);
if (mmd->bindinfluences) tmmd->bindinfluences = MEM_dupallocN(mmd->bindinfluences); if (mmd->bindinfluences) tmmd->bindinfluences = MEM_dupallocN(mmd->bindinfluences);
if (mmd->bindoffsets) tmmd->bindoffsets = MEM_dupallocN(mmd->bindoffsets); 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->dyngrid) tmmd->dyngrid = MEM_dupallocN(mmd->dyngrid);
if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences); if (mmd->dyninfluences) tmmd->dyninfluences = MEM_dupallocN(mmd->dyninfluences);
if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts); if (mmd->dynverts) tmmd->dynverts = MEM_dupallocN(mmd->dynverts);
if (mmd->bindweights) tmmd->dynverts = MEM_dupallocN(mmd->bindweights); /* deprecated */ if (mmd->bindweights) tmmd->bindweights = MEM_dupallocN(mmd->bindweights); /* deprecated */
if (mmd->bindcos) tmmd->dynverts = MEM_dupallocN(mmd->bindcos); /* deprecated */ if (mmd->bindcos) tmmd->bindcos = MEM_dupallocN(mmd->bindcos); /* deprecated */
} }
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)

View File

@@ -160,40 +160,19 @@ static void freeData(ModifierData *md)
static void copyData(ModifierData *md, ModifierData *target) static void copyData(ModifierData *md, ModifierData *target)
{ {
#ifdef WITH_OCEANSIM #ifdef WITH_OCEANSIM
#if 0
OceanModifierData *omd = (OceanModifierData *) md; OceanModifierData *omd = (OceanModifierData *) md;
#endif
OceanModifierData *tomd = (OceanModifierData *) target; OceanModifierData *tomd = (OceanModifierData *) target;
tomd->geometry_mode = omd->geometry_mode; freeData(target);
tomd->resolution = omd->resolution;
tomd->spatial_size = omd->spatial_size;
tomd->wind_velocity = omd->wind_velocity; modifier_copyData_generic(md, target);
tomd->damp = omd->damp;
tomd->smallest_wave = omd->smallest_wave;
tomd->depth = omd->depth;
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;
tomd->refresh = 0; 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 */ /* XXX todo: copy cache runtime too */
tomd->cached = 0; tomd->cached = 0;
tomd->bakestart = omd->bakestart;
tomd->bakeend = omd->bakeend;
tomd->oceancache = NULL; tomd->oceancache = NULL;
tomd->ocean = BKE_ocean_add(); tomd->ocean = BKE_ocean_add();

View File

@@ -136,7 +136,9 @@ static void copyData(ModifierData *md, ModifierData *target)
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target; SurfaceDeformModifierData *tsmd = (SurfaceDeformModifierData *)target;
*tsmd = *smd; freeData(target);
modifier_copyData_generic(md, target);
if (smd->verts) { if (smd->verts) {
tsmd->verts = MEM_dupallocN(smd->verts); tsmd->verts = MEM_dupallocN(smd->verts);

View File

@@ -45,6 +45,7 @@
#include "BKE_camera.h" #include "BKE_camera.h"
#include "BKE_library.h"
#include "BKE_library_query.h" #include "BKE_library_query.h"
#include "BKE_material.h" #include "BKE_material.h"
#include "BKE_mesh.h" #include "BKE_mesh.h"
@@ -70,9 +71,12 @@ static void copyData(ModifierData *md, ModifierData *target)
{ {
#if 0 #if 0
UVProjectModifierData *umd = (UVProjectModifierData *) md; UVProjectModifierData *umd = (UVProjectModifierData *) md;
UVProjectModifierData *tumd = (UVProjectModifierData *) target;
#endif #endif
UVProjectModifierData *tumd = (UVProjectModifierData *) target;
modifier_copyData_generic(md, target); modifier_copyData_generic(md, target);
id_us_plus((ID *)tumd->image);
} }
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))

View File

@@ -468,12 +468,13 @@ if(WITH_ALEMBIC)
--testdir "${TEST_SRC_DIR}/alembic" --testdir "${TEST_SRC_DIR}/alembic"
--alembic-root "${ALEMBIC_ROOT_DIR}" --alembic-root "${ALEMBIC_ROOT_DIR}"
) )
add_test(NAME script_alembic_import add_test(NAME script_alembic_import
COMMAND COMMAND
"$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS} "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
-- --
--testdir "${TEST_SRC_DIR}/alembic" --testdir "${TEST_SRC_DIR}/alembic"
--with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
) )
else() else()
@@ -487,6 +488,7 @@ if(WITH_ALEMBIC)
--python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
-- --
--testdir "${TEST_SRC_DIR}/alembic" --testdir "${TEST_SRC_DIR}/alembic"
--with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
) )
endif() endif()

View File

@@ -157,6 +157,8 @@ class AbstractAlembicTest(unittest.TestCase):
if proptype == 'CompoundProperty': if proptype == 'CompoundProperty':
# To read those, call self.abcprop() on it. # To read those, call self.abcprop() on it.
continue continue
if len(parts) < 2:
raise ValueError('Error parsing result from abcprop: %s', info.strip())
valtype_and_arrsize, name_and_extent = parts[1:] valtype_and_arrsize, name_and_extent = parts[1:]
# Parse name and extent # Parse name and extent

View File

@@ -129,6 +129,9 @@ class SimpleImportTest(AbstractAlembicTest):
bpy.data.cache_files[fname].filepath = relpath.replace('1.abc', '2.abc') bpy.data.cache_files[fname].filepath = relpath.replace('1.abc', '2.abc')
bpy.context.scene.update() bpy.context.scene.update()
if args.with_legacy_depsgraph:
bpy.context.scene.frame_set(10)
x, y, z = cube.matrix_world.to_euler('XYZ') x, y, z = cube.matrix_world.to_euler('XYZ')
self.assertAlmostEqual(x, math.pi / 2, places=5) self.assertAlmostEqual(x, math.pi / 2, places=5)
self.assertAlmostEqual(y, 0) self.assertAlmostEqual(y, 0)
@@ -213,6 +216,8 @@ def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--testdir', required=True, type=pathlib.Path) 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) args, remaining = parser.parse_known_args(argv)
unittest.main(argv=remaining) unittest.main(argv=remaining)

View File

@@ -36,6 +36,9 @@ BLACKLIST = {
"cycles", "cycles",
"io_export_dxf", # TODO, check on why this fails "io_export_dxf", # TODO, check on why this fails
'io_import_dxf', # Because of cydxfentity.so dependency '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`. # Some modules need to add to the `sys.path`.
@@ -211,11 +214,10 @@ def load_modules():
[(os.sep + f + ".py") for f in BLACKLIST]) [(os.sep + f + ".py") for f in BLACKLIST])
for f in source_files: for f in source_files:
ok = False
for ignore in ignore_paths: for ignore in ignore_paths:
if ignore in f: if ignore in f:
ok = True break
if not ok: else:
raise Exception("Source file %r not loaded in test" % f) raise Exception("Source file %r not loaded in test" % f)
print("loaded %d modules" % len(loaded_files)) print("loaded %d modules" % len(loaded_files))