Skip to content

Commit 0f0a007

Browse files
authored
Merge pull request #248 from Kapim/master
fixes regarding meshes processing
2 parents 1b4eb51 + eadf249 commit 0f0a007

File tree

7 files changed

+642
-267
lines changed

7 files changed

+642
-267
lines changed

arcor2_AREditor/Assets/BASE/Scripts/DataHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ public static class DataHelper {
55
// Start is called before the first frame update
66

77
public static IO.Swagger.Model.Position Vector3ToPosition(Vector3 vector) {
8-
return new IO.Swagger.Model.Position((decimal) vector.x, (decimal) vector.y, (decimal) vector.z);
8+
return new IO.Swagger.Model.Position(x: (decimal) vector.x, y: (decimal) vector.y, z: (decimal) vector.z);
99
}
1010

1111
public static Vector3 PositionToVector3(IO.Swagger.Model.Position position) => new Vector3((float) position.X, (float) position.Y, (float) position.Z);
1212

1313
public static IO.Swagger.Model.Orientation QuaternionToOrientation(Quaternion quaternion) {
14-
return new IO.Swagger.Model.Orientation((decimal) quaternion.w, (decimal) quaternion.x, (decimal) quaternion.y, (decimal) quaternion.z);
14+
return new IO.Swagger.Model.Orientation(w: (decimal) quaternion.w, x: (decimal) quaternion.x, y: (decimal) quaternion.y, z: (decimal) quaternion.z);
1515
}
1616

1717
public static Quaternion OrientationToQuaternion(IO.Swagger.Model.Orientation orientation) => new Quaternion((float) orientation.X, (float) orientation.Y, (float) orientation.Z, (float) orientation.W);

arcor2_AREditor/Assets/BASE/Scripts/MeshImporter.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void ImportMesh(string path, string aoId) {
6767
AssetLoaderOptions assetLoaderOptions = AssetLoader.CreateDefaultLoaderOptions();
6868
AssetLoader.LoadModelFromFile(path, null, delegate (AssetLoaderContext assetLoaderContext) {
6969
if (Path.GetExtension(path).ToLower() == ".stl") {
70-
assetLoaderContext.RootGameObject.transform.Rotate(0f, 180f, 0f); // TODO kinali hacked version had 0, 90f, 0
70+
assetLoaderContext.RootGameObject.transform.Rotate(0f, 90f, 0f);
7171
}
7272

7373
OnMeshImported?.Invoke(this, new ImportedMeshEventArgs(assetLoaderContext.WrapperGameObject, aoId));
@@ -85,7 +85,8 @@ private void ImportMesh(string path, string aoId) {
8585
private IEnumerator DownloadMesh(string meshId, string fileName, string aoId) {
8686

8787
//Debug.LogError("MESH: download started");
88-
string uri = MainSettingsMenu.Instance.GetProjectServiceURI() + fileName;
88+
string uri = MainSettingsMenu.Instance.GetAssetFileURI(fileName);
89+
Debug.LogError(uri);
8990
using (UnityWebRequest www = UnityWebRequest.Get(uri)) {
9091
// Request and wait for the desired page.
9192
yield return www.Send();
@@ -200,7 +201,8 @@ public bool CheckIfNewerRobotModelExists(string meshId, string fileName) {
200201
return CanIDownload(meshId);
201202
}
202203

203-
string uri = MainSettingsMenu.Instance.GetProjectServiceURI() + fileName;
204+
string uri = MainSettingsMenu.Instance.GetAssetFileURI(fileName);
205+
204206
DateTime downloadedZipLastModified = meshFileInfo.LastWriteTime;
205207
try {
206208
HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);

arcor2_AREditor/Assets/BASE/Scripts/URDF/UrdfManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public IEnumerator DownloadUrdfPackage(string robotType, string fileName) {
4040
//GameManager.Instance.SetTurboFramerate();
4141

4242
//Debug.Log("URDF: download started");
43-
string uri = MainSettingsMenu.Instance.GetProjectServiceURI() + fileName;
43+
string uri = MainSettingsMenu.Instance.GetAssetFileURI(fileName);
4444
UnityWebRequest www;
4545
try {
4646
www = UnityWebRequest.Get(uri);
@@ -261,7 +261,7 @@ public bool CheckIfNewerRobotModelExists(string robotType, string fileName) {
261261
// Check whether downloading can be started and start it, if so.
262262
return CanIDownload(fileName);
263263
}
264-
string uri = MainSettingsMenu.Instance.GetProjectServiceURI() + fileName;
264+
string uri = MainSettingsMenu.Instance.GetAssetFileURI(fileName);
265265
try {
266266
HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
267267
HttpWebResponse httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();

0 commit comments

Comments
 (0)