You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* rename internal reference for `pc.SceneRegistry` from `_sceneRegistry` to `scenes`
* add jsdoc comments for pc.Application#scenes
* remove jsdoc private tag for pc.Registry and pc.RegistryItem
* add jsdoc for pc.RegistryItem properties
* mark old scene functions as private and deprecated
* add console warning (if debug build) in deprecated scene functions
Co-authored-by: Will Eastcott <will@playcanvas.com>
Copy file name to clipboardExpand all lines: src/framework/application.js
+40-9Lines changed: 40 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,18 @@ Object.assign(pc, function () {
77
77
* this.app.maxDeltaTime = 0.2;
78
78
*/
79
79
80
+
/**
81
+
* @name pc.Application#scenes
82
+
* @type {pc.SceneRegistry}
83
+
* @description The scene registry managed by the application.
84
+
* @example
85
+
* // Search the scene registry for a item with the name 'racetrack1'
86
+
* var sceneItem = this.app.scenes.find('racetrack1');
87
+
*
88
+
* // Load the scene using the item's url
89
+
* this.app.scenes.loadScene(sceneItem.url);
90
+
*/
91
+
80
92
/**
81
93
* @name pc.Application#assets
82
94
* @type {pc.AssetRegistry}
@@ -302,7 +314,7 @@ Object.assign(pc, function () {
302
314
303
315
this.i18n=newpc.I18n(this);
304
316
305
-
this._sceneRegistry=newpc.SceneRegistry(this);
317
+
this.scenes=newpc.SceneRegistry(this);
306
318
307
319
varself=this;
308
320
this.defaultLayerWorld=newpc.Layer({
@@ -817,22 +829,28 @@ Object.assign(pc, function () {
817
829
},
818
830
819
831
/**
832
+
* @private
833
+
* @deprecated
820
834
* @function
821
835
* @name pc.Application#getSceneUrl
822
836
* @description Look up the URL of the scene hierarchy file via the name given to the scene in the editor. Use this to in {@link pc.Application#loadSceneHierarchy}.
823
837
* @param {string} name - The name of the scene file given in the Editor.
824
838
* @returns {string} The URL of the scene file.
825
839
*/
826
840
getSceneUrl: function(name){
827
-
varentry=this._sceneRegistry.find(name);
841
+
// #ifdef DEBUG
842
+
console.warn("DEPRECATED: pc.Application#getSceneUrl is deprecated. Use pc.Application#scenes and pc.SceneRegistry#find instead.");
843
+
// #endif
844
+
varentry=this.scenes.find(name);
828
845
if(entry){
829
846
returnentry.url;
830
847
}
831
848
returnnull;
832
-
833
849
},
834
850
835
851
/**
852
+
* @private
853
+
* @deprecated
836
854
* @function
837
855
* @name pc.Application#loadSceneHierarchy
838
856
* @description Load a scene file, create and initialize the Entity hierarchy
@@ -850,10 +868,15 @@ Object.assign(pc, function () {
console.warn("DEPRECATED: pc.Application#loadSceneHierarchy is deprecated. Use pc.Application#scenes and pc.SceneRegistry#loadSceneHierarchy instead.");
873
+
// #endif
874
+
this.scenes.loadSceneHierarchy(url,callback);
854
875
},
855
876
856
877
/**
878
+
* @private
879
+
* @deprecated
857
880
* @function
858
881
* @name pc.Application#loadSceneSettings
859
882
* @description Load a scene file and automatically apply the scene settings to the current scene.
@@ -869,10 +892,15 @@ Object.assign(pc, function () {
0 commit comments