support missing script for prefab

This commit is contained in:
Jare Guo
2016-04-11 21:23:39 +08:00
parent 111e633541
commit 725af05924
2 changed files with 9 additions and 5 deletions
+5 -3
View File
@@ -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;
+4 -2
View File
@@ -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];