EditionComponent3D Class
Component managing the user-guided edition of the 3D scene. Manages all interactions involving modifications of the scene's geometry. Necessary when the scene can be edited by the user.
For instance, in viewer mode, this component is inactive.
This component sends internal events when an object is manipulated, which can be listened to by the widgets for example.
To set/remove a callback for one of these events, use the functions on
and off
of this component (see Controls for the declaration).
Here is the list of all events you can set callbacks to, and the type of the argument provided to the callback :
- deselectObject (no argument)
- dispose (BABYLON.Mesh)
- refresh (BABYLON.Mesh)
- selectObject (BABYLON.Mesh)
- special (MouseEvent)
Constructor
EditionComponent3D
-
core
Parameters:
-
core
wnp.CoreWanaplan Core.
Item Index
Methods
- addDraggable
- addHistory
- addUnremovableDraggable deprecated
- addWidget
- clickSelection
- constrains
- deselect
- disableWidget
- dragLock
- dragSelection
- EnableWidget
- getDragged
- getLastPosition
- getPointerCoordinates
- getReferentParent
- getReferentPlane
- getRoot
- getSelected
- getSelectedObject
- historyDelete
- historyRefresh
- isLocked
- isSelectableObject
- isSelectableOverture
- isSelectableStairway
- lock
- notify
- off
- on
- onAddToProducts
- onBeforeDragStart
- onClick
- onClickDerived
- onCloneObject
- onCloneObject
- onCreateObject
- onDispose
- onDispose
- onDoubleClick
- onDoubleClickDerived
- onDragEnd
- onDragging
- onDragStart
- onIAction
- onKeyDown
- onMouseDown
- onMouseDownDerived
- onMouseMove
- onMouseMoveDerived
- onMouseUpDerived
- onNewPlan
- onOverrideProduct
- onRefreshObject
- onRemoveObject
- onSelectObject
- onSelectObject
- pickMeshUnderCursor
- redoAdd
- redoDelete
- redoRefresh
- refreshObject
- refreshReferentPlane
- removeDraggable
- resetDraggable
- select
- selectObject
- selectTopLevelObject
- setDragged
- setReferentParent
- setRoot
- setScreenSize
- setSelectedObject
- setupHistory
- startListening
- stopListening
- undoAdd
- undoDelete
- undoRefresh
- unlock
Properties
Methods
addDraggable
-
object
Parameters:
-
object
BABYLON.MeshThe object.
addHistory
-
target
-
params
-
type
Adds a history action.
addUnremovableDraggable
-
object
Parameters:
-
object
BABYLON.MeshThe object.
addWidget
-
widget
Adds a widget in the object edition component.
Parameters:
-
widget
WidgetThe widget to add.
clickSelection
-
event
Parameters:
-
event
MouseEventThe JS event
constrains
-
[U]
-
[V]
U
is specified, the object is dragged along an axis, carried by the vector U
.
* Both params are specified, the object is dragged along a plane, directed by U
and V
.
Parameters:
-
[U]
BABYLON.Vector3 optionalFirst Vector. -
[V]
BABYLON.Vector3 optionalSecond Vector.
deselect
()
disableWidget
()
Disables the widgets for an object.
dragLock
()
dragSelection
-
event
Parameters:
-
event
MouseEventThe JS event
EnableWidget
()
Enables the widgets for an object.
getDragged
()
BABYLON.PickingInfo
Returns:
getLastPosition
()
getPointerCoordinates
-
event
Parameters:
-
event
EventThe JS event
getReferentParent
()
BABYLON.Mesh
Controls
wiki for more info.
Returns:
getReferentPlane
()
BABYLON.Plane
Returns:
getRoot
()
BABYLON.Mesh
Controls
.
Returns:
getSelected
()
BABYLON.PickingInfo
Returns:
getSelectedObject
()
BABYLON.Mesh
Gets the currently selected object.
Returns:
The currently selected object.
historyDelete
-
target
-
params
-
valueField
The function called when undoing/redoing a deletion.
historyRefresh
-
target
-
params
-
valueField
The function called when undoing/redoing a refresh.
isLocked
-
object
Returns true if an object or group is locked. A group is locked if one of its children is locked.
Parameters:
-
object
BABYLON.MeshThe mesh to check
Returns:
true if the object is locked
isSelectableObject
-
object
Checks if a mesh is selectable.
Parameters:
-
object
BABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
isSelectableOverture
-
object
Checks if an overture is selectable.
Parameters:
-
object
BABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
isSelectableStairway
-
object
Checks if a stairway is selectable.
Parameters:
-
object
BABYLON.MeshThe mesh to check.
Returns:
Is a selectable mesh or not.
lock
-
key
-
[flags]
Disables some behaviors. Registers a key so that the action can only be re-enabled with the same key. Actions to lock must be passed in parameter as their corresponding flag. Supports multi-lock :
A lock the action ------------------------------------------------------------------- A unlock the action. --------------------- B lock the same action ----------------- B unlock the action -----------------------.
<-------------------------------action is locked -------------------------------------------------------->.
--------time--------->.
notify
-
event
-
data
on
-
event
-
handler
-
insertFirst
Parameters:
Returns:
onBeforeDragStart
()
Triggered on Controls event before-dragstart
.
Tests if the object is locked before starting to drag.
onClickDerived
-
pickingInfo
Triggered on event wnp.engine3D.click.collided
.
Behavior : if ctrl is pressed, the object is added to the current group, if the right button is pressed,
the special
event is sent to the widgets.
Parameters:
-
pickingInfo
BABYLON.PickingInfoThe picking information on what is under the mouse.
onCloneObject
()
Triggered on event wnp.request.object.clone
.
Called when the user clones an object or a group.
onCloneObject
-
object3D
-
doNotAddHistory
Removes an object or a group.
Parameters:
-
object3D
BABYLON.MeshThe object.
-
doNotAddHistory
BooleanAdd or not to the history.
onCreateObject
-
event
Triggered on event wnp.engine3D.object.create
.
Called when a mesh is added to the scene.
Parameters:
-
event
EventThe JS event.
onDispose
-
event
Triggered on event wnp.engine3D.object.dispose
.
Called when an object is removed from the scene.
Parameters:
-
event
EventThe JS event.
onDispose
-
event
Triggered on event wnp.engine3D.allFloorsReady
.
Called when the floor id changes.
Parameters:
-
event
EventThe JS event.
onDoubleClick
-
event
wnp.engine3D.dblclick.collided
.
Parameters:
-
event
EventThe JS event.
onDoubleClickDerived
-
pickingInfo
Triggered on event wnp.engine3D.dblclick.collided
.
Behavior : triggers the function animate
on the underlying mesh.
Parameters:
-
pickingInfo
BABYLON.PickingInfoThe picking information on what is under the mouse.
onDragging
-
event
wnp.engine3D.dragging
.
Parameters:
-
event
EventThe JS event.
onDragStart
-
event
wnp.engine3D.drag-start
.
Parameters:
-
event
EventThe JS event.
onIAction
()
private
Sends a different action for the configurator depending on the object's nature (Group or not).
onKeyDown
-
event
Triggered on event wnp.keyboardManager.keyDown
.
Behavior : When the user uses ctrl-d (duplicates the object) and
the delete key (removes the object).
Parameters:
-
event
EventThe JS event.
onMouseDown
-
event
wnp.engine3D.mousedown
.
Parameters:
-
event
EventThe JS event.
onMouseDownDerived
-
event
Triggered on Controls event mousedown
.
Parameters:
-
event
EventThe Controls event.
onMouseMove
-
event
wnp.engine3D.mouse-move
.
Parameters:
-
event
EventThe JS event.
onMouseMoveDerived
-
event
Triggered on Controls event mousemove
.
Parameters:
-
event
EventThe Controls event.
onMouseUpDerived
-
event
Triggered on Controls event mouseup
.
Parameters:
-
event
EventThe Controls event.
onNewPlan
-
event
Triggered on event wnp.request.newPlanReady
.
Called when the user clicks on the new plan button.
Parameters:
-
event
ObjectL'objet associé à l'événement.
onRefreshObject
-
event
Triggered on event wnp.engine3D.object.refresh
.
Called when an object is refreshed
Parameters:
-
event
EventThe JS event.
onRemoveObject
-
event
Triggered on event wnp.request.object.remove
.
Removes an object.
Parameters:
-
event
EventThe JS event.
onSelectObject
-
object
Triggered on Controls event deselect
.
Parameters:
-
object
BABYLON.MeshThe selected object.
onSelectObject
-
object
Triggered on Controls event select
.
Parameters:
-
object
BABYLON.MeshThe selected object.
pickMeshUnderCursor
-
event
-
[ref]
Parameters:
-
event
MouseEventThe JS event -
[ref]
BABYLON.Mesh optionalOptional parameter to override the referent parent.
redoAdd
-
target
-
params
The redo function for the add action.
redoDelete
-
target
-
params
The redo function for the delete action.
redoRefresh
-
target
-
params
The redo function for the refresh action.
refreshObject
-
object3D
-
options
Refreshes an object. Rebuilds the entire 3D object, given the programmable instance it is linked to.
Parameters:
-
object3D
BABYLON.Meshthe mesh to refresh.
-
options
ObjectThe options : noHistory and modifiedProperties
refreshReferentPlane
()
removeDraggable
-
object
Parameters:
-
object
BABYLON.MeshThe object.
resetDraggable
()
select
-
topLevelObjectPI
Parameters:
-
topLevelObjectPI
BABYLON.PickingInfoThe new selected object, as a picking information.
selectObject
-
object
setSelectedObject
is that a select
event is fired.
Parameters:
-
object
BABYLON.MeshThe new selected object.
selectTopLevelObject
-
object
Parameters:
-
object
BABYLON.MeshThe object from which we have to find the top-level object.
setDragged
-
dragged
Parameters:
-
dragged
BABYLON.PickingInfoThe new dragged object.
setReferentParent
-
parent
Controls
wiki for more info.
Parameters:
-
parent
BABYLON.MeshThe new referent parent.
setRoot
-
root
Controls
.
NB 2 : The referent parent is also set to the new root, for consistency.
Parameters:
-
root
BABYLON.MeshThe new root.
setScreenSize
-
width
-
height
setSelectedObject
-
object
selectObject
is that no select
event is fired.
Parameters:
-
object
BABYLON.MeshThe new selected object.
setupHistory
()
Setupps the history for the edition actions.
startListening
()
Engine3D
events.
stopListening
()
Engine3D
events.
undoAdd
-
target
-
params
The undo function for the add action.
undoDelete
-
target
-
params
The undo function for the delete action.
undoRefresh
-
target
-
params
The undo function for the refresh action.
Properties
cloneWidget
Widget.Clone
The clone widget: Allows the user to duplicate an object by clicking on the copy icon.
elevationWidget
Widget.Info
The elevation widget: Creates a widget panel on the right side of the screen and allows to change the elevation of an object by dragging the cursor of the elevation bar.
groupWidget
Widget.Group
The group widget: Allows the user to group/ungroup objects if several objects/a group are selected.
infoWidget
Widget.Info
The info widget: Allows the user to have all the properties of an object by clicking on the info sprite.
lockWidget
Widget.Lock
The lock widget: Allows the user to lock/unlock an object by clicking on the lock icon.
objects
BABYLON.Mesh
removeWidget
Widget.Remove
The remove widget: Allows the user to remove an object by clicking on the trash icon.
rotatorWidget
Widget.Rotator
The rotator widget: Allows the user to turn an object with the green circle.
scene
BABYLON.Scene
widget
Widget
The table of all widgets.
Events
wnp.editionComponent.removeObject
wnp.engine3D.object.clone
Fired to clone an object
wnp.request.configurator.start
Fired when the configurator is needed for an object.
wnp.request.disable-orbit-camera
wnp.request.enable-orbit-camera
wnp.request.groupConfigurator.start
Fired when the configurator is needed for a group.
wnp.request.historyAction
Fired when the history is needed on an action.
Event Payload:
-
component
BaseComponent3DThe component of the action (here it is EditionComponent3D).
-
object
BABYLON.MeshThe target object.
-
params
ObjectParameters of the history.
-
action
StringThe type of action done.
wnp.request.object.remove
Fired when the delete button is pushed while a mesh is selected.
Event Payload:
-
object
BABYLON.MeshThe currently selected object.
-
structure
FloorStructureThe current structure.
wnp.request.saveHistory
Fired to request a save of the history.