Ejemplo n.º 1
0
    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)

        contextCreator = lambda usdFile: self.GetResolverContext(usdFile)
        appController = AppController(arg_parse_result, contextCreator)

        return (app, appController)
Ejemplo n.º 2
0
    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)

        contextCreator = lambda usdFile: self.GetResolverContext(usdFile)
        appController = AppController(arg_parse_result, contextCreator)

        return (app, appController)
Ejemplo n.º 3
0
    def RegisterOptions(self, parser):
        '''
        register optional arguments on the ArgParser
        '''
        from pxr import UsdUtils

        parser.add_argument('--renderer',
                            action='store',
                            type=str,
                            dest='renderer',
                            choices=AppController.GetRendererOptionChoices(),
                            help="Which render backend to use (named as it "
                            "appears in the menu).  Use '%s' to "
                            "turn off Hydra renderers." %
                            AppController.HYDRA_DISABLED_OPTION_STRING,
                            default='')

        parser.add_argument('--select',
                            action='store',
                            default='/',
                            dest='primPath',
                            type=str,
                            help='A prim path to initially select and frame')

        UsdAppUtils.cameraArgs.AddCmdlineArgs(
            parser,
            altHelpText=(
                "Which camera to set the view to on open - may be given as "
                "either just the camera's prim name (ie, just the last "
                "element in the prim path), or as a full prim path.  Note "
                "that if only the prim name is used, and more than one camera "
                "exists with the name, which is used will be effectively "
                "random (default=%(default)s)"))

        parser.add_argument('--mask',
                            action='store',
                            dest='populationMask',
                            metavar='PRIMPATH[,PRIMPATH...]',
                            help='Limit stage population to these prims, '
                            'their descendants and ancestors.  To specify '
                            'multiple paths, either use commas with no spaces '
                            'or quote the argument and separate paths by '
                            'commas and/or spaces.')

        parser.add_argument('--clearsettings',
                            action='store_true',
                            dest='clearSettings',
                            help='Restores usdview settings to default')

        parser.add_argument('--defaultsettings',
                            action='store_true',
                            dest='defaultSettings',
                            help='Launch usdview with default settings')

        parser.add_argument('--norender',
                            action='store_true',
                            dest='noRender',
                            help='Display only hierarchy browser')

        parser.add_argument('--noplugins',
                            action='store_true',
                            dest='noPlugins',
                            help='Do not load plugins')

        parser.add_argument('--unloaded',
                            action='store_true',
                            dest='unloaded',
                            help='Do not load payloads')

        parser.add_argument(
            '--timing',
            action='store_true',
            dest='timing',
            help=
            'Echo timing stats to console. NOTE: timings will be unreliable when the --mallocTagStats option is also in use'
        )

        parser.add_argument(
            '--traceToFile',
            action='store',
            type=str,
            dest='traceToFile',
            default=None,
            help=
            'Start tracing at application startup and write chrome-compatible output to the specified trace file when the application quits'
        )

        parser.add_argument(
            '--memstats',
            action='store',
            default='none',
            dest='mallocTagStats',
            type=str,
            choices=['none', 'stage', 'stageAndImaging'],
            help=
            'Use the Pxr MallocTags memory accounting system to profile USD, saving results to a tmp file, with a summary to the console.  Will have no effect if MallocTags are not supported in the USD installation.'
        )

        parser.add_argument('--numThreads',
                            action='store',
                            type=int,
                            default=0,
                            help='Number of threads used for processing'
                            '(0 is max, negative numbers imply max - N)')

        parser.add_argument('--ff',
                            action='store',
                            dest='firstframe',
                            type=int,
                            help='Set the first frame of the viewer')

        parser.add_argument('--lf',
                            action='store',
                            dest='lastframe',
                            type=int,
                            help='Set the last frame of the viewer')

        parser.add_argument('--cf',
                            action='store',
                            dest='currentframe',
                            type=int,
                            help='Set the current frame of the viewer')

        UsdAppUtils.complexityArgs.AddCmdlineArgs(
            parser,
            altHelpText=(
                'Set the initial mesh refinement complexity (%(default)s).'))

        parser.add_argument('--quitAfterStartup',
                            action='store_true',
                            dest='quitAfterStartup',
                            help='quit immediately after start up')

        parser.add_argument('--sessionLayer',
                            default=None,
                            type=str,
                            help="If specified, the stage will be opened "
                            "with the 'sessionLayer' in place of the default "
                            "anonymous layer. As this changes the session "
                            "layer from anonymous to persistent, be "
                            "aware that layers saved from Export Overrides "
                            "will include the opinions in the persistent "
                            "session layer.")
Ejemplo n.º 4
0
    def RegisterOptions(self, parser):
        '''
        register optional arguments on the ArgParser
        '''
        parser.add_argument('--renderer',
                            action='store',
                            type=str,
                            dest='renderer',
                            choices=AppController.GetRendererOptionChoices(),
                            help="Which render backend to use (named as it "
                            "appears in the menu).  Use '%s' to "
                            "turn off Hydra renderers." %
                            AppController.HYDRA_DISABLED_OPTION_STRING,
                            default='')

        parser.add_argument('--select',
                            action='store',
                            default='/',
                            dest='primPath',
                            type=str,
                            help='A prim path to initially select and frame')

        parser.add_argument(
            '--camera',
            action='store',
            default="main_cam",
            type=str,
            help="Which camera to set the view to on "
            "open - may be given as either just the camera's "
            "prim name (ie, just the last element in the prim "
            "path), or as a full prim path.  Note that if only "
            "the prim name is used, and more than one camera "
            "exists with the name, which is used will be "
            "effectively random")

        parser.add_argument('--mask',
                            action='store',
                            dest='populationMask',
                            metavar='PRIMPATH[,PRIMPATH...]',
                            help='Limit stage population to these prims, '
                            'their descendants and ancestors.  To specify '
                            'multiple paths, either use commas with no spaces '
                            'or quote the argument and separate paths by '
                            'commas and/or spaces.')

        parser.add_argument('--clearsettings',
                            action='store_true',
                            dest='clearSettings',
                            help='Restores usdview settings to default')

        parser.add_argument('--defaultsettings',
                            action='store_true',
                            dest='defaultSettings',
                            help='Launch usdview with default settings')

        parser.add_argument('--norender',
                            action='store_true',
                            dest='noRender',
                            help='Display only hierarchy browser')

        parser.add_argument('--noplugins',
                            action='store_true',
                            dest='noPlugins',
                            help='Do not load plugins')

        parser.add_argument('--unloaded',
                            action='store_true',
                            dest='unloaded',
                            help='Do not load payloads')

        parser.add_argument(
            '--timing',
            action='store_true',
            dest='timing',
            help=
            'echo timing stats to console. NOTE: timings will be unreliable when the --mallocTagStats option is also in use'
        )

        parser.add_argument(
            '--memstats',
            action='store',
            default='none',
            dest='mallocTagStats',
            type=str,
            choices=['none', 'stage', 'stageAndImaging'],
            help=
            'Use the Pxr MallocTags memory accounting system to profile USD, saving results to a tmp file, with a summary to the console.  Will have no effect if MallocTags are not supported in the USD installation.'
        )

        parser.add_argument('--numThreads',
                            action='store',
                            type=int,
                            default=0,
                            help='Number of threads used for processing'
                            '(0 is max, negative numbers imply max - N)')

        parser.add_argument('--ff',
                            action='store',
                            dest='firstframe',
                            type=int)

        parser.add_argument('--lf', action='store', dest='lastframe', type=int)

        parser.add_argument('--complexity',
                            action='store',
                            type=str,
                            default="low",
                            dest='complexity',
                            choices=[c.id for c in Complexities.ordered()],
                            help='Set the initial mesh refinement complexity '
                            '(%(default)s).')

        parser.add_argument('--quitAfterStartup',
                            action='store_true',
                            dest='quitAfterStartup',
                            help='quit immediately after start up')