Skip to content

Commit

Permalink
Default constraint names use the str() function. (#265)
Browse files Browse the repository at this point in the history
In the case of the diameter constraint, it will return either "Radius" or "Diameter"
depending on the setting.

If you edit the name of the Diameter constarint, it replaces the default naming.
  • Loading branch information
amrsoll committed Aug 23, 2022
1 parent 4c953d9 commit a0d2a32
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions class_defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2179,11 +2179,9 @@ def set_origin_props(e):


class GenericConstraint:

def _name_getter(self):
name = self.get("name")
if not name:
return type(self).__name__
return name
return self.get("name", str(self))

def _name_setter(self, new_name):
self["name"] = new_name
Expand Down Expand Up @@ -2827,7 +2825,10 @@ def use_radius_setter(self, setting):
# Avoid triggering the property's update callback
self["value"] = distance

label = "Diameter"
@property
def label(self):
return "Radius" if self.setting else "Diameter"

value: FloatProperty(
name="Size",
subtype="DISTANCE",
Expand Down

0 comments on commit a0d2a32

Please sign in to comment.