Export_3ds: Added distance cue chunk export
[blender-addons.git] / render_copy_settings / panel.py
blob2248b5877bcda5c43efb58570a4d71cb075081a1
1 # SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 import bpy
6 from . import presets
7 from . import data as data_types
10 class RENDER_UL_copy_settings(bpy.types.UIList):
11 def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
12 #assert(isinstance(item, (data_types.RenderCopySettingsScene, data_types.RenderCopySettingsDataSetting)))
13 if self.layout_type in {'DEFAULT', 'COMPACT'}:
14 if isinstance(item, data_types.RenderCopySettingsDataSetting):
15 layout.label(text=item.name, icon_value=icon)
16 layout.prop(item, "copy", text="")
17 else: #elif isinstance(item, data_types.RenderCopySettingsDataScene):
18 layout.prop(item, "allowed", text=item.name, toggle=True)
19 elif self.layout_type in {'GRID'}:
20 layout.alignment = 'CENTER'
21 if isinstance(item, data_types.RenderCopySettingsDataSetting):
22 layout.label(text=item.name, icon_value=icon)
23 layout.prop(item, "copy", text="")
24 else: #elif isinstance(item, data_types.RenderCopySettingsDataScene):
25 layout.prop(item, "allowed", text=item.name, toggle=True)
28 class RENDER_PT_copy_settings(bpy.types.Panel):
29 bl_label = "Copy Settings"
30 bl_space_type = "PROPERTIES"
31 bl_region_type = "WINDOW"
32 bl_context = "render"
33 bl_options = {'DEFAULT_CLOSED'}
34 COMPAT_ENGINES = {'BLENDER_RENDER'}
36 def draw(self, context):
37 layout = self.layout
38 cp_sett = context.scene.render_copy_settings
40 layout.operator("scene.render_copy_settings", text="Copy Render Settings")
42 split = layout.split(factor=0.75)
43 split.template_list("RENDER_UL_copy_settings", "settings", cp_sett, "affected_settings",
44 cp_sett, "affected_settings_idx", rows=5)
46 col = split.column()
47 all_set = {sett.strid for sett in cp_sett.affected_settings if sett.copy}
48 for p in presets.presets:
49 label = ""
50 if p.elements & all_set == p.elements:
51 label = "Clear {}".format(p.ui_name)
52 else:
53 label = "Set {}".format(p.ui_name)
54 col.operator("scene.render_copy_settings_preset", text=label).presets = {p.rna_enum[0]}
56 layout.prop(cp_sett, "filter_scene")
57 if len(cp_sett.allowed_scenes):
58 layout.label(text="Affected Scenes:")
59 layout.template_list("RENDER_UL_copy_settings", "scenes", cp_sett, "allowed_scenes",
60 # cp_sett, "allowed_scenes_idx", rows=6, type='GRID')
61 cp_sett, "allowed_scenes_idx", rows=6) # XXX Grid is not nice currently...
62 else:
63 layout.label(text="No Affectable Scenes!", icon="ERROR")
66 classes = (
67 RENDER_UL_copy_settings,
68 RENDER_PT_copy_settings,