!2754 优化:fbx导入缩放

pull/2753/MERGE
黄诗津 5 months ago committed by ChenX
parent 41df260eca
commit 8bf067cc4a

@ -231,9 +231,7 @@ export class EntityFbx extends Entity
//缩放尺寸(如果用户指定了这个缩放 我们就缩放它) //缩放尺寸(如果用户指定了这个缩放 我们就缩放它)
if (this._ScaleSize.x) if (this._ScaleSize.x)
this.newObject.scale.copy(this._ScaleSize).divide(this._Size).multiplyScalar(10); this.newObject.scale.copy(this._ScaleSize).divide(this._Size);
else
this.newObject.scale.set(10, 10, 10);//UE4缩放10 如果按米为单位的缩放1000
dObj.add(this.newObject); dObj.add(this.newObject);
@ -330,9 +328,7 @@ export class EntityFbx extends Entity
//缩放尺寸(如果用户指定了这个缩放 我们就缩放它) //缩放尺寸(如果用户指定了这个缩放 我们就缩放它)
if (this._ScaleSize.x) if (this._ScaleSize.x)
this.newObject.scale.copy(this._ScaleSize).divide(this._Size).multiplyScalar(10); this.newObject.scale.copy(this._ScaleSize).divide(this._Size);
else
this.newObject.scale.set(10, 10, 10);//UE4缩放10 如果按米为单位的缩放1000
this.newObject.updateMatrix();//保证更新缩放 this.newObject.updateMatrix();//保证更新缩放
this.newObject.updateMatrixWorld(false);//保证更新位置 this.newObject.updateMatrixWorld(false);//保证更新位置

@ -4,12 +4,12 @@ import { observer } from "mobx-react";
import React from "react"; import React from "react";
import { MathUtils, Matrix4, Vector3 } from "three"; import { MathUtils, Matrix4, Vector3 } from "three";
import { app } from "../../../../ApplicationServices/Application"; import { app } from "../../../../ApplicationServices/Application";
import { safeEval } from "../../../../Common/eval";
import { KeyBoard } from "../../../../Common/KeyEnum"; import { KeyBoard } from "../../../../Common/KeyEnum";
import { MakeRotateMatrix4 } from "../../../../Common/Matrix4Utils"; import { MakeRotateMatrix4 } from "../../../../Common/Matrix4Utils";
import { FixedNotZero } from "../../../../Common/Utils"; import { FixedNotZero } from "../../../../Common/Utils";
import { safeEval } from "../../../../Common/eval";
import { Entity } from "../../../../DatabaseServices/Entity/Entity"; import { Entity } from "../../../../DatabaseServices/Entity/Entity";
import { commandMachine, CommandWrap } from "../../../../Editor/CommandMachine"; import { CommandWrap, commandMachine } from "../../../../Editor/CommandMachine";
import { CommandState } from "../../../../Editor/CommandState"; import { CommandState } from "../../../../Editor/CommandState";
import { AxisType } from "../../../../Editor/TranstrolControl/CoorAxes"; import { AxisType } from "../../../../Editor/TranstrolControl/CoorAxes";
import { AppToaster } from "../../Toaster"; import { AppToaster } from "../../Toaster";
@ -33,7 +33,7 @@ export class SizeComponent extends React.Component<SizeComponentProps>
this.disposeAutorun = autorun(() => this.disposeAutorun = autorun(() =>
{ {
if (this.sizeRef.current) if (this.sizeRef.current)
this.sizeRef.current.inputElement.value = this.props.store[this.props.sizeKey].toFixed(0); this.sizeRef.current.inputElement.value = this.props.store[this.props.sizeKey].toFixed(3);
}); });
} }
@ -51,7 +51,7 @@ export class SizeComponent extends React.Component<SizeComponentProps>
let value = safeEval(this.sizeRef.current.inputElement.value); let value = safeEval(this.sizeRef.current.inputElement.value);
if (isNaN(value) && this.sizeRef.current) if (isNaN(value) && this.sizeRef.current)
{ {
this.sizeRef.current.inputElement.value = store[this.props.sizeKey].toFixed(0); this.sizeRef.current.inputElement.value = store[this.props.sizeKey].toFixed(3);
return; return;
} }
@ -110,7 +110,7 @@ export class SizeComponent extends React.Component<SizeComponentProps>
}} }}
/> />
<NumericInput <NumericInput
defaultValue={MathUtils.clamp(store[this.props.sizeKey], 0, Number.MAX_VALUE).toFixed(0)} defaultValue={MathUtils.clamp(store[this.props.sizeKey], 0, Number.MAX_VALUE).toFixed(3)}
ref={this.sizeRef} ref={this.sizeRef}
onKeyDown={(e) => onKeyDown={(e) =>
{ {
@ -121,7 +121,7 @@ export class SizeComponent extends React.Component<SizeComponentProps>
} }
if (e.keyCode === KeyBoard.Escape) if (e.keyCode === KeyBoard.Escape)
{ {
this.sizeRef.current.inputElement.value = store[this.props.sizeKey].toFixed(0); this.sizeRef.current.inputElement.value = store[this.props.sizeKey].toFixed(3);
} }
}} }}
onBlur={() => { this.ChangeModuleSize(); }} onBlur={() => { this.ChangeModuleSize(); }}

Loading…
Cancel
Save