Add default selection marker on CMS

This commit is contained in:
Tim
2025-07-17 22:15:53 +02:00
parent f8909dedad
commit 74eb725db1
2 changed files with 7 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
}
}
readonly List<GameObject> _children = new List<GameObject>();
public readonly Dictionary<int, ChildModel> portDict = new Dictionary<int, ChildModel>(); //for CMS marker
public MeshFilter meshFilter;
public MeshRenderer meshRenderer;
@@ -158,6 +159,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
cmb.ChildModel = ModelManager.GetById(id);
cmb.Parent = this;
Model.Ports[portNum].Apply(_children[portNum].transform);
portDict[portNum] = cmb.ChildModel;
Exploder.HandleModelChange();
}
@@ -197,6 +199,7 @@ public class ModelBehaviour : MonoBehaviour, IResettable
cmb.Parent = this;
cmb.ChildModel = childModel;
port.Apply(child.transform); // move to correct position
portDict[i] = cmb.ChildModel;
}
}

View File

@@ -51,6 +51,10 @@ public class ChildModelSelector : MonoBehaviour, IResettable
cmsb.AssignModel = () => AssignModel(childModel);
cmsb.RemoveOtherMarkers = RemoveOtherMarkers;
cmsb.Model = childModel;
if (modelManager.BaseModelBehaviour.portDict[PortIndex].NameId == childModel.NameId)
{
cmsb.marker.SetActive(true);
}
Models.Add(go);
Buttons.Add(cmsb);