Skip to content

Commit

Permalink
FIxing dialog and graph to tell "please add new graph"
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-moreau committed Aug 4, 2018
1 parent fbbf18b commit 74702b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/editor/gui/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ export default class Dialog {
form.build('ASK-NAME-CREATE-DIALOG');

// Events
popin.onClose = () => form.element.destroy();

popin.onButtonClick = id => {
if (!form.isValid())
return;

resolve(form.element.record['Name']);

// Destroy
form.element.destroy();
// Close
popin.close();
};
});
Expand Down
14 changes: 12 additions & 2 deletions src/tools/behavior/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,13 @@ export default class BehaviorGraphEditor extends EditorPlugin {
this.toolbar.element.right = `Attached to "${node instanceof Scene ? 'Scene' : node.name}"`;
this.toolbar.element.render();

// Unlock
// Unlock / lock
this.layout.unlockPanel('left');
this.layout.unlockPanel('main');

if (this.datas.metadatas.length === 0)
this.layout.lockPanel('main', 'Please add a graph');
else
this.layout.unlockPanel('main');
}

/**
Expand Down Expand Up @@ -320,6 +324,9 @@ export default class BehaviorGraphEditor extends EditorPlugin {
// Select latest script
this.grid.select([this.datas.metadatas.length - 1]);
this.selectGraph(this.datas.metadatas.length - 1);

// Unlock
this.layout.unlockPanel('main');
}

/**
Expand All @@ -334,6 +341,9 @@ export default class BehaviorGraphEditor extends EditorPlugin {
this.datas.metadatas.splice(id - offset, 1);
offset++;
});

// Update
this.objectSelected(this.node);
}

/**
Expand Down

0 comments on commit 74702b2

Please sign in to comment.