mirror of
https://github.com/blender/blender-addons-contrib.git
synced 2025-07-29 12:02:31 +00:00
Clean-up: bl_info['tracker_url'] updated to developer.blender.org, some minor other edits
This commit is contained in:
@ -1,29 +1,30 @@
|
||||
#Simplified BSD License
|
||||
# Simplified BSD License
|
||||
#
|
||||
#Copyright (c) 2012, Florian Meyer
|
||||
#tstscr@web.de
|
||||
#All rights reserved.
|
||||
# Copyright (c) 2012, Florian Meyer
|
||||
# tstscr@web.de
|
||||
# All rights reserved.
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
#1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
#(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
#ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
#(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
#SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#################################################################
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
bl_info = {
|
||||
"name": "Auto Save Render",
|
||||
"author": "tstscr",
|
||||
@ -32,10 +33,12 @@ bl_info = {
|
||||
"location": "Rendertab -> Render Panel",
|
||||
"description": "Automatically save the image after rendering",
|
||||
"warning": "",
|
||||
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/Auto_Save",
|
||||
"tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=32491",
|
||||
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
|
||||
"Scripts/Render/Auto_Save",
|
||||
"tracker_url": "https://developer.blender.org/T32491",
|
||||
"category": "Render"}
|
||||
###########################################################################
|
||||
|
||||
|
||||
import bpy
|
||||
from bpy.props import BoolProperty, EnumProperty
|
||||
from bpy.app.handlers import persistent
|
||||
@ -56,13 +59,13 @@ def auto_save_render(scene):
|
||||
if format == 'OPEN_EXR_MULTILAYER': extension = '.exr'
|
||||
if format == 'JPEG': extension = '.jpg'
|
||||
if format == 'PNG': extension = '.png'
|
||||
|
||||
|
||||
blendname = basename(bpy.data.filepath).rpartition('.')[0]
|
||||
filepath = dirname(bpy.data.filepath) + '/auto_saves'
|
||||
|
||||
|
||||
if not exists(filepath):
|
||||
mkdir(filepath)
|
||||
|
||||
|
||||
if scene.auto_save_subfolders:
|
||||
filepath = join(filepath, blendname)
|
||||
if not exists(filepath):
|
||||
@ -72,7 +75,7 @@ def auto_save_render(scene):
|
||||
files = [f for f in listdir(filepath) \
|
||||
if f.startswith(blendname) \
|
||||
and f.lower().endswith(('.png', '.jpg', '.jpeg', '.exr'))]
|
||||
|
||||
|
||||
highest = 0
|
||||
if files:
|
||||
for f in files:
|
||||
@ -81,14 +84,14 @@ def auto_save_render(scene):
|
||||
if suffix:
|
||||
if int(suffix[-1]) > highest:
|
||||
highest = int(suffix[-1])
|
||||
|
||||
|
||||
save_name = join(filepath, blendname) + '_' + str(highest+1).zfill(3) + extension
|
||||
|
||||
image = bpy.data.images['Render Result']
|
||||
if not image:
|
||||
print('Auto Save: Render Result not found. Image not saved')
|
||||
return
|
||||
|
||||
|
||||
print('Auto_Save:', save_name)
|
||||
image.save_render(save_name, scene=None)
|
||||
|
||||
@ -97,7 +100,7 @@ def auto_save_render(scene):
|
||||
###########################################################################
|
||||
def auto_save_UI(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
split=layout.split(percentage=0.66, align=True)
|
||||
row = split.row()
|
||||
row.prop(context.scene, 'save_after_render', text='Auto Save', toggle=False)
|
||||
@ -105,7 +108,7 @@ def auto_save_UI(self, context):
|
||||
#split=layout.split()
|
||||
row=split.row()
|
||||
row.prop(context.scene, 'auto_save_format', text='as', expand=False)
|
||||
|
||||
|
||||
def register():
|
||||
bpy.types.Scene.save_after_render = BoolProperty(
|
||||
name='Save after render',
|
||||
@ -125,7 +128,7 @@ def register():
|
||||
description='Save into individual subfolders per blend name')
|
||||
bpy.app.handlers.render_post.append(auto_save_render)
|
||||
bpy.types.RENDER_PT_render.append(auto_save_UI)
|
||||
|
||||
|
||||
def unregister():
|
||||
del(bpy.types.Scene.save_after_render)
|
||||
del(bpy.types.Scene.auto_save_format)
|
||||
|
Reference in New Issue
Block a user