Module: scenes

Scene API. Most of the routines presented here require an active scene to be set, use get_active() set_active() to do that.

Summary

Members

Methods

Type Definitions

Detailed Description

Members

DATA_ID_ALL

All possible data IDs.
Source:

Methods

append_object(obj, scene_nameopt)

Append copied object to the scene.
Parameters:
Name Type Attributes Description
obj Object3D Object 3D
scene_name String <optional>
Name of the scene
Source:

apply_outline_anim(obj, tau, T, N)

Apply outlining animation to the object
Parameters:
Name Type Description
obj Object3D Object 3D
tau Number Outlining duration
T Number Period of outlining
N Number Number of relapses (0 - infinity)
Source:

apply_outline_anim_def(obj)

Apply outlining animation to the object and use the object's default settings
Parameters:
Name Type Description
obj Object3D Object 3D
Source:

can_select_objects() → {Boolean}

Check if objects can be selected
Returns:
True if objects can be selected.
Type
Boolean
Source:

check_object(obj) → {Boolean}

Check the object's availability in the active scene.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Check result
Type
Boolean
Deprecated:
Source:

check_object_by_dupli_name(empty_name, dupli_name, data_idopt) → {Boolean}

Check if duplicated object is present on scene by empty name and dupli name.
Parameters:
Name Type Attributes Default Description
empty_name String Name of the EMPTY object used to duplicate the object
dupli_name String Name of the duplicated object
data_id Number <optional>
0 ID of loaded data
Returns:
Check result
Type
Boolean
Source:

check_object_by_dupli_name_list(name_list, data_idopt) → {Boolean}

Check if duplicated object is present on scene by empty name and dupli name list.
Parameters:
Name Type Attributes Default Description
name_list Array.<String> List of the EMPTY and DUPLI object names: [empty_name,empty_name,...,dupli_name]
data_id Number <optional>
0 ID of loaded data
Returns:
Check result
Type
Boolean
Source:

check_object_by_name(name, data_idopt) → {Boolean}

Check if object with given name is present on scene.
Parameters:
Name Type Attributes Default Description
name String Object name
data_id Number <optional>
0 ID of loaded data
Returns:
Check result
Type
Boolean
Source:

clear_outline_anim(obj)

Stop outlining animation for the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Source:

get_active() → {String}

Get the current active scene
Returns:
Active scene name
Type
String
Source:

get_active_camera() → {Object3D}

Return the active camera object from the active scene.
Returns:
Camera object.
Type
Object3D
Source:
Example
var m_scenes = require("scenes");
var camera = m_scenes.get_active_camera();

get_all_objects(typeopt, data_idopt) → {Array.<Object3D>}

Get all objects from the active scene.
Parameters:
Name Type Attributes Default Description
type String <optional>
"ALL" Type
data_id Number <optional>
DATA_ID_ALL Objects data id
Returns:
Array with objects.
Type
Array.<Object3D>
Source:

get_bloom_params() → {BloomParams}

Get bloom parameters
Returns:
bloom parameters
Type
BloomParams
Source:

get_cam_water_depth() → {Number}

Return the camera water depth or null if there is no water.
Returns:
Depth
Type
Number
Source:

get_color_correction_params() → {ColorCorrectionParams}

Get color correction params
Returns:
Color correction params
Type
ColorCorrectionParams
Source:

get_dof_params() → {DOFParams}

Get depth-of-field (DOF) params.
Returns:
DOF params
Type
DOFParams
Source:

get_environment_colors() → {Array}

Get horizon and zenith colors of the environment.
Returns:
Environment colors
Type
Array
Source:

get_first_character() → {Object3D}

Find the first character on the active scene.
Returns:
Character object.
Type
Object3D
Source:

get_fog_color_density(dest) → {Vec4}

Get fog color and density.
Parameters:
Name Type Description
dest Vec4 Destnation vector [C,C,C,D]
Returns:
Destnation vector
Type
Vec4
Source:

get_fog_params() → {FogParams|Vec4}

Get fog params
Returns:
  • Fog params
    Type
    FogParams
  • Destnation vector
    Type
    Vec4
Source:

get_glow_material_params() → {GlowMaterialParams}

Get glow material parameters
Returns:
glow material parameters
Type
GlowMaterialParams
Source:

get_god_rays_params() → {GodRaysParams}

Get god rays parameters
Returns:
god rays parameters
Type
GodRaysParams
Source:

get_mb_params() → {MotionBlurParams}

Get motion blur params.
Returns:
Motion blur params
Type
MotionBlurParams
Source:

get_meta_tags() → {SceneMetaTags}

Get the Blender-assigned meta tags from the active scene.
Returns:
Scene meta tags
Type
SceneMetaTags
Source:

get_object_by_dupli_name(empty_name, dupli_name, data_idopt) → {Object3D}

Get the duplicated object by empty name and dupli name.
Parameters:
Name Type Attributes Default Description
empty_name String Name of the EMPTY object used to duplicate the object
dupli_name String Name of the duplicated object
data_id Number <optional>
0 ID of loaded data
Returns:
Object 3D
Type
Object3D
Source:

get_object_by_dupli_name_list(name_list, data_idopt) → {Object3D}

Get the duplicated object by empty name and dupli name list.
Parameters:
Name Type Attributes Default Description
name_list Array.<String> List of the EMPTY and DUPLI object names: [empty_name,empty_name,...,dupli_name]. Can be retrieved with the get_object_name_hierarchy() method.
data_id Number <optional>
0 ID of loaded data.
Returns:
Object 3D.
Type
Object3D
Source:

get_object_by_name(name, data_idopt) → {Object3D}

Get object by name.
Parameters:
Name Type Attributes Default Description
name String Object name
data_id Number <optional>
0 ID of loaded data
Returns:
Object 3D
Type
Object3D
Source:
Example
var m_scenes = require("scenes");
var cube = m_scenes.get_object_by_name("Cube");

get_object_children(obj) → {Array.<Object3D>}

Return the object's children.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Array of children objects.
Type
Array.<Object3D>
Source:

get_object_data_id(obj) → {Number}

Returns object data_id property.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
data_id Data ID property
Type
Number
Source:

get_object_dg_parent(obj) → (nullable) {Object3D}

Return the object's parent.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Parent object
Type
Object3D
Deprecated:
Source:

get_object_name(obj) → {String}

Get the object's name.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Object name
Type
String
Source:

get_object_name_hierarchy(obj) → (nullable) {Array}

Get the object names hierarchy (considering dupli group parenting).
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Object names hierarchy array (from the highest parent to the object itself).
Type
Array
Source:

get_object_type(obj) → {String}

Get the object's type.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Object type
Type
String
Source:

get_outline_color(destnullable) → {RGB}

Get the color of outline outline effect for active scene.
Parameters:
Name Type Attributes Description
dest RGB <nullable>
Destination RGB color vector
Returns:
Destination RGB color vector
Type
RGB
Source:

get_outline_intensity(obj) → {Number}

Get outline intensity for the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Intensity value
Type
Number
Source:

get_scenes() → {Array.<String>}

Get all scene names.
Returns:
Array of scene names.
Type
Array.<String>
Source:

get_shadow_params() → {ShadowParams}

Get shadow params.
Returns:
Shadow params
Type
ShadowParams
Source:

get_shore_dist(trans, v_dist_multopt) → {Number}

Return the distance to the shore line.
Parameters:
Name Type Attributes Default Description
trans Vec3 Current translation.
v_dist_mult Number <optional>
1 Vertical distance multiplier.
Returns:
Distance.
Type
Number
Source:

get_sky_params() → {SkyParams}

Get sky params
Returns:
Sky params
Type
SkyParams
Source:

get_ssao_params() → {SSAOParams}

Get SSAO params
Returns:
SSAO params
Type
SSAOParams
Source:

get_type_mesh_object(obj) → {String}

Return type of mesh object or null.
Parameters:
Name Type Description
obj Object3D Object 3D.
Returns:
Render type: "DYNAMIC" or "STATIC".
Type
String
Source:

get_water_mat_params(water_params)

Get water material parameters.
Parameters:
Name Type Description
water_params WaterParams Water parameters
Source:

get_water_surface_level(pos_x, pos_z) → {Number}

Get water surface level.
Parameters:
Name Type Description
pos_x Number World x position
pos_z Number World z position
Returns:
Surface level
Type
Number
Source:

get_wind_params() → {WindParams}

Get wind parameters
Returns:
Wind params
Type
WindParams
Source:

get_world_by_name(name, data_idopt) → {Object3D}

Get world by name.
Parameters:
Name Type Attributes Default Description
name String World name
data_id Number <optional>
0 ID of loaded data
Returns:
Object 3D
Type
Object3D
Source:

hide_object(obj, ignore_childrenopt)

Hide object and his children if it's necessary. Supported only for dynamic meshes/empties and lamps.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
ignore_children Boolean <optional>
false Ignore children parameter
Source:

is_hidden(obj) → {Boolean}

Check if object is hidden. Supported only for dynamic meshes/empties and lamps.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Check result
Type
Boolean
Source:

is_visible(obj) → {Boolean}

Check if object is visible.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Check result
Type
Boolean
Source:

marker_frame(name) → {Number}

Get timeline marker frame by name.
Parameters:
Name Type Description
name String Timeline marker name
Returns:
Timeline marker frame
Type
Number
Source:

outlining_is_enabled(obj) → {Boolean}

Check if the outlining is enabled or not for the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
Boolean
Source:

pick_object(x, y) → (nullable) {Object3D|Object3D}

For given mouse coords, render the color scene and return an object.
Parameters:
Name Type Description
x Number X Canvas coordinate.
y Number Y Canvas coordinate.
Returns:
  • The object under the given coordinates or null.
    Type
    Object3D
  • The object under the given coordinates or null.
    Type
    Object3D
Source:
Example
var m_cont = require("container");
var m_scenes = require("scenes");

var canvas_cont = m_cont.get_container();
cont.addEventListener("mousedown", down_cb);
var down_cb = function(event) {
    var obj = m_scenes.pick_object(event.clientX, event.clientY);
}

remove_object(obj)

Remove dynamic object from all scenes. Removing static physics object doesn't support.
Parameters:
Name Type Description
obj Object3D Object 3D
Source:

set_active(scene_name)

Set the active scene
Parameters:
Name Type Description
scene_name String Name of the scene
Source:

set_bloom_params(bloom_params)

Set bloom parameters
Parameters:
Name Type Description
bloom_params BloomParams Bloom parameters
Source:

set_color_correction_params(color_corr_params)

Set color correction params.
Parameters:
Name Type Description
color_corr_params ColorCorrectionParams Color correction params.
Source:

set_dof_params(dof_params)

Set depth-of-field (DOF) params
Parameters:
Name Type Description
dof_params DOFParams DOF parameters
Source:

set_environment_colors(opt_environment_energyopt, opt_horizon_coloropt, opt_zenith_coloropt)

Set horizon and/or zenith color(s) of the environment.
Parameters:
Name Type Attributes Description
opt_environment_energy Number <optional>
Environment Energy
opt_horizon_color RGB <optional>
Horizon color
opt_zenith_color RGB <optional>
Zenith color
Source:

set_fog_color_density(val)

Set fog color and density
Parameters:
Name Type Description
val Vec4 Color-density vector [C,C,C,D]
Source:

set_fog_params(fog_params)

Set fog params
Parameters:
Name Type Description
fog_params FogParams Fog params
Source:

set_glow_material_params(glow_material_params)

Set glow material parameters
Parameters:
Name Type Description
glow_material_params GlowMaterialParams Glow material parameters
Source:

set_god_rays_params(god_rays_params)

Set god rays parameters
Parameters:
Name Type Description
god_rays_params GodRaysParams God rays parameters
Source:

set_hmd_params(hmd_params)

Set head-mounted display params.
Parameters:
Name Type Description
hmd_params HMDParams Head-mounted display params.
Source:

set_mb_params(mb_params)

Set motion blur params.
Parameters:
Name Type Description
mb_params MotionBlurParams Motion blur params
Source:

set_outline_color(color)

Set the color of outline outline effect for active scene.
Parameters:
Name Type Description
color RGB RGB color vector
Source:

set_outline_intensity(obj, value)

Set outline intensity for the object.
Parameters:
Name Type Description
obj Object3D Object 3D
value Number Intensity value
Source:

set_shadow_params(shadow_params)

Set shadow params
Parameters:
Name Type Description
shadow_params ShadowParams Shadow params
Source:

set_sky_params(sky_params)

Set sky params
Parameters:
Name Type Description
sky_params SkyParams Sky params
Source:

set_ssao_params(ssao_params)

Set SSAO params
Parameters:
Name Type Description
ssao_params SSAOParams SSAO params
Source:

set_water_params(water_params)

Set water params
Parameters:
Name Type Description
water_params WaterParams Water parameters
Source:

set_wind_params(wind_params)

Set wind parameters
Parameters:
Name Type Description
wind_params WindParams Wind parameters
Source:

show_object(obj, ignore_childrenopt)

Show object and his children if it's necessary. Supported only for dynamic meshes/empties and lamps.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
ignore_children Boolean <optional>
false Ignore children parameter
Source:

update_scene_materials_params()

Update scene materials parameters.
Source:

Type Definitions

BloomParams

Bloom params.
Type:
  • Object
Properties:
Name Type Description
key Boolean Strength of bloom effect
edge_lum Boolean Bloom edge relative luminance. Bloom is visible above this value.
blur Boolean The amount of blur applied to bloom effect.
Source:

ColorCorrectionParams

Color correction params.
Type:
  • Object
Properties:
Name Type Description
brightness Number Brightness
contrast Number Constrast
exposure Number Exposure
saturation Number Saturation
Source:

HMDParams

Head-mounted display params.
Type:
  • Object
Properties:
Name Type Description
enable_hmd_stereo Boolean Enable hmd stereo
distortion_coefs Array Distortion coefficient list
chromatic_aberration_coefs Array Chromatic aberration coefficient list
base_line_factor Number Tray to lens-center distance divided by screen height
inter_lens_factor Number Inter-lens distance divided by screen width
Source:

SceneMetaTags

Scene meta tags.
Type:
  • Object
Properties:
Name Type Description
title String The title meta tag.
description String The description meta tag.
Source: