senangwebs-aframe-editor 1.6.13 → 1.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sw-webverse.js +160 -4
- package/dist/sw-webverse.js.map +1 -1
- package/dist/sw-webverse.min.js +318 -237
- package/dist/sw-webverse.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Main.js +248 -242
- package/src/components/scenegraph/SceneGraph.js +545 -516
- package/src/index.js +95 -0
package/dist/sw-webverse.js
CHANGED
|
@@ -95091,7 +95091,7 @@ object-assign
|
|
|
95091
95091
|
/***/ (module) => {
|
|
95092
95092
|
'use strict';
|
|
95093
95093
|
module.exports = /*#__PURE__*/ JSON.parse(
|
|
95094
|
-
'{"name":"senangwebs-aframe-editor","version":"1.6.
|
|
95094
|
+
'{"name":"senangwebs-aframe-editor","version":"1.6.14","description":"A fork of A-Frame Inspector designed to be use as visual editor used in SenangWebs.","main":"dist/aframe-inspector.min.js","scripts":{"build":"webpack --progress","deploy":"npm run ghpages","dist":"npm run dist:max && npm run dist:min","dist:max":"npm run build","dist:min":"cross-env MINIFY=true npm run build","ghpages":"npm run preghpages && ghpages -p gh-pages","lint":"npm run lintfile src/","lint:css":"stylelint src/css/main.css","lintfile":"eslint","preghpages":"npm run dist && shx rm -rf gh-pages && shx mkdir gh-pages && shx cp -r assets dist examples index.html gh-pages && shx sed -i http://localhost:3333 .. gh-pages/examples/index.html","prepare":"husky install","prepublish":"npm run dist","prettier":"prettier --write \'src/**/*.js\'","start":"webpack serve --progress -d eval-source-map","test":"jest --watch","test:ci":"jest"},"repository":"aframevr/aframe-inspector","license":"MIT","dependencies":{"@fortawesome/free-solid-svg-icons":"^6.5.1","@fortawesome/free-brands-svg-icons":"^6.5.1","clipboard-copy":"^4.0.1","clsx":"^2.1.0","lodash.debounce":"^4.0.8","prop-types":"^15.8.1","react":"^18.2.0","react-dom":"^18.2.0","react-select":"^5.8.0","three":"0.168.0"},"devDependencies":{"@babel/core":"^7.24.0","@babel/eslint-parser":"^7.23.10","@babel/preset-env":"^7.24.0","@babel/preset-react":"^7.23.3","autoprefixer":"^10.4.17","babel-jest":"^29.7.0","babel-loader":"^9.1.3","cross-env":"^7.0.3","css-loader":"^6.10.0","eslint":"^8.57.0","eslint-config-standard":"^17.1.0","eslint-plugin-react":"^7.33.2","ghpages":"0.0.10","husky":"^8.0.1","jest":"^29.7.0","lint-staged":"^13.0.3","postcss-loader":"^8.1.1","prettier":"^3.2.5","react-test-renderer":"^18.2.0","shx":"^0.3.4","style-loader":"^3.3.4","stylelint":"^16.2.1","stylelint-config-standard":"^36.0.0","stylelint-order":"^6.0.4","stylus":"^0.62.0","stylus-loader":"^8.1.0","webpack":"^5.91.0","webpack-cli":"^5.1.4","webpack-dev-server":"^5.0.4"},"keywords":["3d","aframe","editor","inspector","three.js","tool","unity","vr","virtualreality","webvr","wysiwyg"],"lint-staged":{"*.js":"prettier --write"}}'
|
|
95095
95095
|
);
|
|
95096
95096
|
|
|
95097
95097
|
/***/
|
|
@@ -96481,6 +96481,12 @@ object-assign
|
|
|
96481
96481
|
inspectorEnabled: enabled
|
|
96482
96482
|
});
|
|
96483
96483
|
});
|
|
96484
|
+
_defineProperty(_this, 'handleSceneReload', function (newSceneEl) {
|
|
96485
|
+
_this.setState({
|
|
96486
|
+
entity: null,
|
|
96487
|
+
sceneEl: newSceneEl
|
|
96488
|
+
});
|
|
96489
|
+
});
|
|
96484
96490
|
_defineProperty(_this, 'handleOpenHelpModal', function () {
|
|
96485
96491
|
_this.setState({
|
|
96486
96492
|
isHelpOpen: true
|
|
@@ -96596,6 +96602,10 @@ object-assign
|
|
|
96596
96602
|
'openhelpmodal',
|
|
96597
96603
|
this.handleOpenHelpModal
|
|
96598
96604
|
);
|
|
96605
|
+
_lib_Events__WEBPACK_IMPORTED_MODULE_2__['default'].on(
|
|
96606
|
+
'scenereload',
|
|
96607
|
+
this.handleSceneReload
|
|
96608
|
+
);
|
|
96599
96609
|
}
|
|
96600
96610
|
},
|
|
96601
96611
|
{
|
|
@@ -96617,6 +96627,10 @@ object-assign
|
|
|
96617
96627
|
'openhelpmodal',
|
|
96618
96628
|
this.handleOpenHelpModal
|
|
96619
96629
|
);
|
|
96630
|
+
_lib_Events__WEBPACK_IMPORTED_MODULE_2__['default'].off(
|
|
96631
|
+
'scenereload',
|
|
96632
|
+
this.handleSceneReload
|
|
96633
|
+
);
|
|
96620
96634
|
}
|
|
96621
96635
|
},
|
|
96622
96636
|
{
|
|
@@ -103350,7 +103364,7 @@ object-assign
|
|
|
103350
103364
|
if (!curr) {
|
|
103351
103365
|
return false;
|
|
103352
103366
|
}
|
|
103353
|
-
while (curr
|
|
103367
|
+
while (curr != null && curr.isEntity) {
|
|
103354
103368
|
if (!_this.isExpanded(curr)) {
|
|
103355
103369
|
return false;
|
|
103356
103370
|
}
|
|
@@ -103372,7 +103386,7 @@ object-assign
|
|
|
103372
103386
|
_defineProperty(_this, 'expandToRoot', function (x) {
|
|
103373
103387
|
// Expand element all the way to the scene element
|
|
103374
103388
|
var curr = x.parentNode;
|
|
103375
|
-
while (curr
|
|
103389
|
+
while (curr != null && curr.isEntity) {
|
|
103376
103390
|
_this.state.expandedElements.set(curr, true);
|
|
103377
103391
|
curr = curr.parentNode;
|
|
103378
103392
|
}
|
|
@@ -103684,12 +103698,41 @@ object-assign
|
|
|
103684
103698
|
key: 'componentDidUpdate',
|
|
103685
103699
|
value:
|
|
103686
103700
|
/**
|
|
103687
|
-
* Selected entity updated from somewhere else in the app.
|
|
103701
|
+
* Selected entity or scene updated from somewhere else in the app.
|
|
103688
103702
|
*/
|
|
103689
103703
|
function componentDidUpdate(prevProps) {
|
|
103690
103704
|
if (prevProps.selectedEntity !== this.props.selectedEntity) {
|
|
103691
103705
|
this.selectEntity(this.props.selectedEntity);
|
|
103692
103706
|
}
|
|
103707
|
+
|
|
103708
|
+
// Scene element was replaced — re-attach DOM listeners.
|
|
103709
|
+
if (prevProps.scene !== this.props.scene) {
|
|
103710
|
+
if (prevProps.scene) {
|
|
103711
|
+
prevProps.scene.removeEventListener(
|
|
103712
|
+
'child-attached',
|
|
103713
|
+
this.rebuildEntityOptions
|
|
103714
|
+
);
|
|
103715
|
+
prevProps.scene.removeEventListener(
|
|
103716
|
+
'child-detached',
|
|
103717
|
+
this.rebuildEntityOptions
|
|
103718
|
+
);
|
|
103719
|
+
}
|
|
103720
|
+
if (this.props.scene) {
|
|
103721
|
+
this.props.scene.addEventListener(
|
|
103722
|
+
'child-attached',
|
|
103723
|
+
this.rebuildEntityOptions
|
|
103724
|
+
);
|
|
103725
|
+
this.props.scene.addEventListener(
|
|
103726
|
+
'child-detached',
|
|
103727
|
+
this.rebuildEntityOptions
|
|
103728
|
+
);
|
|
103729
|
+
}
|
|
103730
|
+
// Reset expanded state with new scene root.
|
|
103731
|
+
this.setState({
|
|
103732
|
+
expandedElements: new WeakMap([[this.props.scene, true]])
|
|
103733
|
+
});
|
|
103734
|
+
this.rebuildEntityOptions();
|
|
103735
|
+
}
|
|
103693
103736
|
}
|
|
103694
103737
|
},
|
|
103695
103738
|
{
|
|
@@ -112556,6 +112599,119 @@ object-assign
|
|
|
112556
112599
|
}
|
|
112557
112600
|
this.isFirstOpen = false;
|
|
112558
112601
|
},
|
|
112602
|
+
/**
|
|
112603
|
+
* Reload the inspector UI to reflect current scene HTML.
|
|
112604
|
+
* Call this after programmatically modifying the scene DOM.
|
|
112605
|
+
*/
|
|
112606
|
+
reload: function reload() {
|
|
112607
|
+
var _this7 = this;
|
|
112608
|
+
// Deselect current entity.
|
|
112609
|
+
this.selectEntity(null);
|
|
112610
|
+
|
|
112611
|
+
// Clear all existing helpers.
|
|
112612
|
+
for (var id in this.helpers) {
|
|
112613
|
+
var helper = this.helpers[id];
|
|
112614
|
+
this.sceneHelpers.remove(helper);
|
|
112615
|
+
if (helper.dispose) {
|
|
112616
|
+
helper.dispose();
|
|
112617
|
+
}
|
|
112618
|
+
}
|
|
112619
|
+
this.helpers = {};
|
|
112620
|
+
|
|
112621
|
+
// Remove old sceneHelpers from old scene.
|
|
112622
|
+
if (this.scene && this.sceneHelpers.parent) {
|
|
112623
|
+
this.scene.remove(this.sceneHelpers);
|
|
112624
|
+
}
|
|
112625
|
+
|
|
112626
|
+
// Poll for new scene to register in AFRAME.scenes.
|
|
112627
|
+
var _waitForScene = function waitForScene() {
|
|
112628
|
+
var newSceneEl = AFRAME.scenes[0];
|
|
112629
|
+
if (!newSceneEl) {
|
|
112630
|
+
setTimeout(_waitForScene, 100);
|
|
112631
|
+
return;
|
|
112632
|
+
}
|
|
112633
|
+
_this7.sceneEl = newSceneEl;
|
|
112634
|
+
var _onReady = function onReady() {
|
|
112635
|
+
// Wait for camera too.
|
|
112636
|
+
if (!_this7.sceneEl.camera) {
|
|
112637
|
+
_this7.sceneEl.addEventListener(
|
|
112638
|
+
'camera-set-active',
|
|
112639
|
+
function () {
|
|
112640
|
+
return _onReady();
|
|
112641
|
+
},
|
|
112642
|
+
{
|
|
112643
|
+
once: true
|
|
112644
|
+
}
|
|
112645
|
+
);
|
|
112646
|
+
return;
|
|
112647
|
+
}
|
|
112648
|
+
|
|
112649
|
+
// Re-acquire container (new scene creates new canvas).
|
|
112650
|
+
_this7.container = document.querySelector('.a-canvas');
|
|
112651
|
+
|
|
112652
|
+
// Re-init cameras for new scene.
|
|
112653
|
+
(0, _lib_cameras__WEBPACK_IMPORTED_MODULE_7__.initCameras)(_this7);
|
|
112654
|
+
|
|
112655
|
+
// Refresh scene object3D reference.
|
|
112656
|
+
_this7.scene = _this7.sceneEl.object3D;
|
|
112657
|
+
|
|
112658
|
+
// Re-create sceneHelpers in new scene.
|
|
112659
|
+
_this7.sceneHelpers = new THREE.Scene();
|
|
112660
|
+
_this7.sceneHelpers.userData.source = 'INSPECTOR';
|
|
112661
|
+
_this7.sceneHelpers.visible = true;
|
|
112662
|
+
_this7.scene.add(_this7.sceneHelpers);
|
|
112663
|
+
|
|
112664
|
+
// Re-init viewport (transform controls, editor controls, raycaster).
|
|
112665
|
+
_this7.viewport =
|
|
112666
|
+
new _lib_viewport__WEBPACK_IMPORTED_MODULE_2__.Viewport(_this7);
|
|
112667
|
+
|
|
112668
|
+
// Rebuild helpers from new entities.
|
|
112669
|
+
_this7.sceneEl.object3D.traverse(function (node) {
|
|
112670
|
+
_this7.addHelper(node);
|
|
112671
|
+
});
|
|
112672
|
+
|
|
112673
|
+
// Notify React components to update scene reference.
|
|
112674
|
+
_lib_Events__WEBPACK_IMPORTED_MODULE_1__['default'].emit(
|
|
112675
|
+
'scenereload',
|
|
112676
|
+
_this7.sceneEl
|
|
112677
|
+
);
|
|
112678
|
+
|
|
112679
|
+
// Notify React components to rebuild scenegraph.
|
|
112680
|
+
_lib_Events__WEBPACK_IMPORTED_MODULE_1__['default'].emit(
|
|
112681
|
+
'entitycreated'
|
|
112682
|
+
);
|
|
112683
|
+
|
|
112684
|
+
// Enter inspector edit mode on new scene.
|
|
112685
|
+
_this7.opened = true;
|
|
112686
|
+
_lib_Events__WEBPACK_IMPORTED_MODULE_1__['default'].emit(
|
|
112687
|
+
'inspectortoggle',
|
|
112688
|
+
true
|
|
112689
|
+
);
|
|
112690
|
+
document.body.classList.add('aframe-inspector-opened');
|
|
112691
|
+
_this7.sceneEl.resize();
|
|
112692
|
+
_this7.sceneEl.pause();
|
|
112693
|
+
_this7.sceneEl.isPlaying = true;
|
|
112694
|
+
_this7.cursor.play();
|
|
112695
|
+
_lib_shortcuts__WEBPACK_IMPORTED_MODULE_4__.Shortcuts.enable();
|
|
112696
|
+
};
|
|
112697
|
+
if (_this7.sceneEl.hasLoaded) {
|
|
112698
|
+
_onReady();
|
|
112699
|
+
} else {
|
|
112700
|
+
_this7.sceneEl.addEventListener(
|
|
112701
|
+
'loaded',
|
|
112702
|
+
function () {
|
|
112703
|
+
return _onReady();
|
|
112704
|
+
},
|
|
112705
|
+
{
|
|
112706
|
+
once: true
|
|
112707
|
+
}
|
|
112708
|
+
);
|
|
112709
|
+
}
|
|
112710
|
+
};
|
|
112711
|
+
|
|
112712
|
+
// Start polling (small delay to let DOM settle after replaceWith).
|
|
112713
|
+
setTimeout(_waitForScene, 50);
|
|
112714
|
+
},
|
|
112559
112715
|
/**
|
|
112560
112716
|
* Closes the editor and gives the control back to the scene
|
|
112561
112717
|
* @return {[type]} [description]
|