Esempio n. 1
0
        public void Clear()
        {
            if (Renderers != null)
            {
                Renderers.Clear();
                Renderers = null;
            }

            if (Materials != null)
            {
                for (int i = 0; i < Materials.Count; i++)
                {
                    Object.Destroy(Materials[i]);
                }
                Materials.Clear();
                Materials = null;
            }

            if (renderTextureCreated)
            {
                CommandBuffer.ReleaseTemporaryRT(tmpRenderTextureID);
                renderTextureCreated = false;
            }
            else
            {
                if (CommandBuffer != null)
                {
                    attachedCamera.RemoveCommandBuffer(CameraEvent.BeforeImageEffects, CommandBuffer);
                    CommandBuffer.Dispose();
                    CommandBuffer = null;
                }
            }

            //TODO: resettare anche la RenderTexture?
        }
        async Task ExecuteLoadMaterialsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Materials.Clear();
                var materials = await dataStore.GetAuthorMaterials(AuthorId);

                foreach (var material in materials)
                {
                    Materials.Add(material);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 3
0
        public override void LoadFromXml(XElement element)
        {
            base.LoadFromXml(element);
            DesignID = element.ReadAttribute("designID", string.Empty);

            Materials.Clear();

            if (element.HasAttribute("materials", out XAttribute matAttr))
            {
                var materials = matAttr.Value.Split(',');
                for (int i = 0; i < materials.Length; i++)
                {
                    if (int.TryParse(materials[i], out int matID))
                    {
                        Materials.Add(matID);
                    }
                }
            }

            Bone = null;
            if (element.HasElement("Bone", out XElement boneElem))
            {
                Bone = new Bone();
                Bone.LoadFromXml(boneElem);
            }
        }
 private void LoadOrClear()
 {
     if (size != null && !(Commentaries.Any() && Materials.Any() && Pribors.Any()))
     {
         using (var db = new SmetaApplication.DbContexts.SmetaDbAppContext())
         {
             Materials.Clear();
             db.MaterialGroups.Where(x => x.WorkId == Id).ToList().ForEach(x =>
             {
                 Materials.Add(new MaterialGroupDemView(x, diff + 1));
             });
             Pribors.Clear();
             db.PriborGroups.Where(x => x.WorkId == Id).ToList().ForEach(x =>
             {
                 Pribors.Add(new PriborGroupView(x));
             });
             Commentaries.Clear();
             db.Commentaries.Where(x => x.WorkSectionId == WorkSectionId).ToList().ForEach(x =>
             {
                 Commentaries.Add(new CommentaryView(x));
             });
         }
     }
     else
     {
         Commentaries.Clear();
         Materials.Clear();
         Pribors.Clear();
     }
 }
 public void Reset()
 {
     TextureStrings.Clear();
     Materials.Clear();
     Meshes.Clear();
     BoneMaps.Clear();
     BoneMapEntries.Clear();
 }
Esempio n. 6
0
 /// <summary>
 /// Clears all vertices, indices, bone tables, materials and strips.
 /// </summary>
 public void Clear()
 {
     BoneTable.Clear();
     Vertices.Clear();
     Indices.Clear();
     Materials.Clear();
     Strips.Clear();
 }
Esempio n. 7
0
 public void Dispose(AssetManager assetManager)
 {
     TextureStrings.Clear();
     Materials.Clear();
     Meshes.Clear();
     BoneMaps.Clear();
     BoneMapEntries.Clear();
 }
Esempio n. 8
0
 private void ClearAll()
 {
     Vertices.Clear();
     Normals.Clear();
     Colors.Clear();
     UV.Clear();
     Geometries.Clear();
     Materials.Clear();
     BoundingBox = new BoundingBox();
 }
Esempio n. 9
0
 /// <summary>
 /// Clear the selection
 /// </summary>
 public void Clear()
 {
     Elements.Clear();
     Nodes.Clear();
     Loads.Clear();
     SectionFamilies.Clear();
     BuildUpFamilies.Clear();
     Materials.Clear();
     Sets.Clear();
 }
Esempio n. 10
0
        public void Initialize()
        {
            ImageKey         = "materialAnim";
            SelectedImageKey = "materialAnim";

            CanRename  = true;
            CanReplace = true;
            CanExport  = true;
            CanDelete  = true;

            Materials.Clear();
        }
Esempio n. 11
0
 public void Dispose()
 {
     Frames.Clear();
     if (Materials != null)
     {
         Materials.Clear();
     }
     if (Textures != null)
     {
         Textures.Clear();
     }
     Parser = null;
 }
Esempio n. 12
0
        /// <summary>
        /// Erases all model items.
        /// </summary>
        public void ResetModel()
        {
            ResetLastStiffnessMatrix();

            Nodes.Clear();
            Materials.Clear();
            FrameSections.Clear();
            Frames.Clear();
            Springs.Clear();

            AnalysisCases.Clear();
            Combinations.Clear();
        }
Esempio n. 13
0
 private void FinalScreen()
 {
     loading = 0;
     MainScreen.currentScreen = this;
     CreateMarioScreen();
     for (int i = 0; i < Materials.Count; i++)
     {
         Materials[i].Dispose();
     }
     Materials.Clear();
     dThread = new System.Threading.Thread(new System.Threading.ThreadStart(LoadScreen));
     dThread.Start();
 }
Esempio n. 14
0
 public void Dispose()
 {
     Nodes.Clear();
     MarkerGroups.Clear();
     Regions.Clear();
     Materials.Clear();
     Bounds.Clear();
     foreach (var mesh in Meshes)
     {
         mesh.Dispose();
     }
     Meshes.Clear();
 }
Esempio n. 15
0
        private void LoadMaterials()
        {
            Materials.Clear();
            Results.Clear();
            var materials = BdoDataService.GetRecipeMatsByRecipeID(SelectedRecipe.Id);

            foreach (var material in materials)
            {
                if (material.IsItem)
                {
                    material.Item = BdoDataService.GetItemById(material.ItemId.Value);
                    Materials.Add(new RecipeMaterialModel
                    {
                        Name   = material.Item.Name,
                        Img    = material.Item.Img,
                        Grade  = material.Item.Grade,
                        IsItem = true,
                        Id     = material.Item.Id,
                        Amount = material.Amount
                    });
                }
                else
                {
                    //Item Group
                    material.ItemGroup = BdoDataService.GetItemGroupById(material.ItemGroupId.Value);
                    BdoItem item = BdoDataService.FirstItemFromItemGroup(material.ItemGroupId.Value);
                    Materials.Add(new RecipeMaterialModel
                    {
                        Name   = material.ItemGroup.Name,
                        Img    = material.ItemGroup.Items[0].Img,
                        Grade  = ItemGrade.White,
                        IsItem = false,
                        Id     = material.ItemGroup.Id,
                        Amount = material.Amount
                    });
                }
            }

            BdoItem result0 = BdoDataService.GetItemById(SelectedRecipe.Item1Id.Value);

            Results.Add(result0);

            if (SelectedRecipe.Item2Id.HasValue)
            {
                BdoItem result1 = BdoDataService.GetItemById(SelectedRecipe.Item2Id.Value);
                Results.Add(result1);
            }

            NotifyOfPropertyChange(() => Materials);
            NotifyOfPropertyChange(() => Results);
        }
Esempio n. 16
0
 private void ExitScreen()
 {
     if (!MainScreen.currentScreen.isFinish)
     {
         loadLevel--;
     }
     loading = 0;
     CreateMarioScreen();
     MainScreen.currentScreen = this;
     for (int i = 0; i < Materials.Count; i++)
     {
         Materials[i].Dispose();
     }
     Materials.Clear();
 }
        public async Task LoadMaterialsAsync()
        {
            long startTicks = Log.Debug("Enter", Common.LOG_APPNAME);

            var materials = await _materialDataService.AllAsync();

            Materials.Clear();

            foreach (var material in materials)
            {
                Materials.Add(material);
            }

            Log.Debug("Exit", Common.LOG_APPNAME, startTicks);
        }
        private void LoadMaterials()
        {
            long startTicks = Log.Debug("Enter", Common.LOG_APPNAME);

            var materials = _materialDataService.All();

            Materials.Clear();

            foreach (var material in materials)
            {
                Materials.Add(material);
            }

            Log.Debug("Exit", Common.LOG_APPNAME, startTicks);
        }
Esempio n. 19
0
        public static void Clear()
        {
            // Clear Resource Directories
            ModelDirectories.Clear();
            ResourceDirectories.Clear();

            // Clear Viewport Models/Instances
            Viewport.SelectedInstances.Clear();
            DefaultCube.Instances.Clear();
            DefaultTerrainGroup.Clear();
            TerrainGroups.Clear();
            Objects.Clear();

            // Clear Resources
            Materials.Clear();
            Textures.Clear();
        }
        private async void LoadMaterials()
        {
            var loadedMaterials = await materials.GetAsync(MaterialType);

            Materials.Clear();

            var mats =
                loadedMaterials
                .Select(m => new MaterialViewModel(m));


            if (SortByTitle)
            {
                if (SortDescending)
                {
                    mats = mats.OrderByDescending(m => m.TitleText);
                }
                else
                {
                    mats = mats.OrderBy(m => m.TitleText);
                }
            }
            else
            {
                if (SortDescending)
                {
                    mats = mats.OrderByDescending(m => m.GetSortValue(ColumnSortIndex));
                }
                else
                {
                    mats = mats.OrderBy(m => m.GetSortValue(ColumnSortIndex));
                }
            }

            mats.ForEach(Materials.Add);
        }
Esempio n. 21
0
        private void LoadAnim(TexPatternAnim anim)
        {
            CanReplace = true;
            CanExport  = true;
            CanDelete  = true;
            CanRename  = true;

            Text = anim.Name;

            TexPatternAnim = anim;
            FrameCount     = anim.FrameCount;

            Materials.Clear();
            Textures.Clear();
            if (anim.TextureRefNames != null)
            {
                foreach (var tex in anim.TextureRefNames)
                {
                    Textures.Add(tex.Name);
                }
            }

            if (anim.TextureRefs != null)
            {
                foreach (var tex in anim.TextureRefs)
                {
                    Textures.Add(tex.Key);
                }
            }


            foreach (TexPatternMatAnim matanim in anim.TexPatternMatAnims)
            {
                var mat = new MaterialAnimEntry(matanim.Name);
                mat.TexPatternMatAnim = matanim;
                Materials.Add(mat);

                foreach (PatternAnimInfo SamplerInfo in matanim.PatternAnimInfos)
                {
                    BfresSamplerAnim sampler = new BfresSamplerAnim(SamplerInfo.Name, this);
                    mat.Samplers.Add(sampler);

                    int textureIndex = 0;

                    if (SamplerInfo.SubBindIndex != -1)
                    {
                        textureIndex = SamplerInfo.SubBindIndex;

                        sampler.Keys.Add(new Animation.KeyFrame()
                        {
                            Frame = 0, Value = textureIndex
                        });
                        sampler.Constant = true;
                    }
                    if (SamplerInfo.CurveIndex != -1)
                    {
                        int index = (int)SamplerInfo.CurveIndex;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrackWiiU(matanim.Curves[index]);
                        sampler.AnimDataOffset = matanim.Curves[index].AnimDataOffset;
                        sampler.Keys           = keyGroup.Keys;

                        foreach (var ind in keyGroup.Keys)
                        {
                            Console.WriteLine($"{SamplerInfo.Name} {ind.Value}");
                        }
                    }
                }
            }
        }
Esempio n. 22
0
        public void LoadAnim(ShaderParamAnim anim, AnimationType type)
        {
            Initialize();

            Text = anim.Name;

            AnimType = type;

            FrameCount      = anim.FrameCount;
            ShaderParamAnim = anim;

            Materials.Clear();
            foreach (ShaderParamMatAnim matAnim in anim.ShaderParamMatAnims)
            {
                MaterialAnimEntry matNode = new MaterialAnimEntry(matAnim.Name);
                matNode.materialAnimData = matAnim;
                Materials.Add(matNode);

                //Param info determines which curves to use for each param
                //Add the curves and keys for left/right for interpolating after
                foreach (var param in matAnim.ParamAnimInfos)
                {
                    BfresParamAnim paramInfo = new BfresParamAnim(param.Name);
                    paramInfo.Type = type;
                    matNode.Params.Add(paramInfo);

                    //Get constant anims
                    for (int constant = 0; constant < param.ConstantCount; constant++)
                    {
                        Animation.KeyGroup keyGroup = new Animation.KeyGroup();
                        keyGroup.Keys.Add(new Animation.KeyFrame()
                        {
                            InterType = InterpolationType.CONSTANT,
                            Frame     = 0,
                            Value     = matAnim.Constants[constant].Value,
                        });

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = matAnim.Constants[constant].AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });

                        if (paramInfo.Text.Contains("Color") || paramInfo.Text.Contains("color"))
                        {
                            paramInfo.Type = AnimationType.Color;
                        }
                    }

                    for (int curve = 0; curve < param.FloatCurveCount + param.IntCurveCount; curve++)
                    {
                        int index = curve + param.BeginCurve;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrackWiiU(matAnim.Curves[index]);
                        keyGroup.AnimDataOffset = matAnim.Curves[index].AnimDataOffset;
                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });

                        if (paramInfo.Text.Contains("Color") || paramInfo.Text.Contains("color"))
                        {
                            paramInfo.Type = AnimationType.Color;
                        }
                    }
                }
            }
        }
Esempio n. 23
0
        private void LoadAnim(MaterialAnim anim)
        {
            Initialize();

            MaterialAnim = anim;
            FrameCount   = MaterialAnim.FrameCount;
            Text         = anim.Name;

            Textures.Clear();
            if (anim.TextureNames != null)
            {
                foreach (var name in anim.TextureNames)
                {
                    Textures.Add(name);
                }
            }

            Materials.Clear();
            foreach (var matanim in anim.MaterialAnimDataList)
            {
                var mat = new MaterialAnimEntry(matanim.Name);
                mat.MaterialAnimData = matanim;
                Materials.Add(mat);

                foreach (var param in matanim.ParamAnimInfos)
                {
                    FSHU.BfresParamAnim paramInfo = new FSHU.BfresParamAnim(param.Name);
                    mat.Params.Add(paramInfo);

                    paramInfo.Type = AnimationType.ShaderParam;

                    //There is no better way to determine if the param is a color type afaik
                    if (param.Name.Contains("Color") || param.Name.Contains("color") || param.Name == "multi_tex_reg2")
                    {
                        paramInfo.Type = AnimationType.Color;
                    }
                    else if (AnimType == AnimationType.TexturePattern)
                    {
                        paramInfo.Type = AnimationType.TexturePattern;
                    }
                    else if (AnimType == AnimationType.TextureSrt)
                    {
                        paramInfo.Type = AnimationType.TextureSrt;
                    }
                    else
                    {
                        paramInfo.Type = AnimationType.ShaderParam;
                    }

                    //Get constant anims
                    for (int constant = 0; constant < param.ConstantCount; constant++)
                    {
                        int index = constant + param.BeginConstant;

                        Animation.KeyGroup keyGroup = new Animation.KeyGroup();
                        keyGroup.Keys.Add(new Animation.KeyFrame()
                        {
                            InterType = InterpolationType.CONSTANT,
                            Frame     = 0,
                            Value     = matanim.Constants[index].Value,
                        });

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = matanim.Constants[index].AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }

                    for (int curve = 0; curve < param.FloatCurveCount + param.IntCurveCount; curve++)
                    {
                        int index = curve + param.BeginCurve;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);
                        keyGroup.AnimDataOffset = matanim.Curves[index].AnimDataOffset;

                        paramInfo.Values.Add(new Animation.KeyGroup()
                        {
                            AnimDataOffset = keyGroup.AnimDataOffset,
                            Keys           = keyGroup.Keys,
                        });
                    }
                }

                foreach (TexturePatternAnimInfo SamplerInfo in matanim.TexturePatternAnimInfos)
                {
                    BfresSamplerAnim sampler = new BfresSamplerAnim(SamplerInfo.Name, this, mat);
                    mat.Samplers.Add(sampler);


                    int textureIndex = 0;

                    if (SamplerInfo.BeginConstant != 65535)
                    {
                        textureIndex = matanim.Constants[SamplerInfo.BeginConstant].Value;

                        sampler.Keys.Add(new Animation.KeyFrame()
                        {
                            Frame = 0, Value = textureIndex
                        });
                        sampler.Constant       = true;
                        sampler.AnimDataOffset = matanim.Constants[SamplerInfo.BeginConstant].AnimDataOffset;
                    }
                    if (SamplerInfo.CurveIndex != 65535)
                    {
                        int index = (int)SamplerInfo.CurveIndex;

                        Animation.KeyGroup keyGroup = CurveHelper.CreateTrack(matanim.Curves[index]);

                        sampler.AnimDataOffset = matanim.Curves[index].AnimDataOffset;
                        sampler.Keys           = keyGroup.Keys;
                    }
                }
            }
        }
Esempio n. 24
0
 public void Reset()
 {
     Categories.Clear();
     Materials.Clear();
     CurrentCompany = null;
 }