Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit efc7cc6

Browse files
author
Bastien Montagne
committed
Copy Render Settings: Add support for Cycles, Eevee and Workbench settings.
In addition to `Scene.render` properties, add properties from `Scene.cycles`, `Scene.eevee` and `Scene.display.shading` to the list of copyable data. Note that the list of propoerties is now fairly gigantic, the search field at the bottom of the list becomes a critical help. Better ways to control what is shown and to filter properties should be added at some point, when there is time for such development. Fix #104771.
1 parent 6049854 commit efc7cc6

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

render_copy_settings/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
bl_info = {
66
"name": "Copy Render Settings",
77
"author": "Bastien Montagne",
8-
"version": (1, 2, 0),
9-
"blender": (3, 6, 0),
8+
"version": (2, 0, 0),
9+
"blender": (4, 0, 0),
1010
"location": "Render buttons (Properties window)",
1111
"description": "Allows to copy a selection of render settings "
1212
"from current scene to others.",

render_copy_settings/operator.py

+31-12
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ def scene_render_copy_settings_update():
3636

3737
# Get all available render settings, and update accordingly affected_settings…
3838
props = {}
39-
for prop in current_scene.render.bl_rna.properties:
40-
if prop.identifier in {'rna_type'}:
41-
continue
42-
if prop.is_readonly:
43-
continue
44-
props[prop.identifier] = prop.name
39+
for prop_container_id in (('render',), ('cycles',), ('eevee',), ('display', 'shading')):
40+
prop_container = current_scene
41+
for pc_id_item in prop_container_id:
42+
prop_container = getattr(prop_container, pc_id_item, None)
43+
if prop_container is None:
44+
break
45+
if prop_container is None:
46+
continue;
47+
for prop in prop_container.bl_rna.properties:
48+
if prop.identifier in {'rna_type'}:
49+
continue
50+
if prop.is_readonly:
51+
continue
52+
props[".".join(prop_container_id) + "." + prop.identifier] = prop.name
4553
corr = 0
4654
for i, sett in enumerate(cp_sett.affected_settings):
4755
if sett.strid not in props:
@@ -130,17 +138,28 @@ def execute(self, context):
130138
# Real interesting stuff…
131139

132140
def do_copy(context, affected_settings, allowed_scenes):
133-
# Stores render settings from current scene.
134-
p = {sett: getattr(context.scene.render, sett)
135-
for sett in affected_settings}
141+
def resolve_rnapath_get(bdata, rna_path_items):
142+
for item in rna_path_items:
143+
bdata = getattr(bdata, item, None)
144+
if bdata is None:
145+
break
146+
return bdata
147+
148+
def resolve_rnapath_set(bdata, rna_path_items, value):
149+
bdata = resolve_rnapath_get(bdata, rna_path_items[:-1])
150+
setattr(bdata, rna_path_items[-1], value)
151+
152+
# Stores various render settings from current scene.
153+
p = {rna_path_items: resolve_rnapath_get(context.scene, rna_path_items)
154+
for rna_path_items in affected_settings}
136155
# put it in all other (valid) scenes’ render settings!
137156
for scene in bpy.data.scenes:
138157
# If scene not in allowed scenes, skip.
139158
if scene.name not in allowed_scenes:
140159
continue
141160
# Propagate all affected settings.
142-
for sett, val in p.items():
143-
setattr(scene.render, sett, val)
161+
for rna_path_items, val in p.items():
162+
resolve_rnapath_set(scene, rna_path_items, val)
144163

145164

146165
class RenderCopySettingsOPCopy(bpy.types.Operator):
@@ -157,7 +176,7 @@ def poll(cls, context):
157176
def execute(self, context):
158177
regex = None
159178
cp_sett = context.scene.render_copy_settings
160-
affected_settings = {sett.strid for sett in cp_sett.affected_settings if sett.copy}
179+
affected_settings = {tuple(sett.strid.split(".")) for sett in cp_sett.affected_settings if sett.copy}
161180
allowed_scenes = {sce.name for sce in cp_sett.allowed_scenes if sce.allowed}
162181
do_copy(context, affected_settings=affected_settings, allowed_scenes=allowed_scenes)
163182
return {'FINISHED'}

0 commit comments

Comments
 (0)