mirror of
https://github.com/buzz-lightsnack-2007/BlendererOnline.git
synced 2024-08-14 23:57:22 +00:00
Added image viewer feature.
This commit is contained in:
parent
6a668e8203
commit
79a9a774ad
1 changed files with 47 additions and 17 deletions
|
@ -110,8 +110,8 @@
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
{
|
||||||
"output_type": "stream",
|
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"\u001b[1mStatus: \t\u001b[0mStarting render of file test.blend…\n",
|
"\u001b[1mStatus: \t\u001b[0mStarting render of file test.blend…\n",
|
||||||
"src/tcmalloc.cc:283] Attempt to free invalid pointer 0x7fc749c1e040 \n"
|
"src/tcmalloc.cc:283] Attempt to free invalid pointer 0x7fc749c1e040 \n"
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
" return False\n",
|
" return False\n",
|
||||||
" else: \n",
|
" else: \n",
|
||||||
" if configuration.blend_fileName == None: \n",
|
" if configuration.blend_fileName == None: \n",
|
||||||
" raise ImportError(formatting.font.bold + 'Input Blender file name is missing. ' + formatting.clear + 'It is a required field. ')\n",
|
" raise ImportError(formatting.font.bold + 'The file name for the Blender file is missing. ' + formatting.clear + 'It is a required field. ')\n",
|
||||||
" else: \n",
|
" else: \n",
|
||||||
" return True\n",
|
" return True\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -200,6 +200,8 @@
|
||||||
" else: \n",
|
" else: \n",
|
||||||
" !blender -b {configuration.blend_fileName} -o ./output_ -E {configuration.renderer} -F {configuration.output_fileFormat} -x 1 -f {configuration.frame} --cycles-device {configuration.device}\n",
|
" !blender -b {configuration.blend_fileName} -o ./output_ -E {configuration.renderer} -F {configuration.output_fileFormat} -x 1 -f {configuration.frame} --cycles-device {configuration.device}\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
" info.status('Render of file ' + configuration.blend_fileName + ' has completed.')\n",
|
||||||
|
"\n",
|
||||||
" if checkInvalidUploadProceed(): \n",
|
" if checkInvalidUploadProceed(): \n",
|
||||||
" start_render()\n",
|
" start_render()\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -212,16 +214,10 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "markdown",
|
||||||
"execution_count": null,
|
"metadata": {},
|
||||||
"metadata": {
|
|
||||||
"id": "Hk2D1RK3WqVV"
|
|
||||||
},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
"source": [
|
||||||
"\n",
|
"<h2>Utilities</h2>"
|
||||||
"\n",
|
|
||||||
"!blender -b $filename -o ./test_ -E $renderer -x 1"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -251,8 +247,44 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"from IPython.display import Image\n",
|
"#@title Picture Viewer\n",
|
||||||
"Image(filename='./test_0001.png')"
|
"#@title Configuration\n",
|
||||||
|
"class formatting:\n",
|
||||||
|
" clear = '\\033[0m'\n",
|
||||||
|
" class color: \n",
|
||||||
|
" purple = '\\033[95m'\n",
|
||||||
|
" cyan = '\\033[96m'\n",
|
||||||
|
" cyan_dark = '\\033[36m'\n",
|
||||||
|
" blue = '\\033[94m'\n",
|
||||||
|
" green = '\\033[92m'\n",
|
||||||
|
" yellow = '\\033[93m'\n",
|
||||||
|
" red = '\\033[91m'\n",
|
||||||
|
" class font:\n",
|
||||||
|
" bold = '\\033[1m'\n",
|
||||||
|
" underline = '\\033[4m'\n",
|
||||||
|
"\n",
|
||||||
|
"## Define screen functions. \n",
|
||||||
|
"def clear(): from IPython.display import clear_output; return clear_output()\n",
|
||||||
|
"\n",
|
||||||
|
"class fileViewer: \n",
|
||||||
|
" image_fileName = '' #@param {type: \"string\"}\n",
|
||||||
|
"\n",
|
||||||
|
"def fixFormatImage(): \n",
|
||||||
|
" ## Give file format of png if the user didn't give any. Of course they should put it. \n",
|
||||||
|
" if getExtension(fileViewer.image_fileName) == None: blend_fileName = (str(blend_fileName) + '.png')\n",
|
||||||
|
"\n",
|
||||||
|
"def preview(): \n",
|
||||||
|
" clear()\n",
|
||||||
|
" try: \n",
|
||||||
|
" from IPython.display import Image\n",
|
||||||
|
" Image(filename=fileViewer.image_fileName)\n",
|
||||||
|
" except:\n",
|
||||||
|
" info.err(formatting.font.bold + 'Could not preview the image. ' + formatting.clear + 'Make sure that the file is present and that the file format is correct.')\n",
|
||||||
|
"\n",
|
||||||
|
"def main(): \n",
|
||||||
|
" fixFormatImage(); preview()\n",
|
||||||
|
"\n",
|
||||||
|
"main()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -262,9 +294,7 @@
|
||||||
"id": "Kvv_WzdIf1CA"
|
"id": "Kvv_WzdIf1CA"
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": []
|
||||||
""
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
@ -285,4 +315,4 @@
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 0
|
"nbformat_minor": 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue