{'practice add-ons':'skelton', 'ver':2.58.0}
Blender2.58も出たことだし
Python3.2の勉強に、bpy弄る><
basic Operator
基本の雛形やる。
まずはExample Operatorを写経。
Reference Operator
Operator(bpy_struct) — Blender v2.57.0 r36138 - API documentation
import bpy class OpHelloBlender(bpy.types.Operator): #<= Operator継承 bl_idname = "screen.hello_blender" bl_label = "Hello" #<= Operator名 def execute(self, context): #<= Operator実行 self.report({'WARNING'}, "Blender") return {'FINISHED'} # addonとして登録する定型 def register():# registering and menu integration bpy.utils.register_class(OpHelloBlender) def unregister():# unregistering and removing menus bpy.utils.unregister_class(OpHelloBlender) if __name__ == "__main__": register()
basic Panel
Example Panelを写経。
import bpy class OBJECT_PT_hello(bpy.types.Panel): #<= Panel継承 bl_label = "Name Change Panel" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "object" def draw(self, context): layout = self.layout obj = context.object # row = layout.row() # row.label(text="Hello world!", icon='WORLD_DATA') row = layout.row() row.label(text="Active object is: " + obj.name) row = layout.row() row.prop(obj, "name") def register(): bpy.utils.register_class(OBJECT_PT_hello) def unregister(): bpy.utils.unregister_class(OBJECT_PT_hello) if __name__ == "__main__": register()
普通にオブジェクトの名前変更欲しいが、、、
って、プロパティエディタのオブジェクトで名前変更出来るねw<