예제 #1
0
        public bool ConnectDstProperty(FbxProperty pProperty)
        {
            if (DstProperties.Contains(pProperty))
            {
                return(false);
            }

            DstProperties.Add(pProperty);

            return(true);
        }
예제 #2
0
파일: Visitor.cs 프로젝트: shoff/FbxSharp
        protected void AcceptFbxObject(FbxObject obj, ISet <object> visitedObjects)
        {
            //AcceptEmitter(obj, visitedObjects);
            Visit(obj);

            //Accept(obj.GetDocument());
            //Accept(obj.GetRootDocument());
            Accept(obj.GetScene(), visitedObjects);

            int i;

            for (i = 0; i < obj.GetSrcObjectCount(); i++)
            {
                Accept(obj.GetSrcObject(i), visitedObjects);
            }
            for (i = 0; i < obj.GetDstObjectCount(); i++)
            {
                Accept(obj.GetDstObject(i), visitedObjects);
            }


            FbxProperty prop = obj.GetFirstProperty();

            while (prop != null && prop.IsValid())
            {
                for (i = 0; i < prop.GetSrcObjectCount(); i++)
                {
                    var srcObj = prop.GetSrcObject(i);
                    Accept(srcObj, visitedObjects);
                }
                for (i = 0; i < prop.GetDstObjectCount(); i++)
                {
                    var dstObj = prop.GetDstObject(i);
                    Accept(dstObj, visitedObjects);
                }

                // TODO: object references in properties
                // TODO: object references in src and dst properties

                prop = obj.GetNextProperty(prop);
            }

            prop = obj.RootProperty;
            for (i = 0; i < prop.GetSrcObjectCount(); i++)
            {
                var srcObj = prop.GetSrcObject(i);
                Accept(srcObj, visitedObjects);
            }
            for (i = 0; i < prop.GetDstObjectCount(); i++)
            {
                var dstObj = prop.GetDstObject(i);
                Accept(dstObj, visitedObjects);
            }
        }
예제 #3
0
        public static string PrintPropertyID(FbxProperty prop)
        {
            if (prop == null)
            {
                return("<<null>>");
            }

            var pobj = prop.GetFbxObject();

            return
                (string.Format("{0} . {1} : {2}",
                               PrintObjectID(pobj),
                               quote(prop.GetName()),
                               prop.PropertyDataType.FullName));
        }
예제 #4
0
        public FbxProperty GetNextDescendent(FbxProperty pProperty)
        {
            if (pProperty.ParentProperty != this)
            {
                return(null);
            }

            var index = Children.IndexOf(pProperty);

            if (index + 1 >= Children.Count)
            {
                return(null);
            }

            return(Children[index + 1]);
        }
예제 #5
0
        public bool IsDescendentOf(FbxProperty pAncestor)
        {
            var c = ParentProperty;

            while (c != null)
            {
                if (c == pAncestor)
                {
                    return(true);
                }

                c = c.GetParent();
            }

            return(false);
        }
예제 #6
0
        public FbxProperty GetNextProperty(FbxProperty pProperty)
        {
            if (!Properties.Contains(pProperty))
            {
                return(null);
            }

            var index = Properties.IndexOf(pProperty);

            if (index + 1 >= Properties.Count)
            {
                return(null);
            }
            if (index < 0)
            {
                return(null);
            }

            return(Properties[index + 1]);
        }
예제 #7
0
        public void PrintProperty(FbxProperty prop, TextWriter writer, bool indent = false)
        {
            string prefix = indent ? "            " : "        ";

            writer.WriteLine("{0}Name = {1}", prefix, prop.GetName());
            var type = prop.GetPropertyDataType();

            writer.WriteLine("{0}Type = {1}", prefix, type.GetName());
//            writer.WriteLine("{0}HierName = {1}", prefix, prop.GetHierarchicalName());
//            writer.WriteLine("{0}Label = {1}", prefix, prop.GetLabel());

//            char n[1024];
            int i;
//            for (i = 0; i < 1024; i++)
//            {
//                n[i] = 0;
//            }
            sbyte      ch;
            byte       uch;
            uint       ui;
            short      sh;
            ushort     ush;
            long       ll;
            ulong      ull;
            bool       b;
            float      f;
            double     d;
            string     fstr;
            FbxVector2 v2;
            FbxVector3 v3;
            FbxVector4 v4;
            string     s;
            FbxTime    t;
            var        sb = new StringBuilder();

            bool printValue = true;

//            switch (type.GetType())
//            {
//            case eFbxUndefined:
//                printValue = false;
//                break;
//            case eFbxChar:
            if (type == typeof(sbyte))
            {
                ch = prop.Get <sbyte>();
                sb.AppendFormat("%i ('%c')", (int)ch, ch);
            }
//                break;
//            case eFbxUChar:
            if (type == typeof(byte))
            {
                uch = prop.Get <byte>();
                sb.AppendFormat("%i ('%c')", (uint)uch, uch);
            }
//                break;
//            case eFbxShort:
            if (type == typeof(short))
            {
                sh = prop.Get <short>();
                sb.AppendFormat("%i", (int)sh);
            }
//                break;
//            case eFbxUShort:
            if (type == typeof(ushort))
            {
                ush = prop.Get <ushort>();
                sb.AppendFormat("%ui", (uint)ush);
            }
//                break;
//            case eFbxUInt:
            if (type == typeof(uint))
            {
                ui = prop.Get <uint>();
                sb.AppendFormat("%ui", ui);
            }
//                break;
//            case eFbxLongLong:
            if (type == typeof(long))
            {
                ll = prop.Get <long>();
                sb.AppendFormat("%lli", ll);
            }
//                break;
//            case eFbxULongLong:
            if (type == typeof(ulong))
            {
                ull = prop.Get <ulong>();
                sb.AppendFormat("%llu", ull);
            }
//                break;
//            case eFbxHalfFloat:
//                printValue = false;
//                break;
//            case eFbxBool:
            if (type == typeof(bool))
            {
                b = prop.Get <bool>();
                if (b)
                {
                    sb.AppendFormat("true");
                }
                else
                {
                    sb.AppendFormat("false");
                }
            }
//                break;
//            case eFbxInt:
            if (type == typeof(int))
            {
                i = prop.Get <int>();
                sb.AppendFormat("%i", i);
            }
//                break;
//            case eFbxFloat:
            if (type == typeof(float))
            {
                f = prop.Get <float>();
                sb.AppendFormat("%f", f);
            }
//                break;
//            case eFbxDouble:
            if (type == typeof(double))
            {
                d = prop.Get <double>();
                sb.AppendFormat("{0}", d);
            }
//                break;
//            case eFbxDouble2:
            if (type == typeof(FbxVector2))
            {
                v2 = prop.Get <FbxVector2>();
                sb.AppendFormat("{0}, {1}", v2.X, v2.Y);
            }
//                break;
//            case eFbxDouble3:
            if (type == typeof(sbyte))
            {
                v3 = prop.Get <FbxVector3>();
                sb.AppendFormat("{0}, {1}, {2}", v3.X, v3.Y, v3.Z);
            }
//                break;
//            case eFbxDouble4:
            if (type == typeof(sbyte))
            {
                v4 = prop.Get <FbxVector4>();
                sb.AppendFormat("{0}, {1}, {2}, {3}", v4.X, v4.Y, v4.Z, v4.W);
            }
//                break;
//            case eFbxDouble4x4:
//            case eFbxEnum:
//                printValue = false;
//                break;
//            case eFbxString:
            if (type == typeof(sbyte))
            {
                fstr = prop.Get <string>();
                sb.Append(quote(fstr));
            }
//                break;
//            case eFbxTime:
            if (type == typeof(sbyte))
            {
                t = prop.Get <FbxTime>();
                sb.AppendFormat("{0}", t);
            }
//                break;
//            case eFbxReference:
            //            FbxObject* obj;
            //            obj = prop.Get<FbxObject*>();
            //            cout << prefix << ".Value = " << obj.GetRuntimeClassId().GetName() << ", uid=" << obj.GetUniqueID() << endl;
            //            break;
//            case eFbxBlob:
//            case eFbxDistance:
//            case eFbxDateTime:
//            case eFbxTypeCount:
//                printValue = false;
//                break;

            if (printValue)
            {
                writer.WriteLine("{0}Value = {1}", prefix, sb.ToString());
            }


            writer.WriteLine("{0}{1}{2}", prefix, "SrcObjectCount = ", prop.GetSrcObjectCount());
            for (i = 0; i < prop.GetSrcObjectCount(); i++)
            {
                FbxObject srcObj = prop.GetSrcObject(i);
                writer.Write("{0}{1}{2}", prefix, "    #", i, " ");
                PrintObjectID(srcObj);
                writer.WriteLine();
            }
            writer.WriteLine("{0}{1}{2}", prefix, "DstObjectCount = ", prop.GetDstObjectCount());
            for (i = 0; i < prop.GetDstObjectCount(); i++)
            {
                FbxObject dstObj = prop.GetDstObject(i);
                writer.Write("{0}{1}{2}", prefix, "    #", i, " ");
                PrintObjectID(dstObj);
                writer.WriteLine();
            }
//            writer.WriteLine("{0}{1}{2}", prefix , "SrcPropertyCount = " , prop.GetSrcPropertyCount() );
//            for (i = 0; i < prop.GetSrcPropertyCount(); i++)
//            {
//                Property prop2 = prop.GetSrcProperty(i);
//                writer.Write("{0}{1}{2}", prefix , "    #" , i , " ");
//                PrintPropertyID(prop2);
//                writer.WriteLine();
//            }
//            writer.WriteLine("{0}{1}{2}", prefix , "DstPropertyCount = " , prop.GetDstPropertyCount() );
//            for (i = 0; i < prop.GetDstPropertyCount(); i++)
//            {
//                Property prop2 = prop.GetDstProperty(i);
//                writer.Write("{0}{1}{2}", prefix , "    #" , i , " ");
//                PrintPropertyID(prop2);
//                writer.WriteLine();
//            }
        }
예제 #8
0
 public void PrintProperty(FbxProperty prop, bool indent = false)
 {
     PrintProperty(prop, Console.Out, indent);
 }
예제 #9
0
 public bool IsConnectedDstProperty(FbxProperty pProperty)
 {
     return(DstProperties.Contains(pProperty));
 }
예제 #10
0
 public Channel(FbxProperty prop)
 {
     Property = prop;
     Curves   = prop.SrcObjects.CreateCollectionView <FbxAnimCurve>();
 }
예제 #11
0
 public static FbxAnimCurveNode CreateTypedCurveNode(FbxProperty pProperty, FbxScene pScene)
 {
     throw new NotImplementedException();
 }
예제 #12
0
 public FbxAnimCurveNode CreateCurveNode(FbxProperty pProperty)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public T GetPropertyValue <T>(FbxProperty pProperty, FbxTime pTime, bool pForceEval = false)
 {
     return(pProperty.EvaluateValue <T>(pTime, pForceEval));
 }
예제 #14
0
 public bool IsConnectedSrcProperty(FbxProperty pProperty)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public bool DisconnectDstProperty(FbxProperty pProperty)
 {
     return(DstProperties.Remove(pProperty));
 }
예제 #16
0
 public /*FBX_DEPRECATED*/ bool SetParent(FbxProperty pOther)
 {
     //throw new NotImplementedException();
     //ParentProperty = pOther;
     return(false);
 }
예제 #17
0
 public bool IsChildOf(FbxProperty pParent)
 {
     return(ParentProperty == pParent);
 }
예제 #18
0
 public static bool HasDefaultValue(FbxProperty pProperty)
 {
     throw new NotImplementedException();
 }
예제 #19
0
        //public FbxPropertyValue GetPropertyValue(Property pProperty, FbxTime pTime, bool pForceEval=false)
        //{
        //    throw new NotImplementedException();
        //}

        public FbxAnimCurveNode GetPropertyCurveNode(FbxProperty pProperty, FbxAnimLayer pAnimLayer)
        {
            throw new NotImplementedException();
        }
예제 #20
0
        // An ordered collection of FbxObject objects

        public PropertySrcObjectCollection(FbxProperty container)
        {
            _container = container;
        }
예제 #21
0
 public bool DisconnectDstProperty(FbxProperty pProperty)
 {
     throw new NotImplementedException();
 }
예제 #22
0
 public void Flush(FbxProperty pProperty)
 {
     throw new NotImplementedException();
 }