Skip to content

🏛️Product base types: product type settings for creators #172

@antirotor

Description

@antirotor

Issue

To configure product types for creators, new settings must be added for every individual creator (or some more centralized one if it makes more sense). This list of product types would be then used to creator to present to publisher as is described in ayon-core PR1 - it is somewhat similar to the Default Variants Setting.

Something like:

...
CreateRender: BasicWrite = SettingsField(
        default_factory=BasicWrite ,
        title="Create Render",
        product_types: list[str] = SettingsField(default_factory=list, title="Product Types"),
 )
...

If it make sense, it could be implemented as one setting in the host mapping product base type and number of product types - in this case, method mentioned1 should be overriden from the default ayon-core implementation to get the data from there.

For example:

class ProductTypeMappingSubmodel(BaseSettingsModel):
    """Base model N:M for product base type and many product types."""
    product_base_type: str = SettingsField("", title="Product Base Type"),
    product_types: list[str] = SettingsField(default_factory=list, title="Product Types")

class ProductTypeMapping(BaseSettingsModel):
    """Mapping for product base types and product types."""
    mappings: list[ProductTypeMappingSubmodel] = SettingsField(default_factory=list, title="Product Type Mapping")

Then on host specific Creator base class something like this:

def get_product_type_items(self) -> list[tuple[str, str]]:
    """Return product type items this creator can create."""
    settings = self.create_context.get_current_project_settings()
    mapping_settings = settings["nuke"]["product_type_mapping"].get(self.product_base_type)
    items = []
    for product_type in product_types:
        items.append((product_type, f"Create {product_type}"))
    return items

This is obviously just example and it depends on number of creators exposed in the host and usage.


Footnotes

  1. https://github.com/ynput/ayon-core/issues/1298 2

Metadata

Metadata

Assignees

Labels

sponsoredThis is directly sponsored by a client or community membertype: featureAdding something new and exciting to the product

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions