Ejemplo n.º 1
0
        public void SetSceneItemProperties(string itemName, SceneItemProperties properties, string sceneName = null)
        {
            var requestFields = new JObject();

            requestFields.Add("item", itemName);

            CheckAdd(sceneName, "scene-name");
            CheckAdd(properties.PositionX, "position.x");
            CheckAdd(properties.PositionY, "position.y");
            CheckAdd(properties.Rotation, "rotation");
            CheckAdd(properties.ScaleX, "scale.x");
            CheckAdd(properties.ScaleY, "scale.y");
            CheckAdd(properties.CropTop, "crop.top");
            CheckAdd(properties.Visiable, "visible");
            CheckAdd(properties.Locked, "locked");
            CheckAdd(properties.PositionX, "crop.bottom");
            CheckAdd(properties.PositionX, "crop.left");
            CheckAdd(properties.PositionX, "crop.right");
            CheckAdd(properties.PositionX, "visible");
            CheckAdd(properties.PositionX, "locked");
            CheckAdd(properties.BoundsType, "bounds.type");
            CheckAdd(properties.BoundsAlignment, "bounds.alignment");
            CheckAdd(properties.BoundsX, "bounds.x");
            CheckAdd(properties.BoundsY, "bounds.y");

            var result = SendRequest("SetSceneItemProperties", requestFields);

            void CheckAdd(object val, string field)
            {
                if (val != null)
                {
                    requestFields.Add(field, JToken.FromObject(val));
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the scene specific properties of a source. Unspecified properties will remain unchanged. Coordinates are relative to the item's parent (the scene or group it belongs to).
        /// </summary>
        /// <param name="props">Object containing changes</param>
        /// <param name="sceneName">Option scene name</param>
        public void SetSceneItemProperties(SceneItemProperties props, string sceneName = null)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.NullValueHandling = NullValueHandling.Ignore;
            var requestFields = JObject.Parse(JsonConvert.SerializeObject(props, settings));

            if (sceneName != null)
            {
                requestFields.Add("scene-name", sceneName);
            }

            SendRequest("SetSceneItemProperties", requestFields);
        }