mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
support missing script for prefab
This commit is contained in:
@@ -30,6 +30,7 @@ require('../platform/deserialize');
|
||||
var _tdInfo = new cc.deserialize.Details();
|
||||
|
||||
var SCENE_ID = 'cc.Scene';
|
||||
var PREFAB_ID = 'cc.Prefab';
|
||||
|
||||
function loadDepends (pipeline, item, asset, tdInfo, callback) {
|
||||
var uuid = item.id,
|
||||
@@ -126,11 +127,12 @@ function loadUuid (item, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isScene = json && (
|
||||
var isInScene = json && (
|
||||
(json[0] && json[0].__type__ === SCENE_ID) ||
|
||||
(json[1] && json[1].__type__ === SCENE_ID)
|
||||
(json[1] && json[1].__type__ === SCENE_ID) ||
|
||||
(json[0] && json[0].__type__ === PREFAB_ID)
|
||||
);
|
||||
var classFinder = isScene ? cc._MissingScript.safeFindClass : function (id) {
|
||||
var classFinder = isInScene ? cc._MissingScript.safeFindClass : function (id) {
|
||||
var cls = JS._getClassById(id);
|
||||
if (cls) {
|
||||
return cls;
|
||||
|
||||
@@ -150,8 +150,10 @@ var enumerateObject = function (obj, parent) {
|
||||
else {
|
||||
// primitive javascript object
|
||||
for (key in obj) {
|
||||
//cc.log(key);
|
||||
if (!obj.hasOwnProperty(key) || (key.charCodeAt(0) === 95 && key.charCodeAt(1) === 95)) { // starts with __
|
||||
if ( !obj.hasOwnProperty(key) ||
|
||||
// starts with "__" but not "__type__"
|
||||
(key.charCodeAt(0) === 95 && key.charCodeAt(1) === 95 && key !== '__type__')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
value = obj[key];
|
||||
|
||||
Reference in New Issue
Block a user