Render sequences
This commit is contained in:
+30
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user