Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2015 08:44
Show Gist options
  • Save anonymous/2b19de5946571d868e81 to your computer and use it in GitHub Desktop.
Save anonymous/2b19de5946571d868e81 to your computer and use it in GitHub Desktop.
test
bl_info = {
"name": "Info To Text",
"author": "Dealga McArdle",
"version": (0, 0, 0),
"blender": (2, 7, 4),
"location": "info header > window > Copy Selected Info To Text",
"description": "copies selected lines to Text datablock",
"wiki_url": "",
"tracker_url": "",
"category": "Development"}
import bpy
class InfoToTextBlock(bpy.types.Operator):
bl_idname = "info.to_text_block"
bl_label = "Copy Selected Info To Text"
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'}
def draw_item(self, context):
layout = self.layout
layout.operator("info.to_text_block")
def register():
bpy.utils.register_class(InfoToTextBlock)
bpy.types.INFO_MT_window.append(draw_item)
def unregister():
bpy.utils.unregister_class(InfoToTextBlock)
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