コード例 #1
0
        public void SetupCosmeticInformation(ViewerAffecterConfig model, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }
            ViewerEffectConfig effect = model.effect;
            string             cls    = JavaClassNameStripper.GetWholeClassName(effect.getClass());

            if (cls == null)
            {
                XanLogger.WriteLine("WARNING: Attempt to get class of ViewerEffectConfig failed!");
                return;
            }

            DataTreeObjectProperty implementationPropKey = dataTreeParent.FindSimpleProperty("Implementation");
            DataTreeObject         implementationProp    = dataTreeParent.Properties[implementationPropKey].First();

            implementationProp.Text = cls.Replace("$", "::");
            if (effect is Skybox skybox)
            {
                dataTreeParent.ImageKey = SilkImage.Sky;
                string name = skybox.model?.getName();
                if (name == null && dataTreeParent.Parent != null && dataTreeParent.Parent.ImageKey == SilkImage.Schemed)
                {
                    dataTreeParent.ImageKey = SilkImage.Scheme;
                    dataTreeParent.AddSimpleProperty("Data Type", "Render Scheme", SilkImage.Scheme);
                }
                else
                {
                    // Name may still be null here.
                    SilkImage target = name == null ? SilkImage.Missing : SilkImage.ModelSet;
                    dataTreeParent.AddSimpleProperty("Model Reference", name, SilkImage.Reference, target, false);
                }

                Transform3D newTrs = new Transform3D(skybox.translationOrigin, Quaternion.IDENTITY, skybox.translationScale.x);
                dataTreeParent.AddSimpleProperty("Transform", newTrs.toString(), SilkImage.Matrix);
            }
        }
コード例 #2
0
        /// <summary>
        /// An alias method used to add a property with a generic icon to <see cref="Properties"/> (omitting the need to create a <see cref="DataTreeObject"/>)<para/>
        /// If the object array contains any <see cref="DataTreeObjectProperty"/> instances, those instances will be used (and <paramref name="propertyValueImages"/> will be overridden where applicable).
        /// </summary>
        /// <param name="name">The name of the property.</param>
        /// <param name="values">The values displayed under the property.</param>
        /// <param name="propertyNameImage">The image displayed next to the property name.</param>
        /// <param name="propertyValueImages">The image displayed next to each of the values for the property.</param>
        /// <param name="displaySinglePropertiesInline">If true, properties with single values will be displayed in the same element containing the property name (<c>Name: Value</c>) instead of as a child element (<c>Name</c>, with a child of <c>Value</c>).</param>
        public DataTreeObjectProperty AddSimpleProperty(string name, object[] values, SilkImage propertyNameImage = SilkImage.Value, SilkImage propertyValueImages = SilkImage.Value, bool displaySinglePropertiesInline = true)
        {
            DataTreeObjectProperty propName = new DataTreeObjectProperty(name, propertyNameImage, displaySinglePropertiesInline);
            List <DataTreeObject>  pValues  = new List <DataTreeObject>();

            foreach (object obj in values)
            {
                if (obj is DataTreeObject objInstance)
                {
                    pValues.Add(objInstance);
                }
                else if (obj is DataTreeObjectProperty prop)
                {
                    pValues.Add(prop);
                }
                else
                {
                    if (obj is null)
                    {
                        pValues.Add(new DataTreeObjectProperty("null", propertyValueImages));
                    }
                    else
                    {
                        pValues.Add(new DataTreeObjectProperty(obj.ToString(), propertyValueImages));
                    }
                }
            }
            Properties[propName] = pValues;
            return(propName);
        }
コード例 #3
0
 /// <summary>
 /// Construct a new property with empty string and the <see cref="SilkImage.Value"/> image.
 /// </summary>
 /// <param name="text">The text to display in this property.</param>
 /// <param name="imageKey">The image to display to the left of the text.</param>
 /// <param name="displaySinglePropertiesInline">If true, properties with single values will be displayed in the same element containing the property name (<c>Name: Value</c>) instead of as a child element (<c>Name</c>, with a child of <c>Value</c>). In the case of this constructor, this object must be a key in a <see cref="DataTreeObject.Properties"/>. When the GUI system creates the properties menu, if this property object has one associated child value, it will display inline as mentioend prior.</param>
 public DataTreeObjectProperty(string text = "", SilkImage imageKey = SilkImage.Value, bool displaySinglePropertiesInline = true)
 {
     Text     = text;
     ImageKey = imageKey;
     DisplaySingleChildInline = displaySinglePropertiesInline;
 }
コード例 #4
0
 /// <summary>
 /// An alias method used to add a property with a generic icon to <see cref="Properties"/> (omitting the need to create a <see cref="DataTreeObject"/>)<para/>
 /// If the object array is a <see cref="DataTreeObjectProperty"/> instance, that instance will be used.
 /// </summary>
 /// <param name="name">The name of the property.</param>
 /// <param name="value">The value displayed under the property.</param>
 /// <param name="propertyNameImage">The image displayed next to the property name.</param>
 /// <param name="propertyValueImages">The image displayed next to each of the values for the property.</param>
 /// <param name="displaySinglePropertiesInline">If true, properties with single values will be displayed in the same element containing the property name (<c>Name: Value</c>) instead of as a child element (<c>Name</c>, with a child of <c>Value</c>).</param>
 public DataTreeObjectProperty AddSimpleProperty(string name, object value, SilkImage propertyNameImage = SilkImage.Value, SilkImage propertyValueImages = SilkImage.Value, bool displaySinglePropertiesInline = true) => AddSimpleProperty(name, new object[] { value }, propertyNameImage, propertyValueImages, displaySinglePropertiesInline);