private void onBeforeManipulatableObjectReParented(Transform newParent, GameObject obj) { ManipulatableObject component = obj.GetComponent <ManipulatableObject>(); DecorationLayoutData decorationLayoutData = default(DecorationLayoutData); decorationLayoutData.Id = DecorationLayoutData.ID.FromFullPath(component.PathId); DecorationLayoutData decoration = decorationLayoutData; if (SceneLayoutData.ContainsKey(decoration.Id.GetFullPath())) { SceneLayoutData.RemoveDecoration(decoration, deleteChildren: true); } }
private DecorationLayoutData UpdateLayoutForManipulatableObject(Transform newParent, ManipulatableObject mo) { string pathId = mo.PathId; if (newParent != mo.transform.parent) { ObjectManipulator.SetUniqueGameObjectName(mo.gameObject, newParent); } DecorationLayoutData decorationLayoutData = default(DecorationLayoutData); decorationLayoutData.Id.Name = mo.gameObject.name; decorationLayoutData.Id.ParentPath = GetRelativeGameObjectPath(newParent.gameObject); decorationLayoutData.DefinitionId = mo.DefinitionId; decorationLayoutData.Type = mo.Type; decorationLayoutData.Position = mo.gameObject.transform.localPosition; decorationLayoutData.Rotation = mo.gameObject.transform.localRotation; decorationLayoutData.UniformScale = mo.gameObject.transform.localScale.x; DecorationLayoutData data = decorationLayoutData; if (data.Id.ParentPath == "") { data.Position = mo.gameObject.transform.position; data.Rotation = mo.gameObject.transform.rotation; data.UniformScale = mo.gameObject.transform.lossyScale.x; data.Id.ParentPath = null; } SetCustomPropertiesInDecoration(ref data, mo.GetComponent <PartneredObject>()); if (SceneLayoutData.ContainsKey(pathId)) { SceneLayoutData.UpdateDecoration(pathId, data); } else { SceneLayoutData.AddDecoration(data); } return(data); }