public SerializableModel(Node node, TimeValue t, bool bMeshData, bool bReferencedData) { color = node.Color; bone = node.IsBone; if (bMeshData) // && node.Visibility.Render) mesh = node.GetMesh(t); transform = node.GetNodeTransform(t); name = node.Name; foreach (Node child in node.Nodes) models.Add(new SerializableModel(child, t, bMeshData)); if (bReferencedData) foreach (SceneObject obj in node.TargetTree.FilterType<SceneObject>()) submeshes.Add(obj.GetMesh(t)); }
public Object GetValue(TimeValue t) { return(GetValue(t, -1)); }
public Object GetValue(TimeValue t) { return GetValue(t, -1); }
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"; } }
public void SetShininess(float v, TimeValue t) { _Mtl.SetShininess(v, t); }
public void SetSelfIllumination(float f, TimeValue t) { _StdMat.SetSelfIllum(f, t); }
public void SetRefractionIndex(float f, TimeValue t) { _StdMat.SetIOR(f, t); }
public Color GetDiffuse(TimeValue t) { return(new Color(_StdMat.GetDiffuse(t))); }
public Color GetSpecular(TimeValue t) { return(new Color(_StdMat.GetSpecular(t))); }
/// <summary> /// Forces all views to redraw at time T. /// </summary> public static void RedrawViews(TimeValue t) { _Interface.RedrawViews(t, RedrawFlags.Normal, null); }
public Color GetAmbient(TimeValue t) { return(new Color(_StdMat.GetAmbient(t))); }
public IEnumerable <Object> GetValues(TimeValue t) { return(from p in Params select p.GetValue(t)); }
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 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"); } }
new public void SetDiffuse(Color c, TimeValue t) { _StdMat.SetDiffuse(c._IColor, t); }
public float GetShininess(TimeValue t) { return(_StdMat.GetShininess(t)); }
new public void SetShininess(float f, TimeValue t) { _StdMat.SetShininess(f, t); }
public float GetShinyStrength(TimeValue t) { return(_StdMat.GetShinStr(t)); }
public void SetOpacityFallOff(float f, TimeValue t) { _StdMat.SetOpacFalloff(f, t); }
public float GetSelfIllumination(TimeValue t) { return(_StdMat.GetSelfIllum(t)); }
public void SetDiffuse(Color c, TimeValue t) { _Mtl.SetDiffuse(c._IColor, t); }
public float GetOpacity(TimeValue t) { return(_StdMat.GetOpacity(t)); }
public SerializableModel(Node node, TimeValue t) : this(node, t, true) { }
public float GetOpacityFallOff(TimeValue t) { return(_StdMat.GetOpacFalloff(t)); }
public static double TimeSpanToSec(TimeValue t) { return (double)t / (double)TicksPerSec; }
public float GetWireSize(TimeValue t) { return(_StdMat.GetWireSize(t)); }
public IEnumerable<Object> GetValues(TimeValue t) { return from p in Params select p.GetValue(t); }
public float GetRefractionIndex(TimeValue t) { return(_StdMat.GetIOR(t)); }
public static IMatrix3 GetWorldMatrix(this IINode node, TimeValue t, bool parent) { var tm = node.GetNodeTM(t, Interval.Forever._IInterval); var ptm = node.ParentNode.GetNodeTM(t, Interval.Forever._IInterval); if (!parent) return tm; if (node.ParentNode.SuperClassID == SuperClassID.Camera) { var r = ptm.GetRow(3); ptm.IdentityMatrix(); ptm.SetRow(3, r); } ptm.Invert(); return tm.Multiply(ptm); }
new public void SetAmbient(Color c, TimeValue t) { _StdMat.SetAmbient(c._IColor, t); }
new public void SetSpecular(Color c, TimeValue t) { _StdMat.SetSpecular(c._IColor, t); }
public void SetShinyStrength(float f, TimeValue t) { _StdMat.SetShinStr(f, t); }
public void SetOpacity(float f, TimeValue t) { _StdMat.SetOpacity(f, t); }
public void SetWireSize(float f, TimeValue t) { _StdMat.SetWireSize(f, t); }
public void SetAmbient(Color c, TimeValue t) { _Mtl.SetAmbient(c._IColor, t); }
public void SetSpecular(Color c, TimeValue t) { _Mtl.SetSpecular(c._IColor, t); }
public Interval(IInterval i) { this.start = i.Start; this.end = i.End; }
public SerializableModel(Node node, TimeValue t, bool bMeshData) : this(node, t, bMeshData, false) { }
public static int TimeToFrame(TimeValue t) { return Math.Min(EndTime, ((int)t - (int)StartTime) / TicksPerFrame); }
public IEnumerable<Object> GetTableValues(TimeValue t) { for (int i = 0; i < TableSize; ++i) yield return GetValue(t, i); }
public void SetValue(Object value, TimeValue t) { SetValue(value, t, -1); }
public static IMatrix3 GetWorldMatrix(this Node node, TimeValue t, bool parent) { return node._Node.GetWorldMatrix(t, parent); }
public float GetRefractionIndex (TimeValue t) { return _StdMat.GetIOR(t); }
public static IMatrix3 GetWorldMatrixComplete(this IINode node, TimeValue t, bool parent) { var tm = node.GetObjTMAfterWSM(t, Interval.Forever._IInterval); var ptm = node.ParentNode.GetObjTMAfterWSM(t, Interval.Forever._IInterval); if (!parent) return tm; ptm.Invert(); return tm.Multiply(ptm); }