diff --git a/common/op_params.py b/common/op_params.py index 308cf8dee663e4..1d300ed3abf6b3 100644 --- a/common/op_params.py +++ b/common/op_params.py @@ -57,7 +57,7 @@ def __init__(self): - Finally, the live arg tells both opParams and opEdit that it's a live parameter that will change. Therefore, you must place the `op_params.get()` call in the update function so that it can update. Here's an example of a good fork_param entry: - self.fork_params = {'camera_offset': Param(default=0.06, allowed_types=VT.number)} # VT.number allows both floats and ints + self.fork_params = {'camera_offset': Param(default=0.06, allowed_types=VT.number), live=True} # VT.number allows both floats and ints """ VT = ValueTypes() @@ -152,6 +152,9 @@ def put(self, key, value): self.params.update({key: value}) self._write() + def __getitem__(self, s): # can also do op_params['param_name'] + return self.get(s) + def delete(self, key): # todo: might be obsolete. remove? if key in self.params: del self.params[key]