Filetype Icons#

This example plugin sets icons for additional filetypes in the Scenefiles tab of the Prism Project Browser.

This can be used to add icons for scenefiles from DCCs, which don’t have a Prism plugin.
The plugins searches for the icons in the same folder where the Plugin Python file is saved, but it can be adjusted to return iconpaths from any other location.

See the section for Single File Plugins on how to load this example.

# FiletypeIcons.py

name = "FiletypeIcons"
classname = "FiletypeIcons"


import os
from qtpy.QtWidgets import *


class FiletypeIcons:
    def __init__(self, core):
        self.core = core
        self.version = "v1.0.0"

        # register getIconPathForFileType callback
        self.core.registerCallback("getIconPathForFileType", self.getIconPathForFileType, plugin=self)

    def getIconPathForFileType(self, extension):
        # this will search for icons in the same folder as this python file
        folder = os.path.dirname(__file__)

        # get iconpaths for specific filetypes
        if extension == ".aep":
            icon = folder + "/ae_icon.png"
        elif extension == ".c4d":
            icon = folder + "/c4d_icon.png"
        else:
            icon = None

        return icon