You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating my own custom types for SOFA, mainly some forcefields but also other stuff. In order to add those types to an object, they must inherit from Sofa.Core.Object on python. This is problematic, since Sofa.Core.Base overrides how properties are read and written. In the end, this breaks adding new properties to custom defined types that are exposed to python.
With that class exposed to python, it is not possible to do
cgSolver = myModule.ConjugateGradient
cgSolver.iterations = 50 # Doesn't work
print(cgSolver.iterations) # prints 25, the default value in the C++ class
Actually, what is happening is that BaseBinding reimplements the _setattr__ function and if it doesn't find the property as a Data, it relies on adding a new dynamic one the __dict__. Before adding it as a dynamic one, it should check if the property is a python property.
I am creating my own custom types for SOFA, mainly some forcefields but also other stuff. In order to add those types to an object, they must inherit from Sofa.Core.Object on python. This is problematic, since Sofa.Core.Base overrides how properties are read and written. In the end, this breaks adding new properties to custom defined types that are exposed to python.
With that class exposed to python, it is not possible to do
This is the output for some tests
If ConjugateGradient doesn't inherit from Sofa.Core.Object, then the properties work fine, but I can't add it to a node.
The text was updated successfully, but these errors were encountered: