Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/alembic/intern/abc_mesh.cc3
-rw-r--r--source/blender/blenkernel/intern/colortools.c82
-rw-r--r--source/blender/blenkernel/intern/customdata.c7
-rw-r--r--source/blender/blenkernel/intern/object_update.c12
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c18
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenloader/intern/versioning_280.c3
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc25
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h1
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc38
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h1
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_taa.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c3
-rw-r--r--source/blender/editors/object/object_transform.c4
-rw-r--r--source/blender/editors/screen/workspace_edit.c64
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c15
-rw-r--r--source/blender/editors/transform/transform_ops.c13
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c1
-rw-r--r--source/blender/gpu/intern/gpu_element.c2
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c9
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c10
-rw-r--r--source/blender/windowmanager/WM_api.h5
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c44
25 files changed, 229 insertions, 149 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index de227be0044..7f7afe0ce5e 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -973,8 +973,7 @@ static void *add_customdata_cb(void *user_data, const char *name, int data_type)
return cd_ptr;
}
- /* create a new layer, taking care to construct the hopefully-soon-to-be-removed
- * CD_MTEXPOLY layer too, with the same name. */
+ /* Create a new layer. */
numloops = mesh->totloop;
cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, NULL, numloops, name);
return cd_ptr;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 45cb5e817d2..863d6351738 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -628,8 +628,6 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
{
CurveMapPoint *cmp = cuma->curve;
BezTriple *bezt;
- float *fp, *allpoints, *lastpoint, curf, range;
- int a, totpoint;
if (cuma->curve == NULL) {
return;
@@ -642,7 +640,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
/* hrmf... we now rely on blender ipo beziers, these are more advanced */
bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr");
- for (a = 0; a < cuma->totpoint; a++) {
+ for (int a = 0; a < cuma->totpoint; a++) {
cuma->mintable = min_ff(cuma->mintable, cmp[a].x);
cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x);
bezt[a].vec[1][0] = cmp[a].x;
@@ -659,7 +657,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
}
const BezTriple *bezt_prev = NULL;
- for (a = 0; a < cuma->totpoint; a++) {
+ for (int a = 0; a < cuma->totpoint; a++) {
const BezTriple *bezt_next = (a != cuma->totpoint - 1) ? &bezt[a + 1] : NULL;
calchandle_curvemap(&bezt[a], bezt_prev, bezt_next);
bezt_prev = &bezt[a];
@@ -687,7 +685,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
sub_v3_v3v3(bezt[0].vec[0], bezt[0].vec[1], vec);
}
}
- a = cuma->totpoint - 1;
+ int a = cuma->totpoint - 1;
if (bezt[a].h2 == HD_AUTO) {
hlen = len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */
@@ -710,23 +708,25 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
if (cuma->table) {
MEM_freeN(cuma->table);
}
- totpoint = (cuma->totpoint - 1) * CM_RESOL;
- fp = allpoints = MEM_callocN(totpoint * 2 * sizeof(float), "table");
- for (a = 0; a < cuma->totpoint - 1; a++, fp += 2 * CM_RESOL) {
+ int totpoint = (cuma->totpoint - 1) * CM_RESOL;
+ float *allpoints = MEM_callocN(totpoint * 2 * sizeof(float), "table");
+ float *point = allpoints;
+
+ for (int a = 0; a < cuma->totpoint - 1; a++, point += 2 * CM_RESOL) {
correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a + 1].vec[0], bezt[a + 1].vec[1]);
BKE_curve_forward_diff_bezier(bezt[a].vec[1][0],
bezt[a].vec[2][0],
bezt[a + 1].vec[0][0],
bezt[a + 1].vec[1][0],
- fp,
+ point,
CM_RESOL - 1,
2 * sizeof(float));
BKE_curve_forward_diff_bezier(bezt[a].vec[1][1],
bezt[a].vec[2][1],
bezt[a + 1].vec[0][1],
bezt[a + 1].vec[1][1],
- fp + 1,
+ point + 1,
CM_RESOL - 1,
2 * sizeof(float));
}
@@ -734,49 +734,63 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
/* store first and last handle for extrapolation, unit length */
cuma->ext_in[0] = bezt[0].vec[0][0] - bezt[0].vec[1][0];
cuma->ext_in[1] = bezt[0].vec[0][1] - bezt[0].vec[1][1];
- range = sqrtf(cuma->ext_in[0] * cuma->ext_in[0] + cuma->ext_in[1] * cuma->ext_in[1]);
- cuma->ext_in[0] /= range;
- cuma->ext_in[1] /= range;
-
- a = cuma->totpoint - 1;
- cuma->ext_out[0] = bezt[a].vec[1][0] - bezt[a].vec[2][0];
- cuma->ext_out[1] = bezt[a].vec[1][1] - bezt[a].vec[2][1];
- range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]);
- cuma->ext_out[0] /= range;
- cuma->ext_out[1] /= range;
+ float ext_in_range = sqrtf(cuma->ext_in[0] * cuma->ext_in[0] +
+ cuma->ext_in[1] * cuma->ext_in[1]);
+ cuma->ext_in[0] /= ext_in_range;
+ cuma->ext_in[1] /= ext_in_range;
+
+ int out_a = cuma->totpoint - 1;
+ cuma->ext_out[0] = bezt[out_a].vec[1][0] - bezt[out_a].vec[2][0];
+ cuma->ext_out[1] = bezt[out_a].vec[1][1] - bezt[out_a].vec[2][1];
+ float ext_out_range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] +
+ cuma->ext_out[1] * cuma->ext_out[1]);
+ cuma->ext_out[0] /= ext_out_range;
+ cuma->ext_out[1] /= ext_out_range;
/* cleanup */
MEM_freeN(bezt);
- range = CM_TABLEDIV * (cuma->maxtable - cuma->mintable);
+ float range = CM_TABLEDIV * (cuma->maxtable - cuma->mintable);
cuma->range = 1.0f / range;
/* now make a table with CM_TABLE equal x distances */
- fp = allpoints;
- lastpoint = allpoints + 2 * (totpoint - 1);
+ float *firstpoint = allpoints;
+ float *lastpoint = allpoints + 2 * (totpoint - 1);
+ point = allpoints;
+
cmp = MEM_callocN((CM_TABLE + 1) * sizeof(CurveMapPoint), "dist table");
- for (a = 0; a <= CM_TABLE; a++) {
- curf = cuma->mintable + range * (float)a;
- cmp[a].x = curf;
+ for (int a = 0; a <= CM_TABLE; a++) {
+ float cur_x = cuma->mintable + range * (float)a;
+ cmp[a].x = cur_x;
- /* get the first x coordinate larger than curf */
- while (curf >= fp[0] && fp != lastpoint) {
- fp += 2;
+ /* Get the first point with x coordinate larger than cur_x. */
+ while (cur_x >= point[0] && point != lastpoint) {
+ point += 2;
}
- if (fp == allpoints || (curf >= fp[0] && fp == lastpoint)) {
- cmp[a].y = curvemap_calc_extend(cuma, curf, allpoints, lastpoint);
+
+ /* Check if we are on or outside the start or end point. */
+ if (point == firstpoint || (point == lastpoint && cur_x >= point[0])) {
+ if (compare_ff(cur_x, point[0], 1e-6f)) {
+ /* When on the point exactly, use the value directly to avoid precision
+ * issues with extrapolation of extreme slopes. */
+ cmp[a].y = point[1];
+ }
+ else {
+ /* Extrapolate values that lie outside the start and end point. */
+ cmp[a].y = curvemap_calc_extend(cuma, cur_x, firstpoint, lastpoint);
+ }
}
else {
- float fac1 = fp[0] - fp[-2];
- float fac2 = fp[0] - curf;
+ float fac1 = point[0] - point[-2];
+ float fac2 = point[0] - cur_x;
if (fac1 > FLT_EPSILON) {
fac1 = fac2 / fac1;
}
else {
fac1 = 0.0f;
}
- cmp[a].y = fac1 * fp[-1] + (1.0f - fac1) * fp[1];
+ cmp[a].y = fac1 * point[-1] + (1.0f - fac1) * point[1];
}
}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 76098db5fd1..1fb29745dba 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -26,6 +26,9 @@
#include "MEM_guardedalloc.h"
+/* Since we have versioning code here (CustomData_verify_versions()). */
+#define DNA_DEPRECATED_ALLOW
+
#include "DNA_customdata_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_ID.h"
@@ -4191,8 +4194,8 @@ bool CustomData_verify_versions(struct CustomData *data, int index)
* Better to be safe here, and fix issue on the fly rather than crash... */
/* 0 structnum is used in writing code to tag layer types that should not be written. */
else if (typeInfo->structnum == 0 &&
- /* XXX Not sure why those two are exception, maybe that should be fixed? */
- !ELEM(layer->type, CD_PAINT_MASK, CD_FACEMAP)) {
+ /* XXX Not sure why those three are exception, maybe that should be fixed? */
+ !ELEM(layer->type, CD_PAINT_MASK, CD_FACEMAP, CD_MTEXPOLY)) {
keeplayer = false;
CLOG_WARN(&LOG, ".blend file read: removing a data layer that should not have been written");
}
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 2bb06c86120..202eadaa35a 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -31,6 +31,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BLI_threads.h"
#include "BLI_math.h"
#include "BKE_animsys.h"
@@ -396,7 +397,16 @@ void BKE_object_data_select_update(Depsgraph *depsgraph, ID *object_data)
void BKE_object_select_update(Depsgraph *depsgraph, Object *object)
{
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
- BKE_object_data_select_update(depsgraph, object->data);
+ if (object->type == OB_MESH && !object->runtime.is_mesh_eval_owned) {
+ Mesh *mesh_input = object->runtime.mesh_orig;
+ Mesh_Runtime *mesh_runtime = &mesh_input->runtime;
+ BLI_mutex_lock(mesh_runtime->eval_mutex);
+ BKE_object_data_select_update(depsgraph, object->data);
+ BLI_mutex_unlock(mesh_runtime->eval_mutex);
+ }
+ else {
+ BKE_object_data_select_update(depsgraph, object->data);
+ }
}
void BKE_object_eval_eval_base_flags(Depsgraph *depsgraph,
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index 96030b7361d..27d85b91ba4 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -233,7 +233,6 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
/* lets intersect the faces */
for (i = 0; i < totface; i++, mface++) {
ParticleData *pa1 = NULL, *pa2 = NULL;
- bool isect1 = false, isect2 = false;
copy_v3_v3(v1, mvert[mface->v1].co);
copy_v3_v3(v2, mvert[mface->v2].co);
@@ -243,7 +242,6 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
co1, &isect_precalc, v1, v2, v3, &lambda, NULL);
if (intersects_tri) {
pa1 = (pa + (int)(lambda * size[a]) * a0mul);
- isect1 = true;
}
if (mface->v4 && (!intersects_tri || from == PART_FROM_VOLUME)) {
@@ -251,28 +249,24 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
if (isect_ray_tri_watertight_v3(co1, &isect_precalc, v1, v3, v4, &lambda, NULL)) {
pa2 = (pa + (int)(lambda * size[a]) * a0mul);
- isect2 = true;
}
}
- if (pa1 == pa2) {
- isect1 |= isect2;
- }
- else if (isect2) {
+ if (pa1) {
if (from == PART_FROM_FACE) {
- pa2->flag &= ~PARS_UNEXIST;
+ pa1->flag &= ~PARS_UNEXIST;
}
else { /* store number of intersections */
- pa2->hair_index++;
+ pa1->hair_index++;
}
}
- if (isect1) {
+ if (pa2 && pa2 != pa1) {
if (from == PART_FROM_FACE) {
- pa1->flag &= ~PARS_UNEXIST;
+ pa2->flag &= ~PARS_UNEXIST;
}
else { /* store number of intersections */
- pa1->hair_index++;
+ pa2->hair_index++;
}
}
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 971ca77ff3d..f2e0ee0c7fa 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -5203,6 +5203,8 @@ void BKE_sequencer_offset_animdata(Scene *scene, Sequence *seq, int ofs)
}
}
}
+
+ DEG_id_tag_update(&scene->adt->action->id, ID_RECALC_ANIMATION);
}
void BKE_sequencer_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 3b70d6582cc..19e14da39cb 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1180,12 +1180,11 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* MTexPoly now removed. */
if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
- const int cd_mtexpoly = 15; /* CD_MTEXPOLY, deprecated */
for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
/* If we have UV's, so this file will have MTexPoly layers too! */
if (me->mloopuv != NULL) {
CustomData_update_typemap(&me->pdata);
- CustomData_free_layers(&me->pdata, cd_mtexpoly, me->totpoly);
+ CustomData_free_layers(&me->pdata, CD_MTEXPOLY, me->totpoly);
BKE_mesh_update_customdata_pointers(me, false);
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 9b02f231be4..46a1ea17041 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -697,6 +697,12 @@ void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visi
break;
}
}
+ /* Materials. */
+ Material ***materials_ptr = give_matarar(object);
+ if (materials_ptr != NULL) {
+ short *num_materials_ptr = give_totcolp(object);
+ build_materials(*materials_ptr, *num_materials_ptr);
+ }
}
void DepsgraphNodeBuilder::build_object_data_camera(Object *object)
@@ -1195,14 +1201,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool is_ob
function_bind(BKE_object_eval_uber_data, _1, scene_cow, object_cow));
op_node->set_as_exit();
/* Materials. */
- if (object->totcol != 0) {
- for (int a = 1; a <= object->totcol; a++) {
- Material *ma = give_current_material(object, a);
- if (ma != NULL) {
- build_material(ma);
- }
- }
- }
+ build_materials(object->mat, object->totcol);
/* Point caches. */
build_object_pointcache(object);
/* Geometry. */
@@ -1434,6 +1433,16 @@ void DepsgraphNodeBuilder::build_material(Material *material)
build_nodetree(material->nodetree);
}
+void DepsgraphNodeBuilder::build_materials(Material **materials, int num_materials)
+{
+ for (int i = 0; i < num_materials; ++i) {
+ if (materials[i] == NULL) {
+ continue;
+ }
+ build_material(materials[i]);
+ }
+}
+
/* Recursively build graph for texture */
void DepsgraphNodeBuilder::build_texture(Tex *texture)
{
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 9983b346355..de9f0e4d6cd 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -202,6 +202,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
void build_light(Light *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
+ void build_materials(Material **materials, int num_materials);
void build_texture(Tex *tex);
void build_image(Image *image);
void build_world(World *world);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 8f85640bb4d..d2f06136b7e 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -200,6 +200,11 @@ static OperationCode bone_target_opcode(ID *target,
return OperationCode::BONE_DONE;
}
+static bool object_have_geometry_component(const Object *object)
+{
+ return ELEM(object->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL, OB_LATTICE, OB_GPENCIL);
+}
+
/* **** General purpose functions **** */
DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain,
@@ -746,6 +751,12 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
add_relation(key_key, geometry_key, "Shapekeys");
build_nested_shapekey(&object->id, key);
}
+ /* Materials. */
+ Material ***materials_ptr = give_matarar(object);
+ if (materials_ptr != NULL) {
+ short *num_materials_ptr = give_totcolp(object);
+ build_materials(*materials_ptr, *num_materials_ptr);
+ }
}
void DepsgraphRelationBuilder::build_object_data_camera(Object *object)
@@ -1929,14 +1940,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
}
}
/* Materials. */
- if (object->totcol) {
- for (int a = 1; a <= object->totcol; a++) {
- Material *ma = give_current_material(object, a);
- if (ma != NULL) {
- build_material(ma);
- }
- }
- }
+ build_materials(object->mat, object->totcol);
/* Geometry collision. */
if (ELEM(object->type, OB_MESH, OB_CURVE, OB_LATTICE)) {
// add geometry collider relations
@@ -1998,6 +2002,8 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
OperationKey object_select_key(
&object->id, NodeType::BATCH_CACHE, OperationCode::GEOMETRY_SELECT_UPDATE);
add_relation(object_data_select_key, object_select_key, "Data Selection -> Object Selection");
+ add_relation(
+ geom_key, object_select_key, "Object Geometry -> Select Update", RELATION_FLAG_NO_FLUSH);
}
void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata)
@@ -2155,9 +2161,11 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
else if (id_type == ID_OB) {
build_object(NULL, (Object *)id);
ComponentKey object_transform_key(id, NodeType::TRANSFORM);
- ComponentKey object_geometry_key(id, NodeType::GEOMETRY);
add_relation(object_transform_key, shading_key, "Object Transform -> Node");
- add_relation(object_geometry_key, shading_key, "Object Geometry -> Node");
+ if (object_have_geometry_component(reinterpret_cast<Object *>(id))) {
+ ComponentKey object_geometry_key(id, NodeType::GEOMETRY);
+ add_relation(object_geometry_key, shading_key, "Object Geometry -> Node");
+ }
}
else if (id_type == ID_SCE) {
Scene *node_scene = (Scene *)id;
@@ -2227,6 +2235,16 @@ void DepsgraphRelationBuilder::build_material(Material *material)
}
}
+void DepsgraphRelationBuilder::build_materials(Material **materials, int num_materials)
+{
+ for (int i = 0; i < num_materials; ++i) {
+ if (materials[i] == NULL) {
+ continue;
+ }
+ build_material(materials[i]);
+ }
+}
+
/* Recursively build graph for texture */
void DepsgraphRelationBuilder::build_texture(Tex *texture)
{
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 257cae7d127..0e15818622f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -264,6 +264,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
void build_light(Light *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
+ void build_materials(Material **materials, int num_materials);
void build_texture(Tex *tex);
void build_image(Image *image);
void build_gpencil(bGPdata *gpd);
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c
index 88f1f30941a..9fba28a3845 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_taa.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -284,9 +284,7 @@ void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata)
GPU_framebuffer_blit(dfbl->color_only_fb, 0, fbl->effect_taa_fb, 0, GPU_COLOR_BIT);
- if (!DRW_state_is_image_render()) {
- DRW_view_set_active(NULL);
- }
+ DRW_view_set_active(NULL);
if (effect_info->jitter_index != 0 && !DRW_state_is_image_render()) {
DRW_viewport_request_redraw();
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index f98a3248e76..6f0319223e0 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -534,6 +534,9 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
EDBM_update_generic(em, true, true);
+
+ DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
MEM_freeN(objects);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 394fea2cf27..2425b5dd2f7 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -475,6 +475,10 @@ static void ignore_parent_tx(Main *bmain, Depsgraph *depsgraph, Scene *scene, Ob
invert_m4_m4(ob_child->parentinv, workob.obmat);
/* Copy result of BKE_object_apply_mat4(). */
BKE_object_transform_copy(ob_child, ob_child_eval);
+ /* Tag for update.
+ * This is because parent matrix did change, so in theory the child object might now be
+ * evaluated to a different location in another editing context. */
+ DEG_id_tag_update(&ob_child->id, ID_RECALC_TRANSFORM);
}
}
}
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index f4138dd7847..61b737589c8 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -331,30 +331,6 @@ static void WORKSPACE_OT_delete(wmOperatorType *ot)
ot->exec = workspace_delete_exec;
}
-static bool workspace_append_activate_poll(bContext *C)
-{
- wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false);
- return WM_operator_poll(C, ot);
-}
-
-static int workspace_append(bContext *C, const char *directory, const char *idname)
-{
- wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false);
- PointerRNA opptr;
- int retval;
-
- WM_operator_properties_create_ptr(&opptr, ot);
- RNA_string_set(&opptr, "directory", directory);
- RNA_string_set(&opptr, "filename", idname);
- RNA_boolean_set(&opptr, "autoselect", false);
-
- retval = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &opptr);
-
- WM_operator_properties_free(&opptr);
-
- return retval;
-}
-
static int workspace_append_activate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -367,23 +343,20 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "idname", idname);
RNA_string_get(op->ptr, "filepath", filepath);
- if (workspace_append(C, filepath, idname) != OPERATOR_CANCELLED) {
- WorkSpace *appended_workspace = BLI_findstring(
- &bmain->workspaces, idname, offsetof(ID, name) + 2);
- BLI_assert(appended_workspace != NULL);
+ WorkSpace *appended_workspace = (WorkSpace *)WM_file_append_datablock(
+ C, filepath, ID_WS, idname);
- if (appended_workspace) {
- /* Set defaults. */
- BLO_update_defaults_workspace(appended_workspace, NULL);
+ if (appended_workspace) {
+ /* Set defaults. */
+ BLO_update_defaults_workspace(appended_workspace, NULL);
- /* Reorder to last position. */
- BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
+ /* Reorder to last position. */
+ BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
- /* Changing workspace changes context. Do delayed! */
- WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
+ /* Changing workspace changes context. Do delayed! */
+ WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
- return OPERATOR_FINISHED;
- }
+ return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
@@ -398,7 +371,6 @@ static void WORKSPACE_OT_append_activate(wmOperatorType *ot)
/* api callbacks */
ot->exec = workspace_append_activate_exec;
- ot->poll = workspace_append_activate_poll;
RNA_def_string(ot->srna,
"idname",
@@ -449,25 +421,21 @@ static void workspace_append_button(uiLayout *layout,
{
const ID *id = (ID *)workspace;
PointerRNA opptr;
- char lib_path[FILE_MAX_LIBEXTRA];
const char *filepath = from_main->name;
if (strlen(filepath) == 0) {
filepath = BLO_EMBEDDED_STARTUP_BLEND;
}
- BLI_path_join(lib_path, sizeof(lib_path), filepath, BKE_idcode_to_name(GS(id->name)), NULL);
-
BLI_assert(STREQ(ot_append->idname, "WORKSPACE_OT_append_activate"));
uiItemFullO_ptr(
layout, ot_append, workspace->id.name + 2, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_string_set(&opptr, "idname", id->name + 2);
- RNA_string_set(&opptr, "filepath", lib_path);
+ RNA_string_set(&opptr, "filepath", filepath);
}
-static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
+static void workspace_add_menu(bContext *UNUSED(C), uiLayout *layout, void *template_v)
{
- Main *bmain = CTX_data_main(C);
const char *app_template = template_v;
bool has_startup_items = false;
@@ -479,10 +447,6 @@ static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
for (WorkSpace *workspace = startup_config->workspaces.first; workspace;
workspace = workspace->id.next) {
uiLayout *row = uiLayoutRow(layout, false);
- if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
- uiLayoutSetActive(row, false);
- }
-
workspace_append_button(row, ot_append, workspace, startup_config->main);
has_startup_items = true;
}
@@ -506,10 +470,6 @@ static void workspace_add_menu(bContext *C, uiLayout *layout, void *template_v)
}
uiLayout *row = uiLayoutRow(layout, false);
- if (BLI_findstring(&bmain->workspaces, workspace->id.name, offsetof(ID, name))) {
- uiLayoutSetActive(row, false);
- }
-
workspace_append_button(row, ot_append, workspace, builtin_config->main);
}
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 22900ee3787..7c4f9f1d95b 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -617,6 +617,8 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_SEQ) {
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL);
+ /* Keyframes on strips has been moved, so make sure related editos are informed. */
+ WM_event_add_notifier(C, NC_ANIMATION, NULL);
}
else if (t->spacetype == SPACE_IMAGE) {
if (t->options & CTX_MASK) {
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 1ed0d5e9221..95c2f088e5d 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2935,11 +2935,16 @@ static void VertsToTransData(TransInfo *t,
}
else if (t->mode == TFM_SKIN_RESIZE) {
MVertSkin *vs = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MVERT_SKIN);
- /* skin node size */
- td->ext = tx;
- copy_v3_v3(tx->isize, vs->radius);
- tx->size = vs->radius;
- td->val = vs->radius;
+ if (vs) {
+ /* skin node size */
+ td->ext = tx;
+ copy_v3_v3(tx->isize, vs->radius);
+ tx->size = vs->radius;
+ td->val = vs->radius;
+ }
+ else {
+ td->flag |= TD_SKIP;
+ }
}
else if (t->mode == TFM_SHRINKFATTEN) {
td->ext = tx;
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index f028f2dc506..e038a2bf79e 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -33,6 +33,7 @@
#include "BKE_global.h"
#include "BKE_report.h"
#include "BKE_editmesh.h"
+#include "BKE_layer.h"
#include "BKE_scene.h"
#include "RNA_access.h"
@@ -754,16 +755,6 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
-static bool skin_resize_poll(bContext *C)
-{
- struct Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type == OB_MESH) {
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- return (em && CustomData_has_layer(&em->bm->vdata, CD_MVERT_SKIN));
- }
- return 0;
-}
-
static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
{
/* identifiers */
@@ -777,7 +768,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
- ot->poll = skin_resize_poll;
+ ot->poll = ED_operator_screenactive;
ot->poll_property = transform_poll_property;
RNA_def_float_vector(
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 14cdb674698..a42a6eba3ff 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -2282,7 +2282,6 @@ static void uvedit_unwrap_cube_project(BMesh *bm,
* component, but clusters all together around the center of map. */
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
if (use_select && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
continue;
}
diff --git a/source/blender/gpu/intern/gpu_element.c b/source/blender/gpu/intern/gpu_element.c
index 380de4c4e65..50e7df96503 100644
--- a/source/blender/gpu/intern/gpu_element.c
+++ b/source/blender/gpu/intern/gpu_element.c
@@ -204,7 +204,7 @@ static void squeeze_indices_short(GPUIndexBufBuilder *builder,
* converting in place to avoid extra allocation */
GLushort *data = (GLushort *)builder->data;
- if (max_index > 0xFFFF) {
+ if (max_index >= 0xFFFF) {
elem->base_index = min_index;
for (uint i = 0; i < index_len; ++i) {
data[i] = (values[i] == RESTART_INDEX) ? 0xFFFF : (GLushort)(values[i] - min_index);
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index c38222a3eb3..75a417150c8 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -30,6 +30,8 @@
extern "C" {
#endif
+#include "DNA_defs.h"
+
/** descriptor and storage for a custom data layer */
typedef struct CustomDataLayer {
/** Type of data in layer. */
@@ -107,9 +109,11 @@ typedef enum CustomDataType {
CD_PROP_FLT = 10,
CD_PROP_INT = 11,
CD_PROP_STR = 12,
- CD_ORIGSPACE = 13, /* for modifier stack face location mapping */
- CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */
- /* CD_MTEXPOLY = 15, */ /* deprecated */
+ CD_ORIGSPACE = 13, /* for modifier stack face location mapping */
+ CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */
+#ifdef DNA_DEPRECATED
+ CD_MTEXPOLY = 15, /* deprecated */
+#endif
CD_MLOOPUV = 16,
CD_MLOOPCOL = 17,
CD_TANGENT = 18,
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c75b289e434..56d46b24a58 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1667,6 +1667,13 @@ static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
DEG_relations_tag_update(CTX_data_main(C));
}
+static void rna_Physics_relations_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
+{
+ DEG_relations_tag_update(bmain);
+}
+
static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->id.data;
@@ -7699,7 +7706,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_world");
RNA_def_property_struct_type(prop, "RigidBodyWorld");
RNA_def_property_ui_text(prop, "Rigid Body World", "");
- RNA_def_property_update(prop, NC_SCENE, NULL);
+ RNA_def_property_update(prop, NC_SCENE, "rna_Physics_relations_update");
/* Tool Settings */
prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 79f7e52681b..3c84bb7ae15 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -438,6 +438,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
med_new->v2 = med_orig->v2;
med_new->crease = med_orig->crease;
med_new->flag = med_orig->flag & ~ME_LOOSEEDGE;
+ /* Tag mvert as not loose.
+ * NOTE: ME_VERT_TMP_TAG is given to be cleared by BKE_mesh_new_nomain_from_template. */
+ mvert_new[med_orig->v1].flag |= ME_VERT_TMP_TAG;
+ mvert_new[med_orig->v2].flag |= ME_VERT_TMP_TAG;
}
/* build polygon -> edge map */
@@ -899,6 +903,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
med_new->v1 = varray_stride + j;
med_new->v2 = med_new->v1 - totvert;
med_new->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ if ((mv_new_base->flag & ME_VERT_TMP_TAG) == 0) {
+ med_new->flag |= ME_LOOSEEDGE;
+ }
med_new++;
}
}
@@ -917,6 +924,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
med_new->v1 = i;
med_new->v2 = varray_stride + i;
med_new->flag = ME_EDGEDRAW | ME_EDGERENDER;
+ if ((mvert_new[i].flag & ME_VERT_TMP_TAG) == 0) {
+ med_new->flag |= ME_LOOSEEDGE;
+ }
med_new++;
}
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index d3c1e5f146d..04e3f7e88dc 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -42,6 +42,7 @@ extern "C" {
struct ARegion;
struct GHashIterator;
struct GPUViewport;
+struct ID;
struct IDProperty;
struct ImBuf;
struct ImageFormatData;
@@ -178,6 +179,10 @@ void WM_autosave_init(struct wmWindowManager *wm);
void WM_recover_last_session(struct bContext *C, struct ReportList *reports);
void WM_file_tag_modified(void);
+struct ID *WM_file_append_datablock(struct bContext *C,
+ const char *filepath,
+ const short id_code,
+ const char *id_name);
void WM_lib_reload(struct Library *lib, struct bContext *C, struct ReportList *reports);
/* mouse cursors */
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index 1a46a4550d9..5a6606984ba 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -464,6 +464,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
if (lapp_data->num_items == 0) {
/* Early out in case there is nothing to link. */
wm_link_append_data_free(lapp_data);
+ /* Clear pre existing tag. */
+ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
return OPERATOR_CANCELLED;
}
@@ -616,10 +618,50 @@ void WM_OT_append(wmOperatorType *ot)
"Localize all appended data, including those indirectly linked from other libraries");
}
-/** \name Reload/relocate libraries.
+/** \name Append single datablock and return it.
+ *
+ * Used for appending workspace from startup files.
*
* \{ */
+ID *WM_file_append_datablock(bContext *C,
+ const char *filepath,
+ const short id_code,
+ const char *id_name)
+{
+ Main *bmain = CTX_data_main(C);
+
+ /* Tag everything so we can make local only the new datablock. */
+ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, true);
+
+ /* Define working data, with just the one item we want to append. */
+ WMLinkAppendData *lapp_data = wm_link_append_data_new(0);
+
+ wm_link_append_data_library_add(lapp_data, filepath);
+ WMLinkAppendDataItem *item = wm_link_append_data_item_add(lapp_data, id_name, id_code, NULL);
+ BLI_BITMAP_ENABLE(item->libraries, 0);
+
+ /* Link datablock. */
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ wm_link_do(lapp_data, NULL, bmain, scene, view_layer, v3d);
+
+ /* Get linked datablock and free working data. */
+ ID *id = item->new_id;
+ wm_link_append_data_free(lapp_data);
+
+ /* Make datablock local. */
+ BKE_library_make_local(bmain, NULL, NULL, true, false);
+
+ /* Clear pre existing tag. */
+ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false);
+
+ return id;
+}
+
+/** \} */
+
static int wm_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
Library *lib;