Skip to content
This repository has been archived by the owner on Jun 26, 2021. It is now read-only.

Commit

Permalink
Version 1.8_FH
Browse files Browse the repository at this point in the history
- Fixed /issues/4
  • Loading branch information
FritzsHero committed Feb 10, 2019
1 parent c82721e commit 4c11864
Show file tree
Hide file tree
Showing 27 changed files with 2,782 additions and 1,628 deletions.
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@ All notable changes to this RoadArchitect project will be documented in this fil
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [Version: 1.8_FH] - 2019.02.10
### Improvements
- Added some FH_Tag Optimizable as comments, since there is a way to further optimize the Code tagged by this
- Added a few Lines of comments to the code, to get a better idea of what the code does

### Changed
- Changed some Layouts of the Scripts
- Changed some Vars in Scripts to better reflect their purpose

### Added
- Added a few Regions to some Scripts

###Fixed
- Fixed embeddedt/RoadArchitect/issues/4

## [Version: 1.7.5a_FH] - 2019.01.31
### Changed
- Changed most Layouts of the Scripts.
- Changed some Vars in Scripts to better reflect their purpose.
- Changed most Layouts of the Scripts
- Changed some Vars in Scripts to better reflect their purpose

## [Version 1.7] - 2018.07.16
### Changed
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Editor/GSDEditorProgressWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#region "Imports"
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
#endregion


/// <summary>
Expand Down
38 changes: 23 additions & 15 deletions Editor/GSDObjExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ same folder.
*/


#region Imports
#region "Imports"
using UnityEngine;
using UnityEditor;
using System.Collections;
Expand Down Expand Up @@ -102,11 +102,11 @@ private static string MeshToString(MeshFilter mf, Dictionary<string, ObjMaterial


int[] triangles = m.GetTriangles(material);
for (int i = 0; i < triangles.Length; i += 3)
for (int index = 0; index < triangles.Length; index += 3)
{
//Because we inverted the x-component, we also needed to alter the triangle winding.
sb.Append(string.Format("f {1}/{1}/{1} {0}/{0}/{0} {2}/{2}/{2}\n",
triangles[i] + 1 + vertexOffset, triangles[i + 1] + 1 + normalOffset, triangles[i + 2] + 1 + uvOffset));
triangles[index] + 1 + vertexOffset, triangles[index + 1] + 1 + normalOffset, triangles[index + 2] + 1 + uvOffset));
}
}

Expand Down Expand Up @@ -157,7 +157,9 @@ private static void MaterialsToFile(Dictionary<string, ObjMaterial> materialList
int stripIndex = destinationFile.LastIndexOf('/');//FIXME: Should be Path.PathSeparator;

if (stripIndex >= 0)
{
destinationFile = destinationFile.Substring(stripIndex + 1).Trim();
}


string relativeFile = destinationFile;
Expand Down Expand Up @@ -209,9 +211,9 @@ private static void MeshesToFile(MeshFilter[] mf, string folder, string filename
{
sw.Write("mtllib ./" + filename + ".mtl\n");

for (int i = 0; i < mf.Length; i++)
for (int index = 0; index < mf.Length; index++)
{
sw.Write(MeshToString(mf[i], materialList));
sw.Write(MeshToString(mf[index], materialList));
}
}

Expand Down Expand Up @@ -239,7 +241,9 @@ private static bool CreateTargetFolder()
static void ExportSelectionToSeparate()
{
if (!CreateTargetFolder())
{
return;
}

Transform[] selection = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);

Expand All @@ -251,21 +255,25 @@ static void ExportSelectionToSeparate()

int exportedObjects = 0;

for (int i = 0; i < selection.Length; i++)
for (int index = 0; index < selection.Length; index++)
{
Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));
Component[] meshfilter = selection[index].GetComponentsInChildren(typeof(MeshFilter));

for (int m = 0; m < meshfilter.Length; m++)
{
exportedObjects++;
MeshToFile((MeshFilter) meshfilter[m], targetFolder, selection[i].name + "_" + i + "_" + m);
MeshToFile((MeshFilter) meshfilter[m], targetFolder, selection[index].name + "_" + index + "_" + m);
}
}

if (exportedObjects > 0)
{
EditorUtility.DisplayDialog("Objects exported", "Exported " + exportedObjects + " objects", "");
}
else
{
EditorUtility.DisplayDialog("Objects not exported", "Make sure at least some of your selected objects have mesh filters!", "");
}
}


Expand All @@ -290,9 +298,9 @@ static void ExportWholeSelectionToSingle()

ArrayList mfList = new ArrayList();

for (int i = 0; i < selection.Length; i++)
for (int index = 0; index < selection.Length; index++)
{
Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));
Component[] meshfilter = selection[index].GetComponentsInChildren(typeof(MeshFilter));

for (int m = 0; m < meshfilter.Length; m++)
{
Expand All @@ -305,9 +313,9 @@ static void ExportWholeSelectionToSingle()
{
MeshFilter[] mf = new MeshFilter[mfList.Count];

for (int i = 0; i < mfList.Count; i++)
for (int index = 0; index < mfList.Count; index++)
{
mf[i] = (MeshFilter) mfList[i];
mf[index] = (MeshFilter) mfList[index];
}


Expand Down Expand Up @@ -352,9 +360,9 @@ static void ExportEachSelectionToSingle()
int exportedObjects = 0;


for (int i = 0; i < selection.Length; i++)
for (int index = 0; index < selection.Length; index++)
{
Component[] meshfilter = selection[i].GetComponentsInChildren(typeof(MeshFilter));
Component[] meshfilter = selection[index].GetComponentsInChildren(typeof(MeshFilter));

MeshFilter[] mf = new MeshFilter[meshfilter.Length];

Expand All @@ -364,7 +372,7 @@ static void ExportEachSelectionToSingle()
mf[m] = (MeshFilter) meshfilter[m];
}

MeshesToFile(mf, targetFolder, selection[i].name + "_" + i);
MeshesToFile(mf, targetFolder, selection[index].name + "_" + index);
}

if (exportedObjects > 0)
Expand Down
48 changes: 31 additions & 17 deletions Editor/GSDRoadEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ public override void OnInspectorGUI()
bSetDefaultMats = false;
//Graphic null checks:
if (!bHasInit)
{ Init(); }
{
Init();
}



Expand Down Expand Up @@ -883,7 +885,8 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterial1, new GUIContent(" Mat #1: "));
if (RS.RoadMaterial1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterial1 = null; }
{
RS.RoadMaterial1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.RoadMaterial1 != null)
{
Expand Down Expand Up @@ -913,8 +916,6 @@ public override void OnInspectorGUI()





// //Road marker material defaults:
GUILayout.Label("Road marker material(s) defaults:");
// EditorGUILayout.PropertyField (t_RoadMaterialMarker1, new GUIContent (" Mat #1: "));
Expand All @@ -925,30 +926,34 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker1, new GUIContent(" Mat #1: "));
if (RS.RoadMaterialMarker1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterialMarker1 = null; }
{
RS.RoadMaterialMarker1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.RoadMaterialMarker1 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker2, new GUIContent(" Mat #2: "));
if (RS.RoadMaterialMarker2 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterialMarker2 = null; }
{
RS.RoadMaterialMarker2 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterialMarker1 != null && RS.RoadMaterialMarker2 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker3, new GUIContent(" Mat #3: "));
if (RS.RoadMaterialMarker3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterialMarker3 = null; }
{
RS.RoadMaterialMarker3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterialMarker1 != null && RS.RoadMaterialMarker2 != null && RS.RoadMaterialMarker3 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker4, new GUIContent(" Mat #4: "));
if (RS.RoadMaterialMarker4 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterialMarker4 = null; }
{
RS.RoadMaterialMarker4 = null; }
EditorGUILayout.EndHorizontal();
}

Expand All @@ -967,7 +972,8 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial1, new GUIContent(" Mat #1: "));
if (RS.ShoulderMaterial1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterial1 = null; }
{
RS.ShoulderMaterial1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.ShoulderMaterial1 != null)
{
Expand All @@ -982,15 +988,17 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial3, new GUIContent(" Mat #3: "));
if (RS.ShoulderMaterial3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterial3 = null; }
{
RS.ShoulderMaterial3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.ShoulderMaterial1 != null && RS.ShoulderMaterial2 != null && RS.ShoulderMaterial3 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial4, new GUIContent(" Mat #4: "));
if (RS.ShoulderMaterial4 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterial4 = null; }
{
RS.ShoulderMaterial4 = null; }
EditorGUILayout.EndHorizontal();
}
}
Expand All @@ -1010,7 +1018,8 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterialMarker1, new GUIContent(" Mat #1: "));
if (RS.ShoulderMaterialMarker1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterialMarker1 = null; }
{
RS.ShoulderMaterialMarker1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.ShoulderMaterialMarker1 != null)
{
Expand All @@ -1025,15 +1034,17 @@ public override void OnInspectorGUI()
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterialMarker3, new GUIContent(" Mat #3: "));
if (RS.ShoulderMaterialMarker3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterialMarker3 = null; }
{
RS.ShoulderMaterialMarker3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.ShoulderMaterialMarker1 != null && RS.ShoulderMaterialMarker2 != null && RS.ShoulderMaterialMarker3 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterialMarker4, new GUIContent(" Mat #4: "));
if (RS.ShoulderMaterialMarker4 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterialMarker4 = null; }
{
RS.ShoulderMaterialMarker4 = null; }
EditorGUILayout.EndHorizontal();
}
}
Expand Down Expand Up @@ -1299,7 +1310,8 @@ public void OnSceneGUI()
{
//Debug.Log("Drawing new node");
if (RS.GSDSpline.PreviewSpline.mNodes == null || RS.GSDSpline.PreviewSpline.mNodes.Count < 1)
{ RS.GSDSpline.Setup(); }
{
RS.GSDSpline.Setup(); }
RS.GSDSpline.PreviewSpline.MousePos = hitInfo.point;
RS.GSDSpline.PreviewSpline.bGizmoDraw = true;
SceneView.RepaintAll();
Expand All @@ -1321,7 +1333,8 @@ public void OnSceneGUI()
if (RS.GSDSpline && RS.GSDSpline.PreviewSplineInsert)
{
if (RS.GSDSpline.PreviewSplineInsert.mNodes == null || RS.GSDSpline.PreviewSplineInsert.mNodes.Count < 1)
{ RS.GSDSpline.PreviewSplineInsert.DetermineInsertNodes(); }
{
RS.GSDSpline.PreviewSplineInsert.DetermineInsertNodes(); }
RS.GSDSpline.PreviewSplineInsert.MousePos = hitInfo.point;
RS.GSDSpline.PreviewSplineInsert.bGizmoDraw = true;
RS.GSDSpline.PreviewSplineInsert.UpdateActionNode();
Expand Down Expand Up @@ -1490,6 +1503,7 @@ void GSDProgressBar(float tV, string tL)
#endregion


// FH_Tag Optimizable
void Line()
{
GUILayout.Space(4f);
Expand All @@ -1504,5 +1518,5 @@ void LineSmall()
GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1f)); //Horizontal bar
GUILayout.Space(1f);
}

// FH_Tag Optimizable
}
Loading

0 comments on commit 4c11864

Please sign in to comment.