-
-
Save zeffii/fd2c41659e4c9bef284a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class InfoToTextBlock(bpy.types.Operator): | |
"""Tooltip""" | |
bl_idname = "info.to_text_block" | |
bl_label = "Simple Copy To TextBlock Operator" | |
def execute(self, context): | |
bpy.ops.info.report_copy() | |
fdata = context.window_manager.clipboard | |
bpy.data.texts.new('copied_from_console') | |
bpy.data.texts['copied_from_console'].write(fdata) | |
return {'FINISHED'} | |
class CustomInfoMenu(bpy.types.Menu): | |
bl_label = "Info To Textblok" | |
bl_idname = "INFO_MT_custom_menu" | |
def draw(self, context): | |
layout = self.layout | |
layout.operator("info.to_text_block") | |
def draw_item(self, context): | |
layout = self.layout | |
layout.menu(CustomInfoMenu.bl_idname) | |
def register(): | |
bpy.utils.register_class(InfoToTextBlock) | |
bpy.utils.register_class(CustomInfoMenu) | |
bpy.types.INFO_MT_window.append(draw_item) | |
def unregister(): | |
bpy.utils.unregister_class(InfoToTextBlock) | |
bpy.utils.unregister_class(CustomInfoMenu) | |
bpy.types.INFO_MT_window.remove(draw_item) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment