QuiltiX Plugins 0.0.1
Custom Plugins for QuiltiX
Loading...
Searching...
No Matches
plugin.glTFWidget Class Reference

glTF Viewer widget
More...

Inheritance diagram for plugin.glTFWidget:

Public Member Functions

 __init__ (self, parent=None)
 Sets up a web view and loads in a sample glTF viewer page.
 

Public Attributes

 web_view = QWebEngineView()
 
str viewer_options = '?hideSave=true'
 
str viewer_address = 'https://kwokcb.github.io/MaterialXLab/documents/gltfViewer_simple.html'
 
 page = glTFEnginePage(self.web_view)
 

Detailed Description

glTF Viewer widget

Definition at line 157 of file materialxgltf/plugin.py.

Constructor & Destructor Documentation

◆ __init__()

plugin.glTFWidget.__init__ ( self,
parent = None )

Sets up a web view and loads in a sample glTF viewer page.

Definition at line 161 of file materialxgltf/plugin.py.

161 def __init__(self, parent=None):
162 '''
163 @brief Sets up a web view and loads in a sample glTF viewer page.
164 '''
165 super(glTFWidget, self).__init__(parent)
166
167 self.setWindowTitle("glTF Viewer")
168
169 self.setFloating(False)
170
171 # Create a web view.
172 self.web_view = QWebEngineView()
173 self.viewer_options = '?hideSave=true'
174 self.viewer_options += '&env=https://kwokcb.github.io/MaterialXLab/resources/Lights/dreifaltigkeitsberg_1k.hdr'
175 self.viewer_address = 'https://kwokcb.github.io/MaterialXLab/documents/gltfViewer_simple.html'
176 # e.g. For debugging can set to local host if you want to run a local page
177 #self.viewer_address = 'http://localhost:8000/documents/gltfViewer_simple.html'
178 self.viewer_address += self.viewer_options
179 #self.logger.debug('glTF Viewer address: ' + self.viewer_address)
180
181 # Create a custom page and set it to the web view
182 self.page = glTFEnginePage(self.web_view)
183 self.web_view.setPage(self.page)
184
185 self.web_view.setUrl(QtCore.QUrl(self.viewer_address))
186
187 # Apply the request interceptor
188 #interceptor = MyRequestInterceptor()
189 #QWebEngineProfile.defaultProfile().setUrlRequestInterceptor(interceptor)
190
191 #settings = self.web_view.settings()
192 # Disable features that might trigger the error (general approach)
193 #settings.setAttribute(QWebEngineSettings.WebAttribute.LocalStorageEnabled, False)
194 #settings.setAttribute(QWebEngineSettings.WebAttribute.LocalContentCanAccessFileUrls, False)
195 #settings.setAttribute(QWebEngineSettings.WebAttribute.XSSAuditingEnabled, False)
196
197 # Set up the layout
198 layout = QVBoxLayout()
199 layout.addWidget(self.web_view)
200
201 # Create a central widget to hold the layout
202 central_widget = QWidget()
203 central_widget.setLayout(layout)
204
205 # Inject JavaScript after the page is loaded
206 #self.web_view.loadFinished.connect(self.page.injectJavaScript)
207
208 # Set the central widget of the dock widget
209 self.setWidget(central_widget)
210

Member Data Documentation

◆ page

plugin.glTFWidget.page = glTFEnginePage(self.web_view)

Definition at line 182 of file materialxgltf/plugin.py.

◆ viewer_address

plugin.glTFWidget.viewer_address = 'https://kwokcb.github.io/MaterialXLab/documents/gltfViewer_simple.html'

Definition at line 175 of file materialxgltf/plugin.py.

◆ viewer_options

str plugin.glTFWidget.viewer_options = '?hideSave=true'

Definition at line 173 of file materialxgltf/plugin.py.

◆ web_view

plugin.glTFWidget.web_view = QWebEngineView()

Definition at line 172 of file materialxgltf/plugin.py.


The documentation for this class was generated from the following file: