CurveWrapper[] GetCurveWrapperArray() { if (m_Curve == null) { return new CurveWrapper[] { } } ; CurveWrapper cw = new CurveWrapper(); cw.id = "Curve".GetHashCode(); cw.groupId = -1; cw.color = m_Color; cw.hidden = false; cw.readOnly = false; cw.renderer = new NormalCurveRenderer(m_Curve); cw.renderer.SetWrap(m_Curve.preWrapMode, m_Curve.postWrapMode); return(new CurveWrapper[] { cw }); } Rect GetCurveEditorRect() { //return new Rect(0, kToolbarHeight, position.width, position.height-kToolbarHeight); return(new Rect(0, 0, position.width, position.height - kPresetsHeight)); }
private CurveWrapper CreateCurveWrapper(SerializedProperty curve, int id, int regionId, Color color, bool signedRange, CurveWrapper.GetAxisScalarsCallback getAxisScalarsCallback, CurveWrapper.SetAxisScalarsCallback setAxisScalarsCallback) { CurveWrapper curveWrapper = new CurveWrapper(); curveWrapper.id = id; curveWrapper.regionId = regionId; curveWrapper.color = color; curveWrapper.renderer = new NormalCurveRenderer(curve.animationCurveValue); curveWrapper.renderer.SetWrap(curve.animationCurveValue.preWrapMode, curve.animationCurveValue.postWrapMode); if (curveWrapper.curve.keys.Length == 1) { curveWrapper.renderer.SetCustomRange(0f, 1f); curveWrapper.wrapColorMultiplier = Color.clear; } else { curveWrapper.renderer.SetCustomRange(0f, 0f); curveWrapper.wrapColorMultiplier = color; } curveWrapper.vRangeMin = ((!signedRange) ? 0f : -1f); curveWrapper.getAxisUiScalarsCallback = getAxisScalarsCallback; curveWrapper.setAxisUiScalarsCallback = setAxisScalarsCallback; return(curveWrapper); }
private void DoOptimizeCurveButton(Rect rect) { bool flag = false; Vector2 vector = new Vector2(64f, 14f); Rect position = new Rect(rect.xMax - 80f - vector.x, rect.y + (rect.height - vector.y) * 0.5f, vector.x, vector.y); if (!this.m_CurveEditor.IsDraggingCurveOrRegion()) { int num = 0; List <CurveSelection> selectedCurves = this.m_CurveEditor.selectedCurves; int curveID; if (selectedCurves.Count > 0) { for (int i = 0; i < selectedCurves.Count; i++) { CurveWrapper curveWrapperFromSelection = this.m_CurveEditor.GetCurveWrapperFromSelection(selectedCurves[i]); num += ((!AnimationUtility.IsValidOptimizedPolynomialCurve(curveWrapperFromSelection.curve)) ? 0 : 1); } if (selectedCurves.Count != num) { flag = true; if (GUI.Button(position, ParticleSystemCurveEditor.s_Styles.optimizeCurveText)) { for (int j = 0; j < selectedCurves.Count; j++) { CurveWrapper curveWrapperFromSelection2 = this.m_CurveEditor.GetCurveWrapperFromSelection(selectedCurves[j]); if (!AnimationUtility.IsValidOptimizedPolynomialCurve(curveWrapperFromSelection2.curve)) { curveWrapperFromSelection2.curve.preWrapMode = WrapMode.Once; curveWrapperFromSelection2.curve.postWrapMode = WrapMode.Once; curveWrapperFromSelection2.renderer.SetWrap(WrapMode.Once, WrapMode.Once); AnimationUtility.ConstrainToPolynomialCurve(curveWrapperFromSelection2.curve); curveWrapperFromSelection2.changed = true; } } this.m_CurveEditor.SelectNone(); } } } else if (this.m_CurveEditor.GetTopMostCurveID(out curveID)) { CurveWrapper curveWrapperFromID = this.m_CurveEditor.GetCurveWrapperFromID(curveID); if (!AnimationUtility.IsValidOptimizedPolynomialCurve(curveWrapperFromID.curve)) { flag = true; if (GUI.Button(position, ParticleSystemCurveEditor.s_Styles.optimizeCurveText)) { curveWrapperFromID.curve.preWrapMode = WrapMode.Once; curveWrapperFromID.curve.postWrapMode = WrapMode.Once; curveWrapperFromID.renderer.SetWrap(WrapMode.Once, WrapMode.Once); AnimationUtility.ConstrainToPolynomialCurve(curveWrapperFromID.curve); curveWrapperFromID.changed = true; } } } } if (!flag) { using (new EditorGUI.DisabledScope(true)) { GUI.Button(position, ParticleSystemCurveEditor.s_Styles.optimizeCurveText); } } }
private void SaveCurve(SerializedProperty prop, CurveWrapper cw) { prop.animationCurveValue = cw.curve; cw.changed = false; }
// Polynomial curves have limitations on how they have to be authored. // Since we don't enforce the layout, we have a button that enforces the curve layout instead. void DoOptimizeCurveButton(Rect rect) { bool optimizeButtonShown = false; Vector2 buttonSize = new Vector2(64, 14); Rect buttonRect = new Rect(rect.xMax - 80 - buttonSize.x, rect.y + (rect.height - buttonSize.y) * 0.5f, buttonSize.x, buttonSize.y); if (!m_CurveEditor.IsDraggingCurveOrRegion()) { int numValidPolynomialCurve = 0; List <CurveSelection> selection = m_CurveEditor.selectedCurves; if (selection.Count > 0) { for (int j = 0; j < selection.Count; ++j) { CurveWrapper cw = m_CurveEditor.GetCurveWrapperFromSelection(selection[j]); numValidPolynomialCurve += AnimationUtility.IsValidOptimizedPolynomialCurve(cw.curve) ? 1 : 0; } if (selection.Count != numValidPolynomialCurve) { optimizeButtonShown = true; if (GUI.Button(buttonRect, s_Styles.optimizeCurveText)) { for (int j = 0; j < selection.Count; ++j) { CurveWrapper cw = m_CurveEditor.GetCurveWrapperFromSelection(selection[j]); if (!AnimationUtility.IsValidOptimizedPolynomialCurve(cw.curve)) { // Reset wrap mode cw.curve.preWrapMode = WrapMode.Clamp; cw.curve.postWrapMode = WrapMode.Clamp; cw.renderer.SetWrap(WrapMode.Clamp, WrapMode.Clamp); AnimationUtility.ConstrainToPolynomialCurve(cw.curve); cw.changed = true; // Used in SaveChangedCurves () later in OnGUI } } m_CurveEditor.SelectNone(); } } } else { // Check if top most curve can be optimized int topMostCurveID; if (m_CurveEditor.GetTopMostCurveID(out topMostCurveID)) { CurveWrapper cw = m_CurveEditor.GetCurveWrapperFromID(topMostCurveID); if (!AnimationUtility.IsValidOptimizedPolynomialCurve(cw.curve)) { optimizeButtonShown = true; if (GUI.Button(buttonRect, s_Styles.optimizeCurveText)) { // Reset wrap mode cw.curve.preWrapMode = WrapMode.Clamp; cw.curve.postWrapMode = WrapMode.Clamp; cw.renderer.SetWrap(WrapMode.Clamp, WrapMode.Clamp); AnimationUtility.ConstrainToPolynomialCurve(cw.curve); cw.changed = true; // Used in SaveChangedCurves () later in OnGUI } } } } } if (!optimizeButtonShown) { using (new EditorGUI.DisabledScope(true)) { GUI.Button(buttonRect, s_Styles.optimizeCurveText); } } }
protected CurveDependentStepCondition(array_type a) { curveItem_ = new ArrayWrapper(a); }
protected CurveDependentStepCondition(Payoff p) { curveItem_ = new PayoffWrapper(p); }
protected CurveDependentStepCondition(Option.Type type, double strike) { curveItem_ = new PayoffWrapper(type, strike); }
public CurveTreeLeaf(CurveTreeNode parent, CurveWrapper curve) : base(parent) { Curve = curve; }
protected override void ConfigureCurveWrapper(CurveWrapper wrapper) { m_CurvesProxy.ConfigureCurveWrapper(wrapper); }
protected virtual void ConfigureCurveWrapper(CurveWrapper wrapper) { wrapper.color = CurveUtility.GetPropertyColor(wrapper.binding.propertyName); wrapper.renderer = new NormalCurveRenderer(AnimationUtility.GetEditorCurve(animationClip, wrapper.binding)); wrapper.renderer.SetCustomRange(0.0f, animationClip.length); }