bpy Archive
Blender2.5から始めるスクリプト05
オブジェクトパネル最下部に「Test」欄とボタンを作成し、押したら「clicked」と表示する。
import bpyclass 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.layoutdef 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)

- Comments: 0
- Trackbacks: 0
Blender2.5から始めるスクリプト04
オブジェクトパネル最下部に「Test」欄作成
import bpyclass 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.layoutdef draw(self, context):
layout = self.layoutbpy.types.register(OBJECT_PT_Test)

- Comments: 0
- Trackbacks: 0
Blender2.5から始めるスクリプト03
オブジェクトのアトリビュート(nameやlocationとか。属性、プロパティ)を列挙
import bpy
obj = bpy.context.active_object
dir(name)

- Comments: 0
- Trackbacks: 0
Blender2.5から始めるスクリプト02
現在のアクティブなオブジェクト名を表示
import bpy
obj = bpy.context.active_object
print(obj.name)

- Comments: 0
- Trackbacks: 0
Blender2.5から始めるスクリプト01
実行するたびに名前が「Cube」のオブジェクトのx座標を1移動
import bpy
bpy.context.scene.objects["Cube"].location.x += 1

- Comments: 0
- Trackbacks: 0
- Search
- Feeds
- Meta