def LaunchPreamble(self, arg_parse_result): # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) if arg_parse_result.clearSettings: AppController.clearSettings() # Find the resource directory resourceDir = os.path.dirname(os.path.realpath(__file__)) + "/" # Create the Qt application app = QtWidgets.QApplication(sys.argv) # Apply the style sheet to it sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r') # Qt style sheet accepts only forward slashes as path separators sheetString = sheet.read().replace('RESOURCE_DIR', resourceDir.replace("\\", "/")) app.setStyleSheet(sheetString) appController = AppController(arg_parse_result) return (app, appController)
def __LaunchProcess(self, arg_parse_result): ''' after the arguments have been parsed, launch the UI in a forked process ''' # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) from mainWindow import MainWindow if arg_parse_result.clearSettings: MainWindow.clearSettings() # find the resource directory resourceDir = os.path.dirname(os.path.realpath(__file__)) + "/" # Create the Qt application app = QApplication(sys.argv) # apply the style sheet to it sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r') sheetString = sheet.read().replace('RESOURCE_DIR', resourceDir) app.setStyleSheet(sheetString) mainWindow = MainWindow(None, arg_parse_result) if arg_parse_result.quitAfterStartup: # Before we quit, process events one more time to make sure the # UI is fully populated (and to capture all the timing information # we'd want). app.processEvents() sys.exit(0) app.exec_()
def LaunchPreamble(self, arg_parse_result): # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) if arg_parse_result.clearSettings: AppController.clearSettings() # Create the Qt application app = QtWidgets.QApplication(sys.argv) contextCreator = lambda usdFile: self.GetResolverContext(usdFile) appController = AppController(arg_parse_result, contextCreator) return (app, appController)
def LaunchPreamble(self, arg_parse_result): # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) # XXX Override HdPrman's defaults using the env var. In the # future we expect there may be more formal ways to represent # per-app settings for particular Hydra plugins. os.environ.setdefault('HD_PRMAN_MAX_SAMPLES', '1024') if arg_parse_result.clearSettings: AppController.clearSettings() # Create the Qt application app = QtWidgets.QApplication(sys.argv) contextCreator = lambda usdFile: self.GetResolverContext(usdFile) appController = AppController(arg_parse_result, contextCreator) return (app, appController)
if args.variantFallbacks: variantFallbacks = eval(args.variantFallbacks) else: variantFallbacks = {'standin': ['render']} payloadRegex = re.compile(args.payloads) hadError = False errorFile = None if args.errorFileName: errorFile = file(args.errorFileName, "w") if args.dumpMaps and args.dumpPathStr == '': print '--dumpMaps must be used in tandem with --dumpPath' sys.exit(0) dumpPath = Sdf.Path(args.dumpPathStr) if args.dumpPathStr else Sdf.Path() Work.SetMaximumConcurrencyLimit() def PrintErrorMessage(errorFile, msg): if errorFile: print >> errorFile, msg else: print >> sys.stderr, msg def PrintErrors(errorFile, errors): global hadError hadError = True for err in errors: PrintErrorMessage(errorFile, str(err)) PrintErrorMessage(errorFile, '')
from pxr import Usd, Work Work.SetConcurrencyLimitArgument(1) stage = Usd.Stage.OpenMasked('scene.usda', Usd.StagePopulationMask(['/Scene/asset1/mesh_0'])) print "OpenMasked successful"