simpleOp HelloWorld

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import bpy
"""
Hello World をするだけのButtonをBlenderに追加する
"""


class SAMPLE_OT_HelloWorld(bpy.types.Operator):

    bl_idname = "object.hello_world"
    bl_label = "Hello World"
    bl_options = {'REGISTER', 'UNDO'}

    # メニューを実行したときに呼ばれるメソッド
    def execute(self, context):

        print('hello world!!!')

        return {'FINISHED'}


class samplePanel(bpy.types.Panel):
    bl_label = "SamplePanel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"
    bl_category = "SampleAddon"

    def draw(self, context):
        layout = self.layout
        layout.operator('object.hello_world')


def register():
    pass


def unregister():
    pass

最終更新日: 2022-05-10 14:46:53
Back to top