Assembly: Fix limits disappearing on edit (#17289)
This commit is contained in:
@@ -543,13 +543,14 @@ class Joint:
|
||||
|
||||
def setJointType(self, joint, newType):
|
||||
oldType = joint.JointType
|
||||
joint.JointType = newType
|
||||
if newType != oldType:
|
||||
joint.JointType = newType
|
||||
|
||||
# try to replace the joint type in the label.
|
||||
tr_old_type = TranslatedJointTypes[JointTypes.index(oldType)]
|
||||
tr_new_type = TranslatedJointTypes[JointTypes.index(newType)]
|
||||
if tr_old_type in joint.Label:
|
||||
joint.Label = joint.Label.replace(tr_old_type, tr_new_type)
|
||||
# try to replace the joint type in the label.
|
||||
tr_old_type = TranslatedJointTypes[JointTypes.index(oldType)]
|
||||
tr_new_type = TranslatedJointTypes[JointTypes.index(newType)]
|
||||
if tr_old_type in joint.Label:
|
||||
joint.Label = joint.Label.replace(tr_old_type, tr_new_type)
|
||||
|
||||
def onChanged(self, joint, prop):
|
||||
"""Do something when a property has changed"""
|
||||
@@ -1326,6 +1327,7 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
|
||||
|
||||
self.form.jointType.setCurrentIndex(jointTypeIndex)
|
||||
self.jType = JointTypes[self.form.jointType.currentIndex()]
|
||||
self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)
|
||||
|
||||
self.form.distanceSpinbox.valueChanged.connect(self.onDistanceChanged)
|
||||
self.form.distanceSpinbox2.valueChanged.connect(self.onDistance2Changed)
|
||||
@@ -1372,8 +1374,6 @@ class TaskAssemblyCreateJoint(QtCore.QObject):
|
||||
|
||||
self.adaptUi()
|
||||
|
||||
self.form.jointType.currentIndexChanged.connect(self.onJointTypeChanged)
|
||||
|
||||
if self.creating:
|
||||
# This has to be after adaptUi so that properties default values are adapted
|
||||
# if needed. For instance for gears adaptUi will prevent radii from being 0
|
||||
|
||||
Reference in New Issue
Block a user