From 00bafcf3fcbb841127bbd508c73213ed5e150c27 Mon Sep 17 00:00:00 2001 From: Roberto Dolfini Date: Thu, 22 Oct 2026 17:31:30 +0200 Subject: [PATCH 1/3] Keep BL_ parameters the user built formulas on Re-baking a family removed every BL_ parameter that no longer arrived or had changed type. When one was used in another parameter's formula, RemoveParameter did not throw: Revit silently emptied that formula (checked live in Revit 2025). Such a parameter is now kept as it is, and a BL_ parameter with a formula of its own is no longer written over. The bake note says which ones were left alone, and the project types only get the values actually written in the family. IsDeterminedByFormula reads false on a parameter with a formula, so the formula text is checked instead. Co-Authored-By: Claude Opus 5.5 --- src/Bilocus.Revit/Bake/BakeParameter.cs | 25 +++++++++ src/Bilocus.Revit/Bake/FamilyBaker.cs | 13 +++-- src/Bilocus.Revit/Bake/FamilyParameters.cs | 51 +++++++++++++++++-- .../BakeParameterTests.cs | 16 ++++++ 4 files changed, 98 insertions(+), 7 deletions(-) diff --git a/src/Bilocus.Revit/Bake/BakeParameter.cs b/src/Bilocus.Revit/Bake/BakeParameter.cs index 1f46d17..1277655 100644 --- a/src/Bilocus.Revit/Bake/BakeParameter.cs +++ b/src/Bilocus.Revit/Bake/BakeParameter.cs @@ -58,5 +58,30 @@ public static BakeParameter Create(string name, string kind, double value) } return new BakeParameter(name, kind, value); } + + // Whether a family parameter formula refers to the parameter named + // name. Whole names only: BL_ names are letters after the prefix, so + // a letter, digit or underscore next to a match means a longer name. + public static bool IsUsedIn(string name, string formula) + { + if (string.IsNullOrEmpty(formula)) { return false; } + int at = formula.IndexOf(name, StringComparison.Ordinal); + while (at >= 0) + { + int end = at + name.Length; + if ((at == 0 || !IsNameChar(formula[at - 1])) + && (end == formula.Length || !IsNameChar(formula[end]))) + { + return true; + } + at = formula.IndexOf(name, at + 1, StringComparison.Ordinal); + } + return false; + } + + private static bool IsNameChar(char c) + { + return char.IsLetterOrDigit(c) || c == '_'; + } } } diff --git a/src/Bilocus.Revit/Bake/FamilyBaker.cs b/src/Bilocus.Revit/Bake/FamilyBaker.cs index 7258cfa..09adde9 100644 --- a/src/Bilocus.Revit/Bake/FamilyBaker.cs +++ b/src/Bilocus.Revit/Bake/FamilyBaker.cs @@ -715,7 +715,8 @@ private ObjectWrite CreateFamily( // The host's BL_ parameters: with Bake together the // members are often LODs, their values do not add up. - FamilyParameters.Apply(familyDoc, host.Parameters, familyName); + // A fresh family has no formulas: nothing is left out. + FamilyParameters.Apply(familyDoc, host.Parameters, familyName, out _); return null; }); if (refusal != null) { return ObjectWrite.Refused(refusal); } @@ -826,6 +827,8 @@ private ObjectWrite UpdateFamily(BakeMeshRequest host, List built, Family loaded; int removedMembers = 0; + List written = new List(); + string paramsNote = null; try { string refusal = InTransaction(familyDoc, FamilyTransactionName, () => @@ -855,7 +858,7 @@ private ObjectWrite UpdateFamily(BakeMeshRequest host, List built, removedMembers = RemoveOtherMembers(familyDoc, requested); // Added, updated, and the stale BL_ ones removed. - FamilyParameters.Apply(familyDoc, host.Parameters, familyName); + written = FamilyParameters.Apply(familyDoc, host.Parameters, familyName, out paramsNote); // For a family the category is changed in place: it // is always replaced, never recreated (contract). @@ -890,7 +893,7 @@ private ObjectWrite UpdateFamily(BakeMeshRequest host, List built, { // The reload above keeps the project's type values on // purpose: the BL_ ones are written here, and only them. - FamilyParameters.WriteToTypes(_project, target, host.Parameters); + FamilyParameters.WriteToTypes(_project, target, written); List instances = MarkedInstancesOf(target.Id, host.ObjectId); @@ -930,7 +933,9 @@ private ObjectWrite UpdateFamily(BakeMeshRequest host, List built, + " reloaded, but instance not updated: " + instanceRefusal); } - return ObjectWrite.Done(false, switched, notMoved, renameNote, target.Name, removedMembers); + string note = paramsNote == null ? renameNote + : (renameNote == null ? "" : renameNote + "; ") + "family " + target.Name + ": " + paramsNote; + return ObjectWrite.Done(false, switched, notMoved, note, target.Name, removedMembers); } // The bridge's FreeFormElements marked with an obj_id that is not diff --git a/src/Bilocus.Revit/Bake/FamilyParameters.cs b/src/Bilocus.Revit/Bake/FamilyParameters.cs index dbc6978..d494e52 100644 --- a/src/Bilocus.Revit/Bake/FamilyParameters.cs +++ b/src/Bilocus.Revit/Bake/FamilyParameters.cs @@ -13,8 +13,17 @@ namespace Bilocus.Revit.Bake // missing data (an override cleared, a mesh that opened). public static class FamilyParameters { - // Inside an open transaction on the family document. - public static void Apply(Document familyDoc, IList parameters, string typeName) + // Inside an open transaction on the family document. Returns the + // parameters actually written; note says which BL_ ones were left + // alone, or is null. + // + // The user may build on a BL_ parameter in the family editor. One + // used in another parameter's formula is never removed or re-typed: + // RemoveParameter does not throw, it silently empties that formula + // (Revit 2025, checked live). One with a formula of its own is the + // user's choice and is not overwritten. + public static List Apply(Document familyDoc, IList parameters, + string typeName, out string note) { FamilyManager manager = familyDoc.FamilyManager; EnsureCurrentType(manager, typeName); @@ -27,6 +36,8 @@ public static void Apply(Document familyDoc, IList parameters, st List existing = new List(); foreach (FamilyParameter fp in manager.Parameters) { existing.Add(fp); } + List left = new List(); + HashSet keptAsIs = new HashSet(); foreach (FamilyParameter fp in existing) { string name = fp.Definition.Name; @@ -38,26 +49,60 @@ public static void Apply(Document familyDoc, IList parameters, st if (!wanted.TryGetValue(name, out p) || fp.IsInstance || fp.Definition.GetDataType() != SpecOf(p.Kind)) { + string user = FormulaUsing(existing, fp); + if (user != null) + { + keptAsIs.Add(name); + left.Add(name + " kept, used in the formula of " + user); + continue; + } manager.RemoveParameter(fp); } } + List written = new List(); foreach (BakeParameter p in parameters) { + if (keptAsIs.Contains(p.Name)) { continue; } FamilyParameter fp = manager.get_Parameter(p.Name); if (fp == null) { fp = manager.AddParameter(p.Name, GroupTypeId.Geometry, SpecOf(p.Kind), false); } + else if (!string.IsNullOrEmpty(fp.Formula)) + { + // IsDeterminedByFormula reads false here (Revit 2025, + // checked live), and Set would be accepted and ignored: + // the formula text is what tells. + left.Add(p.Name + " not written, it has a formula"); + continue; + } manager.Set(fp, ToInternal(p)); + written.Add(p); + } + + note = left.Count == 0 ? null : string.Join(", ", left); + return written; + } + + // The name of another parameter whose formula uses fp, or null. + private static string FormulaUsing(IList all, FamilyParameter fp) + { + string name = fp.Definition.Name; + foreach (FamilyParameter other in all) + { + if (other.Id == fp.Id) { continue; } + if (BakeParameter.IsUsedIn(name, other.Formula)) { return other.Definition.Name; } } + return null; } // Inside an open transaction on the project. The re-bake reloads // with overwriteParameterValues false, so the user's own values on // the project types stay: the BL_ values are written here, and only // those, on every type of the family (they describe the geometry, - // which is the same for all of them). + // which is the same for all of them). Pass what Apply wrote: a BL_ + // left alone in the family must be left alone here too. public static void WriteToTypes(Document project, Family family, IList parameters) { foreach (ElementId id in family.GetFamilySymbolIds()) diff --git a/tests/Bilocus.Revit.Net.Tests/BakeParameterTests.cs b/tests/Bilocus.Revit.Net.Tests/BakeParameterTests.cs index 84ae519..e2e00f4 100644 --- a/tests/Bilocus.Revit.Net.Tests/BakeParameterTests.cs +++ b/tests/Bilocus.Revit.Net.Tests/BakeParameterTests.cs @@ -37,5 +37,21 @@ public void Create_AcceptsZero() { Assert.Equal(0.0, BakeParameter.Create("BL_Thickness", "length", 0.0).Value); } + + [Theory] + [InlineData("BL_Length * 2", true)] + [InlineData("if(BL_Length > 1 m, 1, 0)", true)] + [InlineData("BL_Width+BL_Length", true)] + [InlineData("(BL_Length)", true)] + [InlineData("BL_LengthTotal / 2", false)] + [InlineData("MyBL_Length * 2", false)] + [InlineData("BL_Length2 * 2", false)] + [InlineData("bl_length * 2", false)] + [InlineData("", false)] + [InlineData(null, false)] + public void IsUsedIn_MatchesWholeNamesOnly(string formula, bool expected) + { + Assert.Equal(expected, BakeParameter.IsUsedIn("BL_Length", formula)); + } } } From 79fd3bd74c68512bcd1069ba1c2a2c54ca571fd0 Mon Sep 17 00:00:00 2001 From: Roberto Dolfini Date: Thu, 22 Oct 2026 17:35:36 +0200 Subject: [PATCH 2/3] Flag BL_ values set by hand once the object changes A value set by hand from the selection is frozen: after a reshape, or on a Shift+D copy edited afterwards, it kept describing a shape that was gone, with nothing to say so. The object's dimensions are now recorded with each value; when they change the panel shows the value with a warning and the family bake message names the object. The value is still sent: setting it again or clearing it is the user's call. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++- src/blender_addon/bridge_bake_send.py | 34 ++++++++++++++- src/blender_addon/bridge_params.py | 12 ++++++ src/blender_addon/panel.py | 14 +++++-- tests/blender/smoke_bake.py | 59 +++++++++++++++++++++++++++ tests/python/test_bridge_params.py | 22 ++++++++++ 6 files changed, 141 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8547041..749cf8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,11 @@ meshes only) as type parameters, plus `BL_Thickness` when set. Values come from the object's extent and can be set by hand from an edge or face selection in the panel, except the volume. Informative only: they do not - drive the geometry and are rewritten at every bake. + drive the geometry and are rewritten at every bake. A value set by hand + is flagged in the panel, and in the bake message, once the object's + dimensions change: it is still sent until you set it again or clear it. + A `BL_` parameter you use in a formula in the family editor is kept even + when it is no longer sent, and one you give a formula is not overwritten. ## 0.2.0 - 2026-10-10 diff --git a/src/blender_addon/bridge_bake_send.py b/src/blender_addon/bridge_bake_send.py index dcd8b33..ee05787 100644 --- a/src/blender_addon/bridge_bake_send.py +++ b/src/blender_addon/bridge_bake_send.py @@ -454,6 +454,11 @@ def bake_selected(context=None, target="directshape", together=False): notes.append("NOT sent: {}".format("; ".join(failed[:3]))) if warned: notes.append("heavy: {}".format("; ".join(warned[:3]))) + if family: + changed = [obj.name for obj, _obj_id in announced if changed_overrides(obj)] + if changed: + notes.append("BL_ values set by hand before the object changed: {}".format( + "; ".join(changed[:3]))) if sent == 0: # bake_end went out anyway: Revit will reply with ok false and all @@ -475,8 +480,35 @@ def bake_selected(context=None, target="directshape", together=False): # Object custom properties holding the BL_ values set by hand, in meters # and square meters: bilocus_param_length, ... Frozen: not recomputed when -# the mesh changes. +# the mesh changes. Next to each, bilocus_param_length_dims holds the +# object's dimensions when it was set, so a value left behind by a reshape +# can be flagged. Shift+D copies both: the copy starts with the same shape, +# so its values are right until it is edited, like the original's. OVERRIDE_PREFIX = "bilocus_param_" +DIMS_SUFFIX = "_dims" + + +def set_override(obj, key, value): + obj[OVERRIDE_PREFIX + key] = value + obj[OVERRIDE_PREFIX + key + DIMS_SUFFIX] = list(obj.dimensions) + + +def clear_override(obj, key): + for name in (OVERRIDE_PREFIX + key, OVERRIDE_PREFIX + key + DIMS_SUFFIX): + if name in obj: + del obj[name] + + +def changed_overrides(obj): + """The keys of the values set by hand while the object had other + dimensions than now.""" + result = [] + for key in overrides_of(obj): + recorded = obj.get(OVERRIDE_PREFIX + key + DIMS_SUFFIX) + recorded = None if recorded is None else tuple(recorded) + if params_logic.changed_since(tuple(obj.dimensions), recorded): + result.append(key) + return result def measure(obj, depsgraph): diff --git a/src/blender_addon/bridge_params.py b/src/blender_addon/bridge_params.py index 6dbf711..1e270e0 100644 --- a/src/blender_addon/bridge_params.py +++ b/src/blender_addon/bridge_params.py @@ -69,3 +69,15 @@ def build_params(dimensions, area, volume, overrides): raise BridgeFramingError("{}: {} is not a valid measure".format(name, value)) result.append({"name": name, "kind": kind, "value": round(value, 6)}) return result + + +def changed_since(dimensions, recorded): + """True if the object's dimensions are no longer those recorded when a + value was set by hand: the value may describe a shape that is gone. + recorded None, or malformed, means a value set before the dimensions + were recorded: unknown, so not flagged. The tolerance absorbs the + float32 noise of obj.dimensions, about 0.1 mm per meter.""" + if recorded is None or len(recorded) != 3: + return False + return any(not math.isclose(float(now), float(then), rel_tol=1e-4, abs_tol=1e-6) + for now, then in zip(dimensions, recorded)) diff --git a/src/blender_addon/panel.py b/src/blender_addon/panel.py index 00cd44b..40deb8f 100644 --- a/src/blender_addon/panel.py +++ b/src/blender_addon/panel.py @@ -124,7 +124,7 @@ def execute(self, context): if problem is not None: self.report({'ERROR'}, problem) return {'CANCELLED'} - obj[bake.OVERRIDE_PREFIX + self.key] = value + bake.set_override(obj, self.key, value) self.report({'INFO'}, "{}: {:.4f}".format(self.key, value)) return {'FINISHED'} @@ -138,8 +138,8 @@ class BILOCUS_OT_clear_bake_param(bpy.types.Operator): def execute(self, context): obj = context.active_object - if obj is not None and (bake.OVERRIDE_PREFIX + self.key) in obj: - del obj[bake.OVERRIDE_PREFIX + self.key] + if obj is not None: + bake.clear_override(obj, self.key) return {'FINISHED'} @@ -496,10 +496,12 @@ def _draw_family_params(layout, target): box = layout.box() box.label(text="Family parameters (informative)") overrides = bake.overrides_of(target) + changed = bake.changed_overrides(target) # area None and volume None: shown as computed at bake, not as missing for key, name, _kind, value, source in params_logic.rows( tuple(target.dimensions), None, None, overrides): row = box.row(align=True) + icon = 'NONE' if source == "none" and key in ("area", "volume"): text = "{}: computed at bake".format(name) if key == "volume": @@ -509,7 +511,11 @@ def _draw_family_params(layout, target): else: unit = "m2" if key == "area" else "m" text = "{}: {:.3f} {} ({})".format(name, value, unit, source) - row.label(text=text) + if key in changed: + # still sent: the user decides, with the picker or the X + text = "{}: {:.3f} {} (set, object changed)".format(name, value, unit) + icon = 'ERROR' + row.label(text=text, icon=icon) if key in params_logic.OVERRIDABLE: op = row.operator("bilocus.set_bake_param", text="", icon='EYEDROPPER') op.key = key diff --git a/tests/blender/smoke_bake.py b/tests/blender/smoke_bake.py index bf45a84..a3db91b 100644 --- a/tests/blender/smoke_bake.py +++ b/tests/blender/smoke_bake.py @@ -888,6 +888,64 @@ def test_family(server, collection, sample, cube, addon_module): bpy.data.meshes.remove(data) +def test_manual_values(collection): + say("--- 4. BL_ values set by hand") + import bmesh + verts = [(x, y, z) for z in (0.0, 0.5) for y in (0.0, 1.0) for x in (0.0, 2.0)] + faces = [(0, 1, 3, 2), (4, 6, 7, 5), (0, 4, 5, 1), (2, 3, 7, 6), (0, 2, 6, 4), (1, 5, 7, 3)] + box = new_mesh_object("BakeM_box", verts, [], faces, collection, (0.0, 40.0, 0.0)) + select_only([box], active=box) + + # Reshaped and measured without leaving Edit Mode: the dimensions + # recorded must be the new ones, or leaving would raise a false flag + bpy.ops.object.mode_set(mode='EDIT') + bm = bmesh.from_edit_mesh(box.data) + for vert in bm.verts: + vert.select = False + if vert.co.x > 1.0: + vert.co.x = 3.0 + for edge in bm.edges: + edge.select = False + long_edge = next(e for e in bm.edges + if {tuple(v.co) for v in e.verts} == {(0.0, 0.0, 0.0), (3.0, 0.0, 0.0)}) + long_edge.select = True + bmesh.update_edit_mesh(box.data) + bpy.context.view_layer.update() + result = bpy.ops.bilocus.set_bake_param(key="length") + bpy.ops.object.mode_set(mode='OBJECT') + bpy.context.view_layer.update() + check(result == {'FINISHED'} and abs(bake_send.overrides_of(box)["length"] - 3.0) < 1e-6, + "length set from the selected edge: {}".format(bake_send.overrides_of(box))) + check(bake_send.changed_overrides(box) == [], + "no flag after leaving Edit Mode (dimensions {})".format(tuple(box.dimensions))) + + copy = box.copy() + copy.data = box.data.copy() + collection.objects.link(copy) + bpy.context.view_layer.update() + check(bake_send.overrides_of(copy) == bake_send.overrides_of(box) + and bake_send.changed_overrides(copy) == [], + "a Shift+D copy keeps the value and is not flagged: same shape") + + copy.scale.x = 1.5 + bpy.context.view_layer.update() + check(bake_send.changed_overrides(copy) == ["length"] and bake_send.changed_overrides(box) == [], + "the reshaped copy is flagged, the original is not") + select_only([copy], active=copy) + labels = [line[2] for line in draw_panel() if line[1] == "label"] + check("BL_Length: 3.000 m (set, object changed) [ERROR]" in labels, + "panel: flagged value with the warning icon") + + bpy.ops.bilocus.clear_bake_param(key="length") + check(not any(name.startswith(bake_send.OVERRIDE_PREFIX) for name in copy.keys()), + "the X removes the value and its recorded dimensions") + + for obj in (copy, box): + data = obj.data + bpy.data.objects.remove(obj) + bpy.data.meshes.remove(data) + + def main(): say("Blender {} - modules from {}".format(bpy.app.version_string, SRC)) scene = bpy.context.scene @@ -897,6 +955,7 @@ def main(): say("addon {} from {}".format("installed" if installed else "from src", os.path.dirname(os.path.abspath(module.__file__)))) test_end_to_end(scene, collection, sample, module) + test_manual_values(collection) disable_addon(module, installed) diff --git a/tests/python/test_bridge_params.py b/tests/python/test_bridge_params.py index db122b3..5e00bd1 100644 --- a/tests/python/test_bridge_params.py +++ b/tests/python/test_bridge_params.py @@ -71,3 +71,25 @@ def test_rows_say_where_each_value_comes_from(): def test_invalid_values_are_rejected(bad): with pytest.raises(BridgeFramingError): bridge_params.build_params((1, 2, 3), 1.0, None, {"length": bad}) + + +# --- a value set by hand on an object that changed since ------------------- + +def test_changed_since_false_on_the_same_dimensions(): + assert not bridge_params.changed_since((2.0, 1.0, 0.5), (2.0, 1.0, 0.5)) + + +def test_changed_since_ignores_float_noise(): + # obj.dimensions is float32 inside Blender: a re-read can wobble + assert not bridge_params.changed_since((2.0000001, 1.0, 0.5), (2.0, 1.0, 0.5)) + + +def test_changed_since_true_when_one_side_changes(): + assert bridge_params.changed_since((2.0, 1.2, 0.5), (2.0, 1.0, 0.5)) + assert bridge_params.changed_since((2.001, 1.0, 0.5), (2.0, 1.0, 0.5)) + + +def test_changed_since_false_without_a_record(): + # values set before the dimensions were recorded: unknown, not flagged + assert not bridge_params.changed_since((2.0, 1.0, 0.5), None) + assert not bridge_params.changed_since((2.0, 1.0, 0.5), (2.0, 1.0)) From ac9e8d67e373b12bfd6fa2ab36eb4c73b850a8b0 Mon Sep 17 00:00:00 2001 From: Roberto Dolfini Date: Thu, 22 Oct 2026 17:42:14 +0200 Subject: [PATCH 3/3] Record BL_ dimensions from the evaluated mesh On Blender 4.2 and 4.5 obj.dimensions is not updated in Edit Mode after a reshape, so a value measured there recorded the old dimensions and was flagged as soon as the user left Edit Mode (caught by CI). The recorded dimensions are now computed from the evaluated mesh, and nothing is flagged while in Edit Mode. Co-Authored-By: Claude Opus 5.5 --- src/blender_addon/bridge_bake_send.py | 28 ++++++++++++++++++++++++--- src/blender_addon/panel.py | 2 +- tests/blender/smoke_bake.py | 4 ++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/blender_addon/bridge_bake_send.py b/src/blender_addon/bridge_bake_send.py index ee05787..ac775ac 100644 --- a/src/blender_addon/bridge_bake_send.py +++ b/src/blender_addon/bridge_bake_send.py @@ -488,9 +488,28 @@ def bake_selected(context=None, target="directshape", together=False): DIMS_SUFFIX = "_dims" -def set_override(obj, key, value): +def set_override(obj, key, value, depsgraph): obj[OVERRIDE_PREFIX + key] = value - obj[OVERRIDE_PREFIX + key + DIMS_SUFFIX] = list(obj.dimensions) + obj[OVERRIDE_PREFIX + key + DIMS_SUFFIX] = list(evaluated_dimensions(obj, depsgraph)) + + +def evaluated_dimensions(obj, depsgraph): + """What obj.dimensions reads in Object Mode, computed from the evaluated + mesh. Values are set by hand in Edit Mode, where Blender 4.2 and 4.5 + do not update obj.dimensions after a reshape (5.x does): recording it + there flagged the value as soon as the user left Edit Mode.""" + evaluated = obj.evaluated_get(depsgraph) + mesh_data = evaluated.to_mesh() + try: + count = len(mesh_data.vertices) + if count == 0: + return tuple(obj.dimensions) + co = [0.0] * (3 * count) + mesh_data.vertices.foreach_get("co", co) + finally: + evaluated.to_mesh_clear() + scale = obj.matrix_world.to_scale() + return tuple((max(co[axis::3]) - min(co[axis::3])) * abs(scale[axis]) for axis in range(3)) def clear_override(obj, key): @@ -501,7 +520,10 @@ def clear_override(obj, key): def changed_overrides(obj): """The keys of the values set by hand while the object had other - dimensions than now.""" + dimensions than now. None in Edit Mode: obj.dimensions is not kept up + to date there on Blender 4.x, the flag shows on leaving it.""" + if obj.mode == 'EDIT': + return [] result = [] for key in overrides_of(obj): recorded = obj.get(OVERRIDE_PREFIX + key + DIMS_SUFFIX) diff --git a/src/blender_addon/panel.py b/src/blender_addon/panel.py index 40deb8f..974a39a 100644 --- a/src/blender_addon/panel.py +++ b/src/blender_addon/panel.py @@ -124,7 +124,7 @@ def execute(self, context): if problem is not None: self.report({'ERROR'}, problem) return {'CANCELLED'} - bake.set_override(obj, self.key, value) + bake.set_override(obj, self.key, value, context.evaluated_depsgraph_get()) self.report({'INFO'}, "{}: {:.4f}".format(self.key, value)) return {'FINISHED'} diff --git a/tests/blender/smoke_bake.py b/tests/blender/smoke_bake.py index a3db91b..f1bb0cd 100644 --- a/tests/blender/smoke_bake.py +++ b/tests/blender/smoke_bake.py @@ -912,6 +912,10 @@ def test_manual_values(collection): bmesh.update_edit_mesh(box.data) bpy.context.view_layer.update() result = bpy.ops.bilocus.set_bake_param(key="length") + recorded = tuple(box[bake_send.OVERRIDE_PREFIX + "length" + bake_send.DIMS_SUFFIX]) + check(all(abs(a - b) < 1e-6 for a, b in zip(recorded, (3.0, 1.0, 0.5))), + "dimensions recorded in Edit Mode are the reshaped ones: {}".format(recorded)) + check(bake_send.changed_overrides(box) == [], "no flag while still in Edit Mode") bpy.ops.object.mode_set(mode='OBJECT') bpy.context.view_layer.update() check(result == {'FINISHED'} and abs(bake_send.overrides_of(box)["length"] - 3.0) < 1e-6,