Commit a8ad5625 authored by frankie's avatar frankie 💬

generation script (not finished) + license in html headers

parent f64c8e07
......@@ -2,6 +2,7 @@
*.sublime-workspace
server/node_modules/*
server/generated/*
blender/generated/20*
models/generated/log_*
rangeSlider-master/*
slider.html
......
......@@ -2,10 +2,10 @@ import os, re, subprocess, colorsys
from time import gmtime, strftime
from PIL import Image,ImageFilter
blend_exec = '/opt/blender-2.79-linux-glibc219-x86_64/./blender'
blend_exec = '/opt/blender-2.79b-linux-glibc219-x86_64/./blender'
weight_baker = os.path.abspath( 'scripts/weight_baking.py' )
hotfolder = os.path.abspath( 'generated' )
hotfolder = '../generated'
folder_suffix_flag = '_done'
needle = 'render-file.py'
diffuse_needle = '_diffuse.png'
......@@ -59,13 +59,14 @@ def launch_rendering( path ):
if oktogo == True:
print( "############# starting model generation ", path, "#############" )
p1 = subprocess.Popen( [ 'python', path + '/' + needle ] )
print( "############# starting model generation " + path + "#############" )
p1 = subprocess.Popen( [ 'python', os.path.join( path, needle ) ] )
p1.wait()
print( "############# starting diffuse generation ", path, "#############" )
print( "############# starting diffuse generation " + path + "#############" )
if not diffuse_needle_found and blend_file is not None:
print( "processing " + path + ' > ' + blend_file )
print( os.path.join( path, blend_file ), weight_baker )
p1 = subprocess.Popen( [ blend_exec, os.path.join( path, blend_file ), '-P', weight_baker ] )
p1.wait()
# seeking diffuse
......
import os,re,subprocess
from shutil import copyfile
hotfolder = '/home/frankiezafe/projects/sisyphus/private/models/generator/generated'
folder_suffix_flag = '_done'
needle = '_icon.png'
def launch_copy( path ):
files = os.listdir( path )
files.sort()
oktogo = False
for f in files:
if f[len(f)-len(needle):] == needle:
copyfile( os.path.join(path,f), os.path.join(gpath,f))
break
gpath = hotfolder + '/gallery'
if not os.path.isdir(gpath):
os.makedirs(gpath)
folders = sorted([os.path.join(hotfolder, o) for o in os.listdir(hotfolder)
if os.path.isdir(os.path.join(hotfolder,o))])
for f in folders:
# double check
if os.path.isdir(f) is True:
if f[len(f)-len(folder_suffix_flag):] == folder_suffix_flag:
launch_copy( f )
#else:
# os.rename( f, f[:-len(folder_suffix_flag)] )
day = ''
html = open( os.path.join(gpath,'index.html'), 'w')
html.write( '<html><head><title>Sisyphus gallery</title><style>html,body,document{ margin:0; padding: 0; font-family: courier; font-size:12px; background: #222; color: #fff; } h1,h2{clear:both; margin: 5px 0 0 5px; padding: 0; } div{float:left; margin: 5px 0 0 5px; border: 1px dotted #aaa;padding: 5px;text-align: center;} div:hover{ font-weight:bold; border-color: #fff; } span{ height: 15px; overflow:hidden; display: block; }</style></head><body>' )
html.write( '<h1>Sisyphus cubes gallery [raw output]</h1>' )
# group by dates
days = {}
for f in os.listdir(gpath):
if f[len(f)-len(needle):] == needle:
fday = f[14:-18]
if not fday in days:
days[fday] = []
days[fday].append( f )
keys = days.keys()
keys.sort()
for d in keys:
html.write( '<h2>' + d + '</h2>' )
days[d].sort()
for f in days[d]:
html.write( '<div><img src="' + f + '"/><br><span>' + f[14:-len(needle)] + '</span></div>' )
html.flush()
html.write( '</body>' )
html.close()
\ No newline at end of file
import os,re,subprocess
from shutil import copyfile
hotfolder = '/home/frankiezafe/projects/sisyphus/private/models/generator/generated'
needles = ['.blend1']
for root, dirs, files in os.walk(hotfolder):
for f in files:
for n in needles:
try:
f.index(n)
print(f)
except:
pass
\ No newline at end of file
import os, re, subprocess, colorsys
from time import gmtime, strftime
from PIL import Image,ImageFilter
hotfolder = '/home/frankiezafe/projects/sisyphus/private/models/generator/generated'
needle = '_diffuse.png'
blend_exec = '/opt/blender-2.79-linux-glibc219-x86_64/./blender'
script_path = '/home/frankiezafe/projects/sisyphus/private/models/generator/weight_baking.py'
def boost_contrast( input_path, output_path = None ):
im = Image.open( input_path )
ld = im.load()
width, height = im.size
for y in range(height):
for x in range(width):
r,g,b = ld[x,y]
if r + g + b == 0:
continue
higher = 0
value = r
if g > value:
higher = 1
value = g
if b > value:
higher = 2
value = b
mult = 255.0 / ld[x,y][higher]
ld[x,y] = ( int(r*mult), int(g*mult), int(b*mult) )
'''
h,s,v = colorsys.rgb_to_hsv(r/255., g/255., b/255.)
h = (h + -90.0/360.0) % 1.0
s = s**0.65
r,g,b = colorsys.hsv_to_rgb(h, s, 1)
ld[x,y] = (int( v * 255 ),int( v * 255 ),int( v * 255 ))
ld[x,y] = (int( s * 255 ),int( s * 255 ),int( s * 255 ))
ld[x,y] = (int(r * 255.9999), int(g * 255.9999), int(b * 255.9999))
'''
im = im.filter( ImageFilter.BLUR )
out = output_path
if out == None:
out = input_path + '.png'
im.save( out,"PNG" )
folders = sorted([os.path.join(hotfolder, o) for o in os.listdir(hotfolder)
if os.path.isdir(os.path.join(hotfolder,o))])
for d in folders:
if os.path.isdir(d) is True:
files = [f for f in os.listdir(d)]
needle_found = False
blend_file = None
for f in files:
#print( f[-len(needle):] )
if f[-len(needle):] == needle:
needle_found = True
elif f[-6:] == '.blend':
blend_file = f
if not needle_found and blend_file is not None:
print( "processing " + d + ' > ' + blend_file )
p1 = subprocess.Popen( [ blend_exec, os.path.join(d,blend_file), '-P', script_path ] )
p1.wait()
# seeking diffuse
diffuse = None
files = [f for f in os.listdir(d)]
for f in files:
if f[-len(needle):] == needle:
diffuse = f
break
if diffuse is not None:
absp = os.path.join(d,diffuse)
boost_contrast( absp, absp ) # overwrite
print( "folder " + d + " finished" )
\ No newline at end of file
import os, re, subprocess, colorsys
from time import gmtime, strftime
from PIL import Image,ImageFilter
overwrite = True
hotfolder = '/home/frankiezafe/projects/sisyphus/private/models/generator/generated'
needle = '_legs.json'
blend_exec = '/opt/blender-2.79-linux-glibc219-x86_64/./blender'
script_path = '/home/frankiezafe/projects/sisyphus/private/models/generator/avatar_leg_animations_exporter.py'
folders = sorted([os.path.join(hotfolder, o) for o in os.listdir(hotfolder)
if os.path.isdir(os.path.join(hotfolder,o))])
for d in folders:
if os.path.isdir(d) is True:
files = [f for f in os.listdir(d)]
needle_found = False
blend_file = None
for f in files:
#print( f[-len(needle):] )
if f[-len(needle):] == needle:
needle_found = not overwrite
elif f[-6:] == '.blend':
blend_file = f
if not needle_found and blend_file is not None:
print( "processing " + d + ' > ' + blend_file )
p1 = subprocess.Popen( [ blend_exec, os.path.join(d,blend_file), '-P', script_path ] )
p1.wait()
# seeking diffuse
print( "folder " + d + " finished" )
\ No newline at end of file
......@@ -693,7 +693,7 @@ def backup():
copyfile(f, abs_path + fname)
#saving the current file in generated folder
blend_path = abs_path + main_conf['generation_name'] + timestamp + '.blend'
blend_path = os.path.abspath( abs_path + main_conf['generation_name'] + timestamp + '.blend' )
#creation of a render-file.py with current configuration
rf_txt = main_conf['render-file.py']
......
......@@ -10,11 +10,12 @@
(._.)
This file is part of sysiphus project
For the latest info, see http://polymorph.cool/
Copyright (c) 2018 polymorph.cool
All rights reserved.
Copyright (c) 2018 Simone Niquille (technofle.sh) and François Zajéga (frankiezafe.org)
All rights reserved.
This file is part of Sisyphus (sisyphus.technofle.sh), an absurd ergonomic simulation producing chairs.
Released under MIT and CC by-nc-sa 4.0, see https://gitlab.com/frankiezafe/sisyphus/ for details.
MIT License
......
/*
_________ ____ .-. _________/ ____ .-. ____
__|__ (_)_/(_)( )____< \| ( ) (_)
`-' `-'
libre video game bazaar
____________________________________ ? ____________________________________
(._.)
This file is part of sysiphus project
For the latest info, see http://polymorph.cool/
Copyright (c) 2018 polymorph.cool
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
___________________________________( ^3^)_____________________________________
ascii font: rotated by MikeChat & myflix
have fun and be cool :)
*/
@font-face {
font-family: 'lincolnmitrelm';
/* src: url('../fonts/lincolnmitre-lm-webfont.woff2') format('woff2'),
url('../fonts/lincolnmitre-lm-webfont.woff') format('woff'); */
src: url('../fonts/lincolnmitre-lm-webfont.ttf');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'space_monoregular';
/* src: url('../fonts/spacemono-regular-webfont.woff2') format('woff2'),
url('../fonts/spacemono-regular-webfont.woff') format('woff'); */
src: url('../fonts/spacemono-regular-webfont.ttf');
font-weight: normal;
font-style: normal;
}
/* COMMON */
/*html, body {
height: 100%;
}
*/
body,
div.dg {
font-family:lincolnmitrelm;
}
body {
color: #fff;
font-size:1em;
text-align:center;
background-color: #fff;
margin: 0px;
overflow: hidden;
}
#info {
position: absolute;
top: 0px; width: 100%;
padding: 5px;
}
a {
color: #c9c9c9;
}
.ac { /* prevent dat-gui from being selected */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.no-pointer-events {
pointer-events: none;
}
.control-disabled {
color: #888;
text-decoration: line-through;
}
/* CUSTOM PANEL */
#panel {
z-index: 10000;
position: absolute;
top: 0px;
right: 0px;
width: 30%;
max-height:100%;
padding: 15px 0 0 15px;
background: transparent;
font-size: 0.8em;
color: #fff;
text-align:left;
overflow-x: hidden;
overflow-y: auto;
}
#panel h1.main_title {
font-size: 3em;
margin-bottom: 0px;
}
#panel p.baseline {
margin-top: 0px;
}
#panel .info_table {
font-family:space_monoregular;
width: 100%;
}
#panel .info_table th,
#panel .info_table td {
border: 1px solid #fff;
border-top: none;
border-bottom: none;
border-right-color: transparent;
padding: 1px 5px;
}
#panel .info_table th {
background-color: rgba( 0,0,0,0.25 );
}
#panel .info_table th,
#panel .info_table td.looped {
text-align:center;
color: #fff;
}
#panel .info_table td {
text-align:right;
}
#panel .info_table th.first,
#panel .info_table td.first,
#panel .info_table th.name,
#panel .info_table td.name {
text-align:left;
}
#panel .info_table th.last,
#panel .info_table td.last {
border-right-color: #fff;
}
#panel .info_table td.name {
font-weight: bold;
}
#panel .info_table td.time:after,
#panel .info_table td.duration:after {
content: "'";
}
#panel .info_table td.weight,
#panel .info_table td.radio {
width: 1%;
}
#panel .info_table div.looped_checkbox {
position: relative;
margin: 0 auto;
display: block;
width: 15px;
height: 15px;
overflow: hidden;
border: 1px solid #aaa;
border-radius: 3px;
background-color: #000;
}
@keyframes looped_checkbox_tonormal {
0% {
background-color: #fff;
border-color: #000;
}
50% {
background-color: #ddd;
border-color: #aaa;
}
100% {
background-color: #000;
border-color: #aaa;
}
}
#panel .info_table div.looped_checkbox.normal {
background: #000;
border-color: #aaa;
animation-name: looped_checkbox_tonormal;
animation-duration: 0.3s;
animation-iteration-count: 1;
}
#panel .info_table div.looped_checkbox.checked {
background: #fff;
border: 1px solid #000;
}
#debugger {
width: 430px;
/*background-color: rgba( 0.2,0.2,0.2,0.6 );*/
height: 300px;
overflow-x: hidden;
overflow-y: auto;
white-space: nowrap;
margin-bottom: 30px;
}
.language_marker {
float: left;
display:block;
padding: 1px 3px;
margin: -2px 5px 0 0;
font-size:0.8em;
background-color: #ff0000;
font-weight: bold;
text-transform: uppercase;
}
#panel.panel_default,
#panel.panel_closed {
width: 270px;
overflow: hidden;
}
@keyframes panel_closing {
0% {
width: 40%;
}
100% {
width: 270px;
}
}
#panel.panel_closed {
animation-name: panel_closing;
animation-duration: 0.7s;
animation-iteration-count: cubic-bezier(.74,0,.47,1);
}
@keyframes panel_opening {
0% {
width: 270px;
}
100% {
width: 40%;
}
}
#panel.panel_open {
width: 40%;
animation-name: panel_opening;
animation-duration: 0.25s;
animation-iteration-count: 1;
transition-timing-function: cubic-bezier(.74,0,.47,1);
}
#panel ul, #panel li {
margin: 0;
padding: 0;
list-style: none;
display: inline;
white-space: nowrap;
}
#panel ul {
display: block;
margin: 0 0 10px 0;
}
#panel li a.tab_normal,
#panel li a.tab_selected {
text-decoration: none;
background: #23f;
color: #fff;
padding: 2px 0px 3px 3px;
font-weight: bold;
outline: 0;
}
@keyframes tab_link_hover {
0% {
background-color: #23f;
padding-bottom: 3px;
}
50% {
background-color: #ff0;
padding-bottom: 9px;
}
100% {
background-color: #f00;
padding-bottom: 10px;
}
}
#panel li a.tab_normal:hover {
background: #f00;
padding-bottom: 10px;
animation-name: tab_link_hover;
animation-duration: 0.3s;
animation-iteration-count: 1;
}
#panel li a.tab_normal:after,
#panel li a.tab_selected:after
{
content: "•";
font-family: sans-serif;
position: relative;
padding: 0 5px 0 3px;
font-size: 150%;
bottom: -5px;
}
#panel li a.tab_normal:hover:after {
content: "↴";
bottom: -10px;
padding: 0 0 0 3px;
}
@keyframes tab_link_selected {
0% {
background-color: #f00;
}
100% {
background-color: #000;
}
}
#panel li a.tab_selected {
background: #000;
padding-bottom: 10px;
animation-name: tab_link_selected;
animation-duration: 0.2s;
animation-iteration-count: 1;
}
#panel li a.tab_selected:after {
content: "↴";
bottom: -10px;
padding: 0 0 0 3px;
}
#panel li a.tab_selected:hover:after {
content: "↟";
bottom: -10px;
padding: 0 0 0 3px;
}
#panel .displayable {
display: none;
line-height: 0.8em;
font-size: 1em;
}
@keyframes displayable_opening {
0% {
background-color: rgba( 20,20,20, 0.0);
line-height: 0.8em;
}
50% {
background-color: rgba( 20,20,20, 0.1);
line-height: 1.4em;
}
100% {
background-color: rgba( 20,20,20, 0.7);
line-height: 1.4em;
}
}
#panel .displayable_open {
display: block;
overflow-x: hidden;
overflow-y: auto;
line-height: 1.4em;
font-size: 1em;
background-color: rgba( 20,20,20, 0.7);
animation-name: displayable_opening;
animation-duration: 0.5s;
animation-iteration-count: 1;
}
@keyframes displayable_subs {
0% {
opacity: 0;
}
50% {
opacity: 0.3;
}
100% {
opacity: 1;
}
}