Created
August 10, 2011 09:29
-
-
Save zeffii/1136443 to your computer and use it in GitHub Desktop.
small panel for 'TEXT_EDITOR' blender 2.5
This file contains hidden or 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 SetTextPreferences(bpy.types.Operator): | |
bl_label = "Set Text Preferences" | |
bl_idname = "txt.set_text_prefs" | |
def execute(self, context): | |
st = context.space_data | |
st.show_line_numbers = True | |
st.show_word_wrap = True | |
st.show_syntax_highlight = True | |
st.show_margin = True | |
return {'FINISHED'} | |
class HelloWorldPanel(bpy.types.Panel): | |
bl_label = "Hello World Panel" | |
bl_idname = "OBJECT_PT_hello" | |
bl_space_type = "TEXT_EDITOR" | |
bl_region_type = "UI" | |
def draw(self, context): | |
layout = self.layout | |
row = layout.row() | |
row.operator("txt.set_text_prefs", icon='COLOR') | |
def register(): | |
bpy.utils.register_class(HelloWorldPanel) | |
bpy.utils.register_class(SetTextPreferences) | |
def unregister(): | |
bpy.utils.unregister_class(HelloWorldPanel) | |
bpy.utils.unregister_class(SetTextPreferences) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
starting point for creating a one button solution to this 4 button problem.