API Reference
Loader
Crane.Loader.class
A class that render the viewer screen
Constructor
new Crane.Loader( unity [, options] )
Loader Returns an Instance
- Parameters
- unity
Crane.Loader
(default : 'viewer' )
Crane.Loader Instance of Class - options
Object
(default : { mode: 1 })
Setpoint object of Configuration object of the Loader
- mode Number`
In the SDK mode, the function that can be used according to each mode is limited and it will be optimized accordingly. (Reference)
- Example
Mode
Mode | Number | Explanation |
Viewer | 1 | You can see 3D objects. |
Editor | 2 | You can load 3D structure and place 3D products. |
Product Viewer | 3 | You can view 3D products. |
Floor Planner | 4 | You can convert the floorplan drawn directly on 2D to a 3D object for viewing. |
Events
setupMode
Event for when the mode is set
Structure
Crane.Structure.class
Class that contain architectural features
Constructor
new Crane.Structure( renderer )
Returns Structure Instance with the renderer instance created by the Loader Class as a parameter.
- Parameters
- renderer
Crane.Loader
Crane.Loader Instance of Class
- Example
Methods
set( id )
Sturcture that corresponds to the id is displayed on the screen.
- Parameters:
- id
String
Structure id given with the structure list
- Example
remove()
Remove the sturucture from display.
flipVertical()
Flip the structure vertically.
flipHorizontal()
Flip the sturucture horizontally.
changeStyleOfWall( materialId )
Change the wallpaper style to the corresponding id material.
- Parameters:
- materialId
String
Material id given with the material list
- Example
changeStyleOfFloor( materialId )
Change the flooring style to the corresponding id material.
- Parameters:
- materialId
String
Material id given with the material list
- Example
setWallOpacity( opacity )
Change the wall opacity.
- Parameters:
- opacity
Number
Number between 0 to 1 to represent the wall opacity
- Example
on( eventName, handler, context )
Register an event handler function for one event.
- Parameters:
- eventName
String
Event name created in Structure Events. - handler
Function
Function to execute when an event occurs - context
Object
This scope that will be referenced within the event function
- Example
off( eventName, handler, context )
Releases the event handler function registered in one event.
- Parameters:
- eventName
String
Event name created in structure events - handler
Function
Functions to execute when an event occurs - context
Object
This scope that will be referenced within the event function
- Example
Events
loaded
Events that occur after the object is loaded on the screen
removed
Events that occur after objects are removed from the screen
flipped
Events that occur when the object is revered up and down / left and right on the screen
- Arguments: Event Object
- event.scale
Array
Scale factor of the object for zoom in / out
- Example
wallStyleChanged
Events that occur after wallpaper changes
floorStyleChanged
Events that occur after flooring changes
Player
Crane.Player.class
Class that create instance for 3D Viewer
Constructor
new Crane.Player( renderer )
Returns instance of the Player.
- Parameters
- renderer
Crane.Loader
Instance of the Class for Crane.Loader
- Example
Methods
resize( size )
Change size of the 3D Player.
- Parameters
- size
Object
The object containing the height and width of the player, ‘width, height’
- Example
setQuality( quality )
Change the quality (resolution) of the 3D player.
- Parameters
- size
Number
Specify the quality (0~3).
- Example
setPlayerMode( mode )
Change the screen mode of the 3D player.
- Parameters
- mode
String
Screen mode, ‘orbit( outer )’, ‘fps( inner )’
- Example
setCeilingHeight( height )
Set the height of the ceiling.
- Parameters
- height
Number
Height of the ceiling
- Example
setProjectionMode( mode )
Change the projection mode of the 3D player.
- Parameters
- mode
String
(default : orthographic)
Projection mode perspective : orthographic
, orthographic : right angle projection
- Example
setPositionOfCamera( position )
Set the camera position of the 3D player.
- Parameters :
- position
String
Camera location init
, front
, back
, left
, right
, top
, bottom
- Example
setAngle( type )
Change the angle of view of the 3D player.
- Parameters :
- type
String
Angle of view low
, mid
, high
- Example
setBrightnessToMonthly( month )
Adjust the light according to the ‘month’.
- Parameters
- month
Number
A number between 1 and 12 representing the month
- Example
setBrightnessToHourly( hour )
Adjust the light according to ‘time’.
- Parameters
- hour
Number
A number between 1 and 12 representing the month
- Example
undo()
Return to the previous state.
redo()
Return to the following state.
clear()
Clear the screen.
Event
resize
Event for when the screen size has changed
updatedQuality
Event for when the quality information of the screen is changed
updatedMode
Event for when the player’s mode has changed
updatedCeilingHeight
Event for when the height of the ceiling has changed
updatedProjectionMode
Event to occur when the player’s projection mode has changed
updatedPositionOfCamera
Event to occur when position of orthogonal camera is changed
- Arguments
- ObserverPresetPosition
String
init : 0
, front : 1
, back : 2
, left : 3
, right : 4
, top : 5
, bottom : 6
- Example
updatedAngle
Event that occur when the angle of view of the player is changed
updatedBrightnessToMonthly
Event to occur when you change the brightness by adjusting the month
updatedBrightnessToHourly
Event to occur when you change the brightness by adjusting the time
clearViewer
Event to occur when the screen is cleared
Product
Crane.Product.class
Class that place and control 3D models of products that exist in the real world, such as household appliances and furniture
Constructor
new Crane.Product( renderer )
Product Instance can be created by passing the Instance created from the Crane.Loader constructor as a parameter.
- Parameters:
- renderer
Crane.Loader
Instance of the Crane.Loader.
- Example
Methods
set( id )
Load item with the id on the screen
- Parameters:
- id
String
The product id given with the products list
- Example
select( uuid )
Select the item with uuid.
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
deselect( uuid )
Deselects items with products with uuid from the selected items
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
remove( uuid )
Remove items with uuid from the screen.
Parameters:
- uuid
String
uid received after the item is loaded on the screen
Example
copy( uuid )
Copy items with uuid from the screen.
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
flipVertical( uuid )
Vertically flip the item with uuid.
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
flipHorizontal( uuid )
Horizontally flip the item with uuid.
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
setTRS( uuid )
Rotates, transforms, and scales a product with uuid..
- Parameters:
- uuid
String
uuid received after the item is loaded on the screen
- Example
createCustomBox( )
Create a custom box.
changeColor( uuid, color )
Change the color of the custom box.
- Parameters:
- uuid
String
uuid received after creating the custom box - color
String
(default : 'ff0000')
The RGB color value that you want to change for the custom box
- Example
Set the context menu type for each item.
- Parameters:
- type
String
(default : 'simple')
Context menu types are ‘simple’ and ‘expert’.
- Example
on( eventName, handler, context )
Register an event handler function for one event.
- Parameters:
- eventName
String
Name of the event created in Products Events - handler
Function
Function to execute when an event occurs - context
Object
this scope that will be referenced in the event function
- Example
off( eventName, handler, context )
Release the event handler function registered in one event.
- Parameters:
- eventName
String
Name of the event created in Products Events - handler
Function
Function to execute - context
Object
this scope that will be referenced in the event function
- Example
Events
loaded
Event to occur after the Product is loaded on the screen
- Arguments: Event Object
- event.uuid
String
uuid of the product loaded on the screen
- Example
selected
Event to occur when product is selected on the screen
- Arguments: Event Object
- event.uuid
Array
uuid list of selected products
- Example
deselected
Event to occur when product is deselected on the screen
- Arguments: Event Object
- event.uuid
Array
uuid list of deselected products
- Example
removed
Event to occur when product is removed from the screen
- Arguments: Event Object
- event.uuid
Array
uuid list of deselected products
- Example
copied
Event to occur when the product is copied from the screen
flipped
Event to occur when the product is flipped up and down / left and right on the screen
- Arguments: Event Object
- event.uuid
Array
uuid of the product that is reversed up and down / left and right - event.position
Array
The position value of the product - event.rotation
Array
The rotation value of the product - event.scale
Array
The scaling factor for the product
- Example
updatedTRS
Event that occur when you move, rotate, or zoom the product on the screen
- Arguments: Event Object
- event.uuid
String
uuid of product with movement, rotation, and zoom - event.position
Array
The position value of the product - event.rotation
Array
The position value of the product - event.scale
Array
The scaling factor for the product
- Example
createdCustomBox
Event that occur after creating a custom box
changedColor
Event to occur when changing color of the custom box
Event to occur when changing the context menu type of the product
Post
Crane.Post.class
Class that draws home designing data stored in Urbanbase Square and draws it on the screen
Constructor
new Crane.Post( renderer )
Instance of the Post can be created by passing the Instance from the Crane.Loader creator as a parameter.
- Parameters:
- renderer
Crane.Loader
Instance of the Crane.Loader
- Example
Methods
set( id )
The home designing object with id is loaded on the screen.
- Parameters:
- id
String
id of home designing object
- Example
Events
loaded
Event that occur after the home designing object is loaded on the screen