ansys-speos-core 0.6.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/PKG-INFO +43 -17
  2. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/README.rst +28 -2
  3. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/pyproject.toml +15 -15
  4. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/generic/constants.py +1 -1
  5. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/face.py +1 -1
  6. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/scene.py +34 -0
  7. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/opt_prop.py +12 -4
  8. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/part.py +7 -9
  9. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/workflow/combine_speos.py +1 -1
  10. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/LICENSE +0 -0
  11. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/__init__.py +0 -0
  12. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/body.py +0 -0
  13. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/bsdf.py +0 -0
  14. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/face.py +0 -0
  15. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/generic/general_methods.py +0 -0
  16. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/generic/visualization_methods.py +0 -0
  17. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/geo_ref.py +0 -0
  18. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/intensity.py +0 -0
  19. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/__init__.py +0 -0
  20. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/body.py +0 -0
  21. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/client.py +0 -0
  22. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/crud.py +0 -0
  23. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/intensity_template.py +0 -0
  24. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/job.py +0 -0
  25. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/part.py +0 -0
  26. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/proto_message_utils.py +0 -0
  27. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/sensor_template.py +0 -0
  28. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/simulation_template.py +0 -0
  29. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/sop_template.py +0 -0
  30. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/source_template.py +0 -0
  31. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/spectrum.py +0 -0
  32. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/kernel/vop_template.py +0 -0
  33. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/launcher.py +0 -0
  34. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/logger.py +0 -0
  35. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/lxp.py +0 -0
  36. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/project.py +0 -0
  37. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/proto_message_utils.py +0 -0
  38. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/py.typed +0 -0
  39. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/sensor.py +0 -0
  40. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/simulation.py +0 -0
  41. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/source.py +0 -0
  42. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/spectrum.py +0 -0
  43. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/speos.py +0 -0
  44. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/workflow/__init__.py +0 -0
  45. {ansys_speos_core-0.6.0 → ansys_speos_core-0.6.1}/src/ansys/speos/core/workflow/open_result.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ansys-speos-core
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A Python wrapper for Ansys Speos
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
@@ -21,13 +21,13 @@ Classifier: Topic :: Scientific/Engineering :: Physics
21
21
  Classifier: Topic :: Scientific/Engineering :: Information Analysis
22
22
  License-File: LICENSE
23
23
  Requires-Dist: protobuf>=3.20,<7
24
- Requires-Dist: grpcio>=1.50.0,<1.71
24
+ Requires-Dist: grpcio>=1.50.0,<1.75
25
25
  Requires-Dist: grpcio-health-checking>=1.45.0,<1.68
26
- Requires-Dist: ansys-api-speos==0.15.2
26
+ Requires-Dist: ansys-api-speos==0.15.3
27
27
  Requires-Dist: ansys-tools-path>=0.3.1
28
28
  Requires-Dist: numpy>=1.20.3,<3
29
- Requires-Dist: comtypes>=1.4,<1.5
30
- Requires-Dist: ansys-sphinx-theme==1.5.2 ; extra == "doc"
29
+ Requires-Dist: comtypes>=1.4,<1.5; platform_system=='Windows'
30
+ Requires-Dist: ansys-sphinx-theme==1.6.0 ; extra == "doc"
31
31
  Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
32
32
  Requires-Dist: Sphinx==8.1.3 ; extra == "doc"
33
33
  Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
@@ -37,26 +37,26 @@ Requires-Dist: sphinx-jinja==2.0.2 ; extra == "doc"
37
37
  Requires-Dist: sphinxcontrib-mermaid==1.0.0 ; extra == "doc"
38
38
  Requires-Dist: myst-parser==4.0.1 ; extra == "doc"
39
39
  Requires-Dist: nbsphinx==0.9.7 ; extra == "doc"
40
- Requires-Dist: jupytext==1.17.2 ; extra == "doc"
41
- Requires-Dist: jupyterlab==4.4.3 ; extra == "doc"
42
- Requires-Dist: jupyter-server==2.16.0 ; extra == "doc"
40
+ Requires-Dist: jupytext==1.17.3 ; extra == "doc"
41
+ Requires-Dist: jupyterlab==4.4.7 ; extra == "doc"
42
+ Requires-Dist: jupyter-server==2.17.0 ; extra == "doc"
43
43
  Requires-Dist: nbconvert==7.16.6 ; extra == "doc"
44
- Requires-Dist: pyvista[jupyter]>=0.43,<0.46 ; extra == "doc"
44
+ Requires-Dist: pyvista[jupyter]>=0.43,<0.47 ; extra == "doc"
45
45
  Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "doc"
46
- Requires-Dist: pyvista>=0.40.0,<0.46 ; extra == "graphics"
46
+ Requires-Dist: pyvista>=0.40.0,<0.47 ; extra == "graphics"
47
47
  Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "graphics"
48
48
  Requires-Dist: matplotlib ; extra == "jupyter"
49
49
  Requires-Dist: jupyterlab>=3 ; extra == "jupyter"
50
50
  Requires-Dist: ipywidgets ; extra == "jupyter"
51
- Requires-Dist: pyvista[jupyter]>=0.43,<0.46 ; extra == "jupyter"
51
+ Requires-Dist: pyvista[jupyter]>=0.43,<0.47 ; extra == "jupyter"
52
52
  Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "jupyter"
53
- Requires-Dist: notebook==7.4.3 ; extra == "jupyter"
53
+ Requires-Dist: notebook==7.4.5 ; extra == "jupyter"
54
54
  Requires-Dist: psutil==7.0.0 ; extra == "tests"
55
- Requires-Dist: pytest==8.4.1 ; extra == "tests"
56
- Requires-Dist: pyvista>=0.40.0,<0.46 ; extra == "tests"
55
+ Requires-Dist: pytest==8.4.2 ; extra == "tests"
56
+ Requires-Dist: pyvista>=0.40.0,<0.47 ; extra == "tests"
57
57
  Requires-Dist: ansys-tools-visualization-interface>=0.8.3 ; extra == "tests"
58
58
  Requires-Dist: ansys-platform-instancemanagement>=1.0.3 ; extra == "tests"
59
- Requires-Dist: pytest-cov==6.2.1 ; extra == "tests"
59
+ Requires-Dist: pytest-cov==6.3.0 ; extra == "tests"
60
60
  Project-URL: Changelog, https://github.com/ansys/pyspeos/blob/main/doc/source/changelog.rst
61
61
  Project-URL: Discussions, https://github.com/ansys/pyspeos/discussions
62
62
  Project-URL: Documentation, https://speos.docs.pyansys.com/
@@ -102,7 +102,7 @@ PySpeos library
102
102
 
103
103
  Project overview
104
104
  ----------------
105
- ``PySpeos`` is a Python library that gathers functionalities and tools based on remote API of Ansys software `Speos <https://www.ansys.com/products/optics>`_ .
105
+ ``PySpeos`` is a Python library that gathers functionalities and tools based on remote API provided by gRPC server of Ansys software `Speos <https://www.ansys.com/products/optics>`_ .
106
106
 
107
107
  Installation
108
108
  ------------
@@ -110,7 +110,6 @@ Installation can be done using the published `package`_ or the repository `sourc
110
110
 
111
111
  Package
112
112
  ~~~~~~~
113
- .. warning:: Release is in progress. It might take some time before it becomes available. Until then, please use `Sources`_.
114
113
 
115
114
  This repository is deployed as the Python packages `ansys-speos-core <https://pypi.org/project/ansys-speos-core>`_.
116
115
  As usual, installation is done by running:
@@ -262,6 +261,33 @@ Use jupyter notebook
262
261
 
263
262
  jupyter notebook can be downloaded from the documentations example section.
264
263
 
264
+ Features
265
+ --------
266
+
267
+ Information of the latest stable release features:
268
+
269
+ PySpeos core features
270
+ ~~~~~~~~~~~~~~~~~~~~~
271
+
272
+ Features supported in the latest release can be found at:
273
+
274
+ * `Optical Materials <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/opt_prop/OptProp.html>`_
275
+ * `Light Sources <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/source/index.html>`_
276
+ * `Sensors <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/sensor/index.html>`_
277
+ * `Simulations <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/simulation/index.html>`_
278
+ * `BSDF Viewer <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/bsdf/index.html>`_
279
+ * `Light Path Finder <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/lxp/LightPathFinder.html>`_
280
+
281
+ Speos RPC features
282
+ ~~~~~~~~~~~~~~~~~~
283
+
284
+ Speos RPC is based on a gRPC server and provides APIs to interact with Speos solver.
285
+
286
+ Features supported in the latest Speos RPC can be found at:
287
+ `Ansys Speos for developers Speos RPC <https://developer.ansys.com/docs/speos>`_.
288
+
289
+
290
+
265
291
  License
266
292
  -------
267
293
  `PySpeos`_ is licensed under the MIT license.
@@ -32,7 +32,7 @@ PySpeos library
32
32
 
33
33
  Project overview
34
34
  ----------------
35
- ``PySpeos`` is a Python library that gathers functionalities and tools based on remote API of Ansys software `Speos <https://www.ansys.com/products/optics>`_ .
35
+ ``PySpeos`` is a Python library that gathers functionalities and tools based on remote API provided by gRPC server of Ansys software `Speos <https://www.ansys.com/products/optics>`_ .
36
36
 
37
37
  Installation
38
38
  ------------
@@ -40,7 +40,6 @@ Installation can be done using the published `package`_ or the repository `sourc
40
40
 
41
41
  Package
42
42
  ~~~~~~~
43
- .. warning:: Release is in progress. It might take some time before it becomes available. Until then, please use `Sources`_.
44
43
 
45
44
  This repository is deployed as the Python packages `ansys-speos-core <https://pypi.org/project/ansys-speos-core>`_.
46
45
  As usual, installation is done by running:
@@ -192,6 +191,33 @@ Use jupyter notebook
192
191
 
193
192
  jupyter notebook can be downloaded from the documentations example section.
194
193
 
194
+ Features
195
+ --------
196
+
197
+ Information of the latest stable release features:
198
+
199
+ PySpeos core features
200
+ ~~~~~~~~~~~~~~~~~~~~~
201
+
202
+ Features supported in the latest release can be found at:
203
+
204
+ * `Optical Materials <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/opt_prop/OptProp.html>`_
205
+ * `Light Sources <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/source/index.html>`_
206
+ * `Sensors <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/sensor/index.html>`_
207
+ * `Simulations <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/simulation/index.html>`_
208
+ * `BSDF Viewer <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/bsdf/index.html>`_
209
+ * `Light Path Finder <https://speos.docs.pyansys.com/version/stable/api/ansys/speos/core/lxp/LightPathFinder.html>`_
210
+
211
+ Speos RPC features
212
+ ~~~~~~~~~~~~~~~~~~
213
+
214
+ Speos RPC is based on a gRPC server and provides APIs to interact with Speos solver.
215
+
216
+ Features supported in the latest Speos RPC can be found at:
217
+ `Ansys Speos for developers Speos RPC <https://developer.ansys.com/docs/speos>`_.
218
+
219
+
220
+
195
221
  License
196
222
  -------
197
223
  `PySpeos`_ is licensed under the MIT license.
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "ansys-speos-core"
7
- version = "0.6.0"
7
+ version = "0.6.1"
8
8
  description = "A Python wrapper for Ansys Speos"
9
9
  readme = "README.rst"
10
10
  requires-python = ">=3.10"
@@ -28,37 +28,37 @@ classifiers=[
28
28
  ]
29
29
  dependencies=[
30
30
  "protobuf>=3.20,<7",
31
- "grpcio>=1.50.0,<1.71",
31
+ "grpcio>=1.50.0,<1.75",
32
32
  "grpcio-health-checking>=1.45.0,<1.68",
33
- "ansys-api-speos==0.15.2",
33
+ "ansys-api-speos==0.15.3",
34
34
  "ansys-tools-path>=0.3.1",
35
35
  "numpy>=1.20.3,<3",
36
- "comtypes>=1.4,<1.5",
36
+ "comtypes>=1.4,<1.5; platform_system=='Windows'",
37
37
  ]
38
38
 
39
39
  [project.optional-dependencies]
40
40
  graphics = [
41
- "pyvista>=0.40.0,<0.46",
41
+ "pyvista>=0.40.0,<0.47",
42
42
  "ansys-tools-visualization-interface>=0.8.3",
43
43
  ]
44
44
  tests = [
45
45
  "psutil==7.0.0",
46
- "pytest==8.4.1",
47
- "pyvista>=0.40.0,<0.46",
46
+ "pytest==8.4.2",
47
+ "pyvista>=0.40.0,<0.47",
48
48
  "ansys-tools-visualization-interface>=0.8.3",
49
49
  "ansys-platform-instancemanagement>=1.0.3",
50
- "pytest-cov==6.2.1",
50
+ "pytest-cov==6.3.0",
51
51
  ]
52
52
  jupyter = [
53
53
  "matplotlib",
54
54
  "jupyterlab>=3",
55
55
  "ipywidgets",
56
- "pyvista[jupyter]>=0.43,<0.46",
56
+ "pyvista[jupyter]>=0.43,<0.47",
57
57
  "ansys-tools-visualization-interface>=0.8.3",
58
- "notebook==7.4.3",
58
+ "notebook==7.4.5",
59
59
  ]
60
60
  doc = [
61
- "ansys-sphinx-theme==1.5.2",
61
+ "ansys-sphinx-theme==1.6.0",
62
62
  "numpydoc==1.8.0",
63
63
  "Sphinx==8.1.3",
64
64
  "sphinx-copybutton==0.5.2",
@@ -68,11 +68,11 @@ doc = [
68
68
  "sphinxcontrib-mermaid==1.0.0",
69
69
  "myst-parser==4.0.1",
70
70
  "nbsphinx==0.9.7",
71
- "jupytext==1.17.2",
72
- "jupyterlab==4.4.3",
73
- "jupyter-server==2.16.0",
71
+ "jupytext==1.17.3",
72
+ "jupyterlab==4.4.7",
73
+ "jupyter-server==2.17.0",
74
74
  "nbconvert==7.16.6",
75
- "pyvista[jupyter]>=0.43,<0.46",
75
+ "pyvista[jupyter]>=0.43,<0.47",
76
76
  "ansys-tools-visualization-interface>=0.8.3",
77
77
  ]
78
78
 
@@ -28,7 +28,7 @@ DEFAULT_HOST: str = "localhost"
28
28
  """Default host used by Speos RPC server and client """
29
29
  DEFAULT_PORT: str = "50098"
30
30
  """Default port used by Speos RPC server and client """
31
- DEFAULT_VERSION: str = "251"
31
+ DEFAULT_VERSION: str = "252"
32
32
  """Latest supported Speos version of the current PySpeos Package"""
33
33
  MAX_SERVER_MESSAGE_LENGTH: int = int(os.environ.get("SPEOS_MAX_MESSAGE_LENGTH", 256 * 1024**2))
34
34
  """Maximum message length value accepted by the Speos RPC server,
@@ -304,7 +304,7 @@ class FaceStub(CrudStub):
304
304
  sizes=[
305
305
  len(message.vertices),
306
306
  len(message.facets),
307
- len(message.texture_coordinates_channels),
307
+ len(message.vertices_data),
308
308
  ],
309
309
  )
310
310
  )
@@ -31,6 +31,7 @@ from ansys.api.speos.scene.v2 import (
31
31
  )
32
32
  from ansys.speos.core.kernel.crud import CrudItem, CrudStub
33
33
  from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str
34
+ from ansys.speos.core.kernel.sop_template import ProtoSOPTemplate, SOPTemplateStub
34
35
 
35
36
  ProtoScene = messages.Scene
36
37
  """Scene protobuf class : ansys.api.speos.scene.v2.scene_pb2.Scene"""
@@ -171,6 +172,39 @@ class SceneStub(CrudStub):
171
172
  def __init__(self, channel):
172
173
  super().__init__(stub=service.ScenesManagerStub(channel=channel))
173
174
  self._actions_stub = service.SceneActionsStub(channel=channel)
175
+ self._is_texture_available = self._check_if_texture_available(channel=channel)
176
+
177
+ def _check_if_texture_available(self, channel) -> bool:
178
+ sop_t_stub = SOPTemplateStub(channel=channel)
179
+ # Create SOPTemplate then scene
180
+ sop_t_link = sop_t_stub.create(
181
+ message=ProtoSOPTemplate(
182
+ name="checkForTextureAvailability",
183
+ optical_polished=ProtoSOPTemplate.OpticalPolished(),
184
+ )
185
+ )
186
+ sce_link = self.create(
187
+ ProtoScene(
188
+ name="checkForTextureAvailability",
189
+ materials=[
190
+ ProtoScene.MaterialInstance(
191
+ name="checkForTextureAvailability", sop_guid=sop_t_link.key
192
+ )
193
+ ],
194
+ )
195
+ )
196
+
197
+ # Read scene (aim is to see if the server knows the new field sop_guid or just ignored it)
198
+ sce_msg = sce_link.get()
199
+
200
+ # Don't forget to delete created objects
201
+ sop_t_link.delete()
202
+ sce_link.delete()
203
+
204
+ # Check presence of sop_guid field -> if yes then texture is available
205
+ if sce_msg.materials[0].HasField("sop_guid"):
206
+ return True
207
+ return False
174
208
 
175
209
  def create(self, message: ProtoScene = None) -> SceneLink:
176
210
  """Create a new entry.
@@ -436,8 +436,13 @@ class OptProp:
436
436
  self.sop_template_link = self._project.client.sop_templates().create(
437
437
  message=self._sop_template
438
438
  )
439
+ # Always clean sop_guids to be sure that we never use both sop_guids and sop_guid
439
440
  self._material_instance.ClearField("sop_guids")
440
- self._material_instance.sop_guids.append(self.sop_template_link.key)
441
+ # Fill sop_guid(s) field according to the server capability regarding textures
442
+ if self._project.client.scenes()._is_texture_available:
443
+ self._material_instance.sop_guid = self.sop_template_link.key
444
+ else:
445
+ self._material_instance.sop_guids.append(self.sop_template_link.key)
441
446
  elif self.sop_template_link.get() != self._sop_template:
442
447
  self.sop_template_link.set(
443
448
  data=self._sop_template
@@ -519,7 +524,8 @@ class OptProp:
519
524
  self.sop_template_link.delete()
520
525
  self.sop_template_link = None
521
526
 
522
- # Reset then the sop_guids (as the sop template was deleted just above)
527
+ # Reset then the sop_guid/sop_guids fields (as the sop template was deleted just above)
528
+ self._material_instance.ClearField("sop_guid")
523
529
  self._material_instance.ClearField("sop_guids")
524
530
 
525
531
  # Remove the material instance from the scene
@@ -537,11 +543,13 @@ class OptProp:
537
543
  self._material_instance.metadata.pop("UniqueId")
538
544
  return self
539
545
 
540
- def _fill(self, mat_inst):
546
+ def _fill(self, mat_inst: ProtoScene.MaterialInstance):
541
547
  self._unique_id = mat_inst.metadata["UniqueId"]
542
548
  self._material_instance = mat_inst
543
549
  self.vop_template_link = self._project.client[mat_inst.vop_guid]
544
- if len(mat_inst.sop_guids) > 0:
550
+ if mat_inst.HasField("sop_guid"):
551
+ self.sop_template_link = self._project.client[mat_inst.sop_guid]
552
+ elif len(mat_inst.sop_guids) > 0:
545
553
  self.sop_template_link = self._project.client[mat_inst.sop_guids[0]]
546
554
  else: # Specific case for ambient material
547
555
  self._sop_template = None
@@ -295,14 +295,13 @@ class Part:
295
295
  else:
296
296
  update_part = False
297
297
  else:
298
- self._parent_part._part.parts.append(
298
+ parent_part_data.parts.append(
299
299
  self._part_instance
300
300
  ) # if no, just add it to the list of part instances
301
301
 
302
- if self._parent_part.part_link is not None and update_part:
303
- self._parent_part.part_link.set(
304
- data=self._parent_part._part
305
- ) # update parent part
302
+ if update_part:
303
+ self._parent_part._part = parent_part_data
304
+ self._parent_part.part_link.set(data=parent_part_data) # update parent part
306
305
 
307
306
  return self
308
307
 
@@ -360,11 +359,10 @@ class Part:
360
359
  None,
361
360
  )
362
361
  if part_inst is not None:
363
- self._parent_part._part.parts.remove(part_inst)
362
+ parent_part_data.parts.remove(part_inst)
363
+ self._parent_part._part = parent_part_data
364
364
  if self._parent_part.part_link is not None:
365
- self._parent_part.part_link.set(
366
- data=self._parent_part._part
367
- ) # update parent part
365
+ self._parent_part.part_link.set(data=parent_part_data) # update parent part
368
366
 
369
367
  # Reset the _unique_id
370
368
  self._unique_id = None
@@ -151,7 +151,7 @@ def _combine(
151
151
  part_data.parts.append(part_inst)
152
152
 
153
153
  for mat in scene_tmp_data.materials:
154
- if len(mat.sop_guids) > 0:
154
+ if mat.HasField("sop_guid") or mat.HasField("texture") or len(mat.sop_guids) > 0:
155
155
  mat.name = spc.name + "." + mat.name
156
156
  mat.geometries.geo_paths[:] = [spc.name + "/" + x for x in mat.geometries.geo_paths]
157
157
  scene_data.materials.append(mat)