Skip to content

Commit

Permalink
Shrinktofit new gen anim 24 (#23)
Browse files Browse the repository at this point in the history
* NewGenAnim

* NewGenAnim

* NewGenAnim

* allow create animgraph asset

* add animation-graph edit template

* NewGenAnim

* add layers variables

* Update

* NewGenAnim

* Update

* Update

* Update

* Update

* NewGenAnim

* Fix

* .transitions()

* Fix

* NewGenAnim

* .transitions()

* Change nodes to nodes()

* Update

* change animation-graph dumpData

* removeLayer() removeVariable()

* NewGenAnim

* .transitions()

* Change nodes to nodes()

* Update

* removeLayer() removeVariable()

* moveLayer()

* only open button in inspector

Co-authored-by: arsen2010 <arsen2010@126.com>
  • Loading branch information
shrinktofit and arsen2010 committed Jun 29, 2021
1 parent b57ccc7 commit c4a60dd
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
45 changes: 45 additions & 0 deletions editor/assets/default_file_content/animgraph
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"__type__": "cc.animation.PoseGraph",
"_name": "",
"_objFlags": 0,
"_native": "",
"_layers": [
{
"weight": 1,
"mask": null,
"blending": 1,
"_graph": {
"_bindings": {},
"name": "Main Layer",
"_nodes": [
{
"_bindings": {},
"name": ""
},
{
"_bindings": {},
"name": ""
},
{
"_bindings": {},
"name": ""
}
],
"_transitions": [],
"_entryNode": {
"_bindings": {},
"name": ""
},
"_existNode": {
"_bindings": {},
"name": ""
},
"_anyNode": {
"_bindings": {},
"name": ""
}
}
}
],
"_variables": {}
}
12 changes: 12 additions & 0 deletions editor/assets/default_file_content/animgraph.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"ver": "1.0.0",
"importer": "*",
"imported": true,
"uuid": "e0a8e34d-9242-4f0f-833b-f57e1ffbf285",
"files": [
"",
".json"
],
"subMetas": {},
"userData": {}
}
1 change: 1 addition & 0 deletions editor/inspector/assets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { join } = require('path');

module.exports = {
'animation-graph': join(__dirname, './assets/animation-graph.js'),
'audio-clip': join(__dirname, './assets/audio-clip.js'),
'auto-atlas': join(__dirname, './assets/texture/auto-atlas.js'), // reuse
'dragonbones-atlas': join(__dirname, './assets/json.js'), // reuse
Expand Down
51 changes: 51 additions & 0 deletions editor/inspector/assets/animation-graph.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
exports.template = `
<section class="asset-animation-graph">
<ui-button class="open">Open Animation Graph Editor Panel</ui-button>
<ui-label class="tip" value="Not support multiple selections"></ui-label>
</section>
`;

exports.style = `
.asset-animation-graph {
padding-top: 10px;
text-align: center;
}
.asset-animation-graph .tip {
color: var(--color-focus-contrast-weakest);
}
`;

exports.$ = {
constainer: '.asset-animation-graph',
button: '.open',
tip: '.tip',
};

exports.ready = function() {
this.$.button.addEventListener('click', async () => {
await Editor.Message.request('scene', 'execute-scene-script', {
name: 'animation-graph',
method: 'edit',
args: [this.asset.uuid],
});

Editor.Panel.open('animation-graph');
});
};

exports.update = function(assetList, metaList) {
this.assetList = assetList;
this.metaList = metaList;
this.meta = this.metaList[0];
this.asset = this.assetList[0];

if (assetList.length !== 1) {
this.$.button.disabled = true;
this.$.tip.style.display = 'block';
} else {
this.$.button.disabled = false;
this.$.tip.style.display = 'none';
}
};

0 comments on commit c4a60dd

Please sign in to comment.