Skip to content

Commit

Permalink
Arch: Allow OfflineRenderingUtils module to run without pivy
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Nov 1, 2019
1 parent 481870b commit 95f18a7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Mod/Arch/OfflineRenderingUtils.py
Expand Up @@ -111,7 +111,7 @@
import tempfile
import inspect
import binascii
from pivy import coin




Expand Down Expand Up @@ -310,6 +310,8 @@ def render(outputfile,scene=None,camera=None,zoom=False,width=400,height=300,bac
#
# But there are other ways, google of GLX indirect rendering

from pivy import coin

if isinstance(camera,str):
camera = getCoinCamera(camera)

Expand Down Expand Up @@ -363,6 +365,8 @@ def buildScene(objects,colors=None):
objects. Optional colors argument can be a dicionary of objName:ShapeColorTuple
or obj:DiffuseColorList pairs."""

from pivy import coin

root = coin.SoSeparator()
for o in objects:
buf = None
Expand Down Expand Up @@ -409,6 +413,8 @@ def getCoinCamera(camerastring):

"""getCoinCamera(camerastring): Returns a coin camera node from a string"""

from pivy import coin

if camerastring:
inp = coin.SoInput()
inp.setBuffer(camerastring)
Expand All @@ -431,7 +437,9 @@ def viewer(scene=None,background=(1.0,1.0,1.0),lightdir=None):
be turned on. This might not work with some 3D drivers."""

# Initialize Coin. This returns a main window to use
from pivy import coin
from pivy import sogui

win = sogui.SoGui.init()
if win is None:
print("Unable to create a SoGui window")
Expand Down Expand Up @@ -814,6 +822,8 @@ def openiv(filename):

"""openiv(filename): opens an .iv file and returns a coin node from it"""

from pivy import coin

f = open(filename,"r")
buf = f.read()
f.close()
Expand All @@ -828,6 +838,8 @@ def saveiv(scene,filename):

"""saveiv(scene,filename): saves an .iv file with the contents of the given coin node"""

from pivy import coin

wa=coin.SoWriteAction()
wa.getOutput().openFile(filename)
wa.getOutput().setBinary(False)
Expand Down

0 comments on commit 95f18a7

Please sign in to comment.