Skip to content

helpers

AyonHelpers

Bases: AyonLib

Class wrapping some useful functions for Ayon.

This class is extending native BP class in Ayon Integration Plugin.

Source code in client/ayon_unreal/api/helpers.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@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)

set_folder_color(path, color)

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.

Parameters:

Name Type Description Default
path str

Path to folder

required
color

class:unreal.LinearColor): Color of the folder

required

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.

Source code in client/ayon_unreal/api/helpers.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@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)