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));
        }
Beispiel #2
0
 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";
            }
        }
Beispiel #5
0
 public void SetShininess(float v, TimeValue t) { _Mtl.SetShininess(v, t); }
Beispiel #6
0
 public void SetSelfIllumination(float f, TimeValue t) { _StdMat.SetSelfIllum(f, t); }
Beispiel #7
0
 public void SetRefractionIndex(float f, TimeValue t) { _StdMat.SetIOR(f, t); }
Beispiel #8
0
 public Color GetDiffuse(TimeValue t)
 {
     return(new Color(_StdMat.GetDiffuse(t)));
 }
Beispiel #9
0
 public Color GetSpecular(TimeValue t)
 {
     return(new Color(_StdMat.GetSpecular(t)));
 }
Beispiel #10
0
 /// <summary>
 /// Forces all views to redraw at time T.
 /// </summary>
 public static void RedrawViews(TimeValue t)
 {
     _Interface.RedrawViews(t, RedrawFlags.Normal, null);
 }
Beispiel #11
0
 public Color GetAmbient(TimeValue t)
 {
     return(new Color(_StdMat.GetAmbient(t)));
 }
Beispiel #12
0
 public IEnumerable <Object> GetValues(TimeValue t)
 {
     return(from p in Params select p.GetValue(t));
 }
Beispiel #13
0
        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");
            }
        }
Beispiel #14
0
        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");
            }
        }
Beispiel #15
0
 new public void SetDiffuse(Color c, TimeValue t) { _StdMat.SetDiffuse(c._IColor, t); }
Beispiel #16
0
 public float GetShininess(TimeValue t)
 {
     return(_StdMat.GetShininess(t));
 }
Beispiel #17
0
 new public void SetShininess(float f, TimeValue t) { _StdMat.SetShininess(f, t); }
Beispiel #18
0
 public float GetShinyStrength(TimeValue t)
 {
     return(_StdMat.GetShinStr(t));
 }
Beispiel #19
0
 public void SetOpacityFallOff(float f, TimeValue t) { _StdMat.SetOpacFalloff(f, t); }
Beispiel #20
0
 public float GetSelfIllumination(TimeValue t)
 {
     return(_StdMat.GetSelfIllum(t));
 }
Beispiel #21
0
 public void SetDiffuse(Color c, TimeValue t) { _Mtl.SetDiffuse(c._IColor, t); } 
Beispiel #22
0
 public float GetOpacity(TimeValue t)
 {
     return(_StdMat.GetOpacity(t));
 }
 public SerializableModel(Node node, TimeValue t)
     : this(node, t, true)
 {
 }
Beispiel #24
0
 public float GetOpacityFallOff(TimeValue t)
 {
     return(_StdMat.GetOpacFalloff(t));
 }
 public static double TimeSpanToSec(TimeValue t) { return (double)t / (double)TicksPerSec; }
Beispiel #26
0
 public float GetWireSize(TimeValue t)
 {
     return(_StdMat.GetWireSize(t));
 }
 public IEnumerable<Object> GetValues(TimeValue t) { return from p in Params select p.GetValue(t); }
Beispiel #28
0
 public float GetRefractionIndex(TimeValue t)
 {
     return(_StdMat.GetIOR(t));
 }
Beispiel #29
0
        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);
        }
Beispiel #30
0
 new public void SetAmbient(Color c, TimeValue t)
 {
     _StdMat.SetAmbient(c._IColor, t);
 }
Beispiel #31
0
 new public void SetAmbient(Color c, TimeValue t) { _StdMat.SetAmbient(c._IColor, t); }
Beispiel #32
0
 new public void SetDiffuse(Color c, TimeValue t)
 {
     _StdMat.SetDiffuse(c._IColor, t);
 }
Beispiel #33
0
 new public void SetSpecular(Color c, TimeValue t) { _StdMat.SetSpecular(c._IColor, t); }
Beispiel #34
0
 new public void SetSpecular(Color c, TimeValue t)
 {
     _StdMat.SetSpecular(c._IColor, t);
 }
Beispiel #35
0
 public void SetShinyStrength(float f, TimeValue t) { _StdMat.SetShinStr(f, t); } 
Beispiel #36
0
 new public void SetShininess(float f, TimeValue t)
 {
     _StdMat.SetShininess(f, t);
 }
Beispiel #37
0
 public void SetOpacity(float f, TimeValue t) { _StdMat.SetOpacity(f, t); }
Beispiel #38
0
 public void SetShinyStrength(float f, TimeValue t)
 {
     _StdMat.SetShinStr(f, t);
 }
Beispiel #39
0
 public void SetWireSize(float f, TimeValue t) { _StdMat.SetWireSize(f, t); } 
Beispiel #40
0
 public void SetSelfIllumination(float f, TimeValue t)
 {
     _StdMat.SetSelfIllum(f, t);
 }
Beispiel #41
0
 public void SetAmbient(Color c, TimeValue t) { _Mtl.SetAmbient(c._IColor, t); }
Beispiel #42
0
 public void SetOpacity(float f, TimeValue t)
 {
     _StdMat.SetOpacity(f, t);
 }
Beispiel #43
0
 public void SetSpecular(Color c, TimeValue t) { _Mtl.SetSpecular(c._IColor, t); }
Beispiel #44
0
 public void SetOpacityFallOff(float f, TimeValue t)
 {
     _StdMat.SetOpacFalloff(f, t);
 }
Beispiel #45
0
 public Interval(IInterval i) { this.start = i.Start; this.end = i.End; }
Beispiel #46
0
 public void SetWireSize(float f, TimeValue t)
 {
     _StdMat.SetWireSize(f, t);
 }
 public SerializableModel(Node node, TimeValue t, bool bMeshData)
     : this(node, t, bMeshData, false)
 { }
Beispiel #48
0
 public void SetRefractionIndex(float f, TimeValue t)
 {
     _StdMat.SetIOR(f, t);
 }
 public static int TimeToFrame(TimeValue t) { return Math.Min(EndTime, ((int)t - (int)StartTime) / TicksPerFrame); }
Beispiel #50
0
 public void SetAmbient(Color c, TimeValue t)
 {
     _Mtl.SetAmbient(c._IColor, t);
 }
 public IEnumerable<Object> GetTableValues(TimeValue t)
 {
     for (int i = 0; i < TableSize; ++i)
         yield return GetValue(t, i);
 }
Beispiel #52
0
 public void SetDiffuse(Color c, TimeValue t)
 {
     _Mtl.SetDiffuse(c._IColor, 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");
            }
        }
Beispiel #54
0
 public void SetSpecular(Color c, TimeValue t)
 {
     _Mtl.SetSpecular(c._IColor, t);
 }
 public void SetValue(Object value, TimeValue t)
 {
     SetValue(value, t, -1);
 }
Beispiel #56
0
 public void SetShininess(float v, TimeValue t)
 {
     _Mtl.SetShininess(v, t);
 }
Beispiel #57
0
 public static IMatrix3 GetWorldMatrix(this Node node, TimeValue t, bool parent)
 {
     return node._Node.GetWorldMatrix(t, parent);
 }
Beispiel #58
0
 public float GetRefractionIndex (TimeValue t) { return _StdMat.GetIOR(t); } 
Beispiel #59
0
        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);
        }
Beispiel #60
0
 public void SetValue(Object value, TimeValue t)
 {
     SetValue(value, t, -1);
 }