Permalink
Browse files

Fixed weight editor bugs

  • Loading branch information...
BlackJax96 committed Jun 24, 2016
1 parent 89349f0 commit 6a3691c41cd205ce38058f17d3995745f96e9db1
@@ -1853,7 +1853,6 @@ private void InitializeComponent()
this.weightEditor.Size = new System.Drawing.Size(264, 103);
this.weightEditor.TabIndex = 31;
this.weightEditor.Visible = false;
this.weightEditor.WeightIncrement = 0.1F;
//
// vertexEditor
//
@@ -1302,6 +1302,7 @@ public void TryConvertMatrixToVertex()
if (_matrixNode != null)
{
IMatrixNode m = MatrixNode;
v.DeferUpdateAssets();
MatrixNode = null;
foreach (Vertex3 v in _manager._vertices)
{
@@ -187,7 +187,7 @@ private void InitializeComponent()
this.numWeight.Name = "numWeight";
this.numWeight.Size = new System.Drawing.Size(62, 20);
this.numWeight.TabIndex = 3;
this.numWeight.Text = "0";
this.numWeight.Text = "100";
this.numWeight.ValueChanged += new System.EventHandler(this.numWeight_ValueChanged);
//
// btnPaste
@@ -312,11 +312,13 @@ public IBoneNode TargetBone
{
int i = _bones.IndexOf(_targetBone);
lstBoneWeights.SelectedIndex = i;
numWeight.Value = i != -1 ? ((BoneWeight)lstBoneWeights.Items[i]).Weight * 100.0f : 0;
if (i < 0)
numWeight.Value = 100.0f;
//numWeight.Value = i != -1 ? ((BoneWeight)lstBoneWeights.Items[i]).Weight * 100.0f : 0;
}
else
{
numWeight.Value = 0;
numWeight.Value = 100.0f;
lstBoneWeights.SelectedIndex = -1;
}
}
@@ -325,7 +327,7 @@ public IBoneNode TargetBone
btnLock.Enabled = false;
btnLock.Text = "Lock";
lblBoneName.Text = "(None)";
numWeight.Value = 0;
numWeight.Value = 0.0f;
lstBoneWeights.SelectedIndex = -1;
}
@@ -625,10 +627,12 @@ private bool Weight(float value, Vertex3 vertex, WeightType type)
//Move influence to each vertex before modifying the influence of one vertex
if (obj.MatrixNode != null)
obj.TryConvertMatrixToVertex();
vertex.DeferUpdateAssets();
vertex.MatrixNode = matrixNode;
if (obj.MatrixNode == null)
obj.TryConvertMatrixToObject();
return true;
}
public void UpdateValues()
@@ -673,19 +677,16 @@ private void btnRemoveBone_Click(object sender, EventArgs e)
ResetList();
}
}
private float _increment = 0.1f;
public float WeightIncrement { get { return _increment; } set { _increment = value; } }
private void btnSubtract_Click(object sender, EventArgs e)
{
IncrementWeight(-_increment / 100.0f);
IncrementWeight(-numAdd.Value / 100.0f);
ResetList();
}
private void btnAdd_Click(object sender, EventArgs e)
{
IncrementWeight(_increment / 100.0f);
IncrementWeight(numAdd.Value / 100.0f);
ResetList();
}

0 comments on commit 6a3691c

Please sign in to comment.