ジャンプ先: 概要. 戻り値. 関連項目. フラグ. Python 例.

概要

emit([attribute=string], [floatValue=float], [object=string], [position=[float, float, float]], [vectorValue=[float, float, float]])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

emit は 「元に戻す」が可能、「照会」が不可能「編集」が不可能 です。

放出 アクションで、エミッタを使用せずに既存のパーティクル オブジェクトにパーティクルを追加することができます。同時に、このアクションで作成されたパーティクルに、パーティクル単位の任意のアトリビュートを設定することができます。作成されたパーティクルは、そのパーティクル オブジェクトの初期状態の一部にはなりません。シーンが巻き戻されると、初期状態に保存されない限りは消滅します。さらに、開始フレーム以上のフレームでは、パーティクル オブジェクトは放出アクションからパーティクルのみを受け取ります。たとえば、放出アクションを使ってフレーム -5 にパーティクルを作成したい場合、そのパーティクル シェイプの開始フレームを -5 以下に設定する必要があります。多くのコマンドやアクションとは異なり、この放出アクションはそのフラグの順番を、その仕組みの場合と同じく重要な情報として使用します。 -object フラグと -position フラグは、引数リストの任意の場所に置くことができます。-attribute フラグと値フラグは、その順序に基づいて解釈されます。-attribute フラグの後とその次の -attribute フラグの前にある値フラグはすべて、引数リストで前にある一番近い -attribute フラグで指定したアトリビュートの値を設定します。これらのフラグの操作方法についての詳細は、以下のを参照してください。現在のところ、 dynExpression コマンドかエクスプレッション エディタ(Expression Editor)で定義されたパーティクル エクスプレッション内から作成されなければ、新規のパーティクルに作成時エクスプレッションは実行されません。パーティクルの作成時に特定の値を設定する場合、その値は -attribute-vectorValue、と -floatValue のフラグを使って設定します。

戻り値

int[] position フラグを渡したのと同じ順序で作成したパーティクルの particleId アトリビュート値のリストを含む整数配列。

関連項目

particle

フラグ

attribute, floatValue, object, position, vectorValue
ロング ネーム(ショート ネーム) 引数型 プロパティ
object(o) string create
このフラグは、DAG ですぐ上にある particleShape またはトランスフォームの名前を親として取得します。パーティクルを追加するオブジェクトを指定します。このアクションではセレクション リストが無視されるため、このフラグを渡す必要があります。
position(pos) [float, float, float] createmultiuse
パーティクルが作成されるパーティクル オブジェクト空間(通常はワールド空間)の位置を指定します。 フラグごとに、1 つのパーティクルが作成されます。
attribute(at) string createmultiuse
後続の値と次の -attribute フラグの前にある値フラグを関連付ける、パーティクル オブジェクトのアトリビュートを指定します。このコマンドで後で同じアトリビュートを指定し、最初のアトリビュートをオフにする場所を取得できます。 使用されるアトリビュートは、パーティクル単位のアトリビュートである必要があります。アトリビュートのロング ネーム、ショート ネームいずれも可能です。 注: パーティクルごとのアトリビュートは、このコマンド フラグを介して指定される前に、パーティクル オブジェクト上に存在している必要があります。
vectorValue(vv) [float, float, float] createmultiuse
「カレントの」パーティクルの「カレントの」アトリビュートに使用するベクトル値を設定します。カレントのアトリビュートとは、最新の -attribute フラグで指定されるアトリビュートを指します。カレントのパーティクルとは、「カレントの」アトリビュートに設定された値の数に該当する -position フラグの一覧にあるパーティクルを指します。カレントのアトリビュートが浮動小数点のパーティクル単位のアトリビュートであれば、このフラグで記述されたベクトルが使用されます。この長さは、 SQR( xVal2 + yVal2 + zVal2 ) として記述されます。
floatValue(fv) float createmultiuse
「カレントの」パーティクルの「カレントの」アトリビュートに使用する float 値を設定します。カレントのアトリビュートとは、最新の -attribute フラグで指定されるアトリビュートを指します。カレントのパーティクルとは、「カレントの」アトリビュートに設定された値の数に該当する -position フラグの一覧にあるパーティクルを指します。カレントのアトリビュートがベクトルのパーティクル単位のアトリビュートであれば、指定した float 値は、このベクトルの 3 つのコンポーネントすべてに使用されます。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

import maya.cmds as cmds

cmds.particle()
cmds.emit( object='particle1', position=(1, 1, 1) )

# This will create one particle at position <<1,1,1>> in the
# already-existing particle object <i>particle1</i>.
#

cmds.particle()
cmds.emit( object='particle1', position=((1, 1, 1), (2, 2, 2)), attribute=('velocity', 'rgbPP'), vectorValue=((1, 2, 3), (2, 3, 4), (.5, 1, 0)), floatValue=.1 )

# This will create two particles at positions <<1,1,1>> and <<2,2,2>> in
# the already-existing particle object <i>particle1</i>.  Then the velocity
# attribute of those particles is set to <<1,2,3>> and <<2,3,4>>,
# respectively.  Also, the rgbPP values are set to <<.5,1,0>> and
# <<.1,.1,.1>>, respectively.  Notice that the rgbPP value for the
# second particle was set with the -floatValue flag, even though rgbPP
# is a vector attribute.  The single value was converted into a vector.

cmds.particle()
cmds.emit( object='particle1', position=((1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5)), attribute=('velocity', 'mass', 'velocity'), vectorValue=((1, 2, 3), (2, 3, 4), (.1, .2, .3), (3, 4, 5)), floatValue=.5)

# This will create five particles in <i>particle1</i>.  The values
# for their attributes are:
#
# Attribute  Particle1   Particle2   Particle3   Particle4   Particle5
# ----------+-----------+-----------+-----------+-----------+---------
# position   <<<<1,1,1>>>>   <<<<2,2,2>>>>   <<<<3,3,3>>>>   <<<<4,4,4>>>>   <<<<5,5,5>>>>
# velocity   <<<<1,2,3>>>>   <<<<2,3,4>>>>   <<<<3,4,5>>>>   <b><<<<3,4,5>>>>   <<<<3,4,5>>>></b>
# mass     .5          .3742       <b>.3742       .3742       .3742</b>
#
# Notice that the second value for mass was seet with the -vectorValue
# flag, even though mass is a float attribute.  The vector was
# converted into a float by taking its length.  Also, notice the <b>bold</b>
# values in the table.  The values for those attribute values were not
# explicitly set in the command.  If there are fewer values given for
# an attribute than there are position flags, the remaining unset
# values are set to the last value set for that attribute.  This
# allows the user to set many of the values to be the same without
# having to use multiple value flags.  One last note.  Notice that the
# attribute flag was passed twice for the attribute velocity.  The value
# flags for repeated attributes pick up where the previous ones left
# off.

x = rand(1)
y = rand(1)
z = rand(1)
p = sphrand(5)
cmds.emit( object='particle1', pos=((x, y, z), ('($p.x)', '($p.y)', '($p.z)')) )

# This is a piece of Python code that could be put in a script or
# even in an expression.  It adds a random number of particles
# to the already-existing particle object <i>particle1</i>.  Since
# the number of particles as well as the positions and velocities
# of the particles are random, it would be impossible to just have
# the emit action itself in the expression or script.  It must be
# built as a string and then sent to the command processor with the
# <b>eval</b> or <b>evalEcho</b> commands.  Notice that when appending
# the vector variables to the string, it is not necessary to append
# each component of the vectors separately.  When they are converted
# from a vector to a string, the three components get separated with
# a space automatically, thus formatting them in the desired way.
# An example of a possible result from this "script" could be:

cmds.emit( object='particle1', pos=((1.899864198, -6.721569708, 0.585203937), (8.103957656, -4.042442985, 2.047724209), (-1.392914569, -0.109724376, 8.62265813), (1.960103537, -3.203145195, -7.6892516), (2.564072614, -6.049536895, 1.334818295), (-5.603376821, 4.33595058, 6.952385447), (-2.478591746, 6.286855715, 6.851659059), (2.424670276, -4.083412217, 6.320538621), (6.440800453, 3.405519296, 5.462135819), (2.445192551, 1.397203422, 3.443755853)), at='velocity', vv=((-2.348796409, 4.022130218, 0.5316172944), (4.149667117, -1.023146404, 1.97965556), (-0.08429132578, -0.5518495233, 1.591812495), (2.597930963, 1.033536331, -1.398351383), (-3.102859272, 3.423569856, 0.7895603241), (-2.519331228, -2.5684916, -1.530779154), (-2.645169119, -0.3186551381, 0.9164776099), (-0.6183816487, -1.060784068, -0.8748223942), (-0.2460372256, 3.567980747, -2.007567372), (1.735044809, -3.660099445, -1.765401859)) )

# The spacing in the string is just for formatting reasons and does
# not affect how the action executes or compiles.