Skip to content

Commit dd43d49

Browse files
committed
Fixed post-process editor
1 parent ed0f79a commit dd43d49

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/editor/components/assets.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export default class EditorAssets {
137137

138138
// Empty or not
139139
if (assets.length === 0) {
140-
this.emptyTextNode = Tools.CreateElement<HTMLHeadElement>('h1', BabylonTools.RandomId(), {
140+
const emptyTextNode = Tools.CreateElement<HTMLHeadElement>('h1', BabylonTools.RandomId(), {
141141
'float': 'left',
142142
'left': '50%',
143143
'top': '50%',
@@ -147,9 +147,9 @@ export default class EditorAssets {
147147
'font-family': 'Roboto,sans-serif !important',
148148
'opacity': '0.5'
149149
});
150-
this.emptyTextNode.textContent = 'Empty';
150+
emptyTextNode.textContent = 'Empty';
151151

152-
$('#' + c.id).append(this.emptyTextNode);
152+
$('#' + c.id).append(emptyTextNode);
153153
}
154154

155155
// Add elements
@@ -250,8 +250,9 @@ export default class EditorAssets {
250250
else
251251
$('#' + component.id).hide();
252252

253-
// Save component
253+
// Save component and refresh
254254
this.components.push(component);
255+
this.refresh(component.id);
255256
}
256257

257258
/**

src/editor/gui/dialog.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class Dialog {
3737
* @param title the title of the dialog
3838
*/
3939
public static CreateWithTextInput (title: string): Promise<string> {
40-
return new Promise<string>((resolve) => {
40+
return new Promise<string>((resolve, reject) => {
4141
// Window
4242
const popin = new Window('AskName');
4343
popin.title = title;
@@ -56,7 +56,10 @@ export default class Dialog {
5656
form.build('ASK-NAME-CREATE-DIALOG');
5757

5858
// Events
59-
popin.onClose = () => form.element.destroy();
59+
popin.onClose = () => {
60+
form.element.destroy();
61+
reject('User decided to not give an input');
62+
};
6063

6164
popin.onButtonClick = id => {
6265
if (!form.isValid())

src/tools/post-process-editor/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ export default class PostProcessEditor extends EditorPlugin {
218218
* @param id the id of the selected item
219219
*/
220220
protected deletePostProcess (id: number): void {
221-
const data = this.datas[id];
222-
223-
const p = this.createOrUpdatePostProcess(data.name);
224-
p.dispose();
221+
const p = this.createOrUpdatePostProcess(this.datas[id].name);
222+
if (p)
223+
p.dispose();
225224

226225
// Remove data
227226
this.datas.splice(id, 1);
228227
this.data = this.datas[0];
229228

230-
// Check if empty
231-
if (this.datas.length === 0) {
229+
if (this.data)
230+
this.selectPostProcess(0);
231+
else {
232232
this.code.setValue('');
233233
this.pixel.setValue('');
234234
this.config.setValue('');
@@ -297,7 +297,6 @@ export default class PostProcessEditor extends EditorPlugin {
297297

298298
if (p.name === name) {
299299
p.setConfig(JSON.parse(this.data.config));
300-
p.userConfig = { };
301300
this.editor.core.onSelectObject.notifyObservers(p);
302301
return p;
303302
}

0 commit comments

Comments
 (0)