Skip to content

Commit

Permalink
Merge pull request #27 from ynput/enhancement/removing-old-api-methods
Browse files Browse the repository at this point in the history
Removing old API methods
  • Loading branch information
jakubjezek001 authored Nov 13, 2024
2 parents 62fc7d9 + 90fecac commit ab733f0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 94 deletions.
11 changes: 0 additions & 11 deletions client/ayon_hiero/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,9 @@
get_track_ayon_tag,
set_track_ayon_tag,
get_track_ayon_data,
get_track_item_pype_tag,
set_track_item_pype_tag,
get_track_item_pype_data,
get_trackitem_ayon_tag,
set_trackitem_ayon_tag,
get_trackitem_ayon_data,
set_publish_attribute,
get_publish_attribute,
imprint,
get_selected_track_items,
set_selected_track_items,
Expand Down Expand Up @@ -104,8 +99,6 @@
"get_trackitem_ayon_tag",
"set_trackitem_ayon_tag",
"get_trackitem_ayon_data",
"set_publish_attribute",
"get_publish_attribute",
"imprint",
"get_selected_track_items",
"set_selected_track_items",
Expand All @@ -115,10 +108,6 @@
"apply_colorspace_project",
"apply_colorspace_clips",
"get_sequence_pattern_and_padding",
# deprecated
"get_track_item_pype_tag",
"set_track_item_pype_tag",
"get_track_item_pype_data",

# plugins
"CreatorWidget",
Expand Down
66 changes: 2 additions & 64 deletions client/ayon_hiero/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,24 +459,6 @@ def get_track_ayon_data(track, container_name=None):
)


@deprecated("ayon_hiero.api.lib.get_trackitem_ayon_tag")
def get_track_item_pype_tag(track_item):
# backward compatibility alias
return get_trackitem_ayon_tag(track_item)


@deprecated("ayon_hiero.api.lib.set_trackitem_ayon_tag")
def set_track_item_pype_tag(track_item, data=None):
# backward compatibility alias
return set_trackitem_ayon_tag(track_item, data)


@deprecated("ayon_hiero.api.lib.get_trackitem_ayon_data")
def get_track_item_pype_data(track_item):
# backward compatibility alias
return get_trackitem_ayon_data(track_item)


def get_trackitem_ayon_tag(track_item, tag_name=AYON_TAG_NAME):
"""
Get pype track item tag created by creator or loader plugin.
Expand Down Expand Up @@ -593,7 +575,7 @@ def imprint(track_item, data=None):
Arguments:
track_item (hiero.core.TrackItem): hiero track item object
data (dict): Any data which needst to be imprinted
data (dict): Any data which needs to be imprinted
Examples:
data = {
Expand All @@ -604,51 +586,7 @@ def imprint(track_item, data=None):
"""
data = data or {}

tag = set_trackitem_ayon_tag(track_item, data)

# add publish attribute
set_publish_attribute(tag, True)


def set_publish_attribute(tag, value):
""" Set Publish attribute in input Tag object
Attribute:
tag (hiero.core.Tag): a tag object
value (bool): True or False
"""
tag_data = tag.metadata()
try:
tag_json_data = tag_data["tag.json_metadata"]
metadata = json.loads(tag_json_data)

except (KeyError, json.JSONDecodeError): # missing key or invalid tag data
metadata = {}

metadata["publish"] = value
tag_data.setValue("tag.json_metadata", json.dumps(metadata))


def get_publish_attribute(tag):
""" Get Publish attribute from input Tag object
Attribute:
tag (hiero.core.Tag): a tag object
Returns:
object: data found on publish attribute or None
"""
tag_data = tag.metadata()

# get data to the publish attribute
try:
tag_json_data = tag_data["tag.json_metadata"]
tag_data = json.loads(tag_json_data)

except (KeyError, json.JSONDecodeError): # missing key or invalid tag data
return None

return tag_data["publish"]
set_trackitem_ayon_tag(track_item, data)


def sync_avalon_data_to_workfile():
Expand Down
17 changes: 0 additions & 17 deletions client/ayon_hiero/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,20 +348,3 @@ def reload_config():
except Exception as e:
log.warning("Cannot reload module: {}".format(e))
importlib.reload(module)


def on_pyblish_instance_toggled(instance, old_value, new_value):
"""Toggle node passthrough states on instance toggles."""

log.info("instance toggle: {}, old_value: {}, new_value:{} ".format(
instance, old_value, new_value))

from ayon_hiero.api import (
get_trackitem_ayon_tag,
set_publish_attribute
)

# Whether instances should be passthrough based on new value
track_item = instance.data["item"]
tag = get_trackitem_ayon_tag(track_item)
set_publish_attribute(tag, new_value)
2 changes: 0 additions & 2 deletions client/ayon_hiero/plugins/create/create_shot_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def create(self, instance_data, _):
"""
instance_data.update({
"newHierarchyIntegration": True,
# Backwards compatible (Deprecated since 24/06/06)
"newAssetPublishing": True,
})

new_instance = CreatedInstance(
Expand Down

0 comments on commit ab733f0

Please sign in to comment.