public void Delete(IPO_Object obj) { var poList = tPOLogic.GetField("proceduralObjects", flags).GetValue(POLogic); var poSelList = tPOLogic.GetField("pObjSelection", flags).GetValue(POLogic); poList.GetType().GetMethod("Remove", flags, null, new Type[] { tPO }, null).Invoke(poList, new object[] { obj.GetProceduralObject() }); poSelList.GetType().GetMethod("Remove", flags, null, new Type[] { tPO }, null).Invoke(poSelList, new object[] { obj.GetProceduralObject() }); }
public override void Do() { if (!firstRun) { return; // TODO this disables Redo } m_clones.Clear(); m_oldSelection = new HashSet <Instance>(selection); //string msg = "Selection\n"; //foreach (Instance i in m_oldSelection) //{ // msg += $"{i.id.Prop}:{i.Info.Name}\n"; //} //Debug.Log(msg); //Debug.Log($"state: {MoveItTool.instance.ToolState}"); //if (MoveItTool.instance.ToolState != MoveItTool.ToolStates.Default) //{ // return; //} foreach (InstanceState instanceState in m_states) { Instance instance = instanceState.instance; if (!((instance is MoveableBuilding || instance is MoveableProp) || !instance.isValid)) { continue; } IPO_Object obj = MoveItTool.PO.ConvertToPO(instance); if (obj == null) { continue; } MoveItTool.PO.visibleObjects.Add(obj.Id, obj); InstanceID instanceID = default(InstanceID); instanceID.NetLane = obj.Id; MoveableProc mpo = new MoveableProc(instanceID); m_clones.Add(mpo); mpo.angle = instance.angle; mpo.position = instance.position; selection.Add(mpo); selection.Remove(instance); instance.Delete(); } }
public void Delete(IPO_Object obj) { var poList = tPOLogic.GetField("proceduralObjects", flags).GetValue(POLogic); var poSelList = tPOLogic.GetField("pObjSelection", flags).GetValue(POLogic); poList.GetType().GetMethod("Remove", flags, null, new Type[] { tPO }, null).Invoke(poList, new object[] { obj.GetProceduralObject() }); poSelList.GetType().GetMethod("Remove", flags, null, new Type[] { tPO }, null).Invoke(poSelList, new object[] { obj.GetProceduralObject() }); if (tPOLogic.GetField("activeIds", flags) != null) { var activeIds = tPOLogic.GetField("activeIds", flags).GetValue(POLogic); activeIds.GetType().GetMethod("Remove", flags, null, new Type[] { typeof(int) }, null).Invoke(activeIds, new object[] { obj.ProcId }); } }
public void DoImplementation() { if (!firstRun) { return; // Disables Redo } m_clones.Clear(); m_oldSelection = new HashSet <Instance>(); foreach (InstanceState instanceState in m_states) { Instance instance = instanceState.instance; lock (instance.data) { if (!instance.isValid) { continue; } if (!(instance is MoveableBuilding || instance is MoveableProp)) { m_oldSelection.Add(instance); continue; } IPO_Object obj = MoveItTool.PO.ConvertToPO(instance); if (obj == null) { continue; } MoveItTool.PO.visibleObjects.Add(obj.Id, obj); InstanceID instanceID = default; instanceID.NetLane = obj.Id; MoveableProc mpo = new MoveableProc(instanceID); m_clones.Add(mpo); mpo.angle = instance.angle; mpo.position = instance.position; selection.Add(mpo); selection.Remove(instance); instance.Delete(); } } MoveItTool.m_debugPanel.UpdatePanel(); }
public void Delete(IPO_Object obj) { throw new NotImplementedException($"Trying to delete {obj} despite no PO!"); }
internal void Delete(IPO_Object obj) { Logic.Delete(obj); }