Files
blender-portable-repo/scripts/addons/rainys_bulk_scene_tools/ops/FreeGPU.py
T
2026-03-17 14:30:01 -06:00

14 lines
458 B
Python

import bpy
class BST_FreeGPU(bpy.types.Operator):
bl_idname = "bst.free_gpu"
bl_label = "Free VRAM"
bl_description = "Unallocate all material images from VRAM"
def execute(self, context):
for mat in bpy.data.materials:
if mat.use_nodes:
for node in mat.node_tree.nodes:
if hasattr(node, 'image') and node.image:
node.image.gl_free()
return {"FINISHED"}