Assembly: Simulation: Fix motion double click (#23778)
* Assembly: Simulation: Fix motion double click * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -358,7 +358,7 @@ class Motion:
|
||||
def getAssembly(self, feaPy):
|
||||
simulation = self.getSimulation(feaPy)
|
||||
if simulation is not None:
|
||||
return simulation.getAssembly()
|
||||
return simulation.Proxy.getAssembly(simulation)
|
||||
return None
|
||||
|
||||
|
||||
@@ -370,7 +370,6 @@ class ViewProviderMotion:
|
||||
def attach(self, vpDoc):
|
||||
"""Setup the scene sub-graph of the view provider, this method is mandatory"""
|
||||
self.app_obj = vpDoc.Object
|
||||
self.assembly = self.app_obj.Proxy.getAssembly(self.app_obj)
|
||||
|
||||
self.display_mode = coin.SoType.fromName("SoFCSelection").createInstance()
|
||||
|
||||
@@ -411,22 +410,19 @@ class ViewProviderMotion:
|
||||
return None
|
||||
|
||||
def doubleClicked(self, vpDoc):
|
||||
if self.assembly is None:
|
||||
return False
|
||||
|
||||
if UtilsAssembly.activeAssembly() != self.assembly:
|
||||
Gui.ActiveDocument.setEdit(self.assembly)
|
||||
|
||||
self.openEditDialog()
|
||||
|
||||
def openEditDialog(self):
|
||||
assembly = self.getAssembly()
|
||||
|
||||
if assembly is None:
|
||||
return False
|
||||
|
||||
joint = None
|
||||
if self.app_obj.Joint is not None:
|
||||
joint = self.app_obj.Joint[0]
|
||||
|
||||
dialog = MotionEditDialog(
|
||||
self.assembly, self.app_obj.MotionType, joint, self.app_obj.Formula
|
||||
)
|
||||
dialog = MotionEditDialog(assembly, self.app_obj.MotionType, joint, self.app_obj.Formula)
|
||||
if dialog.exec_():
|
||||
self.app_obj.MotionType = dialog.motionType
|
||||
self.app_obj.Joint = dialog.joint
|
||||
@@ -444,6 +440,17 @@ class ViewProviderMotion:
|
||||
label=self.app_obj.Joint[0].Label, type_=translate("Assembly", typeStr)
|
||||
)
|
||||
|
||||
def getAssembly(self):
|
||||
assembly = self.app_obj.Proxy.getAssembly(self.app_obj)
|
||||
|
||||
if assembly is None:
|
||||
return None
|
||||
|
||||
if UtilsAssembly.activeAssembly() != assembly:
|
||||
Gui.ActiveDocument.setEdit(assembly)
|
||||
|
||||
return assembly
|
||||
|
||||
|
||||
class MotionEditDialog:
|
||||
def __init__(self, assembly, motionType=MotionTypes[0], joint=None, formula="5*time"):
|
||||
|
||||
Reference in New Issue
Block a user