-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrender_settings_ui.py
More file actions
55 lines (42 loc) · 1.81 KB
/
Copy pathrender_settings_ui.py
File metadata and controls
55 lines (42 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import bpy
from .render_settings import *
class RenderSettingsPanel(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_label = "Render Settings"
bl_category = "Cube"
def draw(self, context):
layout = self.layout
layout.operator("cube.save_render_settings_operator", icon='EXPORT')
layout.operator("cube.load_render_settings_operator", icon='IMPORT')
class SaveRenderSettingsOperator(bpy.types.Operator):
bl_idname = "cube.save_render_settings_operator"
bl_label = "Save Render Settings"
bl_description = "Export current render settings into a JSON file"
filepath = bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
save_render_settings(context.scene, self.filepath)
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class LoadRenderSettingsOperator(bpy.types.Operator):
bl_idname = "cube.load_render_settings_operator"
bl_label = "Load Render Settings"
bl_description = "Import render settings from a JSON file"
bl_options = {'REGISTER', 'UNDO'}
filepath = bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
settings = load_render_settings(self.filepath)
apply_render_settings(bpy.context.scene, settings)
check, check_details = check_settings_blender_version(settings)
# draw function for popup message
def draw(self, context):
self.layout.label(check_details)
if not check:
context.window_manager.popup_menu(draw, title="Warning", icon="ERROR")
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}