示例#1
0
        /// <summary>
        /// Action method for setting the direction and angles of a child object attached
        /// to the this object by the AddTemplate command. The angle is in terms of
        /// yaw/pitch/roll.
        /// </summary>
        /// <remarks>
        /// The units used for this parameter are degrees (1 - 360) but you can have
        /// negative degrees as well. If you define multiple rotations, they happen
        /// in this order.
        /// </remarks>
        /// <param name="token"></param>
        /// <param name="arg1"></param>
        protected virtual ConFileEntry Method_SetRotation(Token token, string arg1 = "0/0/0")
        {
            // Ensure that we have a child template
            ChildTemplate item = Templates?.Items?.LastOrDefault()?.Value;

            if (item == null)
            {
                string err = $"SetRotation called on a non-instantiated child object";
                Logger.Error(err, token.File, token.Position);
                throw new Exception(err);
            }

            // Get the "SetRotation" field, and make sure the ObjectProperty is not null
            if (item.SetRotation == null)
            {
                PropertyInfo field = item.GetProperty("SetRotation").Value;
                item.SetRotation = new ObjectProperty <Point3D>("setRotation", token, field, this);
                token.File.AddProperty(item.SetRotation);
            }

            // Set the new value
            item.SetRotation.SetValue(token);

            // Don't create an entry!
            return(null);
        }
示例#2
0
        /// <summary>
        /// Action method for adding child templates to this object
        /// </summary>
        /// <param name="token"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected virtual ConFileEntry Method_AddTemplate(Token token, string name)
        {
            // Get the internal property, and check if templates is null
            var info = GetProperty("__addTemplate").Value;

            if (Templates == null)
            {
                Templates = new ObjectPropertyList <ChildTemplate>("addTemplate", token, info, this);
            }

            // Create the object template value, and the object property
            ChildTemplate ct   = new ChildTemplate(token.TokenArgs.Arguments.Last(), token);
            var           prop = new ObjectProperty <ChildTemplate>("addTemplate", token, info, this);

            // We must also manually define the ValueInfo, because ChildTemplate
            // is NOT a RefernceType object
            prop.Argument = new ValueInfo <ChildTemplate>(ct);
            Templates.Items.Add(prop);

            return(prop);
        }
示例#3
0
        /// <summary>
        /// Action method for adding child templates to this object
        /// </summary>
        /// <param name="token"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected virtual ConFileEntry Method_AddTemplate(Token token, string name)
        {
            // Get the internal property, and check if templates is null
            var info = GetProperty("__addTemplate").Value;
            if (Templates == null)
                Templates = new ObjectPropertyList<ChildTemplate>("addTemplate", token, info, this);

            // Create the object template value, and the object property
            ChildTemplate ct = new ChildTemplate(token.TokenArgs.Arguments.Last(), token);
            var prop = new ObjectProperty<ChildTemplate>("addTemplate", token, info, this);

            // We must also manually define the ValueInfo, because ChildTemplate
            // is NOT a RefernceType object
            prop.Argument = new ValueInfo<ChildTemplate>(ct);
            Templates.Items.Add(prop);

            return prop;
        }