State¶
Saves the scene state, so it can be restored after augmenting.
State
¶
State(
objects: Sequence[Object],
fields: Sequence[Union[Any, str]] = (),
)
Saves the scene when created, so it can be restored after every datapoint.
It saves, for each object:
- the transforms;
- all unlinked node input values of its materials;
- for cameras, the lens and depth of field (
use_dof,focus_object,focus_distance,aperture_fstop).
It also saves the value at every data path in fields. A data path augmentation
that isn't passed in fields is not restored.
Parameters:
-
objects(Sequence[Object]) –objects to save.
-
fields(Sequence[Union[Any, str]], default:()) –Number,Vector,BooleanandMenuaugmentations, or data path strings. Absolute paths are saved once, relative paths for every object they exist on. Other entries are ignored, so a wholeCompose.augmentationslist can be passed.
Example
initial = state.State([car_1, car_2, lamp, camera],
fields=objects_aug.augmentations + lamp_aug.augmentations)
for _ in range(1000):
objects_aug([car_1, car_2])
generator()
initial.restore()