Ejemplo n.º 1
0
            public Plugin(Animatable a)
                : base(a)
            {
                className = a.ClassName;
                cid       = a.ClassID;
                scid      = a.SuperClassID;
                ReferenceTarget rt  = a as ReferenceTarget;
                var             pbs = new List <ParameterBlock>();

                if (rt == null)
                {
                    targets = new Reference[0];
                }
                else
                {
                    targets = new Reference[rt.NumTargets];
                    for (int i = 0; i < rt.NumTargets; ++i)
                    {
                        var target = rt.GetTarget(i);
                        targets[i] = new Reference(target);

                        if (target is ParameterBlock1)
                        {
                            pbs.Add(new ParameterBlock(target as ParameterBlock1));
                        }
                        else if (target is ParameterBlock2)
                        {
                            pbs.Add(new ParameterBlock(target as ParameterBlock2));
                        }
                    }
                }
                paramblocks = pbs.ToArray();
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns an animatable from a super class ID and a class ID
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="scid"></param>
        /// <param name="cid"></param>
        /// <returns></returns>
        public static T CreatePluginInstance <T>(SuperClassID scid, ClassID cid) where T : Animatable
        {
            // Note: the global Kernel.g.CreateInstance() function is broken! This caused me a lot of grief.
            object      o  = Kernel._Interface.CreateInstance(scid, cid._IClass_ID);
            IAnimatable ia = o as IAnimatable;
            T           r  = CreateWrapper <T>(ia);

            if (r == null)
            {
                throw new Exception("Failed to create plug-in instance");
            }
            return(r);
        }
Ejemplo n.º 3
0
 public IEnumerable <Node> NodesBySuperClass(SuperClassID sid)
 {
     return(from n in NodeTree where n.Object != null & n.SuperClassID == sid select n);
 }
Ejemplo n.º 4
0
 public static Animatable Create(SuperClassID scid, ClassID cid)
 {
     return Animatable.CreatePluginInstance<Animatable>(scid, cid);
 }
Ejemplo n.º 5
0
 public static IEnumerable<Node> NodesListBySuperClasses(this Scene scene, SuperClassID[] sids)
 {
     return from n in scene.NodeTree where n.Object != null && sids.Any(sid => n._Node.EvalWorldState(0, false).Obj.SuperClassID == sid) select n;
 }
Ejemplo n.º 6
0
 public static IEnumerable<Node> NodesListBySuperClass(this Scene scene, SuperClassID sid)
 {
     return from n in scene.NodeTree where n.Object != null && n.Object.SuperClassID == sid select n;
 }
Ejemplo n.º 7
0
 public static Animatable Create(SuperClassID scid, ClassID cid)
 {
     return(Animatable.CreatePluginInstance <Animatable>(scid, cid));
 }
Ejemplo n.º 8
0
 public AppData(IAnimatable anim, ClassID cid, SuperClassID scid)
 {
     this.anim = anim;
     this.cid  = cid;
     this.scid = scid;
 }
Ejemplo n.º 9
0
 public AppData GetAppData(ClassID cid, SuperClassID scid)
 {
     return(new AppData(_Anim, cid, scid));
 }
Ejemplo n.º 10
0
            public Plugin(Animatable a)
                 : base(a)
            {
                className = a.ClassName;
                cid = a.ClassID;
                scid = a.SuperClassID;                
                ReferenceTarget rt = a as ReferenceTarget;
                var pbs = new List<ParameterBlock>();
                if (rt == null)
                {
                    targets = new Reference[0];
                }
                else
                {
                    targets = new Reference[rt.NumTargets];
                    for (int i = 0; i < rt.NumTargets; ++i)
                    {
                        var target = rt.GetTarget(i);
                        targets[i] = new Reference(target);

                        if (target is ParameterBlock1)
                        {
                            pbs.Add(new ParameterBlock(target as ParameterBlock1));
                        }
                        else if (target is ParameterBlock2)
                        {
                            pbs.Add(new ParameterBlock(target as ParameterBlock2));
                        }
                    }
                }
                paramblocks = pbs.ToArray();
            }