mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 08:42:43 +08:00
Merge pull request #1748 from jareguo/master
fix CC_DEV in build worker
This commit is contained in:
@@ -169,6 +169,7 @@ function defineGetSet (cls, name, propName, val, es6) {
|
||||
var setter = val.set;
|
||||
var proto = cls.prototype;
|
||||
var d = Object.getOwnPropertyDescriptor(proto, propName);
|
||||
var setterUndefined = !d;
|
||||
|
||||
if (getter) {
|
||||
if (CC_DEV && !es6 && d && d.get) {
|
||||
@@ -192,32 +193,23 @@ function defineGetSet (cls, name, propName, val, es6) {
|
||||
}
|
||||
|
||||
if (!es6) {
|
||||
var setterUndefined = !d;
|
||||
JS.get(proto, propName, getter, setterUndefined, setterUndefined);
|
||||
}
|
||||
|
||||
if (CC_DEV) {
|
||||
if (CC_EDITOR || CC_DEV) {
|
||||
Attr.setClassAttr(cls, propName, 'hasGetter', true); // 方便 editor 做判断
|
||||
}
|
||||
}
|
||||
|
||||
if (setter) {
|
||||
if (CC_DEV) {
|
||||
if (!es6) {
|
||||
if (d && d.set) {
|
||||
return cc.errorID(3640, name, propName);
|
||||
}
|
||||
JS.set(proto, propName, setter, true, true);
|
||||
if (!es6) {
|
||||
if (CC_DEV && d && d.set) {
|
||||
return cc.errorID(3640, name, propName);
|
||||
}
|
||||
Attr.setClassAttr(cls, propName, 'hasSetter', true); // 方便 editor 做判断
|
||||
JS.set(proto, propName, setter, setterUndefined, setterUndefined);
|
||||
}
|
||||
else if (!es6) {
|
||||
if (d) {
|
||||
JS.set(proto, propName, setter);
|
||||
}
|
||||
else {
|
||||
JS.set(proto, propName, setter, true, true);
|
||||
}
|
||||
if (CC_EDITOR || CC_DEV) {
|
||||
Attr.setClassAttr(cls, propName, 'hasSetter', true); // 方便 editor 做判断
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ Details.prototype.reset = function () {
|
||||
//this.rawObjList.length = 0;
|
||||
//this.rawPropList.length = 0;
|
||||
};
|
||||
if (CC_DEV) {
|
||||
if (CC_EDITOR) {
|
||||
Details.prototype.assignAssetsBy = function (getter) {
|
||||
for (var i = 0, len = this.uuidList.length; i < len; i++) {
|
||||
var uuid = this.uuidList[i];
|
||||
|
||||
@@ -376,7 +376,7 @@ js.getClassName = function (objOrCtor) {
|
||||
return '';
|
||||
};
|
||||
|
||||
function isTempClassId_DEV (id) {
|
||||
function isTempClassId (id) {
|
||||
return typeof id !== 'string' || id.startsWith(tempCIDGenerater.prefix);
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ cc.js.unregisterClass to remove the id of unused class';
|
||||
var res;
|
||||
if (typeof obj === 'function' && obj.prototype.hasOwnProperty('__cid__')) {
|
||||
res = obj.prototype.__cid__;
|
||||
if (!allowTempId && CC_DEV && isTempClassId_DEV(res)) {
|
||||
if (!allowTempId && (CC_DEV || CC_EDITOR) && isTempClassId(res)) {
|
||||
return '';
|
||||
}
|
||||
return res;
|
||||
@@ -521,7 +521,7 @@ cc.js.unregisterClass to remove the id of unused class';
|
||||
var prototype = obj.constructor.prototype;
|
||||
if (prototype && prototype.hasOwnProperty('__cid__')) {
|
||||
res = obj.__cid__;
|
||||
if (!allowTempId && CC_DEV && isTempClassId_DEV(res)) {
|
||||
if (!allowTempId && (CC_DEV || CC_EDITOR) && isTempClassId(res)) {
|
||||
return '';
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -390,12 +390,12 @@ sp.Skeleton = cc.Class({
|
||||
// IMPLEMENT
|
||||
|
||||
__preload: function () {
|
||||
// sgNode 的尺寸不是很可靠 同时 Node 的框框也没办法和渲染匹配 只好强制尺寸为零
|
||||
if (CC_DEV) {
|
||||
if (CC_EDITOR || CC_DEV) {
|
||||
var Flags = cc.Object.Flags;
|
||||
this._objFlags &= Flags.PersistentMask; // for v1.0 project
|
||||
this._objFlags |= (Flags.IsAnchorLocked | Flags.IsSizeLocked);
|
||||
}
|
||||
// sgNode 的尺寸不是很可靠 同时 Node 的框框也没办法和渲染匹配 只好强制尺寸为零
|
||||
this.node.setContentSize(0, 0);
|
||||
//
|
||||
this._refresh();
|
||||
|
||||
@@ -120,7 +120,7 @@ Function(
|
||||
defineMacro('CC_TEST', defined('tap') + '||' + defined('QUnit')) +
|
||||
defineMacro('CC_EDITOR', defined('Editor') + '&&' + defined('process') + '&&"electron" in process.versions') +
|
||||
defineMacro('CC_PREVIEW', '!CC_EDITOR') +
|
||||
defineMacro('CC_DEV', true) + // CC_EDITOR || CC_PREVIEW || CC_TEST
|
||||
defineMacro('CC_DEV', true) + // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST
|
||||
defineMacro('CC_DEBUG', true) + // CC_DEV || Debug Build
|
||||
defineMacro('CC_JSB', defined('jsb')) +
|
||||
defineMacro('CC_BUILD', false)
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ Function(
|
||||
defineMacro('CC_TEST', defined('tap') + '||' + defined('QUnit')) +
|
||||
defineMacro('CC_EDITOR', defined('Editor') + '&&' + defined('process') + '&&"electron" in process.versions') +
|
||||
defineMacro('CC_PREVIEW', '!CC_EDITOR') +
|
||||
defineMacro('CC_DEV', true) + // CC_EDITOR || CC_PREVIEW || CC_TEST
|
||||
defineMacro('CC_DEV', true) + // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST
|
||||
defineMacro('CC_DEBUG', true) + // CC_DEV || Debug Build
|
||||
defineMacro('CC_JSB', defined('jsb')) +
|
||||
defineMacro('CC_BUILD', false)
|
||||
|
||||
Reference in New Issue
Block a user