public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCFixedHandPartData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; if (m_VisibleCheck) { m_VisibleCheck.isChecked = m_Data.m_Visible; } m_Phase0Check.isChecked = m_Data.m_LeftHand; m_Phase1Check.isChecked = !m_Data.m_LeftHand; }
public override VCComponentData Get() { VCFixedHandPartData data = m_Data.Copy() as VCFixedHandPartData; data.m_Position = m_PositionInput.Vector; data.m_Rotation = VCEMath.NormalizeEulerAngle(m_RotationInput.Vector); data.m_Visible = m_VisibleCheck ? m_VisibleCheck.isChecked : true; data.m_LeftHand = m_Phase0Check.isChecked; data.Validate(); m_PositionInput.Vector = data.m_Position; m_RotationInput.Vector = data.m_Rotation; if (m_VisibleCheck) { m_VisibleCheck.isChecked = data.m_Visible; } return(data); }
protected override void Do() { m_Action = new VCEAction(); VCComponentData data = VCComponentData.Create(VCEditor.SelectedPart); if (data != null) { data.m_ComponentId = VCEditor.SelectedPart.m_ID; data.m_Type = VCEditor.SelectedPart.m_Type; data.m_Position = m_PartInst.transform.localPosition; data.m_Rotation = Vector3.zero; data.m_Scale = Vector3.one; data.m_Visible = true; data.m_CurrIso = VCEditor.s_Scene.m_IsoData; data.Validate(); VCEditor.s_Mirror.CalcPrepare(VCEditor.s_Scene.m_Setting.m_VoxelSize); // Mirror if (VCEditor.s_Mirror.Enabled_Masked) { VCEditor.s_Mirror.MirrorComponent(data); for (int i = VCEditor.s_Mirror.OutputCnt - 1; i >= 0; --i) { VCComponentData image = VCEditor.s_Mirror.ComponentOutput[i]; if (VCEditor.s_Scene.m_IsoData.IsComponentIn(image.m_Position)) { List <VCComponentData> conflicts = VCEditor.s_Scene.m_IsoData.FindComponentsAtPos(image.m_Position, image.m_ComponentId); foreach (VCComponentData conflict in conflicts) { if (conflict.m_Scale != image.m_Scale) { continue; } if (conflict.m_Visible != image.m_Visible) { continue; } if (image is IVCMultiphaseComponentData && conflict is IVCMultiphaseComponentData) { if ((image as IVCMultiphaseComponentData).Phase != (conflict as IVCMultiphaseComponentData).Phase) { continue; } } // Delete conflict int index = VCEditor.s_Scene.m_IsoData.GetComponentIndex(conflict); if (index < 0) { continue; } VCEDelComponent del = new VCEDelComponent(index, conflict); del.Redo(); m_Action.Modifies.Add(del); } VCEAddComponent modify = new VCEAddComponent(VCEditor.s_Scene.m_IsoData.m_Components.Count, image); modify.Redo(); m_Action.Modifies.Add(modify); } } m_Action.Register(); } // No mirror else { VCFixedHandPartData fixdata = data as VCFixedHandPartData; if (fixdata != null) { fixdata.m_LeftHand = data.m_Position.x < VCEditor.s_Scene.m_IsoData.m_HeadInfo.xSize * VCEditor.s_Scene.m_Setting.m_VoxelSize * 0.5f; } VCEAddComponent modify = new VCEAddComponent(VCEditor.s_Scene.m_IsoData.m_Components.Count, data); m_Action.Modifies.Add(modify); m_Action.Do(); } } else { Debug.LogWarning("Forget to add this part's implementation ?"); } }
public void OnApplyClick() { m_SelectBrush.ApplyInspectorChange(); m_Data = Get().Copy() as VCFixedHandPartData; }