Path changes

* Relaxed valid base shape requirement, as long as it can return a
  shape using part.getShape()

* Improve ViewProviderPath performance by sharing the same selection
  observer

* Relocate libarea binary installation
This commit is contained in:
Zheng, Lei
2019-07-13 21:34:43 +08:00
committed by wmayer
parent 435815ccc8
commit d93259e238
7 changed files with 97 additions and 65 deletions

View File

@@ -53,31 +53,20 @@ def isValidBaseObject(obj):
# Can't link to anything inside a geo feature group anymore
PathLog.debug("%s is inside a geo feature group" % obj.Label)
return False
if hasattr(obj, 'TypeId') and 'App::Part' == obj.TypeId:
return obj.Group and any(hasattr(o, 'Shape') for o in obj.Group)
if not hasattr(obj, 'Shape'):
PathLog.debug("%s has no shape" % obj.Label)
return False
if obj.TypeId in NotValidBaseTypeIds:
PathLog.debug("%s is blacklisted (%s)" % (obj.Label, obj.TypeId))
return False
if hasattr(obj, 'Sheets') or hasattr(obj, 'TagText'): # Arch.Panels and Arch.PanelCut
PathLog.debug("%s is not an Arch.Panel" % (obj.Label))
return False
return True
import Part
return not Part.getShape(obj).isNull()
def isSolid(obj):
'''isSolid(obj) ... return True if the object is a valid solid.'''
if hasattr(obj, 'Tip'):
return isSolid(obj.Tip)
if hasattr(obj, 'Shape'):
if obj.Shape.Volume > 0.0 and obj.Shape.isClosed():
return True
if hasattr(obj, 'TypeId') and 'App::Part' == obj.TypeId:
if not obj.Group or any(hasattr(o, 'Shape') and not isSolid(o) for o in obj.Group):
return False
return True
return False
import Part
shape = Part.getShape(obj)
return not shape.isNull() and shape.Volume and shape.isClosed()
def toolControllerForOp(op):
'''toolControllerForOp(op) ... return the tool controller used by the op.