123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * ResetMatrixTool.js
- *
- * @author realor
- */
- import { Tool } from './Tool.js'
- import { Solid } from '../core/Solid.js'
- class ResetMatrixTool extends Tool {
- constructor(application, options) {
- super(application)
- this.name = 'reset_matrix'
- this.label = 'tool.reset_matrix.label'
- this.className = 'reset_matrix'
- this.immediate = true
- this.setOptions(options)
- }
- execute() {
- const application = this.application
- let object = application.selection.object
- if (object.geometry) {
- object.geometry.applyMatrix4(object.matrix)
- if (object instanceof Solid) {
- object.updateGeometry(object.geometry)
- }
- object.matrix.identity()
- object.matrix.decompose(object.position, object.quaternion, object.scale)
- object.updateMatrixWorld()
- application.notifyObjectsChanged(object, this)
- application.updateSelection()
- }
- }
- }
- export { ResetMatrixTool }
|