Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update component menu #7

Merged
merged 1 commit into from
Dec 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cocos2d/core/assets/CCPrefab.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ var Prefab = cc.Class({
}
});

cc._Prefab = module.exports = Prefab;
cc.Prefab = module.exports = Prefab;
cc.js.obsolete(cc, 'cc._Prefab', 'Prefab');
2 changes: 1 addition & 1 deletion cocos2d/core/components/CCCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var Canvas = cc.Class({
name: 'cc.Canvas', extends: require('./CCComponent'),

editor: CC_EDITOR && {
menu: 'Canvas',
menu: 'UI/Canvas',
executeInEditMode: true,
disallowMultiple: true
},
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/components/CCELabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var Label = cc.Class({
extends: cc._ComponentInSG,

editor: CC_EDITOR && {
menu: 'UI/Label'
menu: 'Graphics/Label'
},

properties: {
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/components/CCSpriteRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var SpriteRenderer = cc.Class({
extends: require('./CCComponentInSG'),

editor: CC_EDITOR && {
menu: 'Sprite',
menu: 'Graphics/Sprite',
inspector: 'app://editor/page/inspector/sprite.html'
},

Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/components/CCWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var Widget = cc.Class({
name: 'cc.Widget', extends: require('./CCComponent'),

editor: CC_EDITOR && {
menu: 'Widget',
menu: 'UI/Widget',
executeInEditMode: true,
disallowMultiple: true,
inspector: 'app://editor/page/inspector/widget/index.html'
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/core/platform/prefab-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var PrefabInfo = cc.Class({
default: null,
},

// 所属的 prefab 资源对象 (cc._Prefab)
// 所属的 prefab 资源对象 (cc.Prefab)
// (这个属性在场景中是会保存的,但是不会保存在 prefab 里面,因为创建 prefab 时还不知道自己的 uuid 是多少。)
asset: {
default: null,
Expand Down
24 changes: 7 additions & 17 deletions cocos2d/core/utils/base-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,6 @@ var BaseNode = cc.Class(/** @lends cc.ENode# */{
},
},

/**
* position of node.
* @property position
* @type {Vec2}
*/
position: {
get: SGProto.getPosition,
set: function (value) {
this._position.x = value.x;
this._sgNode.x = value.x;

this._position.y = value.y;
this._sgNode.y = value.y;
}
},

/**
* x axis position of node.
* @property x
Expand Down Expand Up @@ -1224,7 +1208,7 @@ var BaseNode = cc.Class(/** @lends cc.ENode# */{

// Define public getter and setter methods to ensure api compatibility.

var SameNameGetSets = ['name', 'skewX', 'skewY', 'rotation', 'rotationX', 'rotationY',
var SameNameGetSets = ['name', 'skewX', 'skewY', 'position', 'rotation', 'rotationX', 'rotationY',
'scale', 'scaleX', 'scaleY', 'children', 'childrenCount', 'parent', 'running',
/*'actionManager',*/ 'scheduler', /*'shaderProgram',*/ 'opacity', 'color', 'tag'];
var DiffNameGetSets = {
Expand Down Expand Up @@ -1268,6 +1252,12 @@ var BaseNode = cc.Class(/** @lends cc.ENode# */{
}
})();

/**
* position of node.
* @property position
* @type {Vec2}
*/

/**
* Scale of node
* @property scale
Expand Down
2 changes: 1 addition & 1 deletion cocos2d/particle/CCEParticleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ var ParticleSystem = cc.Class({
name: 'cc.ParticleSystem',
extends: cc._ComponentInSG,
editor: CC_EDITOR && {
menu: 'ParticleSystem',
menu: 'Graphics/ParticleSystem',
inspector: 'app://editor/page/inspector/particle-system/index.html',
playOnFocus: true,
},
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ paths = {
test: {
src: 'test/qunit/unit/**/*.js',
runner: 'test/qunit/lib/qunit-runner.html',
jsEntryEditorExtends: '../../editor/share/engine-extends/index.js', // only available in editor
jsEntryEditorExtends: '../editor/share/engine-extends/index.js', // only available in editor
dest: 'bin/cocos2d-js-for-test.js',
destEditorExtends: 'bin/cocos2d-js-extends-for-test.js'
},
Expand Down
4 changes: 4 additions & 0 deletions test/qunit/unit/test-load-scene.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
(function () {

if (!TestEditorExtends) {
return;
}

var Script;

module('test scene serialization', {
Expand Down
4 changes: 4 additions & 0 deletions test/qunit/unit/test-prefab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
(function () {

if (!TestEditorExtends) {
return;
}

//var testingCompCallback = false;

var MyComponent = cc.Class({
Expand Down
31 changes: 17 additions & 14 deletions test/qunit/unit/test-record-object.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
if (TestEditorExtends) {

test('undo destroy', function () {
var Type = cc.Class({
extends: cc.Object
test('undo destroy', function () {
var Type = cc.Class({
extends: cc.Object
});
var obj1 = new Type();
var record = Editor._recordObject(obj1);
obj1.destroy();
Editor._restoreObject(obj1, record);
cc.Object._deferredDestroy();
ok(obj1.isValid, 'it should be valid if restored before _deferredDestroy');

obj1.destroy();
cc.Object._deferredDestroy();
Editor._restoreObject(obj1, record);
ok(obj1.isValid, 'it should be valid if restored after _deferredDestroy');
});
var obj1 = new Type();
var record = Editor._recordObject(obj1);
obj1.destroy();
Editor._restoreObject(obj1, record);
cc.Object._deferredDestroy();
ok(obj1.isValid, 'it should be valid if restored before _deferredDestroy');

obj1.destroy();
cc.Object._deferredDestroy();
Editor._restoreObject(obj1, record);
ok(obj1.isValid, 'it should be valid if restored after _deferredDestroy');
});
}