Created
January 22, 2022 21:35
-
-
Save SmashedFrenzy16/b3cc7a5dcf5a46e97558fb0f8fe9f92c to your computer and use it in GitHub Desktop.
Send cursor to center Blender Addon
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
bl_info = { | |
"name" : "test", | |
"author" : "SmashedFrenzy16", | |
"description" : "Test Blender Addon", | |
"blender" : (2, 80, 0), | |
"version" : (0, 0, 1), | |
"location" : "View3D", | |
"warning" : "", | |
"category" : "Generic" | |
} | |
import bpy | |
from . test_operator import TEST_OT_OPERATOR | |
from .test_panel import Test_PT_Panel | |
classes = (TEST_OT_OPERATOR, Test_PT_Panel) | |
register, unregister = bpy.utils.register_classes_factory(classes) |
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 TEST_OT_OPERATOR(bpy.types.Operator): | |
bl_idname = "view3d.cursor_center" | |
bl_label = "Simple operator" | |
bl_description = "Centers the 3d cursor" | |
def execute(self, context): | |
bpy.ops.view3d.snap_cursor_to_center() | |
return {"FINISHED"} | |
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 Test_PT_Panel(bpy.types.Panel): | |
bl_idname = "Test_PT_Panel" | |
bl_label = "Test Panel" | |
bl_category = "Test Addon" | |
bl_space_type = "VIEW_3D" | |
bl_region_type = "UI" | |
def draw(self, context): | |
layout = self.layout | |
row = layout.row() | |
row.operator("view3d.cursor_center", text="Send Cursor to center") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment