Exemplo n.º 1
0
        public virtual void RestoreMaterial(SceneObject so, TypedAttribSet attributes)
        {
            TypedAttribSet material = find_struct(attributes, IOStrings.MaterialStruct);

            if (material == null)
            {
                throw new Exception("SOFactory.RestoreMaterial: Material struct not found!");
            }


            SOMaterial mat        = new SOMaterial();
            bool       bKnownType = false;

            if (check_key_or_debug_print(material, IOStrings.AMaterialType))
            {
                string sType = material[IOStrings.AMaterialType] as string;
                if (sType == IOStrings.AMaterialType_Standard)
                {
                    mat.Type   = SOMaterial.MaterialType.StandardRGBColor;
                    bKnownType = true;
                }
                else if (sType == IOStrings.AMaterialType_Transparent)
                {
                    mat.Type   = SOMaterial.MaterialType.TransparentRGBColor;
                    bKnownType = true;
                }
            }
            if (bKnownType == false)
            {
                return;
            }

            if (check_key_or_debug_print(material, IOStrings.AMaterialName))
            {
                mat.Name = material[IOStrings.AMaterialName] as string;
            }

            if (check_key_or_debug_print(material, IOStrings.AMaterialRGBColor))
            {
                mat.RGBColor = (Colorf)material[IOStrings.AMaterialRGBColor];
            }

            so.AssignSOMaterial(mat);
        }
Exemplo n.º 2
0
 public override OpStatus Apply()
 {
     so.AssignSOMaterial(after);
     return(OpStatus.Success);
 }