def _update(properties, prop, data=None): if not data: return n1 = _obs.obs_property_name(prop) n2 = f"_{n1}_item" p = _obs.obs_properties_get(properties, n2) return SceneItemList._do_update(data, p, n1, n2)
def SetDestinationPositionAndSize(props, p): global Animations # Base the index off of the name since callbacks don't work well. name = obs.obs_property_name(p) indexStr = re.sub("[^0-9]", "", name) animationIndex = int(indexStr) scene_item = getSceneItem() posV = obs.vec2() scaleV = obs.vec2() obs.obs_sceneitem_get_pos(scene_item, posV) obs.obs_sceneitem_get_scale(scene_item, scaleV) width, height = calculateSize(scene_item, scaleV.x, scaleV.y) Animations[animationIndex].destinationX = posV.x Animations[animationIndex].destinationY = posV.y Animations[animationIndex].destinationWidth = width Animations[animationIndex].destinationHeight = height obs.obs_data_set_int(settings, Animations[animationIndex].destinationXStorage, (int)(Animations[animationIndex].destinationX)) obs.obs_data_set_int(settings, Animations[animationIndex].destinationYStorage, (int)(Animations[animationIndex].destinationY)) obs.obs_data_set_int(settings, Animations[animationIndex].destinationWidthStorage, (int)(Animations[animationIndex].destinationWidth)) obs.obs_data_set_int(settings, Animations[animationIndex].destinationHeightStorage, (int)(Animations[animationIndex].destinationHeight))
def on_prop_changed(properties, prop, data=None): n = _obs.obs_property_name(prop) k = "on_{}_changed".format(n) v = None if data: try: VALUES[n] = v = _data.get_value(data, n) except LookupError: pass try: fn = FUNCS[k] except KeyError: pass else: return fn(v)
def properties_set_vis(props, p, settings): global animationCount name = obs.obs_property_name(p) if str(name).strip().lower() != "animationcount": indexStr = re.sub("[^0-9]", "", name) if indexStr == "": return False animationIndex = int(indexStr) showStartingProperties = obs.obs_data_get_bool( settings, Animations[animationIndex].customStartingSettingStorage) variationType = obs.obs_data_get_int( settings, Animations[animationIndex].variationTypeStorage) movementType = obs.obs_data_get_int( settings, Animations[animationIndex].movementTypeStorage) animationProperties_set_vis(props, Animations[animationIndex], variationType, movementType, showStartingProperties) return True
def _button_call(properties, btn): cb = Button.CALLBACKS[_obs.obs_property_name(btn)] return bool(cb())