Skip to content

Commit

Permalink
resolved pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bozmir committed Oct 29, 2024
1 parent 3b758f8 commit 311717d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,21 @@ public class HierarchicalObjectLayerGameObject : LayerGameObject, IPointerClickH
private ToggleScatterPropertySectionInstantiator toggleScatterPropertySectionInstantiator;
[SerializeField] private UnityEvent<GameObject> objectCreated = new();
private List<IPropertySectionInstantiator> propertySections = new();
private TransformLayerPropertyData transformPropertyData;
protected TransformLayerPropertyData transformPropertyData;
private Vector3 previousPosition;
private Quaternion previousRotation;
private Vector3 previousScale;

protected Coordinate coord;

LayerPropertyData ILayerWithPropertyData.PropertyData => transformPropertyData;

protected void Awake()
{
InitializeCoordinates();
transformPropertyData = new TransformLayerPropertyData(coord, transform.eulerAngles, transform.localScale);
transformPropertyData = new TransformLayerPropertyData(new Coordinate(transform.position), transform.eulerAngles, transform.localScale);

propertySections = GetComponents<IPropertySectionInstantiator>().ToList();
toggleScatterPropertySectionInstantiator = GetComponent<ToggleScatterPropertySectionInstantiator>();
}

protected virtual void InitializeCoordinates()
{
coord = new Coordinate(transform.position);
}

protected override void OnEnable()
{
base.OnEnable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ public class HierarchicalStaticObjectLayerGameObject : HierarchicalObjectLayerGa
public Vector3 Rotation = Vector3.zero; //TODO get this value from original template
public Vector3 Scale = Vector3.one; //TODO get this value from original template
public float TargetHeight;
public Vector2 Coordinates = Vector2.zero;
public Vector3 Coordinates = Vector3.zero;
[SerializeField] private CoordinateSystem coordinateSystem;

protected override void InitializeCoordinates()
{
coord = new Coordinate(coordinateSystem, new double[3] { Coordinates.y, Coordinates.x, 0 });
}

protected override void Start()
{
base.Start();
UpdatePosition(coord);
UpdateRotation(Rotation);
UpdateScale(Scale);
transformPropertyData.Position = new Coordinate(coordinateSystem, new double[3] { Coordinates.y, Coordinates.x, Coordinates.z });
transformPropertyData.EulerRotation = Rotation;
transformPropertyData.LocalScale = Scale;
}

protected override void UpdatePosition(Coordinate newPosition)
Expand All @@ -32,12 +28,12 @@ protected override void UpdatePosition(Coordinate newPosition)

public override void OnSelect()
{

//this is to prevent executing base class functionality
}

public override void OnDeselect()
{

//this is to prevent executing base class functionality
}
}
}
1 change: 0 additions & 1 deletion Assets/Scripts/Projects/PrefabLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using netDxf.Collections;
using Netherlands3D.Twin.Layers;
using Newtonsoft.Json;
using UnityEngine;
Expand Down
15 changes: 0 additions & 15 deletions Assets/_Functionalities/AssetBundles/Scripts/AssetBundleLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,12 @@ public class AssetBundleLoader : MonoBehaviour
public string prefabName;
public Vector3 spawnPosition;

public static List<HierarchicalObjectLayerGameObject> hierarchicalObjectLayerGameObjects = new List<HierarchicalObjectLayerGameObject>();

private void Awake()
{
ProjectData.Current.PrefabLibrary.AddPrefabGroupRuntime("ObjectenBibliotheek");
OnProjectDataChanged(ProjectData.Current);
}

private void Start()
{
//ProjectData.Current.OnDataChanged.AddListener(OnProjectDataChanged);
}

private void OnProjectDataChanged(ProjectData projectData)
{
//we want only the original asset here and not an instantiation
Expand All @@ -51,8 +44,6 @@ private void OnProjectDataChanged(ProjectData projectData)
if (layerObject != null)
{
projectData.PrefabLibrary.AddObjectToPrefabGroupRuntime("ObjectenBibliotheek", layerObject);
if(!hierarchicalObjectLayerGameObjects.Contains(layerObject))
hierarchicalObjectLayerGameObjects.Add(layerObject);
}
});
}
Expand Down Expand Up @@ -138,11 +129,5 @@ public IEnumerator GetAssetBundle(string path, UnityAction<AssetBundle> callBack
callBack?.Invoke(bundle);
}
}

private void OnDestroy()
{
//ProjectData.Current.OnDataChanged.RemoveListener(OnProjectDataChanged);
hierarchicalObjectLayerGameObjects.Clear();
}
}
}

0 comments on commit 311717d

Please sign in to comment.