Skip to content

Commit

Permalink
Fixed FCurves
Browse files Browse the repository at this point in the history
  • Loading branch information
effekseer committed Jun 17, 2018
1 parent 45fb388 commit ded69b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Dev/Cpp/Viewer/3rdParty/imgui_addon/fcurve/fcurve.cpp
Expand Up @@ -980,14 +980,14 @@ namespace ImGui
auto mousePos = GetMousePos();
auto v = transform_s2f(mousePos);

for (int i = 0; i < count - 1; i++)
for (int i = 0; i < count; i++)
{
auto p = transform_f2s(ImVec2(keys[i], values[i]));

if (!IsHovered(mousePos, p, 3)) continue;


for (int j = i; j < count - 1; j++)
for (int j = i; j < count; j++)
{
keys[j] = keys[j + 1];
values[j] = values[j + 1];
Expand All @@ -1000,6 +1000,7 @@ namespace ImGui
}

(*newCount) = count - 1;
count = count - 1;
hasControlled = true;
break;

Expand Down Expand Up @@ -1038,6 +1039,7 @@ namespace ImGui
interporations[0] = ImFCurveInterporationType::Linear;

(*newCount) = count + 1;
count = count + 1;
hasControlled = true;
}
else if (v.x >= keys[count - 1])
Expand All @@ -1052,6 +1054,7 @@ namespace ImGui
interporations[count] = ImFCurveInterporationType::Linear;

(*newCount) = count + 1;
count = count + 1;
hasControlled = true;
}
else
Expand Down Expand Up @@ -1082,6 +1085,7 @@ namespace ImGui
interporations[i + 1] = ImFCurveInterporationType::Linear;

(*newCount) = count + 1;
count = count + 1;
hasControlled = true;
break;
}
Expand Down
5 changes: 4 additions & 1 deletion Dev/Editor/EffekseerMP/GUI/Dock/FCurves.cs
Expand Up @@ -1072,6 +1072,8 @@ public override void UpdateGraph(ref bool canControl)
properties[i].RightValues = properties[i].RightValues.Take(properties[i].RightValues.Length - 1).ToArray();
properties[i].Interpolations = properties[i].Interpolations.Take(properties[i].Interpolations.Length - 1).ToArray();
}

properties[i].IsDirtied = true;
}

for(int k = 0; k < properties[i].Values.Length; k++)
Expand Down Expand Up @@ -1184,7 +1186,7 @@ public override void EnlargeAnchors()
var length_pre = 10.0f;
var length_next = 10.0f;

if (prop.KVSelected.Length == 1)
if (prop.KVSelected.Length -1 == 1)
{
d = 0.0f;
}
Expand Down Expand Up @@ -1263,6 +1265,7 @@ void OnChanged(int i)
properties[i].RightKeys = new float[0];
properties[i].RightValues = new float[0];
properties[i].Interpolations = new int[0];
properties[i].KVSelected = new byte[0];
properties[i].Update(fcurves[i]);
}

Expand Down

0 comments on commit ded69b0

Please sign in to comment.