Changeset View
Changeset View
Standalone View
Standalone View
space_view3d_math_vis/__init__.py
| Context not available. | |||||
| from . import utils, draw | from . import utils, draw | ||||
| import bpy | import bpy | ||||
| from bpy.types import Menu, Operator | |||||
| class CleanupConsole(bpy.types.Operator): | |||||
| bl_idname = "mathvis.cleanup_console" | |||||
| bl_label = "Cleanup Math Vis Console" | |||||
| bl_description = "Remove all visualised variables from the Console." | |||||
| bl_options = {'REGISTER'} | |||||
| def execute(self, context): | |||||
| utils.cleanup_math_data() | |||||
lijenstina: Spaces around equals | |||||
| return {'FINISHED'} | |||||
| def menu_func_cleanup(self, context): | |||||
| self.layout.operator("mathvis.cleanup_console", text="Clear Math Vis") | |||||
| def console_hook(): | def console_hook(): | ||||
| draw.tag_redraw_all_view3d() | draw.tag_redraw_all_view3d() | ||||
Done Inline Actionstype is also builtin in python, better not to override it… use key_type (or even ktype) instead? mont29: `type` is also builtin in python, better not to override it… use `key_type` (or even `ktype`)… | |||||
Done Inline Actionsvars is builtin in python, better not to override it… use variables instead? mont29: `vars` is builtin in python, better not to override it… use `variables` instead? | |||||
| Context not available. | |||||
| import console_python | import console_python | ||||
| console_python.execute.hooks.append((console_hook, ())) | console_python.execute.hooks.append((console_hook, ())) | ||||
| bpy.utils.register_module(__name__) | |||||
Done Inline Actionsprop.key=key spaces around equals and below (lines 70 and 76) lijenstina: **prop.key=key** spaces around equals and below (lines 70 and 76) | |||||
| bpy.types.CONSOLE_MT_console.prepend(menu_func_cleanup) | |||||
Done Inline ActionsYou still have some issues with spaces around = :p mont29: You still have some issues with spaces around `=` :p | |||||
| def unregister(): | def unregister(): | ||||
| Context not available. | |||||
| import console_python | import console_python | ||||
| console_python.execute.hooks.remove((console_hook, ())) | console_python.execute.hooks.remove((console_hook, ())) | ||||
| bpy.types.CONSOLE_MT_console.remove(menu_func_cleanup) | |||||
| bpy.utils.unregister_module(__name__) | |||||
| Context not available. | |||||
Done Inline Actions= & spaces again mont29: `=` & spaces again | |||||
Done Inline Actionsagain spaces, one after comma… mont29: again spaces, one after comma… | |||||
Not Done Inline ActionsDon’t forget to del bpy.types.Scene.MathVisProp mont29: Don’t forget to `del bpy.types.Scene.MathVisProp` | |||||
Spaces around equals