Beispiel #1
0
        //------------------------------------------------------------------------------
        public static void CreateXenoMappingSet(string path)
        {
            XenoTemplateMapping mapping = ScriptableObject.CreateInstance <XenoTemplateMapping>();

            //String targetPath = EditorUtils.ValidateAssetPath(
            //    EditorUtils.GetDirectoryPathOfSelectedAsset(),
            //    XenoTemplateTool.TemplateFileFolderName
            //);

            String rawPath = String.Format("{0}/NewXenoTemplateMapping.asset", path);

            //String uniquePath = AssetDatabase.GenerateUniqueAssetPath(rawPath);

            AssetDatabase.CreateAsset(mapping, rawPath);
            AssetDatabase.SetLabels(mapping, new String[] { XenoTemplateTool.MapLabel });

            Selection.activeObject = mapping;
        }
Beispiel #2
0
        //------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            m_targetMapping = target as XenoTemplateMapping;
            Undo.RecordObject(m_targetMapping, "Modify mapping");

            SetupGuiStyles();

            CustomMappingGUI();

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EnvironmentMappingGUI();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
Beispiel #3
0
        //------------------------------------------------------------------------------
        private static void LoadCustomMappings(ref Dictionary <String, String> tokenReplacements)
        {
            List <String> mappingAssetPaths = EditorUtils.FindAssetPaths(XenoTemplateTool.MapLabel);

            foreach (String path in mappingAssetPaths)
            {
                if (!File.Exists(path))
                {
                    continue;
                }

                XenoTemplateMapping mapping = AssetDatabase.LoadAssetAtPath(path, typeof(XenoTemplateMapping)) as XenoTemplateMapping;

                foreach (KeyValuePair <String, XenoTemplateCustomMappingData> kvp in mapping.CustomMappings)
                {
                    MapCustom(kvp.Key, kvp.Value, ref tokenReplacements);
                }

                foreach (KeyValuePair <String, String> kvp in mapping.EnvironmentMappings)
                {
                    MapEnvVariable(kvp.Key, kvp.Value, ref tokenReplacements);
                }
            }
        }