make Syncables base class handle selection filtering and dispatching sync to sub Features
This commit is contained in:
parent
613f959781
commit
cfc3370ad8
1 changed files with 28 additions and 3 deletions
|
@ -6,13 +6,38 @@ class Syncable:
|
|||
def IsActive(self):
|
||||
sel = Gui.Selection.getSelection()
|
||||
|
||||
print(len(sel))
|
||||
if len(sel) == 0: return False
|
||||
|
||||
print(sel, self.SYNCABLES)
|
||||
|
||||
for obj in sel:
|
||||
if obj.Type not in self.SYNCABLES:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def Activated(self):
|
||||
selection = [ sel for sel in Gui.Selection.getSelection() if sel.Type in self.SYNCABLES ]
|
||||
syncables = []
|
||||
|
||||
if len(selection) == 1:
|
||||
syncables = selection
|
||||
else:
|
||||
syncables = []
|
||||
|
||||
for i in selection:
|
||||
for j in selection:
|
||||
print(selection)
|
||||
if i == j: continue
|
||||
|
||||
if i in j.OutList:
|
||||
break
|
||||
else:
|
||||
syncables.append(i)
|
||||
|
||||
for s in syncables:
|
||||
if not hasattr(s, 'Proxy'): continue
|
||||
|
||||
feature = s.Proxy
|
||||
if hasattr(feature, self.method):
|
||||
getattr(feature, self.method)()
|
||||
|
||||
s.recompute()
|
||||
|
|
Loading…
Add table
Reference in a new issue