LoginSignup
0
0

More than 5 years have passed since last update.

DAZ Scriptでメッセージボックスを表示する(Global オブジェクトについて)

Last updated at Posted at 2018-10-27

※本記事は、Blogの方にも投稿しています。
http://lowpolysnow.com/wp/20181203/56/


DAZ Scriptではメッセージボックスの表示やSceneパネルのノードの取得などの機能を、Globalオブジェクトとして提供しています。

詳しくは、以下にリファレンスがあります。

Global [Documentation Center]
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/global

Global「オブジェクト」と呼んでいますが、実際には「Global」をシンタックスとして指定する必要はなく、例えばメッセージボックスを表示したいときは、MessageBoxプロパティを直接指定します。

(function () {
    MessageBox.information("do it ! ジャスト ドゥ イット!", "doit()", "OK");
})();

実行結果は次のようになります。
1540478954508.png

リファレンスのMessageBoxプロパティの項を参照するとわかりますが、Globalシンタックスが省略されているものの、実際にはGlobalオブジェクトのMessageBoxプロパティを指定しており、DzMessageBoxオブジェクトを取得しています。上記の例では、そのDzMessageBoxオブジェクトのinformationメソッドを実行しています。

リファレンスのページにGlobalオブジェクトの詳しい説明があります。

The global object is never used directly, and cannot be created using the new operator. It is automatically created when the scripting engine is initialized, and its functions and properties are available immediately. The global object has no syntax. Its functions and properties are accessed directly.

Globalオブジェクトは直接使用されず、またnew演算子でインスタンスを作成するもできません。DAZ Scriptエンジンが初期化されると自動的に作成され、そのメソッドとプロパティはすぐに利用することができます。Globalオブジェクトにはシンタックスがありません。メソッドとプロパティは直接アクセスします。

要は、次の様には利用できません。

//このコードはエラーになります。
(function () {
    Global.MessageBox.information("do it ! ジャスト ドゥ イット!", "doit()", "OK");
})();

他にも、次のようなプロパティを使用することができます。(詳しくはリファレンス参照)

ECMA Script由来
  • Math:数学関数のライブラリです。

など

DAZ Script由来
  • MessageBox:画面上にメッセージボックスを表示します。
  • Scene:Sceneパネルの情報にアクセスします。

など

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0