5
$\begingroup$

I've just finished a character with a huge amount of objects, allot of which have sub-D mods. But I only ever set the Viewport level so all objects have a incorrect render sub-D level. Is there a way to make the renderer take the viewport sub-D levels or maybe to convert all render levels to be the same as the viewport levels without having to manually go through every single object.

$\endgroup$
3
  • $\begingroup$ I think if you have a bunch of objects with the same modifiers you can group select and hold Alt while changing settings and it will change for all. $\endgroup$ Commented Jan 7, 2022 at 22:31
  • $\begingroup$ if Allen's comment doesn't help, you could write a simple python script which does the work for u... $\endgroup$
    – Chris
    Commented Jan 8, 2022 at 4:21
  • $\begingroup$ Allen's comment doesn't help because the objects have other things besides sub d and not all objects have the same sub d level $\endgroup$
    – Sidney
    Commented Jan 8, 2022 at 9:48

1 Answer 1

2
$\begingroup$

I asked ChatGPT to write a script and I got a nice result. This matches the value on the selected objects and it also matches if there are more than 1 modifiers in the stack. It's slow to show the result (I don't know why, but hover over the value and it should update).

import bpy

# Get selected objects
selected_objects = bpy.context.selected_objects

# Loop through selected objects
for obj in selected_objects:
    # Check if object has subdivision modifier
    for mod in obj.modifiers:
        if mod.type == 'SUBSURF' and mod.name.startswith("Sub"):
            # Copy "Levels Viewport" value to "Render" value
            mod.render_levels = mod.levels
            
            # Print success message
            print("Subdivision modifier render levels matched to viewport levels on object: " + obj.name + " for modifier: " + mod.name)
            
    else:
        # Print error message if no subdivision modifier found
        print("No subdivision modifier found on object: " + obj.name)
$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .