Somebody from the forums on Blenderartists.org sent me this. So I have a solution. I asked our developper to modify it so that it would detect the name of the object (based on the proxify add-on) and change it for the high res version, so foo lo would be switch to foo hi. He decided to push this even more. We’ll have, in the properties, a way to turn on an off many display options (origin only, bounding box, point cloud, LOD or full geo). It will be absolutely awesome. Once it’s done, how can we submit this in case the institute would like to integrate it into Blender?
Also, I saw that when you have very heavy geometry on screen (and sill have RAM and VRAM available), the entire interface become sluggish. I can understand the slow down for the viewport but what I don’t understand is why the rest of the interface is affected. Even doing things like “file, save as” would take about 30 secs just to get the file menu to pop up. Could it be because the entire interface is drawn by open GL and it needs to evaluate everything on screen no matter what? Is there a way you could tell Blender to only refresh the viewport if needed?
Here’s the script:
import bpy
from bpy.types import Mesh, Scene
original_geometry: Mesh = None
def prepare_render(scene: Scene, context: object) -> None:
global original_geometry
# append geometry from another blend file
# https://docs.blender.org/api/current/bpy.types.BlendDataLibraries.html#bpy.types.BlendDataLibraries.load
with bpy.data.libraries.load("C:\\Users\\user\\Documents\\boxy.blend", link=False, relative=False) as (data_from, data_to):
data_to.meshes = [name for name in data_from.meshes if name == "Sphere"]
# get object
cube = bpy.data.objects["Cube"]
# store geometry to original_geometry
original_geometry = cube.data
# swap geometry
cube.data = bpy.data.meshes["Sphere"]
def restore_render(scene: Scene, context: object) -> None:
global original_geometry
# get object
cube = bpy.data.objects["Cube"]
# get current geometry to delete
geometry_to_delete = cube.data
# swap geometry
cube.data = original_geometry
# delete geometry from current blend file
bpy.data.meshes.remove(geometry_to_delete, do_unlink=True, do_id_user=True, do_ui_user=True)
init handler
bpy.app.handlers.render_init.append(prepare_render)
bpy.app.handlers.render_cancel.append(restore_render)
bpy.app.handlers.render_complete.append(restore_render)