Material properties This is the father of all properties handling colors. More...
#include <PropertyStandard.h>
Public Member Functions | |
virtual Property * | Copy (void) const |
Returns a new copy of the property (mainly for Undo/Redo and transactions). | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? This method is defined in Base::Persistence. | |
virtual PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. | |
virtual Base::Type | getTypeId (void) const |
const Material & | getValue (void) const |
This method returns a string representation of the property. | |
virtual void | Paste (const Property &from) |
PropertyMaterial () | |
A constructor. | |
virtual void | Restore (Base::XMLReader &reader) |
This method is used to restore properties from an XML document. | |
virtual void | Save (Base::Writer &writer) const |
This method is used to save properties to an XML document. | |
void | setAmbientColor (const Color &col) |
void | setDiffuseColor (const Color &col) |
void | setEmmisiveColor (const Color &col) |
virtual void | setPyObject (PyObject *) |
void | setShininess (float) |
void | setSpecularColor (const Color &col) |
void | setTransparency (float) |
void | setValue (const Material &mat) |
Sets the property. | |
~PropertyMaterial () | |
A destructor. | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Material properties This is the father of all properties handling colors.
Definition at line 702 of file PropertyStandard.h.
PropertyMaterial::PropertyMaterial | ( | ) |
A constructor.
A more elaborate description of the constructor.
Definition at line 1716 of file PropertyStandard.cpp.
Referenced by Copy().
PropertyMaterial::~PropertyMaterial | ( | ) |
A destructor.
A more elaborate description of the destructor.
Definition at line 1721 of file PropertyStandard.cpp.
Property * PropertyMaterial::Copy | ( | void | ) | const [virtual] |
Returns a new copy of the property (mainly for Undo/Redo and transactions).
Implements App::Property.
Definition at line 1823 of file PropertyStandard.cpp.
References draftTools::p, and PropertyMaterial().
void * App::PropertyMaterial::create | ( | void | ) | [static] |
Reimplemented from App::Property.
Definition at line 1714 of file PropertyStandard.cpp.
Base::Type App::PropertyMaterial::getClassTypeId | ( | void | ) | [static] |
Reimplemented from App::Property.
Definition at line 1714 of file PropertyStandard.cpp.
Referenced by Gui::Dialog::DlgMaterialPropertiesImp::on_ambientColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_diffuseColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_emissiveColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_shininess_valueChanged(), Gui::Dialog::DlgMaterialPropertiesImp::on_specularColor_changed(), and Gui::Dialog::DlgMaterialPropertiesImp::setViewProviders().
virtual unsigned int App::PropertyMaterial::getMemSize | ( | void | ) | const [inline, virtual] |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? This method is defined in Base::Persistence.
Reimplemented from App::Property.
Definition at line 743 of file PropertyStandard.h.
PyObject * PropertyMaterial::getPyObject | ( | void | ) | [virtual] |
This method returns the Python wrapper for a C++ object.
It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.
The default implementation returns 'None'.
Reimplemented from Base::BaseClass.
Definition at line 1780 of file PropertyStandard.cpp.
Base::Type App::PropertyMaterial::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from App::Property.
Definition at line 1714 of file PropertyStandard.cpp.
const Material & PropertyMaterial::getValue | ( | void | ) | const |
This method returns a string representation of the property.
Definition at line 1733 of file PropertyStandard.cpp.
Referenced by Gui::Dialog::DlgMaterialPropertiesImp::on_ambientColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_diffuseColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_emissiveColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_shininess_valueChanged(), Gui::Dialog::DlgMaterialPropertiesImp::on_specularColor_changed(), MeshGui::ViewProviderMeshNode::onChanged(), Gui::ViewProviderGeometryObject::onChanged(), FemGui::ViewProviderFemMesh::onChanged(), PartGui::ViewProviderPartExt::onChanged(), MeshGui::ViewProviderMeshCurvature::onChanged(), PartGui::ViewProviderPartBase::onChanged(), MeshGui::ViewProviderMesh::onChanged(), and Gui::Dialog::DlgMaterialPropertiesImp::setViewProviders().
void App::PropertyMaterial::init | ( | void | ) | [static] |
Reimplemented from App::Property.
Definition at line 1714 of file PropertyStandard.cpp.
void PropertyMaterial::Paste | ( | const Property & | from | ) | [virtual] |
Definition at line 1830 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), and App::Property::hasSetValue().
void PropertyMaterial::Restore | ( | Base::XMLReader & | ) | [virtual] |
This method is used to restore properties from an XML document.
It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:
void PropertyVector::Restore(Base::XMLReader &reader) { // read my Element reader.readElement("PropertyVector"); // get the value of my Attribute _cVec.x = (float)reader.getAttributeAsFloat("valueX"); _cVec.y = (float)reader.getAttributeAsFloat("valueY"); _cVec.z = (float)reader.getAttributeAsFloat("valueZ"); }
Implements Base::Persistence.
Definition at line 1808 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Material::ambientColor, App::Material::diffuseColor, App::Material::emissiveColor, Base::XMLReader::getAttributeAsFloat(), Base::XMLReader::getAttributeAsUnsigned(), App::Property::hasSetValue(), Base::XMLReader::readElement(), App::Color::setPackedValue(), App::Material::shininess, App::Material::specularColor, and App::Material::transparency.
void PropertyMaterial::Save | ( | Base::Writer & | ) | const [virtual] |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
void PropertyVector::Save (Writer &writer) const { writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x << "\" valueY=\"" << _cVec.y << "\" valueZ=\"" << _cVec.z <<"\"/>" << endl; }
The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
Definition at line 1797 of file PropertyStandard.cpp.
References App::Material::ambientColor, App::Material::diffuseColor, App::Material::emissiveColor, App::Color::getPackedValue(), Base::Writer::ind(), App::Material::shininess, App::Material::specularColor, Base::Writer::Stream(), and App::Material::transparency.
void PropertyMaterial::setAmbientColor | ( | const Color & | col | ) |
Definition at line 1738 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Material::ambientColor, and App::Property::hasSetValue().
void PropertyMaterial::setDiffuseColor | ( | const Color & | col | ) |
Definition at line 1745 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Material::diffuseColor, and App::Property::hasSetValue().
Referenced by Gui::ViewProviderGeometryObject::onChanged(), FemGui::ViewProviderFemMesh::onChanged(), PartGui::ViewProviderPartExt::onChanged(), and PartGui::ViewProviderPartBase::onChanged().
void PropertyMaterial::setEmmisiveColor | ( | const Color & | col | ) |
Definition at line 1759 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Material::emissiveColor, and App::Property::hasSetValue().
void PropertyMaterial::setPyObject | ( | PyObject * | value | ) | [virtual] |
Reimplemented from Base::BaseClass.
Definition at line 1785 of file PropertyStandard.cpp.
References draftlibs::dxfReader::error(), setValue(), and App::MaterialPy::Type.
void PropertyMaterial::setShininess | ( | float | val | ) |
Definition at line 1766 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Property::hasSetValue(), and App::Material::shininess.
void PropertyMaterial::setSpecularColor | ( | const Color & | col | ) |
Definition at line 1752 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Property::hasSetValue(), and App::Material::specularColor.
void PropertyMaterial::setTransparency | ( | float | val | ) |
Definition at line 1773 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), App::Property::hasSetValue(), and App::Material::transparency.
Referenced by Gui::ViewProviderGeometryObject::onChanged().
void PropertyMaterial::setValue | ( | const Material & | mat | ) |
Sets the property.
Definition at line 1726 of file PropertyStandard.cpp.
References App::Property::aboutToSetValue(), and App::Property::hasSetValue().
Referenced by Gui::Dialog::DlgMaterialPropertiesImp::on_ambientColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_diffuseColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_emissiveColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_shininess_valueChanged(), Gui::Dialog::DlgMaterialPropertiesImp::on_specularColor_changed(), and setPyObject().