API Docs for: 2.7.3
Show:

DecorationComponent Class

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

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

Constructor

DecorationComponent

(
  • core
)

Parameters:

  • core Core

    Wanaplan core.

Methods

addHistory

(
  • target
  • params
  • type
  • component
)

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

(
  • object
  • material
  • collided
)

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

() private

Inherited from BaseComponent3D:

Recompute of the component.

decorate

(
  • object
  • material
  • collisionInfo
)

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:

Destructor.

disable

()

Inherited from BaseComponent3D:

Disables the component

enable

()

Inherited from BaseComponent3D:

Enables the component

getFloor

(
  • [structure]
)
BABYLON.Mesh

Inherited from BaseComponent3D:

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

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getMaterial

() MaterialInfo

Gets a material.

Returns:

MaterialInfo:

Material Info

historyPaint

(
  • target
  • params
  • modifiedMaterial
)

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:

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

isSubMeshDecorable

(
  • object
)

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

Parameters:

  • object Object

    the selected submesh.

onClick

(
  • event
)

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

Parameters:

  • event Object

    The object associated to the event.

onContextChanged

(
  • context
)

Inherited from BaseComponent3D

Called when the context changes

Parameters:

  • context String

    The current context : 2D or 3D.

onPaintHandler

(
  • event
)

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

(
  • target
  • params
)

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

()

Creates the history for the paint action

startListening

()

Inherited from BaseComponent3D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent3D:

Removes all the event listeners.

stopPainMode

()

Stops the paint mode by setting all parameters to null.

undoPaint

(
  • target
  • params
)

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

(
  • deltaTime
)

Inherited from BaseComponent3D:

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

updateLastItemMenu

(
  • item
)

Updates the item of the menu with the last color

Parameters:

Properties

keyboardManager

wnp.KeyboardManager

Inherited from BaseComponent3D:

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

name

String

Inherited from BaseComponent3D:

Name of the component.

structure

wnp.Structure

Inherited from BaseComponent3D:

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

Events

wnp.engine3D.brushReady

Fired when the decoration brush is ready.

wnp.engine3D.decorate

Fired to decorate an object with a material.

wnp.engine3D.paint

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

wnp.menu.main.add

Fired to add a menu item into the main menu.

wnp.menu.main.deselect

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

wnp.menu.main.remove

Fired to remove a menu item from the main menu.

wnp.menu.main.replace

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

wnp.request.historyAction

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

wnp.request.saveHistory

Fired to request a save of the history.