-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[query] Which is better to use...? #4
Comments
@MarioMey I've used context managers a lot in Scripted-text. Yes, yes as soon as its leaves closure. def sanic_effect(self):
"really fast speed text scrolling(filter)"
# add filter scroll to source if not present,
self.update_text(self._scripted_text)
with source_ar(self.source_name) as source, filter_ar(
source, "py_scroll"
) as scroll:
if scroll is None:
with data_ar() as settings:
obs.obs_data_set_int(settings, "speed_x", 5000)
with p_source_ar("scroll_filter", "py_scroll", settings) as _source:
obs.obs_source_filter_add(source, _source)
with data_ar(scroll) as filter_settings:
obs.obs_data_set_int(filter_settings, "speed_x", 5000)
obs.obs_source_update(scroll, filter_settings)
if self.duration // self.refresh_rate <= 3:
obs.obs_source_filter_remove(source, scroll)
self.duration = 0 Using def sanic_effect(self):
"really fast speed text scrolling(filter)"
# add filter scroll to source if not present,
self.update_text(self._scripted_text)
with ExitStack() as stack:
source = stack.enter_context(source_ar(self.source_name))
scroll = stack.enter_context(filter_ar(source, "py_scroll"))
if scroll is None:
settings = stack.enter_context(data_ar())
obs.obs_data_set_int(settings, "speed_x", 5000)
_source = stack.enter_context(
p_source_ar("scroll_filter", "py_scroll", settings)
)
obs.obs_source_filter_add(source, _source)
filter_settings = stack.enter_context(data_ar(scroll))
obs.obs_data_set_int(filter_settings, "speed_x", 5000)
obs.obs_source_update(scroll, filter_settings)
if self.duration // self.refresh_rate <= 3:
obs.obs_source_filter_remove(source, scroll)
self.duration = 0 Sure, I think we can try using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seeing change_order.py, I realized that you used
@contextmanager
functions to usewith
statement. You didn't use them in other scripts. I would like to know why you used it. Is it better? Does it close automatically the reference or something like that?Another question: can I ask this queries here? 😁
The text was updated successfully, but these errors were encountered: