From 4ec136b2526b11da4cb9de2e483f84a1f2c4b7a8 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Mon, 24 Mar 2025 19:06:26 +0000 Subject: [PATCH] Material: Convert XML bindings to Python. --- src/Mod/Material/App/Array2D.pyi | 53 ++++++ src/Mod/Material/App/Array2DPy.xml | 6 +- src/Mod/Material/App/Array3D.pyi | 71 ++++++++ src/Mod/Material/App/Array3DPy.xml | 12 +- src/Mod/Material/App/CMakeLists.txt | 12 ++ src/Mod/Material/App/Material.pyi | 156 ++++++++++++++++ src/Mod/Material/App/MaterialFilter.pyi | 27 +++ .../Material/App/MaterialFilterOptions.pyi | 32 ++++ src/Mod/Material/App/MaterialLibrary.pyi | 32 ++++ src/Mod/Material/App/MaterialManager.pyi | 70 ++++++++ src/Mod/Material/App/MaterialProperty.pyi | 25 +++ src/Mod/Material/App/Model.pyi | 65 +++++++ src/Mod/Material/App/ModelManager.pyi | 37 ++++ src/Mod/Material/App/ModelProperty.pyi | 51 ++++++ src/Mod/Material/App/UUIDs.pyi | 167 ++++++++++++++++++ src/Mod/Material/Gui/CMakeLists.txt | 1 + src/Mod/Material/Gui/MaterialTreeWidget.pyi | 49 +++++ .../bindings/model/generateModel_Python.py | 1 + 18 files changed, 858 insertions(+), 9 deletions(-) create mode 100644 src/Mod/Material/App/Array2D.pyi create mode 100644 src/Mod/Material/App/Array3D.pyi create mode 100644 src/Mod/Material/App/Material.pyi create mode 100644 src/Mod/Material/App/MaterialFilter.pyi create mode 100644 src/Mod/Material/App/MaterialFilterOptions.pyi create mode 100644 src/Mod/Material/App/MaterialLibrary.pyi create mode 100644 src/Mod/Material/App/MaterialManager.pyi create mode 100644 src/Mod/Material/App/MaterialProperty.pyi create mode 100644 src/Mod/Material/App/Model.pyi create mode 100644 src/Mod/Material/App/ModelManager.pyi create mode 100644 src/Mod/Material/App/ModelProperty.pyi create mode 100644 src/Mod/Material/App/UUIDs.pyi create mode 100644 src/Mod/Material/Gui/MaterialTreeWidget.pyi diff --git a/src/Mod/Material/App/Array2D.pyi b/src/Mod/Material/App/Array2D.pyi new file mode 100644 index 0000000000..7325e84490 --- /dev/null +++ b/src/Mod/Material/App/Array2D.pyi @@ -0,0 +1,53 @@ +from Base.Metadata import export +from Base.BaseClass import BaseClass +from Base.Metadata import constmethod +from typing import Final, List, Any + + +@export( + Twin="Array2D", + TwinPointer="Array2D", + Namespace="Materials", + Include="Mod/Material/App/MaterialValue.h", + Delete=True, + Constructor=True +) +class Array2D(BaseClass): + """ + 2D Array of material properties. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Array: Final[List] = ... + """The 2 dimensional array.""" + + Dimensions: Final[int] = ... + """The number of dimensions in the array, in this case 2.""" + + Rows: int = ... + """The number of rows in the array.""" + + Columns: int = ... + """The number of columns in the array.""" + + @constmethod + def getRow(self, value: Any) -> Any: + """ + Get the row given the first column value + """ + ... + + @constmethod + def getValue(self, row: int, column: int) -> Any: + """ + Get the value at the given row and column + """ + ... + + def setValue(self, row: int, column: int, value: Any): + """ + Set the value at the given row and column + """ + ... diff --git a/src/Mod/Material/App/Array2DPy.xml b/src/Mod/Material/App/Array2DPy.xml index af6c665945..4f679cd933 100644 --- a/src/Mod/Material/App/Array2DPy.xml +++ b/src/Mod/Material/App/Array2DPy.xml @@ -25,7 +25,7 @@ The number of dimensions in the array, in this case 2. - + @@ -39,12 +39,12 @@ - + Get the row given the first column value - + Get the value at the given row and column diff --git a/src/Mod/Material/App/Array3D.pyi b/src/Mod/Material/App/Array3D.pyi new file mode 100644 index 0000000000..9a0d6cc5c1 --- /dev/null +++ b/src/Mod/Material/App/Array3D.pyi @@ -0,0 +1,71 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Any, Final, List + + +@export( + Twin="Array3D", + TwinPointer="Array3D", + Namespace="Materials", + Include="Mod/Material/App/MaterialValue.h", + Delete=True, + Constructor=True +) +class Array3D(BaseClass): + """ + 3D Array of material properties. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Array: Final[List] = ... + """The 3 dimensional array.""" + + Dimensions: Final[int] = ... + """The number of dimensions in the array, in this case 3.""" + + Columns: int = ... + """The number of columns in the array.""" + + Depth: int = ... + """The depth of the array (3rd dimension).""" + + @constmethod + def getRows(self) -> int: + """ + Get the number of rows in the array at the specified depth. + """ + ... + + @constmethod + def getValue(self) -> Any: + """ + Get the value at the given row and column + """ + ... + + @constmethod + def getDepthValue(self) -> Any: + """ + Get the column value at the given depth + """ + ... + + def setDepthValue(self, value: Any): + """ + Set the column value at the given depth + """ + ... + + def setValue(self, depth: int, row: int, column: int, value: Any): + """ + Set the value at the given depth, row, and column + """ + ... + + def setRows(self, depth: int, value: int): + """ + Set the number of rows at the given depth + """ + ... diff --git a/src/Mod/Material/App/Array3DPy.xml b/src/Mod/Material/App/Array3DPy.xml index 2f17c825b8..dd79ce6ee4 100644 --- a/src/Mod/Material/App/Array3DPy.xml +++ b/src/Mod/Material/App/Array3DPy.xml @@ -25,31 +25,31 @@ The number of dimensions in the array, in this case 3. - + The number of columns in the array. - + The depth of the array (3rd dimension). - + - + Get the number of rows in the array at the specified depth. - + Get the value at the given row and column - + Get the column value at the given depth diff --git a/src/Mod/Material/App/CMakeLists.txt b/src/Mod/Material/App/CMakeLists.txt index a38701eb69..fecf64e763 100644 --- a/src/Mod/Material/App/CMakeLists.txt +++ b/src/Mod/Material/App/CMakeLists.txt @@ -43,17 +43,29 @@ else() endif() generate_from_xml(Array2DPy) +generate_from_py_(Array2D) generate_from_xml(Array3DPy) +generate_from_py_(Array3D) generate_from_xml(MaterialFilterPy) +generate_from_py_(MaterialFilter) generate_from_xml(MaterialFilterOptionsPy) +generate_from_py_(MaterialFilterOptions) generate_from_xml(MaterialLibraryPy) +generate_from_py_(MaterialLibrary) generate_from_xml(MaterialManagerPy) +generate_from_py_(MaterialManager) generate_from_xml(MaterialPy) +generate_from_py_(Material) generate_from_xml(ModelManagerPy) +generate_from_py_(ModelManager) generate_from_xml(ModelPropertyPy) +generate_from_py_(ModelProperty) generate_from_xml(MaterialPropertyPy) +generate_from_py_(MaterialProperty) generate_from_xml(ModelPy) +generate_from_py_(Model) generate_from_xml(UUIDsPy) +generate_from_py_(UUIDs) SET(Python_SRCS Exceptions.h diff --git a/src/Mod/Material/App/Material.pyi b/src/Mod/Material/App/Material.pyi new file mode 100644 index 0000000000..46c1b75c0f --- /dev/null +++ b/src/Mod/Material/App/Material.pyi @@ -0,0 +1,156 @@ +from Base.Metadata import export, no_args, sequence_protocol +from Base.BaseClass import BaseClass +from typing import Final, Dict + + +@export( + Include="Mod/Material/App/Materials.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +@sequence_protocol(sq_length=True, sq_item=True, sq_contains=True, mp_subscript=True) +class Material(BaseClass): + """ + Material descriptions. + + Author: David Carter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + LibraryName: Final[str] = ... + """Model library name.""" + + LibraryRoot: Final[str] = ... + """Model library path.""" + + LibraryIcon: Final[str] = ... + """Model icon path.""" + + Name: str = ... + """Model name.""" + + Directory: str = ... + """Model directory relative to the library root.""" + + UUID: Final[str] = ... + """Unique model identifier. This is only valid after the material is saved.""" + + Description: str = ... + """Description of the material.""" + + URL: str = ... + """URL to a material reference.""" + + Reference: str = ... + """Reference for material data.""" + + Parent: str = ... + """Parent material UUID.""" + + AuthorAndLicense: Final[str] = ... + """deprecated -- Author and license information.""" + + Author: str = ... + """Author information.""" + + License: str = ... + """License information.""" + + PhysicalModels: Final[list] = ... + """List of implemented models.""" + + AppearanceModels: Final[list] = ... + """List of implemented models.""" + + Tags: Final[list] = ... + """List of searchable tags.""" + + Properties: Final[dict] = ... + """deprecated -- Dictionary of all material properties.""" + + PhysicalProperties: Final[dict] = ... + """deprecated -- Dictionary of material physical properties.""" + + AppearanceProperties: Final[dict] = ... + """deprecated -- Dictionary of material appearance properties.""" + + LegacyProperties: Final[dict] = ... + """deprecated -- Dictionary of material legacy properties.""" + + PropertyObjects: Final[dict] = ... + """Dictionary of MaterialProperty objects.""" + + def addPhysicalModel(self) -> None: + """Add the physical model with the given UUID""" + ... + + def removePhysicalModel(self) -> None: + """Remove the physical model with the given UUID""" + ... + + def hasPhysicalModel(self) -> bool: + """Check if the material implements the physical model with the given UUID""" + ... + + def addAppearanceModel(self) -> None: + """Add the appearance model with the given UUID""" + ... + + def removeAppearanceModel(self) -> None: + """Remove the appearance model with the given UUID""" + ... + + def hasAppearanceModel(self) -> bool: + """Check if the material implements the appearance model with the given UUID""" + ... + + def isPhysicalModelComplete(self) -> bool: + """Check if the material implements the physical model with the given UUID, and has values defined for each property""" + ... + + def isAppearanceModelComplete(self) -> bool: + """Check if the material implements the appearance model with the given UUID, and has values defined for each property""" + ... + + def hasPhysicalProperty(self) -> bool: + """Check if the material implements the physical property with the given name""" + ... + + def hasAppearanceProperty(self) -> bool: + """Check if the material implements the appearance property with the given name""" + ... + + def hasLegacyProperties(self) -> bool: + """Returns true of there are legacy properties""" + ... + + def getPhysicalValue(self) -> str: + """Get the value associated with the property""" + ... + + def setPhysicalValue(self) -> None: + """Set the value associated with the property""" + ... + + def getAppearanceValue(self) -> str: + """Get the value associated with the property""" + ... + + def setAppearanceValue(self) -> None: + """Set the value associated with the property""" + ... + + def setValue(self) -> None: + """Set the value associated with the property""" + ... + + @no_args + def keys(self) -> list: + """Property keys""" + ... + + @no_args + def values(self) -> list: + """Property values""" + ... diff --git a/src/Mod/Material/App/MaterialFilter.pyi b/src/Mod/Material/App/MaterialFilter.pyi new file mode 100644 index 0000000000..f131306a4c --- /dev/null +++ b/src/Mod/Material/App/MaterialFilter.pyi @@ -0,0 +1,27 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import List + + +@export( + Include="Mod/Material/App/MaterialFilter.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +class MaterialFilter(BaseClass): + """ + Material filters. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Name: str = ... + """Name of the filter used to select a filter in a list""" + + RequiredModels: List = ... + """Materials must include the specified models.""" + + RequiredCompleteModels: List = ... + """Materials must have complete versions of the specified models.""" \ No newline at end of file diff --git a/src/Mod/Material/App/MaterialFilterOptions.pyi b/src/Mod/Material/App/MaterialFilterOptions.pyi new file mode 100644 index 0000000000..d3b6a5bd8e --- /dev/null +++ b/src/Mod/Material/App/MaterialFilterOptions.pyi @@ -0,0 +1,32 @@ +from Base.Metadata import export +from Base.BaseClass import BaseClass + + +@export( + Include="Mod/Material/App/MaterialFilter.h", + Namespace="Materials", + Constructor=True, + Delete=True +) +class MaterialFilterOptions(BaseClass): + """ + Material filtering options. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + IncludeFavorites: bool = ... + """Include materials marked as favorite.""" + + IncludeRecent: bool = ... + """Include recently used materials.""" + + IncludeEmptyFolders: bool = ... + """Include empty folders.""" + + IncludeEmptyLibraries: bool = ... + """Include empty libraries.""" + + IncludeLegacy: bool = ... + """Include materials using the older legacy format.""" diff --git a/src/Mod/Material/App/MaterialLibrary.pyi b/src/Mod/Material/App/MaterialLibrary.pyi new file mode 100644 index 0000000000..300689b02f --- /dev/null +++ b/src/Mod/Material/App/MaterialLibrary.pyi @@ -0,0 +1,32 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final + +@export( + Include="Mod/Material/App/MaterialLibrary.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +class MaterialLibrary(BaseClass): + """ + Material library. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Name: str = ... + """Name of the library""" + + Icon: str = ... + """String value of the icon.""" + + Directory: str = ... + """Local directory where the library is located. For non-local libraries this will be empty""" + + ReadOnly: bool = ... + """True if the library is local.""" + + Local: bool = ... + """True if the library is local.""" diff --git a/src/Mod/Material/App/MaterialManager.pyi b/src/Mod/Material/App/MaterialManager.pyi new file mode 100644 index 0000000000..493725bc01 --- /dev/null +++ b/src/Mod/Material/App/MaterialManager.pyi @@ -0,0 +1,70 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final, List, Dict, overload + +@export( + Include="Mod/Material/App/MaterialManager.h", + Namespace="Materials", + Constructor=True +) +class MaterialManager(BaseClass): + """ + Material descriptions. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + MaterialLibraries: Final[List] = ... + """List of Material libraries.""" + + Materials: Final[Dict] = ... + """List of Materials.""" + + def getMaterial(self) -> None: + """ + Get a material object by specifying its UUID + """ + ... + + def getMaterialByPath(self) -> None: + """ + Get a material object by specifying its path and library name + """ + ... + + def inheritMaterial(self) -> None: + """ + Create a new material object by specifying the UUID of its parent + """ + ... + + def materialsWithModel(self) -> None: + """ + Get a list of materials implementing the specified model + """ + ... + + def materialsWithModelComplete(self) -> None: + """ + Get a list of materials implementing the specified model, with values for all properties + """ + ... + + def save(self, **kwargs) -> None: + """ + Save the material in the specified library + """ + ... + + def filterMaterials(self, **kwargs) -> None: + """ + Returns a filtered material list + """ + ... + + def refresh(self) -> None: + """ + Refreshes the material tree. Use sparingly as this is an expensive operation. + """ + ... \ No newline at end of file diff --git a/src/Mod/Material/App/MaterialProperty.pyi b/src/Mod/Material/App/MaterialProperty.pyi new file mode 100644 index 0000000000..c5c827d484 --- /dev/null +++ b/src/Mod/Material/App/MaterialProperty.pyi @@ -0,0 +1,25 @@ +from Base.Metadata import export +from ModelProperty import ModelProperty +from typing import Final + +@export( + Include="Mod/Material/App/Materials.h", + Namespace="Materials", + FatherInclude="Mod/Material/App/Model.h", + FatherNamespace="Materials", + Constructor=True, + Delete=False, +) +class MaterialProperty(ModelProperty): + """ + Material property descriptions. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Value: Final[object] = None + """The value of the material property.""" + + Empty: Final[bool] = False + """The property value is undefined.""" diff --git a/src/Mod/Material/App/Model.pyi b/src/Mod/Material/App/Model.pyi new file mode 100644 index 0000000000..ed88aa0e8f --- /dev/null +++ b/src/Mod/Material/App/Model.pyi @@ -0,0 +1,65 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final, List, Dict, overload + +@export( + Include="Mod/Material/App/Model.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +class Model(BaseClass): + """ + Material model descriptions. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + LibraryName: Final[str] = "" + """Model library name.""" + + LibraryRoot: Final[str] = "" + """Model library path.""" + + LibraryIcon: Final[str] = "" + """Model icon path.""" + + Name: str = "" + """Model name.""" + + Type: str = "" + """Model type.""" + + Directory: str = "" + """Model directory.""" + + UUID: Final[str] = "" + """Unique model identifier.""" + + Description: str = "" + """Description of the model.""" + + URL: str = "" + """URL to a detailed description of the model.""" + + DOI: str = "" + """Digital Object Identifier (see https://doi.org/)""" + + Inherited: Final[List[str]] = [] + """List of inherited models identified by UUID.""" + + Properties: Final[Dict[str, str]] = {} + """Dictionary of model properties.""" + + def addInheritance(self) -> None: + """ + Add an inherited model. + """ + ... + + def addProperty(self) -> None: + """ + Add a model property. + """ + ... diff --git a/src/Mod/Material/App/ModelManager.pyi b/src/Mod/Material/App/ModelManager.pyi new file mode 100644 index 0000000000..e7e28f3435 --- /dev/null +++ b/src/Mod/Material/App/ModelManager.pyi @@ -0,0 +1,37 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final, List, Dict + +@export( + Include="Mod/Material/App/ModelManager.h", + Namespace="Materials", + Constructor=True +) +class ModelManager(BaseClass): + """ + Material model descriptions. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + ModelLibraries: Final[List] = ... + """List of model libraries.""" + + LocalModelLibraries: Final[List] = ... + """List of local model libraries.""" + + Models: Final[Dict] = ... + """List of model libraries.""" + + def getModel(self) -> ...: + """ + Get a model object by specifying its UUID + """ + ... + + def getModelByPath(self) -> ...: + """ + Get a model object by specifying its path + """ + ... diff --git a/src/Mod/Material/App/ModelProperty.pyi b/src/Mod/Material/App/ModelProperty.pyi new file mode 100644 index 0000000000..370f6f3422 --- /dev/null +++ b/src/Mod/Material/App/ModelProperty.pyi @@ -0,0 +1,51 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final + + +@export( + Include="Mod/Material/App/Model.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +class ModelProperty(BaseClass): + """ + Material property descriptions. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Name: str = ... + """Property name.""" + + DisplayName: str = ... + """Property display friendly name.""" + + Type: str = ... + """Property type.""" + + Units: str = ... + """Property units category.""" + + URL: str = ... + """URL to a detailed description of the property.""" + + Description: str = ... + """Property description.""" + + Columns: Final[list] = ... + """List of array columns.""" + + Inheritance: Final[str] = ... + """UUID of the model in which the property is defined.""" + + Inherited: Final[bool] = ... + """True if the property is inherited.""" + + def addColumn(self) -> None: + """ + Add a model property column. + """ + ... diff --git a/src/Mod/Material/App/UUIDs.pyi b/src/Mod/Material/App/UUIDs.pyi new file mode 100644 index 0000000000..2fd83a6f39 --- /dev/null +++ b/src/Mod/Material/App/UUIDs.pyi @@ -0,0 +1,167 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Final + +@export( + PythonName="Material.UUIDs", + Twin="ModelUUIDs", + TwinPointer="ModelUUIDs", + Include="Mod/Material/App/ModelUuids.h", + Namespace="Materials", + Constructor=True, + Delete=True, +) +class UUIDs(BaseClass): + """ + Material model UUID identifiers. + + Author: DavidCarter (dcarter@davidcarter.ca) + Licence: LGPL + """ + + Father: Final[str] = ... + """UUID for model System:Legacy/Father""" + + MaterialStandard: Final[str] = ... + """UUID for model System:Legacy/MaterialStandard""" + + ArrudaBoyce: Final[str] = ... + """UUID for model System:Mechanical/ArrudaBoyce""" + + Density: Final[str] = ... + """UUID for model System:Mechanical/Density""" + + Hardness: Final[str] = ... + """UUID for model System:Mechanical/Hardness""" + + IsotropicLinearElastic: Final[str] = ... + """UUID for model System:Mechanical/IsotropicLinearElastic""" + + LinearElastic: Final[str] = ... + """UUID for model System:Mechanical/LinearElastic""" + + Machinability: Final[str] = ... + """UUID for model System:Machining/Machinability""" + + MooneyRivlin: Final[str] = ... + """UUID for model System:Mechanical/MooneyRivlin""" + + NeoHooke: Final[str] = ... + """UUID for model System:Mechanical/NeoHooke""" + + OgdenN1: Final[str] = ... + """UUID for model System:Mechanical/OgdenN1""" + + OgdenN2: Final[str] = ... + """UUID for model System:Mechanical/OgdenN2""" + + OgdenN3: Final[str] = ... + """UUID for model System:Mechanical/OgdenN3""" + + OgdenYld2004p18: Final[str] = ... + """UUID for model System:Mechanical/OgdenYld2004p18""" + + OrthotropicLinearElastic: Final[str] = ... + """UUID for model System:Mechanical/OrthotropicLinearElastic""" + + PolynomialN1: Final[str] = ... + """UUID for model System:Mechanical/PolynomialN1""" + + PolynomialN2: Final[str] = ... + """UUID for model System:Mechanical/PolynomialN2""" + + PolynomialN3: Final[str] = ... + """UUID for model System:Mechanical/PolynomialN3""" + + ReducedPolynomialN1: Final[str] = ... + """UUID for model System:Mechanical/ReducedPolynomialN1""" + + ReducedPolynomialN2: Final[str] = ... + """UUID for model System:Mechanical/ReducedPolynomialN2""" + + ReducedPolynomialN3: Final[str] = ... + """UUID for model System:Mechanical/ReducedPolynomialN3""" + + Yeoh: Final[str] = ... + """UUID for model System:Mechanical/Yeoh""" + + Fluid: Final[str] = ... + """UUID for model System:Fluid/Fluid""" + + Thermal: Final[str] = ... + """UUID for model System:Thermal/Thermal""" + + Electromagnetic: Final[str] = ... + """UUID for model System:Electromagnetic/Electromagnetic""" + + Architectural: Final[str] = ... + """UUID for model System:Architectural/Architectural""" + + ArchitecturalRendering: Final[str] = ... + """UUID for model System:Architectural/ArchitecturalRendering""" + + Costs: Final[str] = ... + """UUID for model System:Costs/Costs""" + + BasicRendering: Final[str] = ... + """UUID for model System:Rendering/BasicRendering""" + + TextureRendering: Final[str] = ... + """UUID for model System:Rendering/TextureRendering""" + + AdvancedRendering: Final[str] = ... + """UUID for model System:Rendering/AdvancedRendering""" + + VectorRendering: Final[str] = ... + """UUID for model System:Rendering/VectorRendering""" + + RenderAppleseed: Final[str] = ... + """UUID for model System:Rendering/RenderAppleseed""" + + RenderCarpaint: Final[str] = ... + """UUID for model System:Rendering/RenderCarpaint""" + + RenderCycles: Final[str] = ... + """UUID for model System:Rendering/RenderCycles""" + + RenderDiffuse: Final[str] = ... + """UUID for model System:Rendering/RenderDiffuse""" + + RenderDisney: Final[str] = ... + """UUID for model System:Rendering/RenderDisney""" + + RenderEmission: Final[str] = ... + """UUID for model System:Rendering/RenderEmission""" + + RenderGlass: Final[str] = ... + """UUID for model System:Rendering/RenderGlass""" + + RenderLuxcore: Final[str] = ... + """UUID for model System:Rendering/RenderLuxcore""" + + RenderLuxrender: Final[str] = ... + """UUID for model System:Rendering/RenderLuxrender""" + + RenderMixed: Final[str] = ... + """UUID for model System:Rendering/RenderMixed""" + + RenderOspray: Final[str] = ... + """UUID for model System:Rendering/RenderOspray""" + + RenderPbrt: Final[str] = ... + """UUID for model System:Rendering/RenderPbrt""" + + RenderPovray: Final[str] = ... + """UUID for model System:Rendering/RenderPovray""" + + RenderSubstancePBR: Final[str] = ... + """UUID for model System:Rendering/RenderSubstancePBR""" + + RenderTexture: Final[str] = ... + """UUID for model System:Rendering/RenderTexture""" + + RenderWB: Final[str] = ... + """UUID for model System:Rendering/RenderWB""" + + TestModel: Final[str] = ... + """UUID for model System:Test/Test Model""" diff --git a/src/Mod/Material/Gui/CMakeLists.txt b/src/Mod/Material/Gui/CMakeLists.txt index a466a6f988..7364da6c27 100644 --- a/src/Mod/Material/Gui/CMakeLists.txt +++ b/src/Mod/Material/Gui/CMakeLists.txt @@ -31,6 +31,7 @@ qt_create_resource_file(${Material_TR_QRC} ${QM_SRCS}) qt_add_resources(MatGui_QRC_SRCS Resources/Material.qrc ${Material_TR_QRC}) generate_from_xml(MaterialTreeWidgetPy) +generate_from_py_(MaterialTreeWidget) SET(Python_SRCS MaterialTreeWidgetPy.xml diff --git a/src/Mod/Material/Gui/MaterialTreeWidget.pyi b/src/Mod/Material/Gui/MaterialTreeWidget.pyi new file mode 100644 index 0000000000..e2acb43211 --- /dev/null +++ b/src/Mod/Material/Gui/MaterialTreeWidget.pyi @@ -0,0 +1,49 @@ +from Metadata import export, constmethod, forward_declarations, class_declarations, sequence_protocol +from Base.BaseClass import BaseClass +from typing import Final, overload + +@export( + Twin="MaterialTreeWidget", + TwinPointer="MaterialTreeWidget", + Include="Mod/Material/Gui/MaterialTreeWidget.h", + Namespace="MatGui", + Constructor=True, + Delete=False, +) +class MaterialTreeWidget(BaseClass): + """ + Material tree widget. + """ + + UUID: str = ... + """Material UUID.""" + + expanded: bool = ... + """Expand material tree.""" + + IncludeFavorites: bool = ... + """Include favorites in the material list.""" + + IncludeRecent: bool = ... + """Include recently used materials in the material list.""" + + IncludeEmptyFolders: bool = ... + """Include empty folders in the material list.""" + + IncludeEmptyLibraries: bool = ... + """Include empty libraries in the material list.""" + + IncludeLegacy: bool = ... + """Include legacy materials in the material list.""" + + def setFilter(self) -> None: + """ + Set the material filter or list of filters. + """ + ... + + def selectFilter(self) -> None: + """ + Set the current material filter. + """ + ... diff --git a/src/Tools/bindings/model/generateModel_Python.py b/src/Tools/bindings/model/generateModel_Python.py index 2f0a7ff017..d00b4352d2 100644 --- a/src/Tools/bindings/model/generateModel_Python.py +++ b/src/Tools/bindings/model/generateModel_Python.py @@ -492,6 +492,7 @@ def _parse_class(class_node, source_code: str, path: str, imports_mapping: dict) # Parse imports to compute module metadata module_name = _get_module_from_path(path) + imported_from_module = imports_mapping[base_class_name] parent_module_name = _extract_module_name(imported_from_module, module_name)