Fix example python scripts to work in the UI as well

* In the UI program we can't import renderdoc (it's already imported) so we just
  alias it to rd.
This commit is contained in:
baldurk
2018-08-29 12:58:23 +01:00
parent 94fcff1616
commit 416646d027
6 changed files with 48 additions and 6 deletions
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
# We'll need the struct data to read out of bytes objects
import struct
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
def loadCapture(filename):
# Open a capture file handle
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
draws = {}
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
def printVar(v, indent = ''):
print(indent + v.name + ":")
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
# Define a recursive function for iterating over draws
def iterDraw(d, indent = ''):
@@ -1,4 +1,11 @@
import renderdoc as rd
import sys
# Import renderdoc if not already imported (e.g. in the UI)
if 'renderdoc' not in sys.modules and '_renderdoc' not in sys.modules:
import renderdoc
# Alias renderdoc for legibility
rd = renderdoc
# Recursively search for the drawcall with the most vertices
def biggestDraw(prevBiggest, d):