Render sequences

This commit is contained in:
ChristopheSeux
2024-03-14 17:44:05 +01:00
parent 688a06dffd
commit ac14fe5ba9
9 changed files with 237 additions and 91 deletions
+30
View File
@@ -11,6 +11,36 @@ from textwrap import dedent
import bpy
class attr_set():
"""Receive a list of tuple [(data_path:python_obj, "attribute":str, "wanted value":str)]
before with statement : Store existing values, assign wanted value
after with statement: Restore values to their old values
"""
def __init__(self, attrib_list):
"""Initialization
Args:
attrib_list (list[tuple]): a list of tuple with the
"""
self.store = []
for item in attrib_list:
prop, attr = item[:2]
self.store.append( (prop, attr, getattr(prop, attr)) )
for item in attrib_list:
prop, attr = item[:2]
if len(item) >= 3:
setattr(prop, attr, item[2])
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_traceback):
for prop, attr, old_val in self.store:
setattr(prop, attr, old_val)
def abspath(path):
path = os.path.abspath(bpy.path.abspath(path))
return Path(path)