Fix more 3D stuff, add back animation support

This commit is contained in:
Joshua Goins 2023-04-13 12:34:39 -04:00
parent 7f41367eca
commit ed16fa93e3
25 changed files with 108 additions and 127 deletions

View file

@ -0,0 +1,6 @@
{
"alt_text": "A 3d sculpt of a short, brown haired girl. Its only a bust.",
"date": "2020-12-12",
"title": "Sniper Stand-up Test",
"tags": ["Animation"]
}

View file

@ -1,4 +0,0 @@
{
"date": "2016",
"title": "Lantern"
}

View file

@ -1,8 +0,0 @@
{
"characters": [
"Sakura"
],
"date": "2021",
"nsfw": false,
"title": "Sakura (PC vs Quest poly)"
}

BIN
assets/3d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

BIN
assets/play-circle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -57,30 +57,27 @@ menu:
- name: 'Art' - name: 'Art'
url: '/art' url: '/art'
weight: 2 weight: 2
- name: '3D'
url: '/3D'
weight: 3
- name: 'Music' - name: 'Music'
url: '/music' url: '/music'
weight: 4 weight: 3
- name: 'Software' - name: 'Software'
url: '/software' url: '/software'
weight: 5 weight: 4
- name: 'Videos' - name: 'Videos'
url: 'https://tube.ryne.moe/@redchannel' url: 'https://tube.ryne.moe/@redchannel'
weight: 6 weight: 5
- name: 'Downloads' - name: 'Downloads'
url: '/downloads' url: '/downloads'
weight: 7 weight: 6
- name: 'Links' - name: 'Links'
url: '/links' url: '/links'
weight: 8 weight: 7
- name: 'Guestbook' - name: 'Guestbook'
url: '/guestbook' url: '/guestbook'
weight: 9 weight: 8
- name: 'About' - name: 'About'
url: '/about' url: '/about'
weight: 10 weight: 9
footer: footer:
- name: 'Blog Feed' - name: 'Blog Feed'
url: '/blog/index.xml' url: '/blog/index.xml'

View file

@ -0,0 +1,11 @@
---
title: Sniper Stand-up Test
date: 2020-12-12
layout: art-detail
filename: /animation/sniper-standup.webm
alt_text: "A 3d sculpt of a short, brown haired girl. Its only a bust."
slug: sniper-standup
animation: true
arttags:
- animation
---

View file

@ -1,11 +0,0 @@
---
title: Sakura (PC vs Quest poly)
date: 2021-01-01
excludefeed: true
layout: art-detail
filename: /art/pc-vs-quest.webp
slug: pc-vs-quest
characters:
- Sakura
nsfw: false
---

View file

@ -2,7 +2,7 @@
title: Art title: Art
layout: art layout: art
summary: My personal art gallery. summary: My personal art gallery.
new_banner: You can now view select 3D pieces in your browser! new_banner: You can now view select 3D pieces in your browser! Animations are slowly being added back too.
commissions: true commissions: true
aliases: aliases:
- /gallery - /gallery

View file

@ -1,22 +1,22 @@
--- ---
title: Stats title: Stats
layout: art-stats layout: art-stats
total: 187 total: 186
years: years:
- year: 2019 - year: 2019
num: 60 num: 60
- year: 2022 - year: 2022
num: 46 num: 46
- year: 2020 - year: 2020
num: 29 num: 30
- year: 2021 - year: 2021
num: 28 num: 27
- year: 2023 - year: 2023
num: 8 num: 8
- year: 2016
num: 8
- year: 2018 - year: 2018
num: 7 num: 7
- year: 2016
num: 7
- year: 2017 - year: 2017
num: 1 num: 1
characters: characters:
@ -26,23 +26,25 @@ characters:
num: 9 num: 9
- name: Merume - name: Merume
num: 7 num: 7
- name: Sakura
num: 5
- name: Mari - name: Mari
num: 5 num: 5
- name: Asuka - name: Asuka
num: 5 num: 5
- name: Mythra - name: Mythra
num: 4 num: 4
- name: Elisanne - name: Sakura
num: 2 num: 4
- name: Byleth - name: Byleth
num: 2 num: 2
- name: Tifa - name: Rei
num: 2
- name: Elisanne
num: 2 num: 2
tags: tags:
- name: technical - name: technical
num: 1 num: 1
- name: animation
num: 1
- name: landscape - name: landscape
num: 7 num: 7
- name: drawpile - name: drawpile

View file

@ -1,37 +0,0 @@
{
"categories": [
{
"name": "Uncategorized",
"description": "Test",
"years": [
{
"year": 2016,
"pieces": [
{
"title": "Lantern",
"filename": "lantern.glb"
}
]
},
{
"year": 2022,
"pieces": [
{
"title": "Sakura",
"filename": "sakura.glb"
}
]
},
{
"year": 2023,
"pieces": [
{
"title": "Planet Express Ship",
"filename": "planet-express-ship.glb"
}
]
}
]
}
]
}

View file

@ -4,6 +4,6 @@
"goinghome", "goinghome",
"orbit-correction" "orbit-correction"
], ],
"new-banner": "You can now view select 3D pieces in your browser!", "new-banner": "You can now view select 3D pieces in your browser! Animations are slowly being added back too.",
"commissions": true "commissions": true
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -7,7 +7,7 @@ def write_field(f, key, value):
f.write(key + ": " + value + "\n") f.write(key + ": " + value + "\n")
def parse_art_json(output_directory, filename, json_file, threed = False): def parse_art_json(output_directory, filename, json_file, threed = False, animation = False):
json_data = json.load(json_file) json_data = json.load(json_file)
year = None year = None
@ -46,7 +46,10 @@ def parse_art_json(output_directory, filename, json_file, threed = False):
if "camera-fov" in json_data: if "camera-fov" in json_data:
write_field(f, 'fov', json_data["camera-fov"]) write_field(f, 'fov', json_data["camera-fov"])
else: else:
write_field(f, 'filename', '/art/' + filename + '.webp') if animation:
write_field(f, 'filename', '/animation/' + filename + '.webm')
else:
write_field(f, 'filename', '/art/' + filename + '.webp')
if "alt_text" in json_data: if "alt_text" in json_data:
write_field(f, 'alt_text', write_field(f, 'alt_text',
@ -57,6 +60,9 @@ def parse_art_json(output_directory, filename, json_file, threed = False):
if threed: if threed:
write_field(f, 'threed', 'true') write_field(f, 'threed', 'true')
if animation:
write_field(f, 'animation', 'true')
characters = [] characters = []
if "characters" in json_data: if "characters" in json_data:
f.write("characters:\n") f.write("characters:\n")
@ -97,6 +103,7 @@ def parse_art_json(output_directory, filename, json_file, threed = False):
art_data_directory = '../art' art_data_directory = '../art'
threed_data_directory = '../3d' threed_data_directory = '../3d'
animation_data_directory = '../animation'
art_output_directory = '../content/art' art_output_directory = '../content/art'
shutil.rmtree(art_output_directory) shutil.rmtree(art_output_directory)
@ -168,6 +175,35 @@ for filename in os.listdir(threed_data_directory):
collected_years.add(year) collected_years.add(year)
total_art += 1 total_art += 1
for filename in os.listdir(animation_data_directory):
f = os.path.join(animation_data_directory, filename)
if os.path.isfile(f):
filename_without_ext = os.path.splitext(filename)[0]
with open(f, "r") as file:
year, characters, tags = parse_art_json(art_output_directory, filename_without_ext, file, False, True)
if year in year_stats:
year_stats[year] += 1
else:
year_stats[year] = 1
for character in characters:
if character in character_stats:
character_stats[character] += 1
else:
character_stats[character] = 1
for tag in tags:
if tag in tag_stats:
tag_stats[tag] += 1
else:
tag_stats[tag] = 1
collected_years.add(year)
total_art += 1
for year in collected_years: for year in collected_years:
with open(os.path.join(art_output_directory, str(year), '_index.md'), 'w') as f: with open(os.path.join(art_output_directory, str(year), '_index.md'), 'w') as f:
f.write('---\n') f.write('---\n')

View file

@ -433,7 +433,7 @@ pre {
} }
model-viewer { model-viewer {
height: 100vh; height: 600px;
width: 100%; width: 100%;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;

View file

@ -1,34 +0,0 @@
{{ define "main" }}
<h2>{{ .Title }}</h2>
<hr>
{{ .Content }}
{{ $art := (index site.Data ($.Param "json")) }}
{{ $newgrounds_icon := resources.Get "newgrounds.webp" }}
{{ range $art.categories }}
<h3>{{ .name }}</h3>
<p>{{ .description }}</p>
{{ range sort .years "year" "desc" }}
<h4>{{ .year }}</h4>
<div class="gallery">
{{ range .pieces }}
{{ $full := resources.Get (printf "%s/%s" ($.Param "json") .filename) }}
{{ with resources.Get $full }}
<model-viewer src="{{ .RelPermalink }}" shadow-intensity="1" camera-controls touch-action="pan-y"></model-viewer>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}
{{ $site := resources.Get "js/model-viewer.min.js" }}
{{ if hugo.IsProduction }}
{{ $site = $site | minify | fingerprint | resources.PostProcess }}
{{ end }}
<script type="module" src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
{{ end }}

View file

@ -5,12 +5,20 @@
{{ with resources.Get .Params.filename }} {{ with resources.Get .Params.filename }}
{{ if $.Params.threed }} {{ if $.Params.threed }}
{{ $cameraorbit := $.Params.orbit }} {{ $cameraorbit := $.Params.orbit }}
{{ $cameratarget := $.Params.target }} {{ $cameratarget := $.Params.target }}
{{ $fov := $.Params.fov }} {{ $fov := $.Params.fov }}
<model-viewer src="{{ .RelPermalink }}" shadow-intensity="1" camera-controls touch-action="pan-y" camera-orbit="{{ $cameraorbit }}" camera-target="{{ $cameratarget }}" field-of-view="{{ $fov }}"></model-viewer> <model-viewer src="{{ .RelPermalink }}" shadow-intensity="1" camera-controls touch-action="pan-y" camera-orbit="{{ $cameraorbit }}" camera-target="{{ $cameratarget }}" field-of-view="{{ $fov }}"></model-viewer>
{{ else }} {{ else }}
<img class="article-img" style="display: block; max-height: 1000px; margin-left: auto; margin-right: auto;" alt="{{ $.Params.alt_text }}" title="{{ $.Params.alt_text }}" src="{{ .RelPermalink }}"/> {{ if $.Params.animation }}
<div style="text-align: center;">
<video controls>
<source src="{{ .RelPermalink }}" type="video/webm">
</video>
</div>
{{ else }}
<img class="article-img" style="display: block; max-height: 1000px; margin-left: auto; margin-right: auto;" alt="{{ $.Params.alt_text }}" title="{{ $.Params.alt_text }}" src="{{ .RelPermalink }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -3,6 +3,10 @@
{{ $base = "3d" }} {{ $base = "3d" }}
{{ end }} {{ end }}
{{ if .Params.animation }}
{{ $base = "animation" }}
{{ end }}
{{ $full := resources.Get (printf "%s/%s.webp" $base .Params.slug) }} {{ $full := resources.Get (printf "%s/%s.webp" $base .Params.slug) }}
{{ if $full }} {{ if $full }}
@ -17,7 +21,7 @@
{{ $year = index $split 3 }} {{ $year = index $split 3 }}
{{ end }} {{ end }}
<a class="no-decoration" href="{{ .Permalink }}"> <a class="no-decoration grid-item" href="{{ .Permalink }}">
{{ $path := printf "/%s/%d/%.2d/%s" $base (int $year) (int $month) $filename_without_ext}} {{ $path := printf "/%s/%d/%.2d/%s" $base (int $year) (int $month) $filename_without_ext}}
{{ $title := .Params.title }} {{ $title := .Params.title }}
@ -28,7 +32,18 @@
{{ end }} {{ end }}
{{ with $image }} {{ with $image }}
<img class="grid-item" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" title="{{ $title }}" src="{{ .Permalink }}"/> {{ if $.Params.threed }}
{{ with resources.Get "3d.png" }}
<img alt="Viewable 3D" title="Viewable 3D" style="z-index: 1; position: absolute; left: 10px; top: 10px" src="{{ .Permalink }}" />
{{ end }}
{{ end }}
{{ if $.Params.animation }}
{{ with resources.Get "play-circle.png" }}
<img alt="Viewable Animation" title="Viewable Animation" style="z-index: 1; position: absolute; left: 10px; top: 10px" src="{{ .Permalink }}" />
{{ end }}
{{ end }}
<img width="{{ .Width }}" height="{{ .Height }}" alt="{{ $title }}" title="{{ $title }}" src="{{ .Permalink }}">
{{ else }} {{ else }}
<p>Thumbnail not found!</p> <p>Thumbnail not found!</p>
{{ end }} {{ end }}