Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Use a custom icon for custom animations to better differentiate them

Scott Petrovic57b693669fe9
diff --git a/src/lib/processes/animations-listing/AnimationSearch.ts b/src/lib/processes/animations-listing/AnimationSearch.ts
index df0b251..6d7635c 100644
--- a/src/lib/processes/animations-listing/AnimationSearch.ts
+++ b/src/lib/processes/animations-listing/AnimationSearch.ts
@@ -181,24 +181,25 @@ export class AnimationSearch extends EventTarget {
const theme_name: string = this.theme_manager.get_current_theme()
const is_custom_animation = animation_clip.metadata?.source_type === 'custom-import'
- // build out inner HTML for animation item
- let animation_entry_html = `<div class="${is_custom_animation ? 'anim-custom-item' : 'anim-item'}">
- <button class="secondary-button play" data-index="${original_index}" style="display: flex; flex-direction:column">`
-
- // custom animations won't have a video preview, so make it appear a bit different
- if (is_custom_animation) {
- animation_entry_html += '<div class="anim-preview-placeholder" style="pointer-events: none;">'
- } else {
- animation_entry_html += `<div class="anim-preview-placeholder" data-src="../animpreviews/${preview_folder}/${theme_name}_${anim_name}.webm" style="pointer-events: none;">`
- }
-
- animation_entry_html += `<div class="anim-item">
- <button class="secondary-button play" data-index="${original_index}" style="display: flex; flex-direction:column"></button>
- <label class="styled-checkbox">
- <input type="checkbox" name="${animation_clip.name}" value="${original_index}" ${checked_attribute}>
- <span class="anim-preview-label">${this.animation_name_clean(animation_clip.name)}</span>
- </label>
- </div>`
+ const preview_data_src_attribute = is_custom_animation
+ ? ''
+ : ` data-src="../animpreviews/${preview_folder}/${theme_name}_${anim_name}.webm"`
+
+ const custom_animation_badge_html = is_custom_animation
+ ? '<span class="anim-custom-badge" title="Custom animation" aria-label="Custom animation">C</span>'
+ : ''
+
+ const animation_entry_html = `
+ <div class="${is_custom_animation ? 'anim-custom-item' : 'anim-item'}">
+ <button class="secondary-button play" data-index="${original_index}" style="display: flex; flex-direction:column; position: relative;">
+ ${custom_animation_badge_html}
+ <div class="anim-preview-placeholder"${preview_data_src_attribute} style="pointer-events: none;"></div>
+ <label class="styled-checkbox">
+ <input type="checkbox" name="${animation_clip.name}" value="${original_index}" ${checked_attribute}>
+ <span class="anim-preview-label">${this.animation_name_clean(animation_clip.name)}</span>
+ </label>
+ </button>
+ </div>`
// append the entire item HTML to the DOM element
this.animation_list_container.innerHTML += animation_entry_html
diff --git a/src/styles.css b/src/styles.css
index 50fc20a..3c16955 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -226,7 +226,7 @@ button.secondary-button.play
{
padding: 0;
display: inline-flex;
- background: var(--bg-primary);
+ /* background: var(--bg-primary); */
flex-grow: 1;
align-items: center;
border: none;
@@ -443,6 +443,7 @@ option {
font-size: 90%;
cursor: pointer;
line-height: 110%;
+ text-align: left;
}
@@ -651,4 +652,16 @@ input[type="file"] {
#animation-progress-loader-container #loading-status-text {
font-size: 1.1rem;
color: var(--text-primary);
+}
+
+.anim-custom-badge {
+ position: absolute;
+ top: 0.5rem;
+ left: 0.5rem;
+ border-radius: 3rem;
+ background: var(--button-alternate-bg);
+ color: #ffffff;
+ font-size: 0.9rem;
+ pointer-events: none;
+ padding: 0.5rem 1rem;
}
\ No newline at end of file