make self publish button optional

This commit is contained in:
Mustafa-Zarkash 2023-09-22 12:06:37 +03:00
parent 9eefc288a9
commit 4f52c70093
7 changed files with 56 additions and 2 deletions

View file

@ -168,6 +168,7 @@ class HoudiniCreator(NewCreator, HoudiniCreatorBase):
"""Base class for most of the Houdini creator plugins."""
selected_nodes = []
settings_name = None
_add_self_publish_button = False
def create(self, subset_name, instance_data, pre_create_data):
try:
@ -194,7 +195,10 @@ class HoudiniCreator(NewCreator, HoudiniCreatorBase):
self)
self._add_instance_to_context(instance)
imprint(instance_node, instance.data_to_store())
add_self_publish_button(instance_node)
if self._add_self_publish_button:
add_self_publish_button(instance_node)
return instance
except hou.Error as er:
@ -300,6 +304,11 @@ class HoudiniCreator(NewCreator, HoudiniCreatorBase):
def apply_settings(self, project_settings):
"""Method called on initialization of plugin to apply settings."""
# Apply General Settings
self._add_self_publish_button = \
project_settings["houdini"]["general"]["add_self_publish_button"]
# Apply Creator Settings
settings_name = self.settings_name
if settings_name is None:
settings_name = self.__class__.__name__

View file

@ -1,4 +1,7 @@
{
"general": {
"add_self_publish_button": false
},
"imageio": {
"activate_host_color_management": true,
"ocio_config": {

View file

@ -5,6 +5,10 @@
"label": "Houdini",
"is_file": true,
"children": [
{
"type": "schema",
"name": "schema_houdini_general"
},
{
"key": "imageio",
"type": "dict",

View file

@ -0,0 +1,14 @@
{
"type": "dict",
"key": "general",
"label": "General",
"collapsible": true,
"is_group": true,
"children": [
{
"type": "boolean",
"key": "add_self_publish_button",
"label": "Add Self Publish Button"
}
]
}

View file

@ -0,0 +1,15 @@
from pydantic import Field
from ayon_server.settings import BaseSettingsModel
class GeneralSettingsModel(BaseSettingsModel):
add_self_publish_button: bool = Field(
False,
title="Add Self Publish Button"
)
DEFAULT_GENERAL_SETTINGS = {
"add_self_publish_button": False
}

View file

@ -5,6 +5,10 @@ from ayon_server.settings import (
MultiplatformPathListModel,
)
from .general import (
GeneralSettingsModel,
DEFAULT_GENERAL_SETTINGS
)
from .imageio import HoudiniImageIOModel
from .publish_plugins import (
PublishPluginsModel,
@ -52,6 +56,10 @@ class ShelvesModel(BaseSettingsModel):
class HoudiniSettings(BaseSettingsModel):
general: GeneralSettingsModel = Field(
default_factory=GeneralSettingsModel,
title="General"
)
imageio: HoudiniImageIOModel = Field(
default_factory=HoudiniImageIOModel,
title="Color Management (ImageIO)"
@ -73,6 +81,7 @@ class HoudiniSettings(BaseSettingsModel):
DEFAULT_VALUES = {
"general" : DEFAULT_GENERAL_SETTINGS,
"shelves": [],
"create": DEFAULT_HOUDINI_CREATE_SETTINGS,
"publish": DEFAULT_HOUDINI_PUBLISH_SETTINGS

View file

@ -1 +1 @@
__version__ = "0.1.3"
__version__ = "0.1.4"