Please enable Javascript to view the contents

 ·  ☕ 3 分钟 · 👀... 阅读

blenderAPI

data数据

可以访问blender中的所有数据

可以进行材质属性、物体大小等进行修改

context

只能访问当前激活的物体

ops

操作指令,比如按钮什么的,或者创建物体

operators

types

所有实现的‘class类模块’定义

props

blender中properties属性管理

 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
1invoke
初始化
self.execute(context):调用execute
{'RUNNING_MODAL'}:调用modal,配合context.window_manager.modal_handler_add(self)
    def invoke(self,context,event)
    #event 对键盘按键的检测,在operator的执行中,对快捷键进行检测

    
2execute
执行操作

3modal
一直运行,例如Fly-ModeGRS的实现

4poll:民义检测
用来检测状态

5、返回值
invoke execute modal 必须返回固定值:
'RUNNING_MODAL':运行modal
'CANCELLED':取消操作(右键)无undo
'FINISHED':确定操作(左键):有undo
'PASS_THROUGH'
'INTERFACE'

WindowManager(ID)

utils

管理自身的小工具

path

访问系统的文件系统

bpy.path.abspath

获取文件的当前路径绝对路径

bpy.path.basename

bpy.path.repath

命名规范

operator :_OT_

menu:_MT_

header:_HT_

panel:_PT_

面板操作

 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
class className:
    #属性

    def poll():
    	#运行前的手动判断

    def draw_header():
        #绘制标题头

    def draw():
        #绘制主要内容

        
- bl_label:别名
- bl_idnamepanel的程序访问名字
- bl_space_type:各个ui_type对应的值
- bl_options:显示状态
- bl_category:分组标签
- bl_parent_id
- bl_region_ty
  - UIN面板
  - CHANNELS:文件选择窗口
  - WINDOW和bl_context搭配用
- bl_context/bl_region_type/bl_space_type:三个搭配使用

按钮:
operator('my.button',text='name',emboss=False,depress=True)
#关键字

sublayout	子布局
ltem		控件项

关于曲线

 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
bpy.data.objects['objectName'].animation_data.action.fcurves
bpy.data.actions['curveGroupName'].fcurves['curveName']
len(boy.context.object.animation_data.action.fcurves)					#获取当前物体曲线数量

bpy.context.object.animation_data.action.fcurves[4].mute = False		#让曲线是否生效

bpy.context.object.animation_data.action.fcurves[4].lock = False		#锁定曲线

bpy.context.object.animation_data.action.fcurves[4].select = True		#选择该曲线


bpy.ops.graph.hide(unselected=True)						#隐藏未选中的

bpy.data.window_managers['WinMan'].(null) = True
#插入关键帧

继承函数:bpy_struct.keyframe_insert
	(继承bpy_struct类)
参数:
	data_path 数据路径,例如:location位置
    index	  索引	 例如:位置xyz012
    frame	  帧数 	 默认为当前,时间轴选中帧
    group	  分组  	 Object Transforms(物体-变换)
    
    
bl_info = {
    "name": "BL_ammiel_v0_1",
    "description": "BL_ammiel_v0_1",
    "author": ".",
    "version": (0, 0, 1),
    "blender": (2, 80, 0),
    "location": "Everywhere",
    "category": " Blender Box"
}
    
    
actions		动作
armatures	骨架
curves		曲线

bpy.ops.graph


分享

幽梦
作者
幽梦
傻猪男孩

目录