Skip to content

Commit 90ccefb

Browse files
authored
Merge pull request #130 from patuwwy/fix-fork-2
Purge passes on import/fork
2 parents 0d58d32 + c78cbd6 commit 90ccefb

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

app/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Shadertoy unofficial plugin.",
4-
"version": "0.13.226",
4+
"version": "0.13.228",
55
"description": "Shadertoy.com unofficial plugin.",
66
"homepage_url": "https://github.com/patuwwy/ShaderToy-Chrome-Plugin",
77
"background": {

app/shadertoy-plugin.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,14 @@
669669
var text = reader.result;
670670

671671
try {
672-
dataLoadShader(
673-
JSON.parse('[' + text + ']')
674-
);
672+
while(gShaderToy.mEffect.mPasses.length) {
673+
gShaderToy.mEffect.DestroyPass(0);
674+
}
675+
676+
gShaderToy.Load(JSON.parse(text, true));
675677
} catch (error) {
676678
window.alert('Failed to load shader!');
677679
}
678-
679-
gShaderToy.mInfo.id = '-1';
680680
};
681681

682682
reader.readAsText(file);
@@ -1067,7 +1067,11 @@
10671067
gShaderToy.mEffect.DestroyPass(0);
10681068

10691069
setTimeout(function() {
1070-
gShaderToy.Load(JSON.parse('[' + storedShader + ']')[0]);
1070+
while(gShaderToy.mEffect.mPasses.length) {
1071+
gShaderToy.mEffect.DestroyPass(0);
1072+
}
1073+
1074+
gShaderToy.Load(JSON.parse(storedShader), true);
10711075
window.localStorage.setItem(
10721076
LOCALSTORAGE_SHADER_FORK_KEYNAME,
10731077
''

0 commit comments

Comments
 (0)