Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixes loading presets with textures referencing groups #591

Merged
merged 2 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/application/worker/store/modules/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const state = {
textureDefinition.id = id;
}

if (type === "canvas") {
if (type === "canvas" || type == "group") {
const { id } = options;
textureDefinition.location = "outputs/auxillaryCanvas";
textureDefinition.id = id;
Expand Down
9 changes: 6 additions & 3 deletions src/application/worker/store/modules/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ const actions = {
return writeTo.groups[existingGroupIndex];
}

const id = args.id || uuidv4();

const group = {
...args,
name,
id,
clearing: args.clearing || false,
enabled: args.enabled || false,
hidden: args.hidden || false,
Expand All @@ -121,9 +124,9 @@ const actions = {
compositeOperation: args.compositeOperation || "normal",
context: await store.dispatch("outputs/getAuxillaryOutput", {
name,
group: "group"
}),
id: args.id || uuidv4()
group: "group",
id
})
};

const alphaInputBind = await store.dispatch("inputs/addInput", {
Expand Down
6 changes: 4 additions & 2 deletions src/application/worker/store/modules/outputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const actions = {
type = "2d",
options = {},
group = "",
id = "",
reactToResize = true,
width = state.main ? state.main.canvas.width : 300,
height = state.main ? state.main.canvas.height : 300
Expand All @@ -70,14 +71,15 @@ const actions = {
name,
context,
reactToResize,
group
group,
id
});

return outputContext;
},

addAuxillaryOutput({ commit }, outputContext) {
outputContext.id = uuidv4();
outputContext.id = outputContext.id || uuidv4();
commit("ADD_AUXILLARY", outputContext);
return outputContext;
},
Expand Down
7 changes: 4 additions & 3 deletions src/components/Controls/TextureControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</select>

<div v-if="type === 'group'">
<select v-model="modelCanvasId" @change="setTexture('canvas')">
<select v-model="modelCanvasId" @change="setTexture('group')">
<option v-for="group in groupOutputs" :value="group.id" :key="group.id">
{{ group.name }}
</option>
Expand Down Expand Up @@ -68,7 +68,8 @@ export default {
this.value.type && this.value.type.length
? this.value.type
: this.textureTypes[0];
this.modelImagePath = this.value.options.path;
this.modelImagePath = this.value.options.path || "";
this.modelCanvasId = this.value.options.id || "";
},

computed: {
Expand Down Expand Up @@ -117,7 +118,7 @@ export default {
textureDefinition.options.path = this.modelImagePath;
}

if (type === "canvas") {
if (type === "canvas" || type === "group") {
if (!this.modelCanvasId) {
return;
}
Expand Down