public List <PropertyGridElement> CreatePropertyGridElements(Material item)
        {
            var listOfProperties = new List <PropertyGridElement>();

            var category = $"01 - {string.Format(item.Description)}";

            listOfProperties.Add(new PropertyGridElement("MaterialGroup", new MaterialGroups().GetById(item.MaterialGroupId).Description, category, ""));
            listOfProperties.Add(new PropertyGridElement("Code", item.Code.ToString(), category, ""));
            listOfProperties.Add(new PropertyGridElement("Description", item.Description, category, ""));

            category = $"02 - {string.Format(Translations.MasterData.Properties)}";

            var materialParameters = new MaterialParameters().GetByMaterialGroupId(item.MaterialGroupId);

            foreach (var materialParameter in materialParameters)
            {
                var materialParameterValues = new MaterialParameterValues().GetByMaterialParameterId(materialParameter.Id);

                foreach (var materialParameterValue in materialParameterValues)
                {
                    if (item.Id == materialParameterValue.MaterialId)
                    {
                        listOfProperties.Add(new PropertyGridElement(materialParameter.Code, materialParameterValue.Value, category, ""));
                    }
                }
            }

            return(listOfProperties);
        }
        public void DeleteMaterialParameterValues(Material selectedMaterial)
        {
            List <MaterialParameterValue> materialParameterValues = new MaterialParameterValues().GetByMaterialId(selectedMaterial.Id);

            foreach (var materialParameterValue in materialParameterValues)
            {
                new MaterialParameterValues().Delete(materialParameterValue);
            }
        }
Exemplo n.º 3
0
 public static void Set(DeviceManager deviceManager, Material material, ref MaterialParameterValues parameters)
 {
     if (deviceManager.CurrentMaterial != material)
     {
         Set_Slow(deviceManager, material, ref parameters);
     }
     else
     {
         material.Flush(deviceManager, ref parameters);
     }
 }
Exemplo n.º 4
0
        public void Flush(DeviceManager deviceManager, ref MaterialParameterValues parameters)
        {
            deviceManager.ActiveViewTransform?.AutoApply(this);

            // FIXME: Avoid double-set for cases where there is a default + override, since it's wasteful
            DefaultParameters.Apply(this);
            parameters.Apply(this);

            ValidateParameters();

            Flush_Epilogue(deviceManager);
        }
Exemplo n.º 5
0
        internal void Begin(DeviceManager deviceManager, ref MaterialParameterValues parameters)
        {
            CheckDevice(deviceManager);
            Flush(deviceManager, ref parameters);

            if (BeginHandlers != null)
            {
                foreach (var handler in BeginHandlers)
                {
                    handler(deviceManager);
                }
            }
        }
Exemplo n.º 6
0
 public void ApplyMaterial(Material material, ref MaterialParameterValues parameters)
 {
     ActiveMaterial.Set(this, material, ref parameters);
 }
Exemplo n.º 7
0
            private static void Set_Slow(DeviceManager deviceManager, Material material, ref MaterialParameterValues parameters)
            {
                if (deviceManager.CurrentMaterial != null)
                {
                    deviceManager.CurrentMaterial.End(deviceManager);
                }

                deviceManager.CurrentMaterial = material;
                deviceManager.UpdateTargetInfo(null, false, true);

                if (material != null)
                {
                    material.Begin(deviceManager, ref parameters);
                }
            }