Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/ufkoot.py
Last active February 12, 2024 02:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/b0910b95ad92df070c98 to your computer and use it in GitHub Desktop.
Save zeffii/b0910b95ad92df070c98 to your computer and use it in GitHub Desktop.
'''
installation
- from a fresh Blender start
- drop ufkoot.py into your scripts/addons(_contrib) folder
- in User Preferences / addons / Testing (or community..) / Development
- tick 'Info To Text'
- press Save User Settings
- close the User Preferences Panel
- press Ctrl + U , (this will store this preference in the startup.blend)
access
- A new menu entry is added to Info -> Window -> Copy Selected Info To Text
'''
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