From BlenderWiki
BlenderWikiから
このページはBlender2.5の特徴をドキュメント化したものです。Blender2.4xのドキュメントをお探しならば、Doc:ManualかDoc:Tutorialsを読んでください。
Blender 2.5's UI is fully extensible.
Blender2.5のUIは完全に広げることができる。
Here is how to manipulate it:
ここに、どうそれを操るかがある:
[
edit
]
Making reports
レポートを作ること。
Operators
can create UI alerts like this:
オペレータはこのようなUI警戒を作成できる:
self . report ( 'ERROR' , "A message to the user" ) self . report ( 'ERROR' 、 「ユーザへのメッセージ」 )
-
The script does
not
stop running when the report appears.
スクリプトは、レポートが現れるとき、走るのを止めない。
-
There can only be one report message at a time.
一度に、1つのレポート・メッセージしかあることができない。
Extra reports will overwrite the contents of earlier ones - but not their location.
余分なレポートはそれらの位置ではなく、以前のもののコンテンツを上書きする。
If you call an error while an info is up, it will appear in the info area.
インフォメーションが上がっている間、誤りを呼ぶと、それはインフォメーション領域に現れる。
The report types are:
レポート・タイプは以下の通りである。
-
ERROR
誤り
-
ERROR_INVALID_INPUT
誤りの_の無効の_入力
-
ERROR_INVALID_CONTEXT
誤りの_の無効の_Context(コンテキスト)
-
ERROR_OUT_OF_MEMORY
_メモリの_からの誤り_
-
Pop-up menu at cursor which can be dismissed with a click
クリックで棄却できるカーソルのポップアップ・メニュー
-
INFO
インフォメーション
-
Message slides into view in the info panel
インフォメーション・パネルの視点へのメッセージ・スライド
(i.e. main menu)
(すなわち、メイン・メニュー)
-
OPERATOR
オペレータ
-
DEBUG
デバッグ
-
Unknown
未知
[
edit
]
Creating and invoking new menus
新しいメニューを作成して、呼び出すこと。
import bpy 輸入 bpy class MyMenu ( bpy. types . Menu ) : クラス MyMenu ( bpy. types . Menu ) : bl_idname = "test_menu" bl_idnameは 「テスト_メニュー」 と等しい。 bl_label = "Custom menu" bl_ラベルは 「カスタム・メニュー」 と等しい。 def draw ( self , context ) : クール なドロー ( 自己 、Context(コンテキスト) ) : l = self . layout lは self . layout と等しい。 l. label ( "This is a label" ,icon= 'MONKEY' ) l. ラベル ( 「これはラベルである」 、アイコン= 'MONKEY' ) 20l. オペレータ ( 「mesh.remove_ダブルス」 ) #bl_idnameが1であれば存在していて、さもなければ、クラス が=l. オペレータ ( 「wm.context_セット_価値」 、テキスト=は 「bpy.context値を設定する」 ) prop. valu e=を支える、 「こんにちは、世界的では、」 prop. data_経路 は 「メニュー_test.test_価値」 と等しい。 l. operator ( "mesh.remove_doubles" ) # bl_idname if one exists, otherwise class prop = l. operator ( "wm.context_set_value" , text= "Set a bpy.context value" ) prop. value = "hello world" prop. data_path = "menu_test.test_value" クール である、_例 ( 自己 、Context(コンテキスト) ) を追加する: def append_example ( self , context ) : lは self . layout と等しい。 l = self . layout l. 分離符 ( ) 20l. ラベル ( 「追加されたセクション」 ) 20l. メニュー ( 「VIEW3 D_MT_編集_メッシュ_スペシャル」 、アイコン= 「メッシュ_デ ータ」 ) 20 de fレジス タ ( ) : l. separator ( ) bpy. types . register ( MyMenu ) 20# ここに直接メニュー を呼ぶと、Blenderは墜落する。 #このファイルを輸入 する、そして、 代わりに呼び出し_習慣_メニュー()を手動で走らせる。 l. label ( "An appended section" ) # 三次元ビューにおけるキーボード入力。 これはデフォルトだけを設定 する、そして、 ユーザが3D View keyconfig編集!km=bpy. context . manager . active_keyconfig . keymaps [ '3D View' ] kmiがkm. items . add ( 'wm.call_メニュー' 、 'G' 'PRESS' ) kmi. properties . name 等しさ 「テスト_メニュー」 との等しさにすると、#、は働 かない。 l. menu ( "VIEW3D_MT_edit_mesh_specials" ,icon= "MESH_DATA" ) クール な呼び出し_習慣_メニュー ( ) : def register ( ) : bpy. types . test_menu . append ( _例を追加する ) bpy. ops . wm . call_メニュー ( 名前=MyMenu. bl_idname ) bpy. types . test_menu . remove ( _例を追加する ) 20 i f__名前__= 「メイン」 : bpy. types . register ( MyMenu ) レジスタ ( ) # Directly calling the menu here crashes Blender; import # this file and run call_custom_menu() manually instead. # Keyboard input in 3D view. This sets defaults only and # will not work if the user has 3D View keyconfig edits! km = bpy. context . manager . active_keyconfig . keymaps [ '3D View' ] kmi = km. items . add ( 'wm.call_menu' , 'G' , 'PRESS' ) kmi. properties . name = "test_menu" def call_custom_menu ( ) : bpy. types . test_menu . append ( append_example ) bpy. ops . wm . call_menu ( name=MyMenu. bl_idname ) bpy. types . test_menu . remove ( append_example ) if __name__ == "main" : register ( )
See
the documentation for
bpy.types.UILayout
for a full list of what you can do, but note that some features only work on panels (see below).
bpy.types.UILayoutに関してできることに関する完全リストに関してドキュメンテーションを見るが、いくつかの特徴がパネルに働くだけであることに注意する(以下を見る)。
Menu frenzy: メニュー狂乱: If your script needs a lot of menus, it may be more efficient to create one generic class and
append()
and
remove()
the items you need whenever you open it.あなたのスクリプトが多くのメニューを必要とするなら、1つの一般的なクラスを創設して、()を追加して、() それを開くときはいつも、必要とする商品を取り外すのは、より効率的であるかもしれない。 You can't do this with submenus, unfortunately. 残念ながら、サブメニューでこれができない。 |
[
edit
]
Creating and positioning new panels
新しいパネルを作成して、置くこと。
Panels are the collapsible, draggable boxes seen in tool shelves and the Properties editor.
パネルは、ツール棚とPropertiesエディタで見られた折りたたみの、そして、「退屈-可能」な箱である。
They are very similar to menus, with two key differences:
それらは2つの主要な違いについてメニューと非常に同様である:
-
They support a wider range of layout objects
彼らは、より広い範囲の割付け対象を支持する。
-
Their location is predefined
それらの位置は事前に定義される。
import bpy 輸入 bpy class OBJECT_PT_hello ( bpy. types . Panel ) : _こんにちは、 クラス OBJECT_PT ( bpy. types . Panel ) : bl_label = "Hello World Panel" bl_ラベル=、 「こんにちは、世界パネル、」 bl_space_type = "PROPERTIES" bl_空間_タイプは 「特性」 と等しい。 bl_region_type = "WINDOW" bl_領域_タイプは 「ウィンドウ」 と等しい。 bl_context = "object" 「物」 というbl_Context(コンテキスト)= def draw ( self , context ) : クール なドロー ( 自己 、Context(コンテキスト) ) : layout = self . layout レイアウトは self . layout と等しい。 obj = context. object objはcontext. object と等しい。 layout. label ( text= "Hello world!" , icon= 'WORLD_DATA' ) layout. label ( テキストが等しい、 「こんにちは、世界!、」 、アイコン= 'WORLD_DATA' ) 20col=layout. column ( ) col. label ( テキストは+ 「アクティブオブジェクトは以下の通りである」 obj. name と等しい ) col. prop ( obj、 「名前」 ) 20bpy. types . register ( _PT_が反対する、こんにちは、 ) col = layout. column ( ) col. label ( text= "Active object is: " + obj. name ) col. prop ( obj, "name" ) bpy. types . register ( OBJECT_PT_hello )
This panel will appear in the Object properties tab, as defined by the
bl_space_type
,
bl_region_type
and
bl_context
variables.
このパネルは、bl_空間_タイプ、bl_領域_タイプ、およびbl_Context(コンテキスト)変数によって定義されるように、Object特性のタブに現れる。
See the docs for a run-down of valid values
, but be aware that only certain combinations will work.
docsを見る、有効値で大荒れしていて、ある組み合わせだけが望んでいるのを意識しているのを除いて、働いている。
Code re-use: コード再使用: It is possible insert the contents of a menu directly into a panel, and to a certain extent vice versa. それは可能である。逆もまた同様にパネルの直接中と、そして、ある程度にメニューのコンテンツを挿入する。 Just call the relevant function. ただ関連機能に電話をする。 |
[
edit
]
Layout tips
レイアウト情報
Most
layout objects
are self-explanatory.
ほとんどの割付け対象が自明である。
Those that are not are below.
そうするそれらは以下にいない。
-
operator_context
オペレータ_Context(コンテキスト)
(enum_str)
-
The manner in which operators in this layout are called.
このレイアウトにおけるオペレータが呼ばれる方法。
Defines whether the entry point isinvoke()
orexecute()
, and allows a context to be specified.
エントリー・ポイントが、()を呼び出すか、または()を実行することであり、Context(コンテキスト)が指定されるのを許容するか否かに関係なく、定義する。
-
column
コラム
()
-
Reduces the vertical spacing between contained elements.
含まれた要素の間の行送りを減少させる。
Does not split the layout vertically - usesplit()
orcolumn_flow()
for that.
雌ジカは垂直にレイアウトを分けなかった--使用はそれのために()かコラム_流れ()を分けた。
-
column_flow
コラム_流れ
(columns=N)
(コラムはNと等しい)
-
Creates N columns, with sub-layouts flowing left to right through them.
サブ・レイアウトがそれらを通して左に右に注いでいるNコラムを作成する。
Great withfor
loops.
すばらしい、輪のために。
-
prop
支柱
(object,"value")
(「値」に反対する)
-
If you want to use this with a custom property defined by your script, you must first register it with
bpy.types.<class>.<type>Property(args)
.
あなたのスクリプトで定義されるカスタム特性と共にこれを使用したいと思うなら、最初に、bpy.typesにそれを登録しなければならない。><のクラス<は>Property(args)をタイプする。
-
introspect
内省する。
()
-
Returns a list containing all elements of the menu.
メニューのすべての要素を入れてあるリストを返す。
-
alignment
整列
()
-
Possibly text alignment, but seems broken?
ことによるとテキスト整列だけ、壊れているように見えるか?