// INITIALIZE // // public void Initialize(string theName, Vector4 v, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theName, theOwnerBlueprint); constant = v; randomMin = Vector4.zero; randomMax = v; curve = ScriptableObject.CreateInstance <VectorCurve>(); curve.Initialize(Vector4.one, theName + "_curve"); curveMin = ScriptableObject.CreateInstance <VectorCurve>(); curveMin.Initialize(Vector4.zero, theName + "_curveMin"); curveMax = ScriptableObject.CreateInstance <VectorCurve>(); curveMax.Initialize(Vector4.one, theName + "_curveMax"); usePerComponentRandom = false; Randomize(); dummyTexture = new Texture2D(1, 1); }
// INITIALIZE // // public void Initialize(string theName, Vector4 v, AmpsBlueprint theOwnerBlueprint) { base.Initialize(theName, theOwnerBlueprint); constant = v; randomMin = Vector4.zero; randomMax = v; curve = ScriptableObject.CreateInstance <VectorCurve>(); curve.Initialize(Vector4.one, theName + "_curve"); curveMin = ScriptableObject.CreateInstance <VectorCurve>(); curveMin.Initialize(Vector4.zero, theName + "_curveMin"); curveMax = ScriptableObject.CreateInstance <VectorCurve>(); curveMax.Initialize(Vector4.one, theName + "_curveMax"); usePerComponentRandom = true; useExtremes = false; hideW = false; reference = null; Randomize(); }
// COPY PROPERTY // // override public void CopyProperty(BaseProperty originalProperty, AmpsBlueprint theOwnerBlueprint) { base.CopyProperty(originalProperty, theOwnerBlueprint); ColorProperty originalColorProperty = originalProperty as ColorProperty; constant = originalColorProperty.constant; randomMin = originalColorProperty.randomMin; randomMax = originalColorProperty.randomMax; curve = ScriptableObject.CreateInstance <VectorCurve>(); curve.Initialize(originalColorProperty.curve); curveMin = ScriptableObject.CreateInstance <VectorCurve>(); curveMin.Initialize(originalColorProperty.curveMin); curveMax = ScriptableObject.CreateInstance <VectorCurve>(); curveMax.Initialize(originalColorProperty.curveMax); usePerComponentRandom = originalColorProperty.usePerComponentRandom; Randomize(); dummyTexture = new Texture2D(1, 1); }
// COPY PROPERTY // // override public void CopyProperty(BaseProperty originalProperty, AmpsBlueprint theOwnerBlueprint) { base.CopyProperty(originalProperty, theOwnerBlueprint); VectorProperty originalVectorProperty = originalProperty as VectorProperty; constant = originalVectorProperty.constant; randomMin = originalVectorProperty.randomMin; randomMax = originalVectorProperty.randomMax; curve = ScriptableObject.CreateInstance <VectorCurve>(); curve.Initialize(originalVectorProperty.curve); curveMin = ScriptableObject.CreateInstance <VectorCurve>(); curveMin.Initialize(originalVectorProperty.curveMin); curveMax = ScriptableObject.CreateInstance <VectorCurve>(); curveMax.Initialize(originalVectorProperty.curveMax); usePerComponentRandom = originalVectorProperty.usePerComponentRandom; useExtremes = originalVectorProperty.useExtremes; hideW = originalVectorProperty.hideW; Randomize(); }
// INITIALIZE // // public void Initialize(VectorCurve originalCurve) { curveInput = originalCurve.curveInput; curveInputVectorComponent = originalCurve.curveInputVectorComponent; curveInputColorComponent = originalCurve.curveInputColorComponent; curveInputCoordSystem = originalCurve.curveInputCoordSystem; inputRangeMin = originalCurve.inputRangeMin; inputRangeMax = originalCurve.inputRangeMax; isInputRangeRandom = originalCurve.isInputRangeRandom; inputRangeRandomMin = originalCurve.inputRangeRandomMin; inputRangeRandomMax = originalCurve.inputRangeRandomMax; outputRangeXMin = originalCurve.outputRangeXMin; outputRangeXMax = originalCurve.outputRangeXMax; outputRangeYMin = originalCurve.outputRangeYMin; outputRangeYMax = originalCurve.outputRangeYMax; outputRangeZMin = originalCurve.outputRangeZMin; outputRangeZMax = originalCurve.outputRangeZMax; outputRangeWMin = originalCurve.outputRangeWMin; outputRangeWMax = originalCurve.outputRangeWMax; curveX = new AnimationCurve(originalCurve.curveX.keys); curveX.preWrapMode = originalCurve.curveX.preWrapMode; curveX.postWrapMode = originalCurve.curveX.postWrapMode; curveY = new AnimationCurve(originalCurve.curveY.keys); curveY.preWrapMode = originalCurve.curveY.preWrapMode; curveY.postWrapMode = originalCurve.curveY.postWrapMode; curveZ = new AnimationCurve(originalCurve.curveZ.keys); curveZ.preWrapMode = originalCurve.curveZ.preWrapMode; curveZ.postWrapMode = originalCurve.curveZ.postWrapMode; curveW = new AnimationCurve(originalCurve.curveW.keys); curveW.preWrapMode = originalCurve.curveW.preWrapMode; curveW.postWrapMode = originalCurve.curveW.postWrapMode; name = originalCurve.name; Randomize(); }
// CURVE PICKER INPUT // // // HACK: It's exactly the same as the previous one, except the passed param type. public void CurvePickerInput(VectorCurve theCurve) { GUILayout.BeginHorizontal(); GUILayout.Label("Input"); GUILayout.FlexibleSpace(); theCurve.curveInput = (AmpsHelpers.eCurveInputs)SortedPopup((int)theCurve.curveInput, AmpsHelpers.curveInputDisplayData, GUILayout.Width(120)); if (AmpsHelpers.isFloatInput(theCurve.curveInput) == false) { theCurve.curveInputVectorComponent = (AmpsHelpers.eVectorComponents)SortedPopup((int)theCurve.curveInputVectorComponent, AmpsHelpers.vectorComponentsDisplayData, GUILayout.Width(40)); } else { GUILayout.Space(40); } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (theCurve.curveInput == AmpsHelpers.eCurveInputs.Acceleration || theCurve.curveInput == AmpsHelpers.eCurveInputs.Position || theCurve.curveInput == AmpsHelpers.eCurveInputs.Rotation || theCurve.curveInput == AmpsHelpers.eCurveInputs.RotationRate || theCurve.curveInput == AmpsHelpers.eCurveInputs.Velocity) { theCurve.curveInputCoordSystem = coordSystemPopup(theCurve.curveInputCoordSystem); } GUILayout.BeginHorizontal(); GUILayout.Label("Random range?"); GUILayout.FlexibleSpace(); theCurve.isInputRangeRandom = GUILayout.Toggle(theCurve.isInputRangeRandom, "", "toggle"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 30; EditorGUIUtility.fieldWidth = 40; theCurve.inputRangeMin = MyFloatField(" ", theCurve.inputRangeMin, GUILayout.ExpandWidth(false)); GUILayout.FlexibleSpace(); theCurve.inputRangeMax = MyFloatField(" ", theCurve.inputRangeMax, GUILayout.ExpandWidth(false)); EditorGUIUtility.labelWidth = 0; EditorGUIUtility.fieldWidth = 0; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (theCurve.isInputRangeRandom) { EditorGUIUtility.labelWidth = 30; EditorGUIUtility.fieldWidth = 40; theCurve.inputRangeRandomMin = MyFloatField(" ", theCurve.inputRangeRandomMin, GUILayout.ExpandWidth(false)); GUILayout.FlexibleSpace(); theCurve.inputRangeRandomMax = MyFloatField(" ", theCurve.inputRangeRandomMax, GUILayout.ExpandWidth(false)); EditorGUIUtility.labelWidth = 0; EditorGUIUtility.fieldWidth = 0; } GUILayout.EndHorizontal(); }