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();
            }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is ClassID))
            {
                return(false);
            }
            ClassID that = (ClassID)obj;

            return(a == that.a && b == that.b);
        }
        /// <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);
        }
Exemple #4
0
 public static Animatable Create(SuperClassID scid, ClassID cid)
 {
     return Animatable.CreatePluginInstance<Animatable>(scid, cid);
 }
Exemple #5
0
 public static Animatable Create(SuperClassID scid, ClassID cid)
 {
     return(Animatable.CreatePluginInstance <Animatable>(scid, cid));
 }
 public AppData(IAnimatable anim, ClassID cid, SuperClassID scid)
 {
     this.anim = anim;
     this.cid  = cid;
     this.scid = scid;
 }
 public AppData GetAppData(ClassID cid, SuperClassID scid)
 {
     return(new AppData(_Anim, cid, scid));
 }
            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();
            }