diff --git a/src/Mod/Draft/draftobjects/pointarray.py b/src/Mod/Draft/draftobjects/pointarray.py index e64436aaf3..3505aa2bfc 100644 --- a/src/Mod/Draft/draftobjects/pointarray.py +++ b/src/Mod/Draft/draftobjects/pointarray.py @@ -60,18 +60,17 @@ class PointArray(DraftObject): QT_TRANSLATE_NOOP("App::Property", _tip)) obj.Base = None - # TODO: this isn't a list, it should be renamed to PointObject - if "PointList" not in properties: + if "PointObject" not in properties: _tip = ("Object containing points used to distribute " "the base object, for example, a sketch or " "a Part compound.\n" "The sketch or compound must contain at least " "one explicit point or vertex object.") obj.addProperty("App::PropertyLink", - "PointList", + "PointObject", "Objects", QT_TRANSLATE_NOOP("App::Property", _tip)) - obj.PointList = None + obj.PointObject = None if "Count" not in properties: _tip = ("Total number of elements in the array.\n" @@ -101,7 +100,7 @@ class PointArray(DraftObject): obj.Count = 0 return - pt_list, count = get_point_list(obj.PointList) + pt_list, count = get_point_list(obj.PointObject) shape = build_copies(obj.Base, pt_list, obj.ExtraPlacement) obj.Shape = shape @@ -110,7 +109,7 @@ class PointArray(DraftObject): def onDocumentRestored(self, obj): """Execute code when the document is restored. - Add properties that don't exist. + Add properties that don't exist and migrate old properties. """ # If the ExtraPlacement property has never been added before # it will add it first, and set it to the base object's position @@ -130,6 +129,19 @@ class PointArray(DraftObject): _wrn("v0.19, " + obj.Label + ", " + _tr(_info)) self.set_properties(obj) + self.migrate_properties_0v19(obj) + + def migrate_properties_0v19(self, obj): + """Migrate properties.""" + # If the old name still exists, migrate it to the new + # name and delete the old property + properties = obj.PropertiesList + + if "PointList" in properties: + obj.PointObject = obj.PointList + obj.removeProperty("PointList") + _info = "'PointList' property will be migrated to 'PointObject'" + _wrn("v0.19, " + obj.Label + ", " + _tr(_info)) def get_point_list(point_object): diff --git a/src/Mod/Draft/drafttests/draft_test_objects.py b/src/Mod/Draft/drafttests/draft_test_objects.py index a41c3d2308..3ed38f3c7b 100644 --- a/src/Mod/Draft/drafttests/draft_test_objects.py +++ b/src/Mod/Draft/drafttests/draft_test_objects.py @@ -476,7 +476,7 @@ def _create_objects(doc=None, _msg(16 * "-") _msg("Path array") poly_h = Draft.make_polygon(3, 250) - poly_h.Placement.Base = Vector(10500, 3000, 0) + poly_h.Placement.Base = Vector(10000, 3000, 0) if App.GuiUp: poly_h.ViewObject.Visibility = False @@ -494,7 +494,7 @@ def _create_objects(doc=None, _msg(16 * "-") _msg("Path link array") poly_h_2 = Draft.make_polygon(4, 200) - poly_h_2.Placement.Base = Vector(10500, 5000, 0) + poly_h_2.Placement.Base = Vector(10000, 5000, 0) if App.GuiUp: poly_h_2.ViewObject.Visibility = False @@ -512,6 +512,7 @@ def _create_objects(doc=None, _msg(16 * "-") _msg("Point array") poly_h = Draft.make_polygon(3, 250) + poly_h.Placement.Base = Vector(12500, 2500, 0) point_1 = Draft.make_point(13000, 3000, 0) point_2 = Draft.make_point(13000, 3500, 0)