/// <summary> /// Add Parameter to Effect /// </summary> public static void AddParameter(IPropertySetter ipro, string parName, object parValue) { DexterParam param; DexterValue[] value; param = new DexterParam(); value = new DexterValue[1]; param.Name = parName; param.dispID = 0; param.nValues = 1; value[0].v = parValue; value[0].rt = 0; value[0].dwInterp = Dexterf.Jump; ipro.AddProp(param, value); }
/// <summary> /// Populates the supplied property setter with values from the parameter list. /// </summary> /// <param name="setter"></param> /// <param name="parameters"></param> internal static void PopulatePropertySetter(IPropertySetter setter, List <Parameter> parameters) { int hr = 0; foreach (Parameter param in parameters) { DexterParam dexterParam; dexterParam.Name = param.Name; dexterParam.dispID = param.DispId; dexterParam.nValues = 1 + param.Intervals.Count; DexterValue[] valueArray = new DexterValue[dexterParam.nValues]; valueArray[0].v = param.Value; valueArray[0].rt = 0; valueArray[0].dwInterp = Dexterf.Interpolate; for (int i = 0, valueIndex = 1; i < param.Intervals.Count; i++, valueIndex++) { Interval interval = param.Intervals[i]; valueArray[valueIndex].v = interval.Value; valueArray[valueIndex].rt = ToUnits(interval.Time); if (interval.Mode == IntervalMode.Interpolate) { valueArray[valueIndex].dwInterp = Dexterf.Interpolate; } else { valueArray[valueIndex].dwInterp = Dexterf.Jump; } } hr = setter.AddProp(dexterParam, valueArray); DESError.ThrowExceptionForHR(hr); } StringBuilder builder = new StringBuilder(); int printed = 0; hr = setter.PrintXML(builder, 0, out printed, 0); Console.WriteLine(builder.ToString()); }
private void TestAddProps() { int hr; DexterValue [] dv; DexterParam dp = new DexterParam(); dp.Name = "Vol"; dp.nValues = 2; dv = new DexterValue[2]; dv[0] = new DexterValue(); dv[0].v = 0; dv[0].rt = 0; dv[0].dwInterp = Dexterf.Jump; dv[1] = new DexterValue(); dv[1].v = 6; dv[1].rt = 3452345; dv[1].dwInterp = Dexterf.Jump; hr = m_ips.AddProp(dp, dv); DESError.ThrowExceptionForHR(hr); }