public Object GetValue(TimeValue t) { ParamType pt = pb.GetParameterType(id); switch (pt) { case ParamType.Int: return(pb.GetInt(id, t)); case ParamType.Float: { IParamDimension dimension = GetDimension(); float result = pb.GetFloat(id, t); try { return(dimension != null?dimension.Convert(result) : result); } // This happens sometimes? catch (AccessViolationException) { throw; //Plugin.Log( Plugin.LogType.Warning, "Error while using IParamDimension to convert value (AccessViolationException)" ); } // Also happens when dimension is corrupt (i.e. during VRayMtl creation on 32 bit) catch (NullReferenceException) { throw; } catch (Exception) { throw; // Plugin.Log( Plugin.LogType.Warning, "Unknown error while using IParamDimension to convert value" ); } } case ParamType.Bool: return(pb.GetInt(id, t) != 0); case ParamType.Rgba: return(pb.GetColor(id, t)); case ParamType.Point3: return(pb.GetPoint3(id, t)); default: return("parameter type " + Enum.GetName(typeof(ParamType), pt) + " is not supported"); } }
public void SetValue(Object value, TimeValue time) { ParamType pt = pb.GetParameterType(id); switch (pt) { case ParamType.Int: pb.SetValue(id, time, (int)value); break; case ParamType.Float: { // TODO: get the dimension. IParamDimension dimension = GetDimension(); float result = pb.GetFloat(id, time); try { pb.SetValue(id, time, dimension != null ? dimension.UnConvert(Utility.OToF(value)) : Utility.OToF(value)); } // Happens sometimes? catch (AccessViolationException) { // Plugin.Log(Plugin.LogType.Warning, "Error while using IParamDimension to unconvert value"); pb.SetValue(id, time, (float)value); } } break; case ParamType.Bool: pb.SetValue(id, time, (bool)value ? 1 : 0); break; case ParamType.Rgba: pb.SetValue(id, time, (IColor)value); break; case ParamType.Point3: pb.SetValue(id, time, value as IPoint3); break; default: throw new Exception("parameter type is not supported"); } }
public void SetValue(Object value, TimeValue time, int tabIndex) { switch (Def.def.Type) { case ParamType2.Index: case ParamType2.IndexTab: case ParamType2.Int: case ParamType2.IntTab: case ParamType2.RadiobtnIndex: case ParamType2.RadiobtnIndexTab: pb.SetValue(id, time, (int)value, tabIndex); break; case ParamType2.Float: case ParamType2.FloatTab: case ParamType2.Angle: case ParamType2.AngleTab: case ParamType2.Double: case ParamType2.DoubleTab: case ParamType2.World: case ParamType2.WorldTab: case ParamType2.PcntFrac: case ParamType2.PcntFracTab: { //IParamDimension dimension = parameters.GetParamDimension( parameters.IDtoIndex( this.paramID ) ); IParamDimension dimension = Def.def.Dim; float result = pb.GetFloat(id, time, tabIndex); try { pb.SetValue(id, time, dimension != null ? dimension.UnConvert(Utility.OToF(value)) : Utility.OToF(value), tabIndex); } // Happens sometimes? catch (AccessViolationException) { // Plugin.Log(Plugin.LogType.Warning, "Error while using IParamDimension to unconvert value"); pb.SetValue(id, time, (float)value, tabIndex); } } break; case ParamType2.Bool: case ParamType2.BoolTab: case ParamType2.Bool2: pb.SetValue(id, time, (bool)value ? 1 : 0, tabIndex); break; case ParamType2.Rgba: case ParamType2.RgbaTab: case ParamType2.Color: case ParamType2.ColorTab: pb.SetValue(id, time, (IColor)value, tabIndex); break; case ParamType2.Frgba: case ParamType2.FrgbaTab: pb.SetValue(id, time, (IAColor)value, tabIndex); break; case ParamType2.Point3: case ParamType2.Point3Tab: pb.SetValue(id, time, value as IPoint3, tabIndex); break; case ParamType2.Tstr: case ParamType2.TstrTab: case ParamType2.String: case ParamType2.StringTab: case ParamType2.Filename: case ParamType2.FilenameTab: case ParamType2.Name: case ParamType2.NameTab: // I'm worried about this. What about AssetUser? pb.SetValue(id, time, (string)value, tabIndex); break; default: throw new Exception("parameter type " + Type + " is not supported"); } }
public int SetSelKeyCoordsExpr(IParamDimension dim, string timeExpr, string valExpr, uint flags) { throw new NotImplementedException(); }
public Object GetValue(TimeValue t, int tabIndex) { switch (Def.def.Type) { case ParamType2.Index: case ParamType2.IndexTab: case ParamType2.Int: case ParamType2.IntTab: case ParamType2.RadiobtnIndex: case ParamType2.RadiobtnIndexTab: return(pb.GetInt(id, t, tabIndex)); case ParamType2.Float: case ParamType2.FloatTab: case ParamType2.Angle: case ParamType2.AngleTab: case ParamType2.Double: case ParamType2.DoubleTab: case ParamType2.World: case ParamType2.WorldTab: case ParamType2.PcntFrac: case ParamType2.PcntFracTab: { IParamDimension dimension = Def.def.Dim; float result = pb.GetFloat(id, t, tabIndex); try { return(dimension != null?dimension.Convert(result) : result); } // This happens sometimes? catch (AccessViolationException) { throw; //Plugin.Log( Plugin.LogType.Warning, "Error while using IParamDimension to convert value (AccessViolationException)" ); } // Also happens when dimension is corrupt (i.e. during VRayMtl creation on 32 bit) catch (NullReferenceException) { throw; //Plugin.Log( Plugin.LogType.Warning, "Error while using IParamDimension to convert value (NullReferenceException)" ); } catch (Exception) { throw; // Plugin.Log( Plugin.LogType.Warning, "Unknown error while using IParamDimension to convert value" ); } } case ParamType2.Bool: case ParamType2.BoolTab: case ParamType2.Bool2: return(pb.GetInt(id, t, tabIndex) != 0); case ParamType2.Rgba: case ParamType2.RgbaTab: case ParamType2.Color: case ParamType2.ColorTab: return(pb.GetColor(id, t, tabIndex)); case ParamType2.Point3: case ParamType2.Point3Tab: return(pb.GetPoint3(id, t, tabIndex)); case ParamType2.Frgba: case ParamType2.FrgbaTab: return(pb.GetAColor(id, t, tabIndex)); case ParamType2.Tstr: case ParamType2.TstrTab: case ParamType2.String: case ParamType2.StringTab: case ParamType2.Filename: case ParamType2.FilenameTab: case ParamType2.Name: case ParamType2.NameTab: return(pb.GetStr(id, t, tabIndex)); default: return("parameter type " + Type + " is not supported"); } }