Skip to content

Commit

Permalink
renamed method 'get_attribute_defs' to 'get_instance_attr_defs'
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Jan 18, 2022
1 parent 20f5e8f commit f8be576
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion openpype/hosts/testhost/plugins/create/auto_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MyAutoCreator(AutoCreator):
identifier = "workfile"
family = "workfile"

def get_attribute_defs(self):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key", label="Number")
]
Expand Down
8 changes: 6 additions & 2 deletions openpype/hosts/testhost/plugins/create/test_creator_1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from openpype import resources
from openpype.hosts.testhost.api import pipeline
from openpype.pipeline import (
Expand Down Expand Up @@ -35,7 +36,10 @@ def remove_instances(self, instances):
for instance in instances:
self._remove_instance_from_context(instance)

def create(self, subset_name, data, options=None):
def create(self, subset_name, data, pre_create_data):
print("Data that can be used in create:\n{}".format(
json.dumps(pre_create_data, indent=4)
))
new_instance = CreatedInstance(self.family, subset_name, data, self)
pipeline.HostContext.add_instance(new_instance.data_to_store())
self.log.info(new_instance.data)
Expand All @@ -48,7 +52,7 @@ def get_default_variants(self):
"different_variant"
]

def get_attribute_defs(self):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key", label="Number"),
]
Expand Down
4 changes: 2 additions & 2 deletions openpype/hosts/testhost/plugins/create/test_creator_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestCreatorTwo(Creator):
def get_icon(self):
return "cube"

def create(self, subset_name, data, options=None):
def create(self, subset_name, data, pre_create_data):
new_instance = CreatedInstance(self.family, subset_name, data, self)
pipeline.HostContext.add_instance(new_instance.data_to_store())
self.log.info(new_instance.data)
Expand All @@ -38,7 +38,7 @@ def remove_instances(self, instances):
for instance in instances:
self._remove_instance_from_context(instance)

def get_attribute_defs(self):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key"),
lib.TextDef("text_key")
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/testhost/plugins/publish/collect_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CollectContextDataTestHost(
hosts = ["testhost"]

@classmethod
def get_attribute_defs(cls):
def get_instance_attr_defs(cls):
return [
attribute_definitions.BoolDef(
"test_bool",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CollectInstanceOneTestHost(
hosts = ["testhost"]

@classmethod
def get_attribute_defs(cls):
def get_instance_attr_defs(cls):
return [
attribute_definitions.NumberDef(
"version",
Expand Down
2 changes: 1 addition & 1 deletion openpype/pipeline/create/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def __init__(
# Stored creator specific attribute values
# {key: value}
creator_values = copy.deepcopy(orig_creator_attributes)
creator_attr_defs = creator.get_attribute_defs()
creator_attr_defs = creator.get_instance_attr_defs()

self._data["creator_attributes"] = CreatorAttributeValues(
self, creator_attr_defs, creator_values, orig_creator_attributes
Expand Down
2 changes: 1 addition & 1 deletion openpype/pipeline/create/creator_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_subset_name(
dynamic_data=dynamic_data
)

def get_attribute_defs(self):
def get_instance_attr_defs(self):
"""Plugin attribute definitions.
Attribute definitions of plugin that hold data about created instance
Expand Down

0 comments on commit f8be576

Please sign in to comment.