Ensure asset is used only once. #30
Unanswered
mGonzim
asked this question in
Help + Q&A
Replies: 2 comments
-
This has been suggested before but there is no way currently to do this. my approach to adding this feature (and/or the commonly requested "only use an item once") would be something like:
in your implementation, you would want do set the array of layers to choose from based on a filter of the const compatibleLayers = layer.elements.filter(
(layer) => !incompatibleDNA.includes(layer.name)
); and adding something like, const unusedLayers = layer.elements.filter(layer => layer.useCount === 0)
const compatibleLayers = layer.elements.filter(
(layer) => {
// if there are layers that haven't been used, filter out the used ones
if (unusedLayers.length > 1) {
return !incompatibleDNA.includes(layer.name) && layer.useCount == 0;
} else {
// if all layers have been used once, only worry about incompatible
return !incompatibleDNA.includes(layer.name)
}
}
); (untested, non-optimal codefor example) |
Beta Was this translation helpful? Give feedback.
0 replies
-
You are clearly good at what you do. I have an idea how to implement this
but I would gladly pay for this feature. Any chance this is possible? 🤔
…On Mon, Feb 14, 2022, 11:39 PM nftchef ***@***.***> wrote:
This has been suggested before but there is no way currently to do this.
my approach to adding this feature (and/or the commonly requested "only
use an item once") would be something like:
- when constructing the available layers probably in getElements, add
a count property, something like useCount
- Then, when selecting the layers in pickRandomElement (which is
already a bloated function). do a check on the count flag.
in your implementation, you would want do set the array of layers to
choose from based on a filter of the useCount property,
essentially extending the compatibleLayers feature to also check for use
count
Taking this,
const compatibleLayers = layer.elements.filter(
(layer) => !incompatibleDNA.includes(layer.name)
);
and adding something like,
const unusedLayers = layer.elements.filter(layer => layer.useCount === 0)
const compatibleLayers = layer.elements.filter(
(layer) => {
// if there are layers that haven't been used, filter out the used ones
if (unusedLayers.length > 1) {
return !incompatibleDNA.includes(layer.name) && layer.useCount == 0;
} else {
// if all layers have been used once, only worry about incompatible
return !incompatibleDNA.includes(layer.name)
}
}
);
(untested, non-optimal codefor example)
—
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AISLUNAMETK7MM52UTJTF3DU3HKIRANCNFSM5OMQTC3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm hoping to get some help. Is there a way to choose a folder within the config however to ensure that the assets used within the folder are only used once. I have some programing experience in JS if you can point me in the right direction I would be very appreciative.
Beta Was this translation helpful? Give feedback.
All reactions