SIObject.Name operator

説明

オブジェクトの名前を String として設定したり、戻したりします。このプロパティを通して取得される名前は、コンテキストを持たないオブジェクト名です。たとえば、X3DObject オブジェクト("cube"など)の場合は、Name および SIObject.FullName はともに同じ名前を戻しますが、Primitive オブジェクトの場合は、Name がジオメトリのタイプを戻し("Polygon Mesh")、FullName は親オブジェクトを含むオブジェクト名の文字列で戻します("cube.polymsh")。

ActionDeltaItem の場合、このプロパティは Relative Name を戻します。これは、Delta がパラメータの SIObject.FullName の代わりに相対名を格納するためです。このため、アクションを簡単にある Model から別のものにコピーすることができます。

コマンドの名前(Name)は、スクリプトを記述するときに使用する名前や History ペインに記録される名前とは異なるため、コマンドを使って作業をする場合は、name プロパティ間の相違点は特に重要となります。この情報は、Command.ScriptingName プロパティに格納されています。

注:オブジェクトによっては名前を変更できない場合もあります。Softimage のビルトインパラメータセット/プロパティセットのパラメータなど、一部のオブジェクトに名前を設定しようとすると Name プロパティは機能しません(エラーも表示されません)。

C#構文

// get accessor

String rtn = SIObject.Name;

// set accessor

SIObject.Name = String;

1. VBScript の例

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

' This snippet creates a sphere (called 'sphere' by default)

' and then changes its name to "NewName"

set oObj = ActiveProject.ActiveScene.Root.AddGeometry("Sphere", "NurbsSurface")

printName oObj			' default name = "sphere"

oObj.Name = "NewName"

printName oObj			' new name = "NewName"

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

' This snippet tries to change the name of a built-in 

' parameter with no luck

set oParam = oObj.Properties( "Visibility" ).Parameters( "viewvis" )

printName oParam			' name = "View Visibility"

oParam.Name = "ThisWontWork"

printName oParam			' name is still the same

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function printName( in_obj )

	Application.LogMessage in_obj.Name

end function

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

' Output of above script:

'INFO : "sphere"

'INFO : "NewName"

'INFO : "View Visibility"

'INFO : "View Visibility"

2. VBScript の例

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

' This example demonstrates the differences between the name information you can

' access in Softimage. Specifically, it shows when you can use the Name, FullName, 

' ScriptingName, and ScriptName properties and what information they return.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CreateParticleCloud()

Application.LogMessage "PARTICLE CLOUD INFO.............."

showNames selection(0), "particle cloud"

set oCube = activesceneroot.addgeometry( "cube", "meshsurface" )

Application.LogMessage typename( oCube.parameters(0) )

Application.LogMessage "OBJECT INFO.............."

showNames oCube, "oCube"

Application.LogMessage "PRIMITIVE INFO.............."

showNames oCube.activeprimitive, "oCube.activeprimitive"

Application.LogMessage "GEOMETRY INFO.............."

showNames oCube.activeprimitive.geometry, "oCube.activeprimitive.geometry"

Application.LogMessage "PARAMETER INFO.............."

showNames oCube.activeprimitive.parameters(0), "oCube.activeprimitive.parameters(0)"

Application.LogMessage "PROPERTIES INFO.............."

showNames oCube.properties(0), "oCube.properties(0)"

Application.LogMessage "PARAMETER INFO.............."

showNames oCube.parameters(0), "oCube.parameters(0)"

Application.LogMessage "COMMAND INFO.............."

showNames application.commands(0), "application.commands(0)"

removefromselection oCloud 

addtoselection oCube 

set oOps = applyop( "twist" )

Application.LogMessage "OPERATOR INFO.............."

showNames oOps(0), "oOps(0)"



'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function showNames( in_ShowMe, in_ErrWhere )

	Application.LogMessage "-------------------------------------------------------------------"

	if typename( in_ShowMe ) <> "Nothing" then

		Application.LogMessage "Name = " & in_ShowMe.Name

		Application.LogMessage "FullName = " & in_ShowMe.FullName

		if typename( in_ShowMe ) = "Command" then

			Application.LogMessage "ScriptingName = " & in_ShowMe.ScriptingName 

		else

			Application.LogMessage "ScriptingName is not available for the " _

				& in_ShowMe.Name & " (it's only for commands)"

		end if

		if typename( in_ShowMe ) = "Parameter" then

			Application.LogMessage "ScriptName = " & in_ShowMe.ScriptName

		else

			Application.LogMessage "ScriptName is not available for the " _

				& in_ShowMe.Name & " (it's only for parameters)"

		end if

	else

		Application.LogMessage "Object required for " & in_ErrWhere

	end if

	Application.LogMessage "-------------------------------------------------------------------"

end function

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

' OUTPUT OF THIS SCRIPT IS:

'INFO : "PARTICLE CLOUD INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = cloud"

'INFO : "FullName = cloud"

'INFO : "ScriptingName is not available for the cloud (it's only for commands)"

'INFO : "ScriptName is not available for the cloud (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "Parameter"

'INFO : "OBJECT INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = cube"

'INFO : "FullName = cube"

'INFO : "ScriptingName is not available for the cube (it's only for commands)"

'INFO : "ScriptName is not available for the cube (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "PRIMITIVE INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = Polygon Mesh"

'INFO : "FullName = cube.polymsh"

'INFO : "ScriptingName is not available for the Polygon Mesh (it's only for commands)"

'INFO : "ScriptName is not available for the Polygon Mesh (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "GEOMETRY INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = polymsh"

'INFO : "FullName = polymsh"

'INFO : "ScriptingName is not available for the polymsh (it's only for commands)"

'INFO : "ScriptName is not available for the polymsh (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "PARAMETER INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Object required for oCube.activeprimitive.parameters(0)"

'INFO : "-------------------------------------------------------------------"

'INFO : "PROPERTIES INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = Kinematics"

'INFO : "FullName = cube.kine"

'INFO : "ScriptingName is not available for the Kinematics (it's only for commands)"

'INFO : "ScriptName is not available for the Kinematics (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "PARAMETER INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = Name"

'INFO : "FullName = cube.Name"

'INFO : "ScriptingName is not available for the Name (it's only for commands)"

'INFO : "ScriptName = Name"

'INFO : "-------------------------------------------------------------------"

'INFO : "COMMAND INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = Volumic"

'INFO : "FullName = Volumic"

'INFO : "ScriptingName = AddProp"

'INFO : "ScriptName is not available for the Volumic (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

'INFO : "OPERATOR INFO.............."

'INFO : "-------------------------------------------------------------------"

'INFO : "Name = Twist Op"

'INFO : "FullName = cube.polymsh.twistop"

'INFO : "ScriptingName is not available for the Twist Op (it's only for commands)"

'INFO : "ScriptName is not available for the Twist Op (it's only for parameters)"

'INFO : "-------------------------------------------------------------------"

関連項目

SIObject.FullName Command.ScriptingName Parameter.ScriptName