Megascan Link Javascript Package¶
This package is responsible to utilize the Substance Painter API to import the Megascan Assets into the current opened project.
It receives the data over websocket from the Megascan Link Python Package.
Utility¶
checkIfSettingsIsSet
(setting)¶Helper function that will check if a propriety of a section is set or not by confronting it with the following values [“true”, “yes”, “y”, “ok”]
- Arguments
setting (String) – String value to check
getHpMeshes
(asset)¶Extract for the lod list of an asset the High Poly meshes
- Arguments
asset (Object) – the asset from which extract the High Poly meshes
- Returns
Array – the list of High poly meshes paths
removeFromAssets
(asset, assets)¶Filter the Megascan Asset list removing a specific asset
- Arguments
asset (Object) – the asset to remove
assets (Array) – the list of asset to filter
String Extensions¶
String.
format
¶Simple extension to the String object that allow to format a string python style taken from StackOverflow
QML Modules¶
- class
main
: public PainterPlugin¶Public Functions
- void
importResources
(Object data)¶Import the Megascan Assets textures in the project and put them in the Megascan/{AssetName} path for each asset
- Parameters
data
: Quixel Bridge Json data
- void
setUpAndBake
(Object asset)¶Set up the baking parameters based on the user config preset parameters and then perform the bake
- Parameters
asset
: the asset to retrive the bake data from
- void
createProjectWithResources
(Object asset, Array imports)¶Create a new project using the defined asset as the Mesh Asset
- Parameters
asset
: Json data of the Mesh asset (Quixel Bridge)
imports
: Array of Json data of additonal resources to import in the newly created project
- boolean
checkForMeshAssets
(Object data)¶Check if in the Bridge json data are present some Assets that have associated a Mesh Asset
- Return
returns True if there is an 3D Asset, False otherwise
- Parameters
data
: Quixel Bridge Json data to checkPublic Members
bool projectCreated READ dummyGetter_projectCreated_ignore
global flag that indicates that a project has been created
Object settings READ dummyGetter_settings_ignore
the settings values of the user config file
Object meshAsset READ dummyGetter_meshAsset_ignore
the current Megascan 3D asset used in the project
Private Members
var Component onCompleted
Simply indicates that the plugin has been loaded correctly
- var
onActiveTextureSetChanged
¶Used to set up the textures set resolution and channel if a new project is being create by this plugin Also set up and started, if requested in the config file, the baking process
- AlgDialog
saveError
¶Dialog showed to the user when the plugin can’t save the current opened project
This happens for example when the users as project opened that has not been saved to disk
- AlgSelectDialog
selectMesh
¶Instance of AlgSelectDialog, this dialog is used for starting a new project with the mesh selected by the user from a list of meshes in the megascan data currently being imported, if the are none or only one 3D mesh this dialog is not showed
- AlgNewProject
createProject
¶Instance of AlgNewProject, this dialog is showed to the user if there is a 3D Mesh in the currently imported data.
As Substance Painter only supports a single mesh per project we ask the user if he want to create a new project with the the data he is currently importing.
This dialog can be suppressed with the config option
askcreateproject
toFalse
- class
AlgNewProject
: public AlgDialog¶This dialog is presented to the user when there is a 3D Mesh asset in the import data and the config option
askcreateproject
is set toTrue
The dialog asks the user if he want to import the assets bitmaps (since Painter only supports a single mesh per project) or wants to create a new project with one of them as the base mesh.
Public Functions
- void
openWithData
(Object data)¶Open the dialog feeding the JSON data coming from Quixel Bridge
- Parameters
data
: the Quixel Bridge JSON dataPublic Members
Object importData READ dummyGetter_importData_ignore
the JSON data currently being imported
Signals
- void
importPressed
(var importData)¶Emitted when the user press the Import button
- Parameters
importData
: the JSON data currently being imported
- void
newProjectPressed
(var importData)¶Emitted when the user press the New Project button
- Parameters
importData
: the JSON data currently being importedPrivate Members
- var
title
¶The tile of the dialog
- var
visible
¶Visibility of the dialog - default is false
- var
width
¶width of the dialog -size if fixed to
400x150
- var
height
¶height of the dialog -size if fixed to
400x150
- var
maximumHeight
¶is set to be equal to the
height
variable this blocks the user to resize the dialog
- var
maximumWidth
¶is set to be equal to the
width
variable this blocks the user to resize the dialog
- var
minimumHeight
¶is set to be equal to the
height
variable this blocks the user to resize the dialog
- var
minimumWidth
¶is set to be equal to the
width
variable this blocks the user to resize the dialog
- AlgButton
importBtn
¶Dialog Import button - emits the importPressed signal
- AlgButton
newPrjBtn
¶Dialog New Projecy button - emits the newProjectPressed signal
- namespace
QtQuick
¶
- namespace
Painter
¶
- namespace
QtWebSockets
¶
- namespace
AlgWidgets
¶
- class
AlgSelectDialog
: public AlgDialog¶This dialog is presented to the user if, when creating a new project, there is more than one 3D Mesh asset in the import data.
This dialogs allow the user to select a 3D Asset to use a the base mesh for the new project, if there are other 3D Assets only their bitmaps are imported.
Public Functions
- void
addAssets
(assetsIn)¶Add assets to the list widgets of the dialog
- Parameters
the
: list of assets to add
- void
openWithAssets
(assetsIn)¶Shorthand function to open the dialog and populate the asset list
- Parameters
the
: list of assets to add to the dialog listPublic Members
Object assets READ dummyGetter_assets_ignore
the list of 3d assets
Object importData READ dummyGetter_importData_ignore
the list of 3d assets
int currentIndex READ dummyGetter_currentIndex_ignore
the current index selected in the list
Private Members
- var
title
¶The tile of the dialog
- var
width
¶width of the dialog -size if fixed to
400x300
- var
height
¶height of the dialog -size if fixed to
400x300
- var
maximumHeight
¶is set to be equal to the
height
variable this blocks the user to resize the dialog
- var
maximumWidth
¶is set to be equal to the
width
variable this blocks the user to resize the dialog
- var
minimumHeight
¶is set to be equal to the
height
variable this blocks the user to resize the dialog
- var
minimumWidth
¶is set to be equal to the
width
variable this blocks the user to resize the dialog
- var
defaultButtonText
¶the accept button text of the dialog - default is
Select
- ListView
assetListView
¶The List widget (ListView QML)
- ListModel
assetList
¶The model of the list, it holds the data needed to populate the widget
- Component
headerList
¶The header of the list
- Component
assetListDelegate
¶This is component instanciated for each entry in the model (assetList)