From BlenderWiki
BlenderWikiから

Jump to:
以下のことのためにジャンプする。
navigation
ナビゲーション
,
search
検索
This page documents Blender 2.5 features, if you're looking for Blender 2.4x doc please read Doc:Manual or Doc:Tutorials .
このページはBlender2.5の特徴をドキュメント化したものです。Blender2.4xのドキュメントをお探しならば、Doc:ManualかDoc:Tutorialsを読んでください。


[ edit ] The Console Editor Type
コンソール・エディタ・タイプ

The interactive console in Blender 2.5 has been improved.
Blender2.5の対話的なコンソールは改良された。
Auto Complete, Python Reporting & more features have been added.
自動Complete、パイソンReporting、および、より多くの特徴が加えられる。
Testing one-liners in the console is a good way to learn the Python API.
コンソールで寸言をテストするのは、パイソンAPIを学ぶ早道である。

[ edit ] Accessing Built-in Python Console
内蔵のニシキヘビ・コンソールにアクセスすること。

Launching the Console using mouse.
マウスを使用することでConsoleを発射する。

By pressing ?
押すことによって?
Shift F4 in any Blender Editor Type (3D View, Timeline etc.,) you can change it to a Console Editor.
どんなBlender Editor TypeのShiftF4、も(Timelineの3D Viewなど、)、それをConsole Editorに変えることができる。

From the screen shot above, you will notice that apart from the usual hot keys that are used to navigate, by pressing Ctrl Space you can enable Auto-complete feature.
上に撃たれたスクリーンから、CtrlSpaceを押すことによってナビゲートするのに使用される普通のホットキーは別としてAuto完全な特徴を可能にすることができるのに気付く。

Since Blender 2.5 uses Python 3.1, the interpreter is loaded and is ready to accept commands at the prompt >>>
Blender2.5がパイソン3.1を使用するので、インタプリタは、積み込まれて、迅速な>>>でコマンドを受け入れる準備ができている。

[ edit ] First look at the Console Environment
まず最初に、Console Environmentを見る。

To check what is loaded into the interpreter environment, type dir() at the prompt and execute it.
インタプリタ環境にロードされることをチェックするために、プロンプトでdir()をタイプする、そして、それを実行する。

Following is a quick overview of the output
以下に、出力の迅速な概観がある。

' C'
A handle to Blender's Context
BlenderのContextへのハンドル
' __builtins__'
Built-ins of Python 3.1
ニシキヘビ3.1の組立の人気のある人
(Classes, functions, variables)
(クラス、機能、変数)
' bpy'
Top level Blender Python API module.
トップ平らなBlenderパイソンAPIモジュール。

[ edit ] Auto Completion at work
仕事における自動Completion

Now, type bpy. and then press Ctrl Space and you will see the Console auto-complete feature in action.
今、タイプbpyその時はCtrlSpaceを押す、そして、Consoleの自動完全な特徴が動作中であることを見る。

You will notice that a list of sub-modules inside of bpy appear.
bpyのサブ・モジュール内部のリストが現れるのに気付く。
These modules encapsulate all that we can do with Blender Python API and are very powerful tools.
これらのモジュールは、私たちがBlenderパイソンAPIでできるすべてを要約して、非常に強力なツールである。

Lets list all the contents of bpy.app module.
bpy.appモジュールのすべてのコンテンツを記載させる。

Notice the green output above the prompt where you enabled auto-completion.
自動完成を可能にしたプロンプトの上で緑色の出力に注意する。
What you see is the result of auto completion listing.
見るものは、自動完成リストの結果である。
In the above listing all are module attribute names, but if you see any name end with '('m then that is a function.
すべてがモジュール属性名にもかかわらず、いずれも終わりを命名するのを見るかどうかという上のリストでは、ことである、'、(次に、それが機能であるということである。

We will make use of this a lot to help our learning the API faster.
私たちは、私たちが、より速くAPIを学ぶのを助けるのにこれを大いに利用する。
Now that you got a hang of this, lets proceed to investigate some of modules in bpy.
このハングを得て、bpyのモジュールのいくつかを調査しかけるのをさせる現在。

[ edit ] Before tinkering with the modules..
以前、いじくりまわすのは、モジュールでそうする。

If you look at the 3D Viewport in the default Blender scene, you will notice 3 objects:
デフォルトBlender場面の3D Viewportを見ると、3個の物に気付く:
Cube, Lamp and Camera.
Cube(キューブ)、ランプ、およびCamera(カメラ)。

  • All objects exist in a context and there can be various modes under which they are operated upon.
    すべての物がContext(コンテキスト)に存在している、そして、それらで作動する様々なモードがあることができる。
  • At any instance, only one object is active and there can be more then one selected objects.
    どんな例でも、1個の物だけが活性である、そして、以上があることができた、そして、次に、1つは物を選択した。
  • All objects are data in the Blender file.
    すべての物がBlenderファイルのデータである。
  • There are operators/functions that create and modify these objects.
    これらの物を作成して、変更するオペレータ/機能がある。

For all the scenarios listed above (not all were listed, mind you..) the bpy module provides functionality to access and modify data.
上(すべてが記載されたというわけではなくて、心はあなたである。)に記載されたすべてのシナリオのために、bpyモジュールはデータにアクセスして、変更する機能性を提供する。

[ edit ] Examples
の例

[ edit ] bpy.context
bpy.context

Note
注意
For the commands below to show the proper output, make sure you have selected object(s) in the 3D view.
以下のコマンドは、三次元ビューで物を選択したのを適切な出力を必ず示している。

[ edit ] Try it out!
それを十分に試す!

bpy.context.mode
Will print the current 3D View mode
現在の3D Viewモードを印刷する。
(Object, Edit, Sculpt etc.,)
(物、Edit、 Sculptなど、)
bpy.context.object or bpy.context.active_object
bpy.context.objectかbpy.context.active_物
Will give access to the active object in the 3D View
3D Viewのアクティブオブジェクトへのアクセスを与える。

>>>

 bpy.

context

.

object

.

location

.

x

 =

1


>>>

bpy.

context

.

object

.

location

.

x

=

1

Change x location to a value of 1
x位置を1の値に変える。

>>>

 bpy.

context

.

object

.

location

.

x

 +=

0.5


>>>

bpy.

context

.

object

.

location

.

x

+=

0.5

Move object from previous x location by 1 unit
1ユニットは前のx位置から物体を動かす。

>>>

 bpy.

context

.

object

.

location

 =

[


1

,

2

,

3


]


>>>

bpy.

context

.

object

.

location

=

[


1

,

2

,

3


]

Changes x, y, z location
変化x、y、z位置

>>>

 bpy.

context

.

object

.

location

.

xyz

 =

[


1

,

2

,

3


]


>>>

bpy.

context

.

object

.

location

.

xyz

=

[


1

,

2

,

3


]

Same as above
同じくらい上では、同じである。

>>>


type


(

bpy.

context

.

object

.

location


)


>>>


タイプ


(

bpy.

context

.

object

.

location


)

Data type of objects location
物の位置に関するデータ型

>>>


dir


(

bpy.

context

.

object

.

location


)


>>>


dir


(

bpy.

context

.

object

.

location


)

Now that is a lot of data that you have access to
近づく手段を持っているデータがいろいろな事があるので
bpy.context.selected_objects
bpy.context.selected_物
Will give access to a list of all selected objects
すべての選択された物のリストへのアクセスを与える。
(including the active object)
(アクティブオブジェクトを含んでいる)

>>>

 bpy.

context

.

selected_objects

 then press

{


{

Shortcut|Ctrl|Space

}


}

 そして、

>>>

bpy.

context

.

selected_物

は押される。

S


h

ortcut|Ctrl|Spa

c


e


>>>

 bpy.

context

.

selected_objects


[


0


]


>>>

bpy.

context

.

selected_物


[


0


]

Prints out name of first object in the list
リストで最初の物の名前を印刷する。

>>>


[


object


for


object


in

 bpy.

context

.

selected_objects


if


object


!

= bpy.

context

.

object


]


>>>。


[


のために

であればbpy.

context

.

selected_物

反対する!

=







bpy.


context

.

object


]

Complex one.. But this prints a list of objects not including the active object
複合体1 しかし、これはアクティブオブジェクトを含まない物のリストを印刷する。

[ edit ] bpy.data
bpy.data

bpy.data has a bunch of functions and variables that give you access to all the data in the Blender file.
bpy.dataには、Blenderファイルのすべてのデータへのアクセスをあなたに与える多くの機能と変数がある。

You can access following data in the current Blender file:
現在のBlenderファイルの次のデータにアクセスできる:

objects, meshes, materials, textures, scenes, screens, sounds, scripts, texts,
cameras, curves, lamps, brushes, armatures, images, lattices, libraries, worlds,
groups, metaballs, particles, node_groups
物、メッシュ、材料、織地、場面、スクリーン、音、スクリプト、テキスト、Camera(カメラ)は曲がる、
ランプ、ブラシ、接極子、イメージ、格子、ライブラリ、世界、グループ、メタボール、Particles(パーティクル)、
ノード_グループ

That's a lot of data.
それは多くのデータである。

[ edit ] Try it out!
それを十分に試す!

[ edit ] Exercise
運動


>>>


for


object


in

 bpy.

data

.

scenes


[


'Scene'


]

.

objects

:

print


(


object

.

name


)

 bpy.

data

.

scenes


[


'場面'


]

.

objects

のための

>>>





:

印刷


(


object

.

name


)

? Enter twice
Enter2倍
Prints the names of all objects belonging to the Blender scene with name "Scene"
名前「場面」でBlender場面に属すすべての物の名前を印刷する。

>>>

 bpy.

data

.

scenes


[


'Scene'


]

.

objects

.

unlink


(

bpy.

context

.

active_object


)


>>>

bpy.

data

.

scenes


[


'場面'


]

.

objects

.

unlink


(

bpy.

context

.

active_物


)

Unlink the active object from the Blender scene named 'Scene'
'場面'というBlender場面からアクティブオブジェクトを放す。

>>>

 bpy.

data

.

materials


[


'Material'


]

.

shadows


>>>

bpy.

data

.

materials


[


'材料'


]

.

shadows


>>>

 bpy.

data

.

materials


[


'Material'


]

.

shadows

 =

False


>>>

bpy.

data

.

materials


[


'材料'


]

.

shadows

と等しい。

[ edit ] bpy.ops
bpy.ops

The tool/action system in Blender 2.5 is built around the concept of operators.
Blender2.5のツール/行為システムはオペレータの概念の周りで組立てられる。
These operators can be called directly from console or can be executed by click of a button or packaged in a python script.
これらのオペレータを直接コンソールから呼ぶことができるか、ボタンのクリックによって実行されるか、またはニシキヘビ・スクリプトでパッケージできる。
Very powerful they are..
非常に強力なそれらはそうである。

For a list of various operator categories, click here
様々なオペレータ・カテゴリのリストに関しては、ここをクリックする。

Lets create a set of five Cubes in the 3D Viewport.
3D Viewportに5Cubesの1セットを創設させる。
First, delete the existing Cube object by selecting it and pressing X
まず最初に、それを選択して、Xを押すことによってCubeが反対する存在を削除する。

[ edit ] Try it out!
それを十分に試す!

The following commands are used to specify that the objects are created in layer 1
以下のコマンドは、物が層1の中で作成されると指定するのに使用される。


>>>

 layers =

[


False


]


*


32


>>>

 layers

[


0


]

 =

True


>>>

層は=

本当に


32

個の

[


っている

]

*


>>>

[


0


]

と等しい。

We create a reference to the operator that is used for creating a cube mesh primitive
私たちは原始的にCube(キューブ)メッシュを作成するのに使用されるオペレータについての言及を作成する。


>>>

 add_cube = bpy.

ops

.

mesh

.

primitive_cube_add


>>>

は_bpy.

ops

.

mesh

.

primitive_Cube(キューブ)_が加え

るCube(キューブ)=を加える。

Now in a for loop, we create the five objects like this (In the screenshot above, I used another method) Press ENTER-KEY twice after entering the command at the shell prompt.
中の現在、輪のために、シェル・プロンプトでコマンドを入力した後に、私たちは、この(映画の撮影では、上では、私が別の方法を使用した)プレスENTER-KEYのように二度5個の物を作成する。


>>>


for

 index

in


range


(


0

,

5


)

:

範囲


(


0

5


)

のインデックスのための

>>>





:
 ...

add_cube


(

location=

(

index

*


3

,

0

,

0


)

, layer=layers

)

 ...

_Cube(キューブ)を加える。


(

位置の=

(

インデックス

*


3

0

0


)

層=層

)



If you have any question about this page topics, please leave a message in the discussion page .
何かこのページ話題に関する質問がありましたら議論ページのメッセージを残す。

Please report any problems editing or creating these pages:
これらのページを編集するか、または作成することにおけるどんな問題も報告する:
Missing images in this page
このページのなくなったイメージ
,
Broken links in this page .
このページのリンク切れ。
Thanks!
ありがとうございます!


Retrieved from " http://wiki.blender.org/index.php/Doc:2.5/Manual/Extensions/Python/Console "
" http://wiki.blender.org/index.php/Doc:2.5/Manual/Extensions/Python/Console "から、検索される。