Commit 2a5218e5 authored by 单奇雲's avatar 单奇雲

merge

parents 623a983e 1463599a
......@@ -26,7 +26,7 @@ class ActuatorContainer extends Component {
}
render() {
const { baseObjs, dataSource } = this.props;
const { baseObjs, dataSource, asyncModels } = this.props;
const { content, animations, basicScene, routePath, particles } = dataSource || {};
const length = (animations || []).length;
return (
......@@ -34,6 +34,7 @@ class ActuatorContainer extends Component {
graphConf={basicScene}
baseObjs={baseObjs}
content={content}
asyncModels={asyncModels}
routePath={routePath}
particles={particles}
animations={animations}
......@@ -50,7 +51,8 @@ ActuatorContainer.propTypes = {
PropTypes.array
]),
dataSource: PropTypes.object,
subjectId: PropTypes.string
subjectId: PropTypes.string,
asyncModels: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
};
export default ActuatorContainer;
......@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { deepCopy } from 'amos-tool';
import A3DDesigner, { r3d, Connect, DESIGNER_CONSTS } from 'amos-3d/lib/designer';
import { A3DUtil } from 'amos-3d/lib/threeTools';
import WorkerObjContent from 'amos-3d/lib/worker/WorkerObjContent';
import { BaseObjHelper } from 'base-r3d/lib/factory';
import { ELEMENT_TYPE } from 'amos-iot-3dgraph/lib/view/pubview/../design/conf';
import { Button, Modal, Row, Col } from 'amos-framework';
......@@ -28,6 +29,7 @@ class StageActuator extends Component {
super(props);
this.state = {
ativeAnimate: '',
startAsyncLoad: false,
currentIndex: 0,
modal: false,//步骤弹框
modelModal: false,//详情弹框
......@@ -90,6 +92,13 @@ class StageActuator extends Component {
}
}
onAllDone = objGroup => {
// 设置子线程开始加载
this.setState({
startAsyncLoad: true
});
}
parseThing = () => {
const { content, routePath, particles } = this.props;
this.a3dRef.parseEverything(content, (dataItem) => {
......@@ -104,18 +113,25 @@ class StageActuator extends Component {
}
}
return dataItem;
}, fmtData => {
}, (fmtData, modelParser) => {
if (fmtData.type === ELEMENT_TYPE.PARTICLE) {
this.addParticle({
const particle = this.addParticle({
userData: fmtData,
position: fmtData.basicAttr.position,
rotation: fmtData.basicAttr.rotation,
scale: fmtData.basicAttr.scale,
data: particles[fmtData.reference]
});
// 添加到 parser 的 cache 中,以供动画使用
modelParser.cacheIn(fmtData.eid, particle);
}
if (fmtData.type === ELEMENT_TYPE.PEN) {
this.a3dRef.newPen({ ...routePath[fmtData.reference],userData: fmtData });
const pen = this.a3dRef.newPen({
...routePath[fmtData.reference],
userData: fmtData
});
// 添加到 parser 的cache 中,以供动画使用
modelParser.cacheIn(fmtData.eid, pen);
}
return fmtData.type === 'model'; // 仅处理 model
});
......@@ -217,7 +233,7 @@ class StageActuator extends Component {
/** 创建粒子 */
addParticle = (param = {}) => {
this.particleHelper.create(param);
return this.particleHelper.create(param);
}
onGraphCreated = ({ cameraFactory, sceneFactory, stagePilot, outlineFactory, r3d }) => {
......@@ -328,6 +344,20 @@ class StageActuator extends Component {
}
/** 处理所有的模型解析完毕之后 */
handleModelParserDone = (modelParser) => {
const { content } = this.props;
// const modelExistAttach = content.filter(userData => userData.attachments && userData.attachments.length > 0 );
// 改变模型关联关系
// modelExistAttach.forEach(userData =>{
// const parentObj = modelParser.get(userData.eid);
// userData.attachments.forEach(eid=>{
// const attachModel = modelParser.get(eid);
// attachModel && parentObj.attach(attachModel);
// });
// });
}
//model start
getContext = () => {
const { modalContent } = this.state;
......@@ -379,8 +409,8 @@ class StageActuator extends Component {
//model end
render() {
const { ativeAnimate, modal, playing, modelModal } = this.state;
const { graphConf, baseObjs, dimension, animations } = this.props;
const { ativeAnimate, modal, playing, modelModal,startAsyncLoad } = this.state;
const { graphConf, baseObjs, dimension, asyncModels,animations } = this.props;
const particlesProps = {
onCreated: this.handleParticlesCreated
};
......@@ -389,6 +419,9 @@ class StageActuator extends Component {
scrollUV: true,
onCreated: this.handlePenEditorCreated
};
const modelContentProps = {
onAllDone: this.onAllDone
};
return (
<div className="board-actuator">
......@@ -405,7 +438,11 @@ class StageActuator extends Component {
particlesProps={particlesProps}
onCreated={this.onGraphCreated}
handleModelParserData={this.handleModelParserData}
/>
handleModelParserDone={this.handleModelParserDone}
modelContentProps={modelContentProps}
>
{startAsyncLoad && <WorkerObjContent objs={asyncModels} enableLoading />}
</A3DDesigner>
}
<PlayTaskTabs content={this.props.content} ref={e => this.taskTabs = e}/>
<Play
......@@ -458,7 +495,8 @@ StageActuator.propTypes = {
animations: PropTypes.array,
total: PropTypes.number,
routePath: PropTypes.object,
particles: PropTypes.object
particles: PropTypes.object,
asyncModels: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
};
export default StageActuator;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment