public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCDecalData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; m_ScaleInput.Vector = new Vector3(m_Data.m_Size, m_Data.m_Size, m_Data.m_Depth); m_MirroredCheck.isChecked = m_Data.m_Mirrored; m_ColorPicker.FinalColor = m_Data.m_Color; if (m_Data.m_ShaderIndex == 0) { m_Shader0Check.isChecked = true; m_Shader1Check.isChecked = false; } else if (m_Data.m_ShaderIndex == 1) { m_Shader1Check.isChecked = true; m_Shader0Check.isChecked = false; } else { m_Shader0Check.isChecked = true; m_Shader1Check.isChecked = false; } }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCFixedPartData; m_PositionInput.Vector = m_Data.m_Position; m_VisibleCheck.isChecked = m_Data.m_Visible; }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCTriphaseFixedPartData; m_PositionInput.Vector = m_Data.m_Position; m_VisibleCheck.isChecked = m_Data.m_Visible; m_Phase0Check.isChecked = (m_Data.m_Phase == 0); m_Phase1Check.isChecked = (m_Data.m_Phase == 1); m_Phase2Check.isChecked = (m_Data.m_Phase == 2); }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCObjectLightData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; m_ScaleInput.Vector = m_Data.m_Scale; m_ColorPicker.FinalColor = m_Data.m_Color; m_VisibleCheck.isChecked = m_Data.m_Visible; }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCQuadphaseFixedPartData; m_PositionInput.Vector = m_Data.m_Position; m_VisibleCheck.isChecked = m_Data.m_Visible; m_Phase0Check.isChecked = (m_Data.m_Phase & 1) == 0; m_Phase1Check.isChecked = (m_Data.m_Phase & 1) == 1; m_SmallBigCheck.isChecked = (m_Data.m_Phase & 2) == 2; m_MotorCheck.isChecked = (m_Data.m_Phase & 4) != 4; }
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 void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCObjectPivotData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; m_ScaleInput.Vector = m_Data.m_Scale; m_VisibleCheck.isChecked = m_Data.m_Visible; m_AnlgeLable.text = m_Data.m_PivotAng.ToString(); m_AnlgeSlider.sliderValue = Convert.ToSingle(m_Data.m_PivotAng) / 720 + 0.5f; }
public override void Set(VCComponentData data) { data.Validate(); m_Data = data.Copy() as VCGeneralPartData; m_PositionInput.Vector = m_Data.m_Position; m_RotationInput.Vector = m_Data.m_Rotation; m_ArmorPartIndex = m_Data.m_ExtendData; if (m_VisibleCheck) { m_VisibleCheck.isChecked = m_Data.m_Visible; } WhiteCat.VCPArmorPivot m_VCPArmorPivot = m_SelectBrush.GetVCPArmorPivotByIndex(m_Data.m_ExtendData); if (m_VCPArmorPivot) { VCEditor.Instance.m_UI.bonePanel.Show(m_VCPArmorPivot); } }
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 ?"); } }
// All Gizmo End void OnGizmoEnd() { if (m_GizmoAction != null) { VCEditor.s_Mirror.CalcPrepare(VCEditor.s_Scene.m_Setting.m_VoxelSize); foreach (SelectInfo si in m_Selection) { bool modified = false; if (!VCEMath.IsEqualVector(si.m_NewPosition, si.m_OldPosition)) { modified = true; } if (!VCEMath.IsEqualRotation(si.m_NewRotation, si.m_OldRotation)) { modified = true; } if (!VCEMath.IsEqualVector(si.m_NewScale, si.m_OldScale)) { modified = true; } if (modified) { VCEAlterComponentTransform modify = new VCEAlterComponentTransform( VCEditor.s_Scene.m_IsoData.GetComponentIndex(si.m_Component.m_Data), si.m_OldPosition, si.m_OldRotation, si.m_OldScale, si.m_NewPosition, si.m_NewRotation, si.m_NewScale); m_GizmoAction.Modifies.Add(modify); // Mirror if (VCEditor.s_Mirror.Enabled_Masked) { Vector3[] old_poses = new Vector3[8]; Vector3[] old_rots = new Vector3[8]; Vector3[] old_scales = new Vector3[8]; VCEditor.s_Mirror.MirrorComponent(si.m_Component.m_Data); for (int i = 0; i < VCEditor.s_Mirror.OutputCnt; ++i) { old_poses[i] = VCEditor.s_Mirror.ComponentOutput[i].m_Position; old_rots[i] = VCEditor.s_Mirror.ComponentOutput[i].m_Rotation; old_scales[i] = VCEditor.s_Mirror.ComponentOutput[i].m_Scale; } VCComponentData tmpdata = si.m_Component.m_Data.Copy(); tmpdata.m_Position = si.m_NewPosition; tmpdata.m_Rotation = si.m_NewRotation; tmpdata.m_Scale = si.m_NewScale; VCEditor.s_Mirror.MirrorComponent(tmpdata); for (int i = 1; i < VCEditor.s_Mirror.OutputCnt; ++i) { VCComponentData image = VCEditor.s_Mirror.ComponentOutput[i]; image.Validate(); List <VCComponentData> edits = VCEditor.s_Scene.m_IsoData.FindComponentsAtPos(old_poses[i], image.m_ComponentId); foreach (VCComponentData iter in edits) { if (!VCEMath.IsEqualRotation(iter.m_Rotation, old_rots[i])) { continue; } if (iter.m_Scale != old_scales[i]) { continue; } if (iter.m_Visible != image.m_Visible) { continue; } if (image is IVCMultiphaseComponentData && iter is IVCMultiphaseComponentData) { if ((image as IVCMultiphaseComponentData).Phase != (iter as IVCMultiphaseComponentData).Phase) { continue; } } if (m_Selection.Find(it => it.m_Component.m_Data == iter) == null) { VCEAlterComponentTransform modify_mirror = new VCEAlterComponentTransform( VCEditor.s_Scene.m_IsoData.GetComponentIndex(iter), iter.m_Position, iter.m_Rotation, iter.m_Scale, image.m_Position, image.m_Rotation, image.m_Scale); m_GizmoAction.Modifies.Add(modify_mirror); } } } } // End 'mirror' } } if (m_GizmoAction.Modifies.Count > 0) { m_GizmoAction.Do(); m_GizmoAction = null; } } else { Debug.LogWarning("Must be some problem here!"); } }