ayon-core/openpype/hosts/unreal/api/helpers.py
2023-04-14 17:42:42 +02:00

44 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import unreal # noqa
class AyonUnrealException(Exception):
pass
@unreal.uclass()
class AyonHelpers(unreal.AyonLib):
"""Class wrapping some useful functions for Ayon.
This class is extending native BP class in Ayon Integration Plugin.
"""
@unreal.ufunction(params=[str, unreal.LinearColor, bool])
def set_folder_color(self, path: str, color: unreal.LinearColor) -> None:
"""Set color on folder in Content Browser.
This method sets color on folder in Content Browser. Unfortunately
there is no way to refresh Content Browser so new color isn't applied
immediately. They are saved to config file and appears correctly
only after Editor is restarted.
Args:
path (str): Path to folder
color (:class:`unreal.LinearColor`): Color of the folder
Example:
AyonHelpers().set_folder_color(
"/Game/Path", unreal.LinearColor(a=1.0, r=1.0, g=0.5, b=0)
)
Note:
This will take effect only after Editor is restarted. I couldn't
find a way to refresh it. Also, this saves the color definition
into the project config, binding this path with color. So if you
delete this path and later re-create, it will set this color
again.
"""
self.c_set_folder_color(path, color, False)