Robert Long 2018-08-30 18:05:15 -07:00
Родитель 83240f0da9 f19e6feb8f
Коммит 88d3305e5e
8 изменённых файлов: 52 добавлений и 21 удалений

4
package-lock.json сгенерированный
Просмотреть файл

@ -13452,8 +13452,8 @@
}
},
"three": {
"version": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16",
"from": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16"
"version": "github:mozillareality/three.js#892c7c7f79e1bfaf9eb2b869772a796bd1ff8717",
"from": "github:mozillareality/three.js#892c7c7f7"
},
"throttle-debounce": {
"version": "2.0.1",

Просмотреть файл

@ -81,7 +81,7 @@
"react-tooltip": "^3.6.1",
"selfsigned": "^1.10.3",
"signals": "^1.0.0",
"three": "github:mozillareality/three.js#09b27a6628e7dd5422db2ebfafa24d198ddb0b16",
"three": "github:mozillareality/three.js#892c7c7f7",
"throttle-debounce": "^2.0.1",
"ws": "^5.2.0"
},

Просмотреть файл

@ -401,13 +401,6 @@ export default class Editor {
scene.name = "Scene";
}
scene.userData._conflictHandler = new ConflictHandler();
scene.userData._conflictHandler.findDuplicates(scene, 0, 0);
if (scene.userData._conflictHandler.getDuplicateStatus() || scene.userData._conflictHandler.getMissingStatus()) {
throw new ConflictError("gltf naming conflicts", "import", url, scene.userData._conflictHandler);
}
return scene;
}

Просмотреть файл

@ -15,6 +15,8 @@ export default class BaseComponent {
static canRemove = true;
static showProps = true;
constructor(node, object) {
this.name = this.constructor.componentName;
this.schema = this.constructor.schema;

Просмотреть файл

@ -0,0 +1,32 @@
import THREE from "../three";
import TransformComponent from "./TransformComponent";
export default class BoxColliderComponent extends TransformComponent {
static componentName = "box-collider";
static _geometry = new THREE.BoxBufferGeometry();
static _material = new THREE.Material();
static canAdd = true;
static canRemove = true;
// Since the box collider props just mirror the node's transform, we hide the props.
static showProps = false;
static dontExportProps = false;
static async inflate(node, _props) {
const boxMesh = new THREE.Mesh(this._geometry, this._material);
const box = new THREE.BoxHelper(boxMesh, 0x00ff00);
box.userData._selectionRoot = node;
Object.defineProperty(box.userData, "_selectionRoot", { value: node, configurable: true, enumerable: false });
box.userData._dontExport = true;
box.userData._dontShowInHierarchy = true;
box.userData._inflated = true;
const component = await this._getOrCreateComponent(node, _props);
node.add(box);
return component;
}
}

Просмотреть файл

@ -1,4 +1,5 @@
import AmbientLightComponent from "./AmbientLightComponent";
import BoxColliderComponent from "./BoxColliderComponent";
import DirectionalLightComponent from "./DirectionalLightComponent";
import GLTFModelComponent from "./GLTFModelComponent";
import HemisphereLightComponent from "./HemisphereLightComponent";
@ -24,6 +25,7 @@ export * from "./utils";
export const Components = [
AmbientLightComponent,
BoxColliderComponent,
DirectionalLightComponent,
GLTFModelComponent,
HemisphereLightComponent,

Просмотреть файл

@ -49,7 +49,8 @@ const Option = props => {
Option.propTypes = {
label: PropTypes.string,
value: PropTypes.string
value: PropTypes.string,
data: PropTypes.object
};
const DropdownIndicator = () => {

Просмотреть файл

@ -220,16 +220,17 @@ class PropertiesPanelContainer extends Component {
contentClassName={contentClassName}
useDefault={useDefault}
>
{componentDefinition.schema.map(prop => (
<InputGroup name={getDisplayName(prop.name)} key={prop.name} disabled={saveable && !component.src}>
{componentTypeMappings.get(prop.type)(
component.props[prop.name],
component.propValidation[prop.name],
this.onChangeComponent.bind(null, component, prop.name),
this.getExtras(prop)
)}
</InputGroup>
))}
{componentDefinition.showProps &&
componentDefinition.schema.map(prop => (
<InputGroup name={getDisplayName(prop.name)} key={prop.name} disabled={saveable && !component.src}>
{componentTypeMappings.get(prop.type)(
component.props[prop.name],
component.propValidation[prop.name],
this.onChangeComponent.bind(null, component, prop.name),
this.getExtras(prop)
)}
</InputGroup>
))}
</PropertyGroup>
);
};