Esempio n. 1
0
        /// <summary>
        /// Builds the object from the JSON description
        /// </summary>
        /// <param name="data">JSON scene description as a <see cref="JObject" /></param>
        public OBSScene(JObject data)
        {
            Name  = (string)data["name"];
            Items = new List <SceneItem>();

            var sceneItems = (JArray)data["sources"];

            foreach (JObject item in sceneItems)
            {
                var scitem = new SceneItem(item);
                Items.Add(scitem);
                if (scitem.InternalType == "group" && item["groupChildren"] != null)
                {
                    JArray childs = (JArray)item["groupChildren"];
                    for (int i = childs.Count - 1; i >= 0; i--)
                    {
                        Items.Add(new SceneItem((JObject)childs[i]));
                    }
                }
            }
        }
 /// <summary>
 /// Set the relative crop coordinates of the specified source item
 /// </summary>
 /// <param name="sceneItem">Scene item object</param>
 /// <param name="cropInfo">Crop coordinates</param>
 /// <param name="scene">Parent scene of scene item</param>
 public void SetSceneItemCrop(SceneItem sceneItem,
                              SceneItemCropInfo cropInfo, OBSScene scene)
 {
     SetSceneItemCrop(sceneItem.SourceName, cropInfo, scene.Name);
 }