private void EntityPivotRotationNormalizeButton_Click(object sender, EventArgs e) { Vector4 v = FloatUtil.ParseVector4String(EntityPivotRotationTextBox.Text); Quaternion q = Quaternion.Normalize(new Quaternion(v)); EntityPivotRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(q.X, q.Y, q.Z, q.W)); }
private void EntityPivotRotationTextBox_TextChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentEntity == null) { return; } Vector4 v = FloatUtil.ParseVector4String(EntityPivotRotationTextBox.Text); Quaternion q = new Quaternion(v); lock (ProjectForm.ProjectSyncRoot) { if (CurrentEntity.PivotOrientation != q) { CurrentEntity.SetPivotOrientation(q); //SetYmapHasChanged(true); var wf = ProjectForm.WorldForm; if (wf != null) { wf.BeginInvoke(new Action(() => { bool editpivot = wf.EditEntityPivot; wf.EditEntityPivot = true; wf.SetWidgetRotation(CurrentEntity.WidgetOrientation, true); wf.EditEntityPivot = editpivot; })); } } } }
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 = new Quaternion(v); CurrentEntity.SetOrientationInv(q); ProjectForm.SetYmapHasChanged(true); var wf = ProjectForm.WorldForm; if (wf != null) { wf.BeginInvoke(new Action(() => { wf.SetWidgetRotation(CurrentEntity.WidgetOrientation, true); })); } } } }
private void UnkVec2TextBox_TextChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentZone?.AudioZone == null) { return; } var vec = FloatUtil.ParseVector4String(UnkVec2TextBox.Text); if (CurrentZone.AudioZone.UnkVec2 != vec) { CurrentZone.AudioZone.UnkVec2 = vec; ProjectItemChanged(); } }
private void InnerVec1TextBox_TextChanged(object sender, EventArgs e) { if (populatingui) { return; } if (CurrentZone?.AudioZone == null) { return; } var vec = FloatUtil.ParseVector4String(InnerVec1TextBox.Text); if (CurrentZone.AudioZone.PlaybackZoneVec1 != vec) { CurrentZone.AudioZone.PlaybackZoneVec1 = vec; ProjectItemChanged(); } }
private void CompRotationTextBox_TextChanged(object sender, EventArgs e) { if (CollisionBounds == null) { return; } if (populatingui) { return; } var q = FloatUtil.ParseVector4String(CompRotationTextBox.Text).ToQuaternion(); lock (ProjectForm.ProjectSyncRoot) { if (CollisionBounds.Orientation != q) { CollisionBounds.Orientation = q; ProjectForm.SetYbnHasChanged(true); } } }
private void RotationTextBox_TextChanged(object sender, EventArgs e) { if (Items == null) { return; } if (populatingui) { return; } var v = FloatUtil.ParseVector4String(RotationTextBox.Text); var wf = ProjectForm.WorldForm; if (wf != null) { wf.BeginInvoke(new Action(() => { wf.ChangeMultiRotation(Items, v.ToQuaternion(), false); })); } }
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); })); } } }
private void ParamTextBox_TextChanged(object sender, EventArgs e) { var tb = sender as TextBox; var parm = tb?.Tag as ShaderParameter; var txt = tb?.Text; if (parm == null) { return; } if (parm.DataType == 0)//texture { var tex = parm.Data as TextureBase; var ttex = tex as Texture; if (ttex == null)//don't do this for embedded textures! { tex.Name = txt; tex.NameHash = JenkHash.GenHash(txt.ToLowerInvariant()); } else { //TODO: modify embedded textures! } } else if (parm.DataType == 1)//Vector4 { parm.Data = FloatUtil.ParseVector4String(txt); } else //Vector4 array { var strs = txt.Split(';'); var vecs = new Vector4[parm.DataType]; for (int i = 0; i < parm.DataType; i++) { var vec = Vector4.Zero; if (i < strs.Length) { vec = FloatUtil.ParseVector4String(strs[i].Trim()); } vecs[i] = vec; } parm.Data = vecs; } var geom = ModelsTreeView.SelectedNode?.Tag as DrawableGeometry; if (geom != null) { if (Drawable != null) { UpdateRenderableParams(Drawable, geom.Shader); } if (DrawableDict != null) { foreach (var dwbl in DrawableDict.Values) { UpdateRenderableParams(dwbl, geom.Shader); } } } ModelForm.OnModelModified(); }