Arch: Make sure the BaseMaterial property contains a Material object

This commit is contained in:
Yorik van Havre 2016-12-29 20:42:30 -02:00
parent 421cb85865
commit 2e380cd581
5 changed files with 10 additions and 1 deletions

View File

@ -346,7 +346,12 @@ class Component:
self.Type = state self.Type = state
def onChanged(self,obj,prop): def onChanged(self,obj,prop):
pass if prop == "BaseMaterial":
if hasattr(obj,"BaseMaterial"):
if obj.BaseMaterial:
if Draft.getType(obj.BaseMaterial) != "Material":
obj.BaseMaterial = None
print "Removing bad BaseMaterial link in ",obj.Name
def clone(self,obj): def clone(self,obj):
"if this object is a clone, sets the shape. Returns True if this is the case" "if this object is a clone, sets the shape. Returns True if this is the case"

View File

@ -261,6 +261,7 @@ class _Equipment(ArchComponent.Component):
def onChanged(self,obj,prop): def onChanged(self,obj,prop):
self.hideSubobjects(obj,prop) self.hideSubobjects(obj,prop)
ArchComponent.Component.onChanged(self,obj.prop)
def execute(self,obj): def execute(self,obj):

View File

@ -290,6 +290,7 @@ class _Space(ArchComponent.Component):
obj.EquipmentPower = p obj.EquipmentPower = p
if hasattr(obj,"Area"): if hasattr(obj,"Area"):
obj.setEditorMode('Area',1) obj.setEditorMode('Area',1)
ArchComponent.Component.onChanged(self,obj.prop)
def addSubobjects(self,obj,subobjects): def addSubobjects(self,obj,subobjects):
"adds subobjects to this space" "adds subobjects to this space"

View File

@ -577,6 +577,7 @@ class _Structure(ArchComponent.Component):
if nodes: if nodes:
self.nodes = [v.Point.add(offset) for v in nodes.Vertexes] self.nodes = [v.Point.add(offset) for v in nodes.Vertexes]
obj.Nodes = self.nodes obj.Nodes = self.nodes
ArchComponent.Component.onChanged(self,obj.prop)
def getNodeEdges(self,obj): def getNodeEdges(self,obj):
"returns a list of edges from stuctural nodes" "returns a list of edges from stuctural nodes"

View File

@ -688,6 +688,7 @@ class _Window(ArchComponent.Component):
# because of load order, but it doesn't harm... # because of load order, but it doesn't harm...
pass pass
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()
ArchComponent.Component.onChanged(self,obj.prop)
def execute(self,obj): def execute(self,obj):