ドメインのコンテンツを保護する
エンティティフィルターは、ドメイン内のエンティティに対する不要な変更を防止するための特別なJavaScript関数です。サーバー全体、またはドメイン内の特定のゾーンに適用することができます。
コンテンツ
Add an Entity Filter to Your Domain
ドメインは、AssetServerまたはクラウドでホストされている任意のエンティティフィルターに接続できます。スクリプトを作成したら(または独自のスクリプトを使用して)、それをATPサーバーまたは選択したクラウドホスティングサービスにアップロードします。
ドメイン設定を開く。
クラウドでホストされているドメインの場合:ブラウザを開き、URL http://<ここにサーバーのIPアドレスを挿入>:40100/settingsを入力します。プロンプトが表示されたらログインします。
Windows上のローカルサーバーの場合:システムトレイのVircadiaアイコンをクリックしてから、[設定]をクリックします。
Macのローカルサーバーの場合:上部のメニューバーにあるVircadiaアイコンを右クリックし、[設定]をクリックします。
任意のOSの場合:ブラウザを開きhttp://localhost:40100/settingsを入力します。
On the top menu bar, select Content > Entities.
Click the 'Advanced Settings' button.
[Filter Entity Edits]の下に、エンティティフィルタースクリプトのURLを入力します。
Add an Entity Filter to a Zone in Your Domain
ドメイン全体ではなく、ドメイン内の特定のゾーンにエンティティフィルターを適用することができます。以下の操作を参照:
インターフェイスで、HUDまたはタブレットをプルアップして**Create**に移動します。
エンティティリストで、保護するゾーンを見つけて選択します。
In the Create Tools, click on the 'Properties' tab.
For 'Filter', enter the URL of your entity filter script.
Included Entity Filters
Vircadiaには、多数のサンプルエンティティフィルタースクリプトがインストールされています。これらは次のディレクトリにあります。
Windows: %Program Files%/Local/Vircadia/scripts/tutorials/entity_edit_filters
Mac: ~/Applications/Vircadia/interface/Contents/Resources/scripts/tutorials/entity_edit_filters
これらのサンプルスクリプトは、次のようにしてドメインコンテンツを保護する方法を示しています。
Keep an entity inside a bounding box
Only allow entities to be moved 5 meters or less
Prevent the addition of entities named "Bob"
Prevent entities from being deleted
これらのエンティティフィルターをそのまま使用するか、ドメインの独自のセキュリティニーズに合わせて変更してください。
Additional Script Examples
独自のエンティティフィルターを作成するのに役立つスクリプトの例をさらにいくつか示します。
// Only allow changes to entity's basic physics; reject all other changes including adds and deletes
(function() {
function filter() {
return false;
}
filter.wantsToFilterAdd = true; // run on adds
filter.wantsToFilterEdit = true; // run on edits
filter.wantsToFilterPhysics = false; // don't run on physics
filter.wantsToFilterDelete = true; // do run on deletes
filter;
});
// Reject all changes to your domain
function filter(properties, filterType, originalProperties) {
// doesn't matter here if rejectAll is set to true
}
// If reject all is true. Any of the filterType changes won't go through
filter.rejectAll = true; // default false