material editor
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: material editor
material attributes are no longer hard coded in material editor ui file ... see git commit c3e64d28 I wonder if some where in the FreeCAD code the material properties are dedined? As far as I know they are not. Just the units are defined in unit system.
Re: material editor
Thanks
Re: material editor
@damian:
do you still do some dev for material editor? What I would like to see is a nice Gui::Input field to change the material attributes, like we have in FEM
Do you do development in this regard? With such an input field in material editor, I would totally switch to the material editor for material editing in FEM.
Bernd
do you still do some dev for material editor? What I would like to see is a nice Gui::Input field to change the material attributes, like we have in FEM
Do you do development in this regard? With such an input field in material editor, I would totally switch to the material editor for material editing in FEM.
Bernd
Re: material editor
good morning @bernd !
A busy week. A lot of work plus painting my parent's house.
Of course, I've followed you and the last night compiled your improvements. Two issues:
1º) Migration to QTreeView with QStyledItemDelegate
2º) Use of PySide version of the InputField ("Gui::InputField")
If you prefer to apply the Gui::Input and switch, later on, I could finish the migration to QTreeView, following the yorik's example. This last doesn't change the material editor and open the door for later dev.
Thank you for your improvements.
OS: Ubuntu 16.04.4 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.13938 (Git)
Build type: Unknown
Branch: mat
Hash: c4fd48fb322a8e8c0927e7c5cac08797f2b0995a
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
A busy week. A lot of work plus painting my parent's house.
Of course, I've followed you and the last night compiled your improvements. Two issues:
1º) Migration to QTreeView with QStyledItemDelegate
2º) Use of PySide version of the InputField ("Gui::InputField")
No. I commented that I didn't find any example of this make directly from the py file, always the property and its kind (for instance length) defined in the ui file. And now you removed the property's classification from the ui file (I like this solution).
I know. I could not offer a solution before two or three weeks.
If you prefer to apply the Gui::Input and switch, later on, I could finish the migration to QTreeView, following the yorik's example. This last doesn't change the material editor and open the door for later dev.
Thank you for your improvements.
OS: Ubuntu 16.04.4 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.13938 (Git)
Build type: Unknown
Branch: mat
Hash: c4fd48fb322a8e8c0927e7c5cac08797f2b0995a
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Re: material editor
Okey, I see one example of "Gui::InputField"
https://github.com/FreeCAD/FreeCAD/blob ... rchWall.py
so complicated!
https://het.as.utexas.edu/HET/Software/ ... lview.html
Code: Select all
self.Length = ui.createWidget("Gui::InputField")
self.Length.setText("0.00 mm")
so complicated!
https://het.as.utexas.edu/HET/Software/ ... lview.html
Re: material editor
Yeah the model view thing in Qt is not simple...
But look at how it is used it here, it's not that hard as it seems in the doc : https://github.com/yorikvanhavre/BIM_Wo ... ts.py#L214
Basically inside all the different functions ( createEditor, setEditorData, etc..) you will need to find which property we are editing (the index contains the exact position of the field in the tree, so you can retrieve for example the text in the first column), and depending on that, display either a QLineEdit, or an InputWidget or something else (QSpinBox, color chooser, etc..)
That is easy for the "fixed" properties (we know their type), but when the user adds custom properties, I'm not sure. Ideally there should be a way to specify the property type. Maybe we need one more column that says the type?
But look at how it is used it here, it's not that hard as it seems in the doc : https://github.com/yorikvanhavre/BIM_Wo ... ts.py#L214
Basically inside all the different functions ( createEditor, setEditorData, etc..) you will need to find which property we are editing (the index contains the exact position of the field in the tree, so you can retrieve for example the text in the first column), and depending on that, display either a QLineEdit, or an InputWidget or something else (QSpinBox, color chooser, etc..)
That is easy for the "fixed" properties (we know their type), but when the user adds custom properties, I'm not sure. Ideally there should be a way to specify the property type. Maybe we need one more column that says the type?
Re: material editor
I was enterteined with the update() and append rows to the model, and ...
Now I'm arriving at editor!
https://srinikom.github.io/pyside-docs/ ... egate.htmlIt is possible for a custom delegate to provide editors without the use of an editor item factory. In this case, the following virtual functions must be reimplemented:
PySide.QtGui.QStyledItemDelegate.createEditor() returns the widget used to change data from the model and can be reimplemented to customize editing behavior.
PySide.QtGui.QStyledItemDelegate.setEditorData() provides the widget with data to manipulate.
PySide.QtGui.QStyledItemDelegate.updateEditorGeometry() ensures that the editor is displayed correctly with respect to the item view.
PySide.QtGui.QStyledItemDelegate.setModelData() returns updated data to the model.
Yes. A few experiments to taste different solutions.
The next weekend might be migrated to model view and code to review.
Re: material editor
mhh I'm curious how you solve the different input widgets inside the tree. I would have gone the easy way and make an edit button and made the editing in a different widget or at least outside the tree widget. I will wait and not do any more changes on the editor.
BTW: I did move the material attribute structure another one. Now the material editor and the FCMat writer use the same material attribute structure. See git commit 1051f10498b5f
@Yorik and others:
I wonder if these material attribute structure is somewhere else defined in the code?
BTW:
Damian, If you have made any changes on the editor, you should rebase your work. I did do some code formating according pep8 style guide on material module for better readability and to have standard code formating.
BTW: I did move the material attribute structure another one. Now the material editor and the FCMat writer use the same material attribute structure. See git commit 1051f10498b5f
@Yorik and others:
I wonder if these material attribute structure is somewhere else defined in the code?
BTW:
Damian, If you have made any changes on the editor, you should rebase your work. I did do some code formating according pep8 style guide on material module for better readability and to have standard code formating.
Re: material editor
Yes, I have got the module PEP8 enabled in my IDE (spyder)
I make all my code in parallel to the existing one, without mess up.
The last step is to activate model/view and remove classical widgets, and it will require refactoring especially some variable names.
This last step will be posterior to your review.
Thank you
Re: material editor
Not in the code, but on the wiki there is this:
https://www.freecadweb.org/wiki/Material
https://www.freecadweb.org/wiki/Material_data_model