FlatRedBall.Glue.ElementRuntime.ShouldElementRuntimeBeCreatedForNos C# (CSharp) Method

ShouldElementRuntimeBeCreatedForNos() public static method

public static ShouldElementRuntimeBeCreatedForNos ( NamedObjectSave n, IElement container ) : bool
n FlatRedBall.Glue.SaveClasses.NamedObjectSave
container IElement
return bool
        public static bool ShouldElementRuntimeBeCreatedForNos(NamedObjectSave n, IElement container)
        {
            bool returnValue = true;



            // We used to create elements that were DefinedByBase, but now
            // we don't want to do that because GlueView will recursively loop
            // through all base objects and create objects for everything defined
            // in base.  If we don't check for DefinedByBase, we get duplicate objects
            // created.
            // Update June 1, 2013
            // If it's DefinedByBase, we
            // should only create it if it's
            // SetByDerived
            if (n.SetByDerived || n.IsDisabled)
            {
                returnValue = false;
            }
            if (n.DefinedByBase)
            {
                // We need to find the defining NOS, and see if it's SetByDerived is set to true
                var found = n.GetDefiningNamedObjectSave(container);
                if (found != null)
                {
                    returnValue = found.SetByDerived;
                }
            }

            return returnValue;
        }