Hi. I’m a bit new to Python with Blender.
I started working on a script that warns you when you try to render an animation and you output directory is set to tmp. I’m planning to extend it to have a list of directory’s to warn you about (the place you store all your .blend files, tmp, etc). I’m also wanting to add support for warnings about folders that have numbered images and pop up windows instead of the print() statement that it currently has.
Heres my current code. Feel free to try it out and tell me how it works.
If you try it you’ll need to switch
if tmp == "/tmp/":
to a different folder depending on your system.
bl_info = {
"name": "Render Warning",
"category": "Object",
}
import bpy
class RenderWarning(bpy.types.Operator):
"""Object Cursor Array"""
bl_idname = "render.render_warning"
bl_label = "Render Warning"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
tmp = context.scene.render.filepath
if tmp == "/tmp/":
self.report({'WARNING'}, "You are in the /tmp/ directory")
else:
#bpy.ops.render.render(animation = True)
self.report({'WARNING'}, "rendering")
return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(RenderWarning.bl_idname)
def register():
bpy.utils.register_class(RenderWarning)
bpy.types.VIEW3D_MT_object.append(menu_func)
def unregister():
bpy.utils.unregister_class(RenderWarning)
bpy.types.VIEW3D_MT_object.remove(menu_func)
if __name__ == "__main__":
register()
EDIT:
Updated the code
If you could give me some suggestions, it would be appreciated.