XSIApplication
v1.5
XSIApplication オブジェクトは Application から継承されます。Application は汎用的なプロパティとメソッドを持ちますが、XSIApplication のプロパティとメソッドは Softimage 固有のものです。XSIApplication は、Softimage のアクティブな Project、Selection オブジェクト、Softimage Command オブジェクトなどの高度なオブジェクトへのアクセスを管理します。
XSIApplication は、Softimage アプリケーションの実行インスタンスであるネイティブオブジェクト。ネイティブ(グローバル)オブジェクトは、そのインスタンスを作成せずともコード内で名前を参照できます。このオブジェクトの名前は Application です。つまり、スクリプトの記述者は'XSIApplication'タイプの'Application'という名前のグローバル変数があると予想することができます。
ただし、NetView スクリプト内では、明示的にXSIApplicationオブジェクトのインスタンスを作成する必要があるため、このオブジェクトはネイティブとして使用することはできません。NetView で XSIApplication オブジェクトを作成するためのスクリプト 構文については以下に例示します。
通常の(非 Netview) VBScript および JScript コードには、「アプリケーション」プリフィックスをドロップし、このオブジェクトのメソッドとプロパティを直接呼び出すことができます。たとえば、"LogMessage"の呼び出しとは、実際"Application.LogMessage"のショートフォームです。この構文上のショートカットは Pythonまたは PerlScript では使用できません。
また、XSIApplication のメソッドとして、すべての Softimage Command を実行することもできます。これは、Python と PerlScrip 内、または Netview 内で実行するすべてのスクリプト言語でコマンドを実行する最良の方法です。
' ' hello world from vbscript ' Application.LogMessage "Hello Softimage world" 'In vbscript we don't need to specify 'the Application. prefix LogMessage "Shortcut of Hello World" |
'
' How to create an instance of the Application Object
' from VBScript for use within a NetView html page.
'
Dim oApplication
set oApplication = CreateObject("XSI.Application")
'Use SIObject.Application to convert from Application object
'to XSIApplication
Dim oXSIApplication
set oXSIApplication = oApplication.Application
oXSIApplication.Application.LogMessage "Hello from Netview" |
/*
hello world from jscript
*/
Application.LogMessage("Hello Softimage world");
//This shortcut is equivalent
LogMessage("Hello from ShortCut code"); |
/*
How to create an instance of the Application Object
from JScript for use within a NetView html page.
*/
var oApplication = new ActiveXObject("XSI.Application");
var oXSIApplication = oApplication.Application;
oXSIApplication.LogMessage( "There are " + oXSIApplication.Plugins.Count + " plugins installed" ) ; |
#
# hello world from pythonscript
#
Application.LogMessage("Hello Softimage world") |
#Python script example, using the global Application #object to invoke the NewScene command. Application.NewScene( "",0 ) |
#
# How to create an instance of the Application Object
# from pythonscript for use within a NetView html page.
#
# Normally you create a instance of an automation object using:
# import win32com.client;
# o=win32com.client.Dispatch('XSI.Application')
# however win32com is not a trusted module so you get around
# this by defining a vbscript function called getXSIApp()
# that returns the Application object.
try :
Application = window.getXSIApp()
except :
print("No browser")
# Note: Python is not a fully functional choice for web programming.
# We recommend writing the Python code as Softimage Custom Commands
# which are invoked using a little JScript or VBScript embedded in the
# html. |