Skip to content

Instantly share code, notes, and snippets.

@dskjal
dskjal / my_properties_panel.py
Last active September 16, 2016 09:47
プロパティシェルフにショートカットプロパティを用意するスクリプト
import bpy
from bpy.props import *
bl_info = {
"name" : "My Properties",
"author" : "",
"version" : (0,1),
"blender" : (2, 77, 0),
"location" : "",
"description" : "",
@dskjal
dskjal / simple_button.py
Last active April 4, 2018 02:05
Blender にボタンを定義するスクリプト
import bpy
class MyButton(bpy.types.Operator):
bl_idname = "my.button"
bl_label = "text"
def execute(self, context):
print("pushed")
return{'FINISHED'}
@dskjal
dskjal / simple_button_with_ui.py
Last active April 4, 2018 02:12
Blender のボタンを表示する
import bpy
##############################################
class UI(bpy.types.Panel):
bl_label = "my panel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
self.layout.operator("my.button")
@dskjal
dskjal / space_region_category.py
Created September 5, 2016 04:23
Blender の UI の配置場所
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Tools"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOL_PROPS"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
@dskjal
dskjal / view_only_selected.py
Last active April 4, 2018 02:06
Blender で選択されているオブジェクトがメッシュで名前が Cube の時だけ UI を表示する
import bpy
class UI(bpy.types.Panel):
bl_label = "my panel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
####################################################################################################
@classmethod
def poll(self, context):
@dskjal
dskjal / expand.py
Last active April 4, 2018 02:06
Blender でボタンを横に並べる
import bpy
class UI(bpy.types.Panel):
bl_label = "my panel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
#############################################
def draw(self, context):
layout = self.layout
@dskjal
dskjal / left.py
Created September 5, 2016 04:27
Blender で左揃えでボタンを配置
def draw(self, context):
layout = self.layout
row = layout.row(align=False)
row.alignment = 'LEFT'
row.operator("my.button", text="1")
row.operator("my.button", text="2")
row.operator("my.button", text="3")
@dskjal
dskjal / group.py
Created September 5, 2016 04:28
Blender で要素をグループ化
def draw(self, context):
layout = self.layout
row = layout.row(align=False)
box = row.box()
box.operator("my.button", text="1")
box.operator("my.button", text="2")
box.operator("my.button", text="3")
@dskjal
dskjal / label_icon.py
Created September 5, 2016 04:29
Blender でラベルとアイコンを配置
def draw(self, context):
layout = self.layout
layout.label("label", icon='TEXT')
layout.operator("my.button", text="1")
@dskjal
dskjal / popup.py
Last active April 4, 2018 02:06
Blender でボタンが押されたときポップアップウインドウを表示する
import bpy
class UI(bpy.types.Panel):
bl_label = "my panel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
self.layout.operator("my.button")