Skip to content

Commit

Permalink
No need to store LOD, just store whether to draw
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 authored and rexissimus committed Oct 1, 2014
1 parent d967ced commit 4037d3d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions vistrails/gui/pipeline_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3433,7 +3433,7 @@ def setContents(self, values):
def boundingRect(self):
return self.bounds

def set_lod(limit, item, lod=None):
def set_lod(limit, item, draw=None):
"""Sets the limit of level of detail used when painting items.
"""
# This function replaces the paint() methods of the given item and its
Expand All @@ -3444,22 +3444,22 @@ def set_lod(limit, item, lod=None):
# scales

paint_orig = item.paint # store reference to original paint method
top_item = lod is None
if lod is None:
lod = [None]
top_item = draw is None
if draw is None:
draw = [True]

# Overrides paint() on that item
def paint_with_lod_check(painter, option, widget):
if top_item:
lod[0] = option.levelOfDetailFromTransform(
painter.worldTransform())
if lod[0] is None or lod[0] > limit:
draw[0] = option.levelOfDetailFromTransform(
painter.worldTransform()) > limit
if draw[0]:
return paint_orig(painter, option, widget)
item.paint = paint_with_lod_check

# Recursively process children
for i in item.childItems():
set_lod(limit, i, lod)
set_lod(limit, i, draw)

class QModuleStatusEvent(QtCore.QEvent):
"""
Expand Down

0 comments on commit 4037d3d

Please sign in to comment.