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

Classes

class  glTFEnginePage
 Custom web engine page for the glTF viewer. More...
 
class  GLTFHighlighter
 Highlighter for glTF text. More...
 
class  glTFWidget
 glTF Viewer widget
More...
 
class  QuiltiX_glTF_serializer
 glTF serializer for MaterialX More...
 

Functions

 after_ui_init ("quiltix.QuiltiXWindow" editor)
 After UI initialization, add the MaterialX glTF serializer to the editor.
 
str plugin_name ()
 Get the name of the plugin.
 
bool is_valid ()
 Check if the plugin is valid.
 
 __init__ (self)
 Initialize the JSON highlighter.
 
 highlight (self, text)
 Highlight the given JSON text.
 

Variables

bool have_highliting = True
 
 logger = logging.getLogger(__name__)
 
bool haveGLTF = False
 
bool has_materialxjsoncore = True
 
 lexer = JsonLexer()
 
 formatter = HtmlFormatter(linenos=False, style='github-dark')
 

Function Documentation

◆ __init__()

plugin.__init__ ( self)

Initialize the JSON highlighter.

Definition at line 43 of file materialxjson/plugin.py.

43 def __init__(self):
44 '''
45 @brief Initialize the JSON highlighter
46 '''
47 self.lexer = JsonLexer()
48 # We don't add line numbers since this get's copied with
49 # copy-paste.
50 self.formatter = HtmlFormatter(linenos=False, style='github-dark')
51

◆ after_ui_init()

plugin.after_ui_init ( "quiltix.QuiltiXWindow" editor)

After UI initialization, add the MaterialX glTF serializer to the editor.

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

588def after_ui_init(editor: "quiltix.QuiltiXWindow"):
589 '''
590 @brief After UI initialization, add the MaterialX glTF serializer to the editor.
591 '''
592 logger.debug("Adding MaterialX glTF serializer")
593 editor.gltf_serializer = QuiltiX_glTF_serializer(editor, constants.ROOT)
594

◆ highlight()

plugin.highlight ( self,
text )

Highlight the given JSON text.

Parameters
textThe JSON text to highlight
Returns
The highlighted HTML

Definition at line 52 of file materialxjson/plugin.py.

52 def highlight(self, text):
53 '''
54 @brief Highlight the given JSON text
55 @param text The JSON text to highlight
56 @return The highlighted HTML
57 '''
58 highlighted_html = highlight(text, self.lexer, self.formatter)
59 styles = (
60 f"<style>"
61 f"{self.formatter.get_style_defs('.highlight')}"
62 f"pre {{ line-height: 1.0; margin: 0; }}"
63 f"</style>"
64 )
65 full_html = f"<html><head>{styles}</head><body>{highlighted_html}</body></html>"
66 return full_html
67

◆ is_valid()

bool plugin.is_valid ( )

Check if the plugin is valid.

That is the glTF serializer module is installed.

Returns
True if the plugin is valid), False otherwise.

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

603def is_valid() -> bool:
604 '''
605 @brief Check if the plugin is valid. That is the glTF serializer module is installed.
606 @return True if the plugin is valid), False otherwise.
607 '''
608 return haveGLTF

◆ plugin_name()

str plugin.plugin_name ( )

Get the name of the plugin.

Returns
The name of the plugin.

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

595def plugin_name() -> str:
596 '''
597 @brief Get the name of the plugin.
598 @return The name of the plugin.'''
599 if haveGLTF:
600 return "MaterialX glTF Serializer"
601 return ""
602

Variable Documentation

◆ formatter

plugin.formatter = HtmlFormatter(linenos=False, style='github-dark')

Definition at line 50 of file materialxjson/plugin.py.

◆ has_materialxjsoncore

bool plugin.has_materialxjsoncore = True

Definition at line 27 of file materialxjson/plugin.py.

◆ have_highliting

bool plugin.have_highliting = True

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

◆ haveGLTF

bool plugin.haveGLTF = False

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

◆ lexer

plugin.lexer = JsonLexer()

Definition at line 47 of file materialxjson/plugin.py.

◆ logger

plugin.logger = logging.getLogger(__name__)

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