WanaPlan

API Docs for: 2.7.0
Show:

DecorationComponent

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

Summary

This component manages the decoration of all the objects in the scene.

Constructor

DecorationComponent

Syntax

DecorationComponent

(
  • core
)

Summary

Parameters:

  • core Core

    Wanaplan core.

Methods

addHistory

Syntax

addHistory

(
  • target
  • params
  • type
  • component
)

Summary

Adds a history action.

Parameters:

  • target Object

    The target of the history action

  • params Object

    Parameters used

  • type String

    Type of the action.

  • component BABYLON.BaseComponent

    The component of the action.

applyMaterial

Syntax

applyMaterial

(
  • object
  • material
  • collided
)

Summary

Applies a new Material on an object.

Parameters:

  • object BABYLON.Mesh

    Instance of an object3D BABYLON.Mesh.

  • material BABYLON.Material

    Instance of material to use on the object.

  • collided Boolean

    The collision information

compute

Inherited from BaseComponent3D:

Syntax

compute

() private

Summary

Recompute of the component.

decorate

Syntax

decorate

(
  • object
  • material
  • collisionInfo
)

Summary

Assigns a new material to an object.

Parameters:

  • object BABYLON.Mesh

    Instance of an 3D object mesh.

  • material BABYLON.Material

    Instance of material to use on the object.

  • collisionInfo Object

    Information on the collision between the ray sent on click and the object.

destroy

Inherited from BaseComponent3D:

Syntax

destroy

()

Summary

Destructor.

disable

Inherited from BaseComponent3D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent3D:

Syntax

enable

()

Summary

Enables the component

getFloor

Inherited from BaseComponent3D:

Syntax

getFloor

(
  • [structure]
)
BABYLON.Mesh

Summary

Gets the 3D mesh of the floor structure in parameter (by default current floor).

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getMaterial

Syntax

getMaterial

() MaterialInfo

Summary

Gets a material.

Returns:

MaterialInfo:

Material Info

historyPaint

Syntax

historyPaint

(
  • target
  • params
  • modifiedMaterial
)

Summary

Function called at undo or redo

Parameters:

  • target Target

    The target of the undo or redo.

  • params Object

    params of the paint.

  • modifiedMaterial wnp.material

    The material modified.

initialize

Inherited from BaseComponent3D:

Syntax

initialize

()

Summary

Method called when Wanaplan is initialized. You don't need to call this method manually.

isSubMeshDecorable

Syntax

isSubMeshDecorable

(
  • object
)

Summary

determine if we can decorate the submesh targeted the list can be be extended

Parameters:

  • object Object

    the selected submesh.

onClick

Syntax

onClick

(
  • event
)

Summary

Triggered on event wnp.engine3D.click.collided to change the material of an object.

Parameters:

  • event Object

    The object associated to the event.

onContextChanged

Inherited from BaseComponent3D

Syntax

onContextChanged

(
  • context
)

Summary

Called when the context changes

Parameters:

  • context String

    The current context : 2D or 3D.

onPaintHandler

Syntax

onPaintHandler

(
  • event
)

Summary

Starts brush mode to paint an object with a color. Triggered on event wnp.engine3D.paint

Parameters:

  • event Object

    The object associated to the event.

redoPaint

Syntax

redoPaint

(
  • target
  • params
)

Summary

Redoes painting by calling the redoFunction of the type action when the ctrl-y is pressed.

Parameters:

  • target Target

    The target of the redo.

  • params Object

    params of the paint.

setupHistory

Syntax

setupHistory

()

Summary

Creates the history for the paint action

startListening

Inherited from BaseComponent3D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent3D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

stopPainMode

Syntax

stopPainMode

()

Summary

Stops the paint mode by setting all parameters to null.

undoPaint

Syntax

undoPaint

(
  • target
  • params
)

Summary

Undoes painting by calling the undoFunction of the type action when the ctrl-z is pressed.

Parameters:

  • target Target

    The target of the undo.

  • params Object

    params of the paint.

update

Inherited from BaseComponent3D:

Syntax

update

(
  • deltaTime
)

Summary

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

updateLastItemMenu

Syntax

updateLastItemMenu

(
  • item
)

Summary

Updates the item of the menu with the last color

Parameters:

Properties

keyboardManager

Inherited from BaseComponent3D:

Syntax

keyboardManager

wnp.KeyboardManager

Summary

Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).

name

Inherited from BaseComponent3D:

Syntax

name

String

Summary

Name of the component.

structure

Inherited from BaseComponent3D:

Syntax

structure

wnp.Structure

Summary

Instance of the structure (shortcut to wanaplan.structure).

Events

wnp.engine3D.brushReady

Syntax

wnp.engine3D.brushReady

Summary

Fired when the decoration brush is ready.

wnp.engine3D.decorate

Syntax

wnp.engine3D.decorate

Summary

Fired to decorate an object with a material.

wnp.engine3D.paint

Syntax

wnp.engine3D.paint

Summary

Fired when a paint texture is chosen in the decoration menu.

wnp.menu.main.add

Syntax

wnp.menu.main.add

Summary

Fired to add a menu item into the main menu.

wnp.menu.main.deselect

Syntax

wnp.menu.main.deselect

Summary

Fired when an item from main menu needs to be deselected.

wnp.menu.main.remove

Syntax

wnp.menu.main.remove

Summary

Fired to remove a menu item from the main menu.

wnp.menu.main.replace

Syntax

wnp.menu.main.replace

Summary

Fired to replace a menu item from the main menu with another.

wnp.request.historyAction

Syntax

wnp.request.historyAction

Summary

Fired when an object is refreshed and if the history is needed.

wnp.request.saveHistory

Syntax

wnp.request.saveHistory

Summary

Fired to request a save of the history.