Hi All,
i have a question. Since somewhere in blender 4.0 one of the EEVEE render settings called rayTracingOptions is using a class instead of a prop for all to most other settings. ive made an addon with from another addon, which was only for EEVEE and i expanded it to the other render engines.
The issue is now that the prop ray_tracing_options is using a class for the settings.
This is the current code to get the keys of all EEVEE settings
def get_eevee_values():
pre_vals = {}
eevee_settings_list = inspect.getmembers(bpy.context.scene.eevee)
for elem in eevee_settings_list:
key, value = elem
if all(item not in key for item in EXCLUDE_LIST):
if isinstance(value, Color):
val = (value.r, value.g, value.b)
elif isinstance(value, str):
val = f"'{value}'"
else:
val = value
pre_vals[f"{EEVEE_KEY_PREFIX}.{key}"] = val
return pre_vals
Im wondering how i should catch all the keys and write to the preset file.
My guess i should add isInstance(key, Class), but i cant seem to finid the correct info about this
This is the addon; save-render-presets
I got it working now, i found in the operator preset file a method to catch the of bpy.type
I got this line ofr preset.py
type(value).__name__
Its not clean but now i can save the preset files again. This is my solution, i basically added an internal loop. i could call the function itself perhaps for cleaner way
def get_eevee_values():
pre_vals = {}
eevee_settings_list = inspect.getmembers(bpy.context.scene.eevee)
for elem in eevee_settings_list:
key, value = elem
if all(item not in key for item in EXCLUDE_LIST):
print("Key: %s - Value: %s" % (key, value))
if isinstance(value, Color):
val = (value.r, value.g, value.b)
elif isinstance(value, str):
val = f"'{value}'"
if type(value).__name__ == 'RaytraceEEVEE':
ray_trace_opt = inspect.getmembers(bpy.context.scene.eevee.ray_tracing_options)
for elem in ray_trace_opt:
key, value = elem
if all(item not in key for item in EXCLUDE_LIST):
key, value = elem
if all(item not in key for item in EXCLUDE_LIST):
val = value
pre_vals[f"{EEVEE_KEY_PREFIX}.ray_tracing_options.{key}"] = val
else:
val = value
pre_vals[f"{EEVEE_KEY_PREFIX}.{key}"] = val
return pre_vals
Where are these settings actually, i mean after reading them. They look like that hidden feature which was added in 3.5 but was for Cycles
Issue is, this is not supported by 4.0.2, so now it needs an extra loop since its called “diffuse_options” in that version. Isnt there a cleaner method?