diff --git a/openpype/hosts/max/plugins/create/create_maxScene.py b/openpype/hosts/max/plugins/create/create_maxScene.py new file mode 100644 index 0000000000..52da615be4 --- /dev/null +++ b/openpype/hosts/max/plugins/create/create_maxScene.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +"""Creator plugin for creating raw max scene.""" +from openpype.hosts.max.api import plugin +from openpype.pipeline import CreatedInstance + + +class CreateMaxScene(plugin.MaxCreator): + identifier = "io.openpype.creators.max.maxScene" + label = "Max Scene(Raw)" + family = "maxScene" + icon = "gear" + + def create(self, subset_name, instance_data, pre_create_data): + from pymxs import runtime as rt + sel_obj = list(rt.selection) + instance = super(CreateMaxScene, self).create( + subset_name, + instance_data, + pre_create_data) # type: CreatedInstance + container = rt.getNodeByName(instance.data.get("instance_node")) + # TODO: Disable "Add to Containers?" Panel + # parent the selected cameras into the container + for obj in sel_obj: + obj.parent = container + # for additional work on the node: + # instance_node = rt.getNodeByName(instance.get("instance_node")) diff --git a/openpype/hosts/max/plugins/load/load_max_scene.py b/openpype/hosts/max/plugins/load/load_max_scene.py index b863b9363f..fa8b6b2894 100644 --- a/openpype/hosts/max/plugins/load/load_max_scene.py +++ b/openpype/hosts/max/plugins/load/load_max_scene.py @@ -9,7 +9,8 @@ from openpype.hosts.max.api import lib class MaxSceneLoader(load.LoaderPlugin): """Max Scene Loader""" - families = ["camera"] + families = ["camera", + "maxScene"] representations = ["max"] order = -8 icon = "code-fork" diff --git a/openpype/hosts/max/plugins/publish/extract_max_scene_raw.py b/openpype/hosts/max/plugins/publish/extract_max_scene_raw.py index cacc84c591..4e567ab76e 100644 --- a/openpype/hosts/max/plugins/publish/extract_max_scene_raw.py +++ b/openpype/hosts/max/plugins/publish/extract_max_scene_raw.py @@ -19,7 +19,8 @@ class ExtractMaxSceneRaw(publish.Extractor, order = pyblish.api.ExtractorOrder - 0.2 label = "Extract Max Scene (Raw)" - hosts = ["max"] + hosts = ["max", + "maxScene"] families = ["camera"] optional = True diff --git a/openpype/plugins/publish/integrate.py b/openpype/plugins/publish/integrate.py index b117006871..69b7734c70 100644 --- a/openpype/plugins/publish/integrate.py +++ b/openpype/plugins/publish/integrate.py @@ -84,6 +84,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): "camera", "animation", "model", + "maxScene", "mayaAscii", "mayaScene", "setdress", diff --git a/openpype/plugins/publish/integrate_legacy.py b/openpype/plugins/publish/integrate_legacy.py index b93abab1d8..66c2c9be51 100644 --- a/openpype/plugins/publish/integrate_legacy.py +++ b/openpype/plugins/publish/integrate_legacy.py @@ -80,6 +80,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): "camera", "animation", "model", + "maxScene", "mayaAscii", "mayaScene", "setdress", diff --git a/tools/build.ps1 b/tools/build.ps1 index 195b2dc75e..f60cb2d0c4 100644 --- a/tools/build.ps1 +++ b/tools/build.ps1 @@ -22,10 +22,10 @@ https://openpype.io/docs #> -$arguments=$ARGS -$disable_submodule_update="" -if($arguments -eq "--no-submodule-update") { - $disable_submodule_update=$true +$arguments = $ARGS +$disable_submodule_update = "" +if ($arguments -eq "--no-submodule-update") { + $disable_submodule_update = $true } $current_dir = Get-Location @@ -45,13 +45,11 @@ function Start-Progress { # $origpos.Y -= 1 - while (($job.State -eq "Running") -and ($job.State -ne "NotStarted")) - { + while (($job.State -eq "Running") -and ($job.State -ne "NotStarted")) { $host.UI.RawUI.CursorPosition = $origpos Write-Host $scroll[$idx] -NoNewline $idx++ - if ($idx -ge $scroll.Length) - { + if ($idx -ge $scroll.Length) { $idx = 0 } Start-Sleep -Milliseconds 100 @@ -59,7 +57,7 @@ function Start-Progress { # It's over - clear the activity indicator. $host.UI.RawUI.CursorPosition = $origpos Write-Host ' ' - <# + <# .SYNOPSIS Display spinner for running job .PARAMETER code @@ -69,17 +67,17 @@ function Start-Progress { function Exit-WithCode($exitcode) { - # Only exit this host process if it's a child of another PowerShell parent process... - $parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId - $parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name - if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) } + # Only exit this host process if it's a child of another PowerShell parent process... + $parentPID = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$PID" | Select-Object -Property ParentProcessId).ParentProcessId + $parentProcName = (Get-CimInstance -ClassName Win32_Process -Filter "ProcessId=$parentPID" | Select-Object -Property Name).Name + if ('powershell.exe' -eq $parentProcName) { $host.SetShouldExit($exitcode) } - exit $exitcode + exit $exitcode } function Show-PSWarning() { if ($PSVersionTable.PSVersion.Major -lt 7) { - Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White + Write-Color -Text "!!! ", "You are using old version of PowerShell - ", "$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor)" -Color Red, Yellow, White Write-Color -Text " Please update to at least 7.0 - ", "https://github.com/PowerShell/PowerShell/releases" -Color Yellow, White Exit-WithCode 1 } @@ -87,7 +85,7 @@ function Show-PSWarning() { function Install-Poetry() { Write-Color -Text ">>> ", "Installing Poetry ... " -Color Green, Gray - $env:POETRY_HOME="$openpype_root\.poetry" + $env:POETRY_HOME = "$openpype_root\.poetry" (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python - } @@ -126,8 +124,8 @@ $version_file = Get-Content -Path "$($openpype_root)\openpype\version.py" $result = [regex]::Matches($version_file, '__version__ = "(?\d+\.\d+.\d+.*)"') $openpype_version = $result[0].Groups['version'].Value if (-not $openpype_version) { - Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray - Exit-WithCode 1 + Write-Color -Text "!!! ", "Cannot determine OpenPype version." -Color Yellow, Gray + Exit-WithCode 1 } # Create build directory if not exist @@ -147,7 +145,8 @@ catch { if (-not $disable_submodule_update) { Write-Color -Text ">>> ", "Making sure submodules are up-to-date ..." -Color Green, Gray & git submodule update --init --recursive -} else { +} +else { Write-Color -Text "*** ", "Not updating submodules ..." -Color Green, Gray } @@ -158,7 +157,8 @@ if (-not (Test-Path -PathType Container -Path "$($env:POETRY_HOME)\bin")) { Write-Color -Text "NOT FOUND" -Color Yellow Write-Color -Text "*** ", "We need to install Poetry create virtual env first ..." -Color Yellow, Gray & "$openpype_root\tools\create_env.ps1" -} else { +} +else { Write-Color -Text "OK" -Color Green } @@ -173,8 +173,7 @@ $startTime = [int][double]::Parse((Get-Date -UFormat %s)) $out = & "$($env:POETRY_HOME)\bin\poetry" run python setup.py build 2>&1 Set-Content -Path "$($openpype_root)\build\build.log" -Value $out -if ($LASTEXITCODE -ne 0) -{ +if ($LASTEXITCODE -ne 0) { Write-Color -Text "------------------------------------------" -Color Red Get-Content "$($openpype_root)\build\build.log" Write-Color -Text "------------------------------------------" -Color Yellow @@ -189,8 +188,8 @@ Write-Color -Text ">>> ", "Restoring current directory" -Color Green, Gray Set-Location -Path $current_dir $endTime = [int][double]::Parse((Get-Date -UFormat %s)) -try -{ +try { New-BurntToastNotification -AppLogo "$openpype_root/openpype/resources/icons/openpype_icon.png" -Text "OpenPype build complete!", "All done in $( $endTime - $startTime ) secs. You will find OpenPype and build log in build directory." -} catch {} +} +catch {} Write-Color -Text "*** ", "All done in ", $($endTime - $startTime), " secs. You will find OpenPype and build log in ", "'.\build'", " directory." -Color Green, Gray, White, Gray, White, Gray