예제 #1
0
        # print("----- item %s" %(item))
        definitionType = item[4]
        filepath = item[2]
        shader_root = checkUnityShaderRoot()
        # print("shader_root  %s" % shader_root)
        if shader_root != "":

            filepath = os.path.join(shader_root, filepath)

    # print("filepath  %s" % filepath)
        if os.path.exists(filepath):
            self.view.window().open_file(filepath + ":" + str(item[3]),
                                         sublime.ENCODED_POSITION)
        else:
            sublime.status_message("%s not exists" % (filepath))

    def is_enabled(self):
        return helper.checkFileExt(self.view.file_name(), "shader")

    def is_visible(self):
        return self.is_enabled()


def plugin_loaded():
    sublime.set_timeout(init, 200)


# st2
if not helper.isST3():
    init()
    def on_done(self, index):
        if index == -1:
            return
        self.view.run_command("cc_insert", { "arg" : RESOURCE_LIST[index]});
        
    def is_enabled(self):
        return helper.checkFileExt(self.view.file_name(), "js")

    def is_visible(self):
        return self.is_enabled()

class CcInsertCommand(sublime_plugin.TextCommand):
    def run(self, edit, arg):
        self.view.insert(edit, self.view.sel()[0].begin(), arg)
    
    def is_enabled(self):
        return True

    def is_visible(self):
        return False

# st3
def plugin_loaded():
    sublime.set_timeout(init, 200)

# st2
if not helper.isST3():
    init()