Arch: Small optimizations in OfflineRenderingUtils module

This commit is contained in:
Yorik van Havre
2020-07-15 16:27:51 +02:00
parent 79e8562f9b
commit f5c57ed30d

View File

@@ -365,8 +365,8 @@ def render(outputfile,scene=None,camera=None,zoom=False,width=400,height=300,bac
# create a default camera if none was given
camera = coin.SoPerspectiveCamera()
cameraRotation = coin.SbRotation.identity()
cameraRotation *= coin.SbRotation(coin.SbVec3f(1,0,0),-0.4)
cameraRotation *= coin.SbRotation(coin.SbVec3f(0,1,0), 0.4)
cameraRotation *= coin.SbRotation(coin.SbVec3f(1,0,0),1.0)
cameraRotation *= coin.SbRotation(coin.SbVec3f(0,0,1),0.4)
camera.orientation = cameraRotation
# make sure all objects get in the view later
zoom = True
@@ -409,7 +409,7 @@ def buildScene(objects,colors=None):
root = coin.SoSeparator()
for o in objects:
buf = None
if hasattr(o,'Shape'):
if hasattr(o,'Shape') and o.Shape and (not o.Shape.isNull()):
# writeInventor of shapes needs tessellation values
buf = o.Shape.writeInventor(2,0.01)
elif o.isDerivedFrom("Mesh::Feature"):
@@ -444,7 +444,7 @@ def getCamera(filepath):
guidata = getGuiData(filepath)
if "GuiCameraSettings" in guidata:
return guidata["GuiCameraSettings"].strip()
print("no camera found in file")
print("No camera found in file")
return None