Blender2.5から始めるスクリプト05

オブジェクトパネル最下部に「Test」欄とボタンを作成し、押したら「clicked」と表示する。 import bpy class ObjectButtonsPanel(bpy.types.Panel): bl_space_type = “PROPERTIES” bl_region_type = “WINDOW” bl_context = “object” class OBJECT_PT_Test(ObjectButtonsPanel): bl_label = “Test” Display = 0 def draw_header(self, context): layout = self.layout def draw(self, context): layout = self.layout row = layout.row() row.operator(“exportbutton”, text=”Exec”) class OBJECT_OT_Test(bpy.types.Operator): bl_label = “Test” bl_idname = “exportbutton” def invoke(self, context, event): scene = context.scene print(“clicked”); return(‘FINISHED’) bpy.types.register(OBJECT_OT_Test) bpy.types.register(OBJECT_PT_Test)

Blender2.5から始めるスクリプト04

オブジェクトパネル最下部に「Test」欄作成 import bpy class ObjectButtonsPanel(bpy.types.Panel): bl_space_type = “PROPERTIES” bl_region_type = “WINDOW” bl_context = “object” class OBJECT_PT_Test(ObjectButtonsPanel): bl_label = “Test” Display = 0 def draw_header(self, context): layout = self.layout def draw(self, context): layout = self.layout bpy.types.register(OBJECT_PT_Test)