Example #1
0
    def parameters(ctx):
        params = dict(task={
            'label': 'Parent Entry',
            'required': True,
            'type': types.Entry,
            'help': 'Parent entry of workspace',
        },
                      name={
                          'label': 'Workspace Name',
                          'required': True,
                          'type': types.String,
                          'help': 'Name of workspace'
                      },
                      template={
                          'label': 'Workspace Template Name',
                          'required': True,
                          'type': types.String,
                          'help': 'Name of workspace template'
                      })

        if not ctx:
            return params

        if ctx.task:
            params['task']['default'] = ctx.task
            params['task']['required'] = False

        templates = api.get_templates('workspace')
        if templates:
            params['template']['options'] = list(templates.keys())

        return params
Example #2
0
    def parameters(ctx):
        params = dict(
            project={
                'label': 'Project',
                'help': 'Project Entry',
                'required': True,
                'type': types.Entry,
            },
            name={
                'label': 'Collection Name',
                'required': True,
                'type': types.String,
                'help': 'Name of Collection',
            },
            template={
                'label': 'Collection Template',
                'require': False,
                'type': types.String,
                'help': 'Name of template',
            },
        )

        if not ctx:
            return params

        if ctx.project:
            params['project']['default'] = ctx.project
            params['project']['required'] = False

        templates = list(api.get_templates('collection').keys())
        if templates:
            params['template']['options'] = templates
            params['template']['default'] = templates[0]

        return params
Example #3
0
    def parameters(ctx):
        params = dict(project={
            'label': 'Project',
            'help': 'Project Entry',
            'required': True,
            'type': types.Entry,
        },
                      collection={
                          'label': 'Collection',
                          'help': 'Collection Name',
                          'required': True,
                          'type': types.String
                      },
                      asset_type={
                          'label': 'Asset Type',
                          'required': True,
                          'type': types.String,
                          'help': 'Type of asset',
                      },
                      name={
                          'label': 'Asset Name',
                          'required': True,
                          'type': types.String,
                          'help': 'Name of asset'
                      },
                      template={
                          'label': 'Asset Template',
                          'required': False,
                          'type': types.String,
                          'help': 'Name of asset template'
                      })

        if not ctx:
            return params

        if ctx.project:
            params['project']['default'] = ctx.project
            params['project']['required'] = False

            # TODO: fix search speed upstream...
            # collection_types = [e.name for e in ctx.project.collections]
            # params['collection']['options'] = collection_types

            # asset_types = [e.name for e in ctx.project.asset_types]
            # params['asset_type']['options'] = asset_types

        if ctx.collection:
            params['collection']['default'] = ctx.collection.name
            params['collection']['required'] = False

        if ctx.asset_type:
            params['asset_type']['default'] = ctx.asset_type.name
            params['asset_type']['required'] = False

        templates = list(api.get_templates('asset').keys())
        if templates:
            params['template']['options'] = templates
            params['template']['default'] = sorted(templates)[0]

        return params
Example #4
0
    def parameters(ctx):
        params = dict(
            task={
                'label': 'Parent Entry',
                'required': True,
                'type': types.Entry,
                'help': 'Parent entry of workspace',
            },
            name={
                'label': 'Workspace Name',
                'required': True,
                'type': types.String,
                'help': 'Name of workspace'
            },
            template={
                'label': 'Workspace template Name',
                'required': True,
                'type': types.String,
                'help': 'Name of template to use if the task has no workspace'
            })

        if not ctx:
            return params

        if ctx.task:
            params['task']['default'] = ctx.task
            params['task']['required'] = False

        # Get default workspace for this host
        host = api.get_host()
        params['name']['default'] = host.name

        default_workspace = host.name
        for name, data in api.config['SOFTWARE'].items():
            if data['host'] == host.name:
                default_workspace = data['default_workspace']
                break

        template = api.get_template(default_workspace, 'workspace')
        if template:
            params['template']['default'] = template.name

        templates = api.get_templates('workspace')
        if templates:
            params['template']['options'] = list(templates.keys())

        return params
Example #5
0
    def parameters(ctx):
        params = dict(project={
            'label': 'Project',
            'help': 'Project Entry',
            'required': True,
            'type': types.Entry,
        },
                      collection={
                          'label': 'Collection',
                          'help': 'Collection Name',
                          'required': True,
                          'type': types.String
                      },
                      name={
                          'label': 'Sequence Name',
                          'required': True,
                          'type': types.String,
                          'help': 'Name of sequence',
                      },
                      template={
                          'label': 'Sequence Template',
                          'required': False,
                          'type': types.String,
                          'help': 'Name of sequence template'
                      })

        if not ctx:
            return params

        if ctx.project:
            params['project']['default'] = ctx.project
            params['project']['required'] = False

            # TODO: fix search speed upstream...
            # collection_types = [e.name for e in ctx.project.collections]
            # params['collection']['options'] = collection_types

        if ctx.collection:
            params['collection']['default'] = ctx.collection.name
            params['collection']['required'] = False

        templates = list(api.get_templates('sequence').keys())
        if templates:
            params['template']['default'] = templates[0]
            params['template']['options'] = templates

        return params
Example #6
0
    def parameters(ctx):
        params = dict(parent={
            'label': 'Parent Entry',
            'required': True,
            'type': types.Entry,
            'help': 'Parent entry of task',
        },
                      type={
                          'label': 'Task Type',
                          'required': True,
                          'type': types.String,
                          'help': 'Type of task',
                      },
                      name={
                          'label': 'Task Name',
                          'required': False,
                          'type': types.String,
                          'help': 'Name of task'
                      },
                      template={
                          'label': 'Task Template Name',
                          'required': False,
                          'type': types.String,
                          'help': 'Name of task template'
                      })

        if not ctx:
            return params

        params['type']['options'] = list(config['TASK_TYPES'].keys())

        if ctx.shot:
            params['parent']['default'] = ctx.shot
            params['parent']['required'] = False

        elif ctx.asset:
            params['parent']['default'] = ctx.asset
            params['parent']['required'] = False

        templates = list(api.get_templates('task').keys())
        if templates:
            params['template']['options'] = templates
            params['template']['default'] = templates[0]

        return params
Example #7
0
    def parameters(cls, ctx):
        params = dict(root={
            'label': 'Project Root',
            'required': True,
            'type': types.String,
            'help': 'project root directory',
        },
                      template={
                          'label': 'Project Template',
                          'required': True,
                          'type': types.String,
                          'help': 'name of a project template',
                      })

        if not ctx:
            return params

        templates = list(api.get_templates('project').keys())
        params['template']['options'] = templates
        if templates:
            params['template']['default'] = templates[0]

        return params