Skip to content

Commit 74702b2

Browse files
committed
FIxing dialog and graph to tell "please add new graph"
1 parent fbbf18b commit 74702b2

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/editor/gui/dialog.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ export default class Dialog {
5656
form.build('ASK-NAME-CREATE-DIALOG');
5757

5858
// Events
59+
popin.onClose = () => form.element.destroy();
60+
5961
popin.onButtonClick = id => {
6062
if (!form.isValid())
6163
return;
6264

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

65-
// Destroy
66-
form.element.destroy();
67+
// Close
6768
popin.close();
6869
};
6970
});

src/tools/behavior/graph.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,13 @@ export default class BehaviorGraphEditor extends EditorPlugin {
270270
this.toolbar.element.right = `Attached to "${node instanceof Scene ? 'Scene' : node.name}"`;
271271
this.toolbar.element.render();
272272

273-
// Unlock
273+
// Unlock / lock
274274
this.layout.unlockPanel('left');
275-
this.layout.unlockPanel('main');
275+
276+
if (this.datas.metadatas.length === 0)
277+
this.layout.lockPanel('main', 'Please add a graph');
278+
else
279+
this.layout.unlockPanel('main');
276280
}
277281

278282
/**
@@ -320,6 +324,9 @@ export default class BehaviorGraphEditor extends EditorPlugin {
320324
// Select latest script
321325
this.grid.select([this.datas.metadatas.length - 1]);
322326
this.selectGraph(this.datas.metadatas.length - 1);
327+
328+
// Unlock
329+
this.layout.unlockPanel('main');
323330
}
324331

325332
/**
@@ -334,6 +341,9 @@ export default class BehaviorGraphEditor extends EditorPlugin {
334341
this.datas.metadatas.splice(id - offset, 1);
335342
offset++;
336343
});
344+
345+
// Update
346+
this.objectSelected(this.node);
337347
}
338348

339349
/**

0 commit comments

Comments
 (0)