public void SetupCosmeticInformation(StaticSetConfig model, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            // So a note to self: Static sets have the 'meshes' container which is a map of other model files.
            // In SK Animator Tools V1 I was an idiot and thought the "model" property was the only key. This is false.
            // Instead, model represents the *default selection*. There may be more models. Iterate through the keys like damn lol.


            DataTreeObjectProperty targetProp = dataTreeParent.AddSimpleProperty("Target Set Model", model.model);

            targetProp.ExtraData["StaticSetConfig"] = model;
            // if (useOnlyTargetModel) dataTreeParent.AddSimpleProperty("Special Directive", "Only export target model", SilkImage.Scripted);

            List <object> objects = new List <object>();

            if (model.meshes != null)
            {
                object[] keys  = model.meshes.keySet().toArray();
                int      msIdx = 0;
                foreach (object key in keys)
                {
                    MeshSet        subModel    = (MeshSet)model.meshes.get(key);
                    VisibleMesh[]  meshes      = subModel.visible;
                    DataTreeObject subModelRef = new DataTreeObject()
                    {
                        Text     = key.ToString(),
                        ImageKey = SilkImage.ModelSet
                    };

                    List <object> subModels = new List <object>();
                    int           idx       = 0;
                    foreach (VisibleMesh mesh in meshes)
                    {
                        subModels.Add(new DataTreeObjectProperty("Mesh " + idx, SilkImage.Triangle));
                        idx++;
                    }

                    subModelRef.AddSimpleProperty("Geometry", subModels.ToArray(), SilkImage.Variant, SilkImage.Value, false);
                    objects.Add(subModelRef);
                    msIdx++;
                }
            }
            dataTreeParent.AddSimpleProperty("Contained Meshes", objects.ToArray(), SilkImage.Reference, SilkImage.Reference, false);
        }
Esempio n. 2
0
 public void SetupCosmeticInformation(Derived model, DataTreeObject dataTreeParent)
 {
     if (dataTreeParent == null)
     {
         return;
     }
     dataTreeParent.AddSimpleProperty("Referenced Model", model.model.getName(), SilkImage.Reference, SilkImage.Reference, false);
 }
Esempio n. 3
0
        public void SetupCosmeticInformation(TileEntry data, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            // This method returns a property, but this is just a stock object (it was created this way in TudeySceneConfigBrancher)
            List <DataTreeObject> values          = dataTreeParent.Properties[dataTreeParent.FindSimpleProperty("Entries")];
            DataTreeObject        prop            = values.First();
            DataTreeObject        existingTileCtr = prop.FindSimpleProperty("Tiles");

            if (existingTileCtr != null)
            {
                // Yes, there is a reason you call find twice. The implicit cast from property to object on existingTileCtr creates a new object
                // as such, casting it back for use in this lookup is a different key.
                existingTileCtr = prop.Properties[prop.FindSimpleProperty("Tiles")].FirstOrDefault();
            }
            DataTreeObject tilesContainer = existingTileCtr ?? new DataTreeObject()
            {
                ImageKey = SilkImage.Tile
            };

            if (existingTileCtr == null)
            {
                // We made a new one. Add it.
                prop.AddSimpleProperty("Tiles", tilesContainer);
            }

            DataTreeObject individualTileDataContainer = new DataTreeObject()
            {
                Text = data.tile.getName(),
                // ImageKey = SilkImage.Tile
            };


            Coord location = data.getLocation();

            //Transform3D trs = new Transform3D(new Vector3f(location.x, data.elevation, location.y), new Quaternion().fromAngleAxis((float)(data.rotation * Math.PI / 2), Vector3f.UNIT_Y), 1f);
            individualTileDataContainer.AddSimpleProperty("Elevation", data.elevation);
            individualTileDataContainer.AddSimpleProperty("Rotation (Deg)", data.rotation * 90);
            individualTileDataContainer.AddSimpleProperty("Coordinate", $"[{location.x}, {location.y}]", SilkImage.Matrix);
            individualTileDataContainer.AddSimpleProperty("Tile Reference", data.tile?.getName(), SilkImage.Reference);
            tilesContainer.AddSimpleProperty("Entry", individualTileDataContainer, SilkImage.Tile);
        }
        public void SetupCosmeticInformation(MergedStaticConfig model, DataTreeObject dataTreeParent)
        {
            ComponentModel[] componentModels = model.models;
            List <object>    refs            = new List <object>();

            foreach (ComponentModel mdl in componentModels)
            {
                refs.Add(mdl.model.getName());
            }
            dataTreeParent.AddSimpleProperty(componentModels.Length + " model references", refs.ToArray(), SilkImage.Reference, SilkImage.Reference, false);
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
        public void SetupCosmeticInformation(ConditionalConfig data, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            dataTreeParent.AddSimpleProperty("Default Data", MakeModelTransformPair(data.defaultModel, data.defaultTransform), SilkImage.Conditional);

            DataTreeObject optionContainer = new DataTreeObject()
            {
                ImageKey = SilkImage.Array
            };
            int idx = 0;

            foreach (ConditionalConfig.Case condition in data.cases)
            {
                optionContainer.AddSimpleProperty("Case " + idx, MakeModelTransformPair(condition.model, condition.transform, condition.condition), SilkImage.Conditional);
                idx++;
            }
            dataTreeParent.AddSimpleProperty("Cases", optionContainer, SilkImage.Array);
        }
        public void SetupCosmeticInformation(PlaceableEntry data, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }
            Transform3D transform = GetTransformField(data);

            // This method returns a property, but this is just a stock object (it was created this way in TudeySceneConfigBrancher)
            List <DataTreeObject> values = dataTreeParent.Properties[dataTreeParent.FindSimpleProperty("Entries")];
            DataTreeObject        prop   = values.First();
            DataTreeObject        existingPlaceableCtr = prop.FindSimpleProperty("Placeable Objects");

            if (existingPlaceableCtr != null)
            {
                // Yes, there is a reason you call find twice. The implicit cast from property to object on existingTileCtr creates a new object
                // as such, casting it back for use in this lookup is a different key.
                existingPlaceableCtr = prop.Properties[prop.FindSimpleProperty("Placeable Objects")].FirstOrDefault();
            }
            DataTreeObject placeableContainer = existingPlaceableCtr ?? new DataTreeObject()
            {
                ImageKey = SilkImage.Variant
            };

            if (existingPlaceableCtr == null)
            {
                // We made a new one. Add it.
                prop.AddSimpleProperty("Placeable Objects", placeableContainer);
            }

            DataTreeObject individualPlacementCtr = new DataTreeObject()
            {
                Text = data.placeable.getName()
            };

            individualPlacementCtr.AddSimpleProperty("Transform", transform.toString(), SilkImage.Matrix);
            individualPlacementCtr.AddSimpleProperty("Reference", data.getReference()?.getName() ?? "null", SilkImage.Reference);
            placeableContainer.AddSimpleProperty("Entry", individualPlacementCtr);
        }
Esempio n. 8
0
        public static void SetupCosmeticData(TudeySceneModel scene, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            DataTreeObject entryContainer = new DataTreeObject {
                Text     = scene.getEntries().size().ToString(),
                ImageKey = SilkImage.Value
            };

            dataTreeParent.AddSimpleProperty("Entries", entryContainer);
        }
        public void SetupCosmeticInformation(ArticulatedConfig model, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            AnimationMapping[] animMaps   = model.animationMappings;
            object[]           animations = new object[animMaps.Length];
            for (int idx = 0; idx < animations.Length; idx++)
            {
                animations[idx] = animMaps[idx].name;
            }
            dataTreeParent.AddSimpleProperty("Animations", animations, SilkImage.Value, SilkImage.Animation, false);
        }
Esempio n. 10
0
        public void SetupCosmeticInformation(CompoundConfig model, DataTreeObject dataTreeParent)
        {
            ComponentModel[] componentModels = model.models;
            List <object>    refs            = new List <object>();

            foreach (ComponentModel mdl in componentModels)
            {
                // Yes, there are cases where this is null.
                if (mdl.model?.getName() != null)
                {
                    refs.Add(mdl.model.getName());
                }
            }
            dataTreeParent.AddSimpleProperty(componentModels.Length + " model references", refs.ToArray(), SilkImage.Reference, SilkImage.Reference, false);
        }
Esempio n. 11
0
            public void SetupCosmeticInformation(Schemed model, DataTreeObject dataTreeParent)
            {
                if (dataTreeParent == null)
                {
                    return;
                }

                SchemedModel[] models = model.models;
                List <object>  refs   = new List <object>();

                foreach (SchemedModel schemedModel in models)
                {
                    refs.Add(schemedModel.model.getName());
                }
                dataTreeParent.AddSimpleProperty(models.Length + " Schemed References", refs.ToArray(), SilkImage.Reference, SilkImage.SchemedModel);
            }
        /// <summary>
        /// Sets up the cosmetic data for this model, or, what's displayed in the GUI for the program.
        /// </summary>
        /// <param name="model">The <see cref="StaticConfig"/> to pull data from.</param>
        /// <param name="dataTreeParent">This is the instance in the data tree that represents this object in the hierarchy.</param>
        public void SetupCosmeticInformation(StaticConfig model, DataTreeObject dataTreeParent)
        {
            if (dataTreeParent == null)
            {
                return;
            }

            if (model.meshes != null && model.meshes.visible != null)
            {
                List <object> subModels = new List <object>();
                int           idx       = 0;
                foreach (VisibleMesh mesh in model.meshes.visible)
                {
                    subModels.Add(new DataTreeObjectProperty("Mesh " + idx, SilkImage.Triangle));
                    idx++;
                }
                dataTreeParent.AddSimpleProperty("Geometry", subModels.ToArray(), SilkImage.Variant, SilkImage.Value, false);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Sets up the cosmetic data for this model, or, what's displayed in the GUI for the program.<para/>
        /// This specific method populates data that is common across all imported models.
        /// </summary>
        /// <param name="model">The model containing other data, such as the <see cref="Implementation"/>.</param>
        /// <param name="dataTreeParent">This is the instance in the data tree that represents this object in the hierarchy. If null, this method call is skipped.</param>
        /// <param name="dataTreeNameIsImplementation">If <see langword="true"/>, the name of <paramref name="dataTreeParent"/> is the implementation of the model, so the implementation property will not be added.</param>
        public static void SetupCosmeticInformation(ModelConfig model, DataTreeObject dataTreeParent, bool dataTreeNameIsImplementation)
        {
            if (dataTreeParent == null)
            {
                return;
            }
            Implementation impl = model.implementation;

            if (!dataTreeNameIsImplementation)
            {
                // If this is true, the name of the actual node is the implementation, rendering this property useless.

                string implementationName = JavaClassNameStripper.GetWholeClassName(impl.getClass().getName()) ?? "Unknown Implementation";
                dataTreeParent.AddSimpleProperty("Implementation", implementationName.Replace("$", "::"), SilkImage.Config, SilkImage.Config, true);
            }

            // It's imported!
            // ...Unless it's a CompoundConfig. (I mean given the properties below it makes sense, it's just a container, not actual model data.)
            if (impl is Imported imported)
            {
                //RootDataTreeObject.AddSimpleProperty("Scale", model.scale);
                List <object> influences = new List <object>(3);
                if (imported.influences.fog)
                {
                    influences.Add(new DataTreeObjectProperty("Fog", SilkImage.Shading));
                }
                if (imported.influences.lights)
                {
                    influences.Add(new DataTreeObjectProperty("Lights", SilkImage.Light));
                }
                if (imported.influences.projections)
                {
                    influences.Add(new DataTreeObjectProperty("Projections", SilkImage.Texture));
                }
                if (influences.Count > 0)
                {
                    dataTreeParent.AddSimpleProperty("Influenced By...", influences.ToArray(), displaySinglePropertiesInline: false);
                }

                /*
                 * MaterialMapping[] matMaps = imported.materialMappings;
                 * object[] materialProperties = new object[matMaps.Length];
                 * for (int idx = 0; idx < materialProperties.Length; idx++) {
                 *      ConfigReference mtlRef = matMaps[idx].material;
                 *      ConfigReference texCfg = (ConfigReference)mtlRef.getArguments().getOrDefault("Texture", null);
                 *      if (texCfg != null) {
                 *              string texFile = (string)texCfg.getArguments().getOrDefault("File", "?");
                 *              materialProperties[idx] = new DataTreeObjectProperty(texFile, SilkImage.Reference, false);
                 *      } else {
                 *              materialProperties[idx] = matMaps[idx].texture;
                 *      }
                 * }
                 * dataTreeParent.AddSimpleProperty("Textures", materialProperties, SilkImage.Value, SilkImage.Texture, false);
                 */
            }
            List <object> parameters = new List <object>();

            foreach (Parameter prop in model.parameters)
            {
                if (prop is Parameter.Direct direct)
                {
                    DataTreeObject paths = new DataTreeObject {
                        ImageKey = SilkImage.Tag,
                        Text     = "Direct: " + direct.name
                    };
                    int idx = 0;
                    foreach (string path in direct.paths)
                    {
                        paths.AddSimpleProperty("Path " + idx, path);
                        idx++;
                    }
                    parameters.Add(paths);
                }
                else if (prop is Parameter.Choice choice)
                {
                    DataTreeObject choices = new DataTreeObject {
                        ImageKey = SilkImage.Value,
                        Text     = "Choice: " + choice.name + " [Default: " + choice.choice + "]"
                    };
                    List <DataTreeObject> choiceList = new List <DataTreeObject>();
                    foreach (Parameter.Choice.Option option in choice.options)
                    {
                        // choiceList.Add(c);
                        DataTreeObject choiceInfo = new DataTreeObject {
                            ImageKey = SilkImage.Tag,
                            Text     = option.name
                        };
                        ArgumentMap args = option.arguments;
                        object[]    keys = args.keySet().toArray();
                        foreach (object key in keys)
                        {
                            choiceInfo.AddSimpleProperty(key.ToString(), args.get(key));
                        }

                        choiceList.Add(choiceInfo);
                    }
                    choices.AddSimpleProperty("Choices", choiceList.ToArray(), SilkImage.Value, SilkImage.Tag, false);

                    List <DataTreeObject> subDirects = new List <DataTreeObject>();
                    foreach (Parameter.Direct dir in choice.directs)
                    {
                        DataTreeObject dirObj = new DataTreeObject {
                            ImageKey = SilkImage.Tag,
                            Text     = "Direct: " + dir.name
                        };
                        int idx = 0;
                        foreach (string path in dir.paths)
                        {
                            dirObj.AddSimpleProperty("Path " + idx, path);
                            idx++;
                        }
                        subDirects.Add(dirObj);
                    }
                    choices.AddSimpleProperty("Choice Directs", subDirects.ToArray(), SilkImage.Value, SilkImage.Tag, false);
                    parameters.Add(choices);
                }
                else
                {
                    parameters.Add($"{prop.name} [{prop.GetType().FullName}]");
                }
            }
            dataTreeParent.AddSimpleProperty("Parameters", parameters.ToArray(), SilkImage.Value, SilkImage.Tag, false);
        }