Module: objects

Objects API.

Additional topics in the User Manual: Object Transform API, Get Object API, Object Selection, Copying Objects (Instancing)

Summary

Methods

Type Definitions

Detailed Description

Methods

copy(obj, name, deep_copyopt) → {Object3D}

Copy MESH object.
Parameters:
Name Type Attributes Default Description
obj Object3D Object 3D
name string New unique object name
deep_copy boolean <optional>
false Copy WebGL buffers
Returns:
New object.
Type
Object3D
Source:
Example
var m_scenes    = require("scenes");
var m_objects   = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
var new_object = m_objects.copy(my_object, "NewObject");

create_line(name)

Create line object
Parameters:
Name Type Description
name string Line object name
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_line = m_objects.create_line("MyLine");

get_custom_prop(obj) → {*}

Get the Blender-assigned custom property field from the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Object custom property field
Type
*
Source:
Example
var m_scenes    = require("scenes");
var m_objects   = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
var my_custom_prop = m_objects.get_custom_prop(my_object);

get_dg_parent(obj) → (nullable) {Object3D}

Get DupliGroup parent object.
Parameters:
Name Type Description
obj Object3D Child object
Returns:
Parent object
Type
Object3D
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
var dg_parent = m_objects.get_dg_parent(my_object);

get_meta_tags(obj) → {ObjectMetaTags}

Get the Blender-assigned meta tags from the object.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Object meta tags
Type
ObjectMetaTags
Source:
Example
var m_scenes    = require("scenes");
var m_objects   = require("objects");

....

var my_object = m_scenes.get_object_by_name("MyObject");
var my_object_meta_tags = m_objects.get_meta_tags(my_object);

get_outlining_objects() → {Array.<Object3D>}

Get all scene outlining objects.
Returns:
Array with outlining objects.
Type
Array.<Object3D>
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var outlining_objects_list = m_objects.get_outlining_objects();

get_parent(obj) → (nullable) {Object3D}

Get parent object.
Parameters:
Name Type Description
obj Object3D Child object
Returns:
Parent object
Type
Object3D
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
var parent_object = m_objects.get_parent(my_object);

get_selectable_objects() → {Array.<Object3D>}

Get all scene selectable objects.
Returns:
Array with selectable objects.
Type
Array.<Object3D>
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var selectable_objects_list = m_objects.get_selectable_objects();

get_wind_bending_params(obj) → {WindBendingParams}

Get object's wind bending parameters. Object must be dynamic.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Wind Bending parameters
Type
WindBendingParams
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
var wind_params = m_objects.get_wind_bending_params(my_object);

hide_all_by_data_id(data_id)

Hide objects that have the given data_id.
Parameters:
Name Type Description
data_id number ID of loaded data.
Source:
Example
var m_obj = require("objects");
m_obj.hide_all_by_data_id(0);

is_armature(obj) → {boolean}

Check if the object is an ARMATURE.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_armature(my_object))
{
    console.log("This is an armature");
}
    else
{
   console.log("This is not an armature");
}

is_camera(obj) → {boolean}

Check if the object is a CAMERA.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_camera(my_object)) 
{
    console.log("This is a camera");
}
    else
{
    console.log("This is not a camera");
}

is_dynamic(obj) → {boolean}

Check if object is dynamic.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_dynamic(my_object))
{
    console.log("This is a dynamic object");
} 
    else
{
    console.log("This is not a dynamic object");
}

is_empty(obj) → {boolean}

Check if the object is an EMPTY.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_empty(my_object))
{
    console.log("This is an empty object");
} 
    else
{
    console.log("This is not an empty object");
}

is_lamp(obj) → {boolean}

Check if the object is a LAMP.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_lamp(my_object))
{
    console.log("This is a lamp");
} 
    else
{
    console.log("This is not a lamp");
}

is_line(obj) → {boolean}

Check if the object is a LINE.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_line(my_object))
{
    console.log("This is a line");
}
    else
{
    console.log("This is not a line");
}

is_mesh(obj) → {boolean}

Check if the object is a MESH.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_mesh(my_object) == true)
{
   console.log("This is a mesh object.");
}

is_speaker(obj) → {boolean}

Check if the object is a SPEAKER.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_speaker(my_object))
{
    console.log("This is a speaker");
}
    else
{
    console.log("This is not a speaker");
}

is_world(obj) → {boolean}

Check if the object is a WORLD.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
Checking result.
Type
boolean
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
if (m_objects.is_world(my_object))
{
    console.log("This is a world object");
}
    else
{
    console.log("This is not a world object");
}

set_wind_bending_params(obj, wb_params)

Set object's wind bending parameters. Object must be dynamic.
Parameters:
Name Type Description
obj Object3D Object 3D
wb_params WindBendingParams Wind Bending parameters
Source:
Example
var m_obj = require("objects");
var wb_params =
{
    angle: 45,
    main_frequency: 0.25,
    detail_frequency: 1,
    detail_amplitude: 0.1,
    branch_amplitude: 0.3
};
m_obj.set_wind_bending_params(obj, wb_params);

show_all_by_data_id(data_id)

Show objects that have the given data_id.
Parameters:
Name Type Description
data_id number ID of loaded data.
Source:
Example
var m_obj = require("objects");
m_obj.show_all_by_data_id(1);

update_boundings(obj)

Update object's boundings (box, cone, cylinder, ellipsoid, sphere, capsule).
Parameters:
Name Type Description
obj Object3D Object 3D
Source:
Example
var m_scenes = require("scenes");
var m_objects = require("objects");

var my_object = m_scenes.get_object_by_name("MyObject");
m_objects.update_boundings(my_object);

Type Definitions

ObjectMetaTags

Type:
  • Object
Properties:
Name Type Description
title string The title meta tag.
description string The description meta tag.
category string The category meta tag.
Source:

WindBendingParams

Wind bending params.
Type:
  • Object
Properties:
Name Type Description
angle number Angle of main wind bending in degrees
main_frequency number Frequency of main wind bending
detail_frequency number Frequency of detail wind bending
detail_amplitude number Amplitude of detail wind bending
branch_amplitude number Amplitude of branches wind bending
Source: