Commit 9d2e64105e81b826496eb2f5753d22cc3bfecbcf

Authored by André Araújo
1 parent a66e6c58
Exists in master

Corrige módulo renderizar vídeo, insere imagem fix vetorizada

@@ -3,8 +3,9 @@ @@ -3,8 +3,9 @@
3 !.gitignore 3 !.gitignore
4 !.gitempty 4 !.gitempty
5 *.log 5 *.log
  6 +*.pyc
6 settings_local.py 7 settings_local.py
  8 +env/
7 video/* 9 video/*
8 tmp/ 10 tmp/
9 uploads/ 11 uploads/
10 -*.pyc  
bpy_checkout.py
1 # -*- coding: UTF-8 -*- 1 # -*- coding: UTF-8 -*-
2 2
3 import bpy 3 import bpy
4 -import sys  
5 import json 4 import json
  5 +import sys
6 6
7 def main(): 7 def main():
8 if (len(sys.argv) == 8): 8 if (len(sys.argv) == 8):
@@ -3,13 +3,12 @@ @@ -3,13 +3,12 @@
3 import bpy 3 import bpy
4 import json 4 import json
5 import os 5 import os
6 -import sys  
7 import shutil 6 import shutil
  7 +import sys
8 8
9 def configure_output(): 9 def configure_output():
10 bpy.context.scene.frame_start = 0 10 bpy.context.scene.frame_start = 0
11 - bpy.context.scene.frame_current = bpy.context.scene.frame_start  
12 - bpy.context.scene.frame_end = bpy.context.scene.frame_start 11 + bpy.context.scene.frame_current = 0
13 bpy.context.scene.render.resolution_x = 640 12 bpy.context.scene.render.resolution_x = 640
14 bpy.context.scene.render.resolution_y = 480 13 bpy.context.scene.render.resolution_y = 480
15 bpy.context.scene.render.resolution_percentage = 100 14 bpy.context.scene.render.resolution_percentage = 100
@@ -62,11 +61,7 @@ def main(): @@ -62,11 +61,7 @@ def main():
62 sys.exit(3) 61 sys.exit(3)
63 try: 62 try:
64 configure_output() 63 configure_output()
65 - renamed_video = file_rename(render_video(video_output))  
66 - base_path = os.path.splitext(renamed_video)[0]  
67 - if (convert_to_webm):  
68 - subprocess.call(["avconv", "-loglevel", "0", "-y", "-i", renamed_video, "-r", "24", "-vcodec", "libvpx", base_path + ".webm"])  
69 - subprocess.call(["rm", renamed_video]) 64 + file_rename(render_video(video_output))
70 except: 65 except:
71 sys.exit(4) 66 sys.exit(4)
72 else: 67 else:
1 # -*- coding: UTF-8 -*- 1 # -*- coding: UTF-8 -*-
2 2
3 -import copy  
4 import json 3 import json
5 -import math  
6 import os 4 import os
7 -import sys  
8 import subprocess 5 import subprocess
9 6
10 getcwd = os.path.dirname(os.path.abspath(__file__)) 7 getcwd = os.path.dirname(os.path.abspath(__file__))
@@ -43,7 +40,7 @@ def check_action(blend_file = "", action_name = "", action_fake_is_valid = True, @@ -43,7 +40,7 @@ def check_action(blend_file = "", action_name = "", action_fake_is_valid = True,
43 else: 40 else:
44 return 3 41 return 3
45 42
46 -def render_video(blend_file = "", video_output = "", convert_to_webm = True, hide_output = False): 43 +def render_video(blend_file = "", video_output = "", convert_to_webm = True, rm_original_video = True, hide_output = False):
47 if (file_exists(blend_file)): 44 if (file_exists(blend_file)):
48 if not (isinstance(blend_file, str) and isinstance(video_output, str)): 45 if not (isinstance(blend_file, str) and isinstance(video_output, str)):
49 return 1 46 return 1
@@ -56,16 +53,24 @@ def render_video(blend_file = "", video_output = "", convert_to_webm = True, hid @@ -56,16 +53,24 @@ def render_video(blend_file = "", video_output = "", convert_to_webm = True, hid
56 ) 53 )
57 if (hide_output): 54 if (hide_output):
58 dev_null = open(os.devnull, 'w') 55 dev_null = open(os.devnull, 'w')
59 - return subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object], stdout = dev_null, stderr = dev_null) 56 + result_code = subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object], stdout = dev_null, stderr = dev_null)
60 else: 57 else:
61 - return subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object]) 58 + result_code = subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object])
  59 + if (convert_to_webm):
  60 + video_mp4 = video_output.upper() + ".mp4"
  61 + video_webm = video_output.upper() + ".webm"
  62 + subprocess.call(["avconv", "-loglevel", "0", "-y", "-i", video_mp4, "-r", "24", "-vcodec", "libvpx", video_webm])
  63 + if (rm_original_video):
  64 + subprocess.call(["rm", video_mp4])
62 except: 65 except:
63 return 2 66 return 2
  67 + return result_code
64 else: 68 else:
65 return 3 69 return 3
66 70
  71 +"""
67 def main(): 72 def main():
68 - print("check_action return:", check_action("casa.blend")) 73 + print("check_action return:", check_action("ENTANTO_AVATAR.blend", "ENTANTO"))
69 # return codes 74 # return codes
70 # 0: [OK] Blend file and Action Name exists 75 # 0: [OK] Blend file and Action Name exists
71 # 1: [ERROR] Args to check_action no match types 76 # 1: [ERROR] Args to check_action no match types
@@ -76,8 +81,7 @@ def main(): @@ -76,8 +81,7 @@ def main():
76 # 6: [ERROR] Action is fake user 81 # 6: [ERROR] Action is fake user
77 # 7: [ERROR] Timeline Frame Count is less than 10 82 # 7: [ERROR] Timeline Frame Count is less than 10
78 # 8: [ERROR] Args count no match 83 # 8: [ERROR] Args count no match
79 -  
80 - print("render_video return:", render_video("casa.blend", "casa")) 84 + print("render_video return:", render_video("ENTANTO_AVATAR.blend", "ENTANTO"))
81 # return codes 85 # return codes
82 # 0: [OK] Video.mp4 generated 86 # 0: [OK] Video.mp4 generated
83 # 1: [ERROR] Args to check_action no match types 87 # 1: [ERROR] Args to check_action no match types
@@ -89,3 +93,4 @@ def main(): @@ -89,3 +93,4 @@ def main():
89 93
90 if __name__ == "__main__": 94 if __name__ == "__main__":
91 main() 95 main()
  96 +"""
92 \ No newline at end of file 97 \ No newline at end of file
@@ -91,11 +91,12 @@ class Corretor: @@ -91,11 +91,12 @@ class Corretor:
91 file.save(uploaded_file) 91 file.save(uploaded_file)
92 renamed_file = os.path.join(upload_dir, secure_filename(sign_name + ".blend")) 92 renamed_file = os.path.join(upload_dir, secure_filename(sign_name + ".blend"))
93 os.rename(uploaded_file, renamed_file) 93 os.rename(uploaded_file, renamed_file)
94 - if (checkout.check_action(renamed_file, sign_name) == 0): 94 + check_result = checkout.check_action(str(renamed_file), str(sign_name))
  95 + if (check_result == 0):
95 result_msg = "File " + filename + " was uploaded." 96 result_msg = "File " + filename + " was uploaded."
96 code = 200 97 code = 200
97 else: 98 else:
98 - result_msg = "File " + filename + " has not expected structure of blend file." 99 + result_msg = "File " + filename + " has not expected structure of blend file. " + str(check_result)
99 code = 400 100 code = 400
100 pyutil.log(result_msg) 101 pyutil.log(result_msg)
101 return make_response(result_msg, code) 102 return make_response(result_msg, code)
view/img/blender.svg 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<!-- Created with Inkscape (http://www.inkscape.org/) -->
2 <svg 3 <svg
3 xmlns:dc="http://purl.org/dc/elements/1.1/" 4 xmlns:dc="http://purl.org/dc/elements/1.1/"
4 xmlns:cc="http://web.resource.org/cc/" 5 xmlns:cc="http://web.resource.org/cc/"
view/img/download.svg 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">  
3 -<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100px" height="100px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"  
4 -viewBox="0 0 100 100" 2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  3 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="52px" height="48px" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  4 +viewBox="0 0 52 48"
5 xmlns:xlink="http://www.w3.org/1999/xlink"> 5 xmlns:xlink="http://www.w3.org/1999/xlink">
6 <defs> 6 <defs>
7 <style type="text/css"> 7 <style type="text/css">
@@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot; @@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot;
12 </defs> 12 </defs>
13 <g id="download"> 13 <g id="download">
14 <metadata id="download"/> 14 <metadata id="download"/>
15 - <path class="fil0" d="M78 57l0 18 -56 0 0 -18 -10 0 0 28 5 0 71 0 0 -28 -10 0zm-28 8l-18 -23 11 1 0 -28 15 0 0 27 10 0 -18 23z"/> 15 + <path class="fil0" d="M44 29l0 12 -36 0 0 -12 -7 0 0 19 3 0 47 0 0 -19 -7 0zm-18 5l-12 -15 7 0 0 -19 10 0 0 19 7 0 -12 15z"/>
16 </g> 16 </g>
17 </svg> 17 </svg>
view/img/finish.svg 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">  
3 -<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100px" height="100px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"  
4 -viewBox="0 0 100 100" 2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  3 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="64px" height="48px" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  4 +viewBox="0 0 63 48"
5 xmlns:xlink="http://www.w3.org/1999/xlink"> 5 xmlns:xlink="http://www.w3.org/1999/xlink">
6 <defs> 6 <defs>
7 <style type="text/css"> 7 <style type="text/css">
@@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot; @@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot;
12 </defs> 12 </defs>
13 <g id="finish"> 13 <g id="finish">
14 <metadata id="finish"/> 14 <metadata id="finish"/>
15 - <path class="fil0" d="M44 79c-4,4 -10,4 -13,0l-20 -20c-2,-2 -3,-4 -3,-6 0,-3 1,-5 3,-7 3,-3 9,-3 13,0l12 12c0,1 2,1 3,0l37 -37c2,-2 5,-3 7,-3l0 0c2,0 5,1 6,3 2,1 3,4 3,6 0,3 -1,5 -3,7l-45 45z"/> 15 + <path class="fil0" d="M27 45c-3,3 -7,3 -9,0l-15 -14c-1,-2 -2,-3 -2,-5 0,-2 1,-3 2,-5 3,-2 7,-2 10,0l8 9c1,1 2,1 3,0l26 -27c2,-1 3,-2 5,-2l0 0c2,0 3,1 5,2 1,1 2,3 2,5 0,1 -1,3 -2,4l-33 33z"/>
16 </g> 16 </g>
17 </svg> 17 </svg>
view/img/fix.svg 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  3 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="64px" height="58px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  4 +viewBox="0 0 64 58"
  5 + xmlns:xlink="http://www.w3.org/1999/xlink">
  6 + <defs>
  7 + <style type="text/css">
  8 + <![CDATA[
  9 + .fil0 {fill:#5EC7BD}
  10 + ]]>
  11 + </style>
  12 + </defs>
  13 + <g id="skip">
  14 + <metadata id="skip"/>
  15 + <path class="fil0" d="M32 14c0,3 0,3 1,5l-31 28c-1,1 -1,1 -1,3 0,1 1,1 1,2l5 4c1,1 1,1 3,1 1,0 1,-1 2,-1l30 -28c2,1 6,1 9,1 2,-1 3,-1 5,-2 0,0 1,-1 1,-1l3 -2c1,-1 1,-1 2,-2 1,-3 1,-5 1,-9 -1,1 -13,7 -14,7 0,0 -5,-9 -6,-10l10 -5c1,-1 1,-1 2,-1 0,0 1,-1 1,-1 0,-1 -5,-2 -7,-2 -3,0 -5,0 -8,1 0,0 -1,1 -2,1 -4,3 -7,7 -7,11z"/>
  16 + </g>
  17 +</svg>
view/img/paperclip.svg 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">  
3 -<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100px" height="100px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"  
4 -viewBox="0 0 100 100" 2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  3 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="47px" height="48px" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  4 +viewBox="0 0 47 48"
5 xmlns:xlink="http://www.w3.org/1999/xlink"> 5 xmlns:xlink="http://www.w3.org/1999/xlink">
6 <defs> 6 <defs>
7 <style type="text/css"> 7 <style type="text/css">
8 <![CDATA[ 8 <![CDATA[
  9 + .str0 {stroke:white;stroke-width:0.132195}
9 .fil0 {fill:#5EC7BD;fill-rule:nonzero} 10 .fil0 {fill:#5EC7BD;fill-rule:nonzero}
10 ]]> 11 ]]>
11 </style> 12 </style>
12 </defs> 13 </defs>
13 <g id="paperclip"> 14 <g id="paperclip">
14 <metadata id="paperclip"/> 15 <metadata id="paperclip"/>
15 - <path class="fil0" d="M35 83c-4,0 -8,-2 -11,-5 -6,-6 -8,-16 0,-24 5,-5 24,-23 33,-33 4,-3 8,-5 12,-3 4,1 7,4 8,8 2,4 0,8 -3,12l-32 31c-2,2 -4,3 -6,3 -2,1 -4,0 -5,-1 -2,-3 -3,-8 1,-12l23 -22c0,-1 2,-1 3,0 1,1 1,3 0,3l-22 23c-2,2 -2,3 -2,4 1,1 1,1 2,1 1,0 2,-1 3,-2l32 -32c2,-2 3,-4 2,-7 -1,-2 -3,-4 -5,-5 -3,-1 -5,0 -7,2 -10,10 -29,29 -33,33 -6,7 -5,14 -1,18 4,4 11,5 17,-1l33 -33c1,-1 3,-1 3,0 1,1 1,2 0,3l-33 33c-3,4 -8,6 -12,6z"/> 16 + <path class="fil0 str0" d="M13 48c-4,0 -7,-1 -9,-3 -4,-4 -5,-12 1,-18 3,-3 17,-17 24,-24 2,-2 6,-3 9,-3 2,1 5,4 6,7 0,3 0,6 -3,8l-23 23c-1,2 -3,2 -4,3 -2,0 -3,-1 -4,-2 -2,-2 -2,-5 1,-8l16 -16c1,-1 2,-1 2,0 1,0 1,2 0,2l-16 17c-1,1 -2,2 -1,3 0,0 1,0 1,0 1,0 2,0 2,-1l24 -23c1,-2 2,-4 1,-6 0,-1 -2,-3 -3,-3 -2,-1 -4,0 -6,1 -7,7 -20,21 -24,25 -4,4 -3,9 0,12 2,3 8,4 12,0l24 -24c1,-1 2,-1 3,0 1,0 1,1 0,2l-24 24c-3,3 -6,4 -9,4z"/>
16 </g> 17 </g>
17 </svg> 18 </svg>
view/img/skip.svg 100755 → 100644
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">  
3 -<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100px" height="100px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"  
4 -viewBox="0 0 100 100" 2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  3 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="53px" height="48px" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  4 +viewBox="0 0 53 48"
5 xmlns:xlink="http://www.w3.org/1999/xlink"> 5 xmlns:xlink="http://www.w3.org/1999/xlink">
6 <defs> 6 <defs>
7 <style type="text/css"> 7 <style type="text/css">
@@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot; @@ -12,6 +12,6 @@ viewBox=&quot;0 0 100 100&quot;
12 </defs> 12 </defs>
13 <g id="skip"> 13 <g id="skip">
14 <metadata id="skip"/> 14 <metadata id="skip"/>
15 - <path class="fil0" d="M10 24c1,-1 23,-17 45,0 8,6 12,15 13,26l22 0 -34 34 -34 -34 22 0c0,-1 1,-3 1,-4 -2,-29 -19,-26 -35,-22z"/> 15 + <path class="fil0" d="M0 6c1,0 15,-11 30,1 5,4 8,9 9,17l14 0 -23 22 -22 -22 15 0c0,-1 0,-2 0,-3 -1,-19 -13,-17 -23,-15z"/>
16 </g> 16 </g>
17 </svg> 17 </svg>