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