private void EntityRotationQuatBox_ValueChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentEntity == null) { return; } Quaternion q = EntityRotationQuatBox.Value; Vector4 v = q.ToVector4(); lock (ProjectForm.ProjectSyncRoot) { if (CurrentEntity._CEntityDef.rotation != v) { var wf = ProjectForm.WorldForm; if (CurrentEntity.MloParent != null) { var world = Quaternion.Normalize(Quaternion.Multiply(q, CurrentEntity.MloParent.Orientation)); CurrentEntity.SetOrientation(world); } else { bool useInverse = (CurrentEntity.MloInstance == null); CurrentEntity.SetOrientation(q, useInverse); } ProjectItemChanged(); wf?.BeginInvoke(new Action(() => { wf.SetWidgetRotation(CurrentEntity.WidgetOrientation, true); })); } } UpdateRotationFlag(); }
private void EntityRotationTextBox_TextChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentEntity == null) { return; } Vector4 v = FloatUtil.ParseVector4String(EntityRotationTextBox.Text); lock (ProjectForm.ProjectSyncRoot) { if (CurrentEntity._CEntityDef.rotation != v) { Quaternion q = v.ToQuaternion(); var wf = ProjectForm.WorldForm; if (CurrentEntity.MloParent != null) { var world = Quaternion.Normalize(Quaternion.Multiply(q, CurrentEntity.MloParent.Orientation)); CurrentEntity.SetOrientation(world); } else { bool useInverse = (CurrentEntity.MloInstance == null); CurrentEntity.SetOrientation(q, useInverse); } ProjectItemChanged(); wf?.BeginInvoke(new Action(() => { wf.SetWidgetRotation(CurrentEntity.WidgetOrientation, true); })); } } }