Some of the implicit type conversions in C++ are very hard to emulate in Python bindings generated by SIP. For instance, the straightforward translation of the C++ snippet
SoMaterial *redPlastic = new SoMaterial; // Now, the statement redPlastic->shininess = 0.5; // works because of the operator // float SoMFField::operator=(float); // which is declared by means of a macro in Inventor/fields/SoSubField.
redPlastic = SoMaterial() redPlastic.shininess = 0.5
Work-arounds are:
redPlastic = SoMaterial() redPlastic.shininess.setValue(0.5)
redPlastic = SoMaterial() # The Python API of SoMFFloat has been extended with respect to its C++ API # to allow this: redPlastic.shininess = SoMFFloat(0.5)
The latter work-around is more dangerous because if you mistype shininess in
redPlastic.shininess = SoMFFloat(0.5)
dir(SoMaterial)