Skip to content

Commit

Permalink
Merge pull request #5 from ynput/enhancement/use-ayon-menu-label
Browse files Browse the repository at this point in the history
Use AYON_MENU_LABEL
  • Loading branch information
iLLiCiTiT authored Feb 8, 2024
2 parents 850e406 + 269817c commit 2746bc9
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/blender/api/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class TOPBAR_MT_avalon(bpy.types.Menu):
"""Avalon menu."""

bl_idname = "TOPBAR_MT_avalon"
bl_label = os.environ.get("AVALON_LABEL")
bl_label = os.environ.get("AYON_MENU_LABEL")

def draw(self, context):
"""Draw the menu in the UI."""
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/fusion/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .pulse import FusionPulse


MENU_LABEL = os.environ["AVALON_LABEL"]
MENU_LABEL = os.environ["AYON_MENU_LABEL"]


self = sys.modules[__name__]
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/harmony/api/TB_sceneOpened.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,15 @@ function start() {
app.avalonMenu = null;

for (var i = 0 ; i < actions.length; i++) {
label = System.getenv('AVALON_LABEL');
label = System.getenv('AYON_MENU_LABEL');
if (actions[i].text == label) {
app.avalonMenu = true;
}
}

var menu = null;
if (app.avalonMenu == null) {
menu = menuBar.addMenu(System.getenv('AVALON_LABEL'));
menu = menuBar.addMenu(System.getenv('AYON_MENU_LABEL'));
}
// menu = menuBar.addMenu('Avalon');

Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/hiero/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def menu_install():

# here is the best place to add menu

menu_name = os.environ['AVALON_LABEL']
menu_name = os.environ['AYON_MENU_LABEL']

context_label = get_context_label()

Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/houdini/api/creator_node_shelves.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def install():
os.remove(filepath)

icon = get_ayon_icon_filepath()
tab_menu_label = os.environ.get("AVALON_LABEL") or "AYON"
tab_menu_label = os.environ.get("AYON_MENU_LABEL") or "AYON"

# Create context only to get creator plugins, so we don't reset and only
# populate what we need to retrieve the list of creator plugins
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/houdini/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ def self_publish():
def add_self_publish_button(node):
"""Adds a self publish button to the rop node."""

label = os.environ.get("AVALON_LABEL") or "AYON"
label = os.environ.get("AYON_MENU_LABEL") or "AYON"

button_parm = hou.ButtonParmTemplate(
"ayon_self_publish",
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/houdini/startup/MainMenuCommon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<subMenu id="openpype_menu">
<labelExpression><![CDATA[
import os
return os.environ.get("AVALON_LABEL") or "AYON"
return os.environ.get("AYON_MENU_LABEL") or "AYON"
]]></labelExpression>
<actionItem id="asset_name">
<labelExpression><![CDATA[
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/max/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_or_create_openpype_menu(

if before in item.title():
help_action = item.menuAction()
tab_menu_label = os.environ.get("AVALON_LABEL") or "AYON"
tab_menu_label = os.environ.get("AYON_MENU_LABEL") or "AYON"
op_menu = QtWidgets.QMenu("&{}".format(tab_menu_label))
menu_bar.insertMenu(help_action, op_menu)

Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/maya/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def add_menu():
parent_widget = get_main_window()
cmds.menu(
MENU_NAME,
label=os.environ.get("AVALON_LABEL") or "OpenPype",
label=os.environ.get("AYON_MENU_LABEL") or "AYON",
tearOff=True,
parent="MayaWindow"
)
Expand Down
15 changes: 7 additions & 8 deletions client/ayon_core/hosts/nuke/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@

log = Logger.get_logger(__name__)

_NODE_TAB_NAME = "{}".format(os.getenv("AVALON_LABEL") or "Avalon")
AVALON_LABEL = os.getenv("AVALON_LABEL") or "Avalon"
AVALON_TAB = "{}".format(AVALON_LABEL)
AVALON_DATA_GROUP = "{}DataGroup".format(AVALON_LABEL.capitalize())
MENU_LABEL = os.getenv("AYON_MENU_LABEL") or "AYON"
NODE_TAB_NAME = MENU_LABEL
DATA_GROUP_KEY = "{}DataGroup".format(MENU_LABEL.capitalize())
EXCLUDED_KNOB_TYPE_ON_READ = (
20, # Tab Knob
26, # Text Knob (But for backward compatibility, still be read
Expand Down Expand Up @@ -443,7 +442,7 @@ def set_avalon_knob_data(node, data=None, prefix="avalon:"):
data = data or dict()
create = OrderedDict()

tab_name = AVALON_TAB
tab_name = NODE_TAB_NAME
editable = ["asset", "subset", "name", "namespace"]

existed_knobs = node.knobs()
Expand Down Expand Up @@ -477,7 +476,7 @@ def set_avalon_knob_data(node, data=None, prefix="avalon:"):
(("warn", ""), warn),
(("divd", ""), divd),
]
tab[AVALON_DATA_GROUP] = OrderedDict(head + list(create.items()))
tab[DATA_GROUP_KEY] = OrderedDict(head + list(create.items()))
create = tab

imprint(node, create, tab=tab_name)
Expand All @@ -500,7 +499,7 @@ def get_avalon_knob_data(node, prefix="avalon:", create=True):
"""

data = {}
if AVALON_TAB not in node.knobs():
if NODE_TAB_NAME not in node.knobs():
return data

# check if lists
Expand All @@ -512,7 +511,7 @@ def get_avalon_knob_data(node, prefix="avalon:", create=True):
# check if the node is avalon tracked
try:
# check if data available on the node
test = node[AVALON_DATA_GROUP].value()
test = node[DATA_GROUP_KEY].value()
log.debug("Only testing if data available: `{}`".format(test))
except NameError as e:
# if it doesn't then create it
Expand Down
8 changes: 2 additions & 6 deletions client/ayon_core/hosts/nuke/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
add_scripts_menu,
add_scripts_gizmo,
get_node_data,
set_node_data
set_node_data,
MENU_LABEL,
)
from .workfile_template_builder import (
NukePlaceholderLoadPlugin,
Expand All @@ -73,8 +74,6 @@
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")

MENU_LABEL = os.environ["AVALON_LABEL"]

# registering pyblish gui regarding settings in presets
if os.getenv("PYBLISH_GUI", None):
pyblish.api.register_gui(os.getenv("PYBLISH_GUI", None))
Expand Down Expand Up @@ -497,9 +496,6 @@ def ls():
This function is used by the Container Manager in Nuke. You'll
need to implement a for-loop that then *yields* one Container at
a time.
See the `container.json` schema for details on how it should look,
and the Maya equivalent, which is in `avalon.maya.pipeline`
"""
all_nodes = nuke.allNodes(recurseGroups=False)

Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/nuke/plugins/create/convert_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
INSTANCE_DATA_KNOB,
get_node_data,
get_avalon_knob_data,
AVALON_TAB,
NODE_TAB_NAME,
)
from ayon_core.hosts.nuke.api.plugin import convert_to_valid_instaces

Expand All @@ -24,7 +24,7 @@ def find_instances(self):
if get_node_data(node, INSTANCE_DATA_KNOB):
continue

if AVALON_TAB not in node.knobs():
if NODE_TAB_NAME not in node.knobs():
continue

# get data from avalon knob
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/resolve/api/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ayon_core.pipeline import registered_host


MENU_LABEL = os.environ["AVALON_LABEL"]
MENU_LABEL = os.environ["AYON_MENU_LABEL"]


def load_stylesheet():
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/substancepainter/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _install_menu(self):

parent = substance_painter.ui.get_main_window()

tab_menu_label = os.environ.get("AVALON_LABEL") or "AYON"
tab_menu_label = os.environ.get("AYON_MENU_LABEL") or "AYON"
menu = QtWidgets.QMenu(tab_menu_label)

action = menu.addAction("Create...")
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/hosts/tvpaint/api/communication_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ def execute_george_through_file(self, george_script):


class QtCommunicator(BaseCommunicator):
label = os.getenv("AVALON_LABEL") or "AYON"
label = os.getenv("AYON_MENU_LABEL") or "AYON"
title = "{} Tools".format(label)
menu_definitions = {
"title": title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ static char* GetLocalString( PIFilter* iFilter, int iNum, char* iDefault )
std::string label_from_evn()
{
std::string _plugin_label = "OpenPype";
if (std::getenv("AVALON_LABEL") && std::getenv("AVALON_LABEL") != "")
if (std::getenv("AYON_MENU_LABEL") && std::getenv("AYON_MENU_LABEL") != "")
{
_plugin_label = std::getenv("AVALON_LABEL");
_plugin_label = std::getenv("AYON_MENU_LABEL");
}
return _plugin_label;
}
Expand Down
2 changes: 1 addition & 1 deletion client/ayon_core/lib/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ def should_start_last_workfile(
"""Define if host should start last version workfile if possible.
Default output is `False`. Can be overridden with environment variable
`AVALON_OPEN_LAST_WORKFILE`, valid values without case sensitivity are
`AYON_OPEN_LAST_WORKFILE`, valid values without case sensitivity are
`"0", "1", "true", "false", "yes", "no"`.
Args:
Expand Down

0 comments on commit 2746bc9

Please sign in to comment.