Skip to content

Commit

Permalink
2.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardFrangenberg committed Aug 5, 2024
1 parent 3f48019 commit ac5526f
Show file tree
Hide file tree
Showing 121 changed files with 5,227 additions and 2,590 deletions.
67 changes: 44 additions & 23 deletions Prism/Plugins/Apps/3dsMax/Integration/PrismMenu.ms
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
if menuMan.findMenu "Prism" != undefined then
(
menuMan.unRegisterMenu (menuMan.findMenu "Prism")
)
(
local mainMenuBar = menuMan.getMainMenuBar()
local subMenu = menuMan.createMenu "Prism"
local psaveItem = menuMan.createActionItem "PrismSave" "Prism"
subMenu.addItem psaveItem -1
local pcommentsaveItem = menuMan.createActionItem "PrismCommentsave" "Prism"
subMenu.addItem pcommentsaveItem -1
local browserItem = menuMan.createActionItem "OpenProjectBrowser" "Prism"
subMenu.addItem browserItem -1
local pmanagerItem = menuMan.createActionItem "PrismStateManager" "Prism"
subMenu.addItem pmanagerItem -1
local settingsItem = menuMan.createActionItem "PrismSettings" "Prism"
subMenu.addItem settingsItem -1
local subMenuItem = menuMan.createSubMenuItem "Prism" subMenu
local subMenuIndex = mainMenuBar.numItems()
mainMenuBar.addItem subMenuItem subMenuIndex
menuMan.updateMenuBar()
menuMan.saveMenuFile (menuMan.getMenuFile())
--menuMan.unRegisterMenu (menuMan.findMenu "Prism")
version = getFileVersion "$max/3dsmax.exe"
versionData = filterString version ","
if versionData[1] as Integer >= 27 then (
function prismMenuCallback =
(
local menuMgr = callbacks.notificationParam()
local mainMenuBar = menuMgr.mainMenuBar
local helpMenuId = "cee8f758-2199-411b-81e7-d3ff4a80d143"
local newSubMenu = mainMenuBar.CreateSubMenu "F8FFB827-741C-4A81-8C89-BBF856DCF56D" "Prism" beforeId:helpMenuId
newSubMenu.CreateAction "bb767ab4-b239-414f-80dd-d55b0a991ce1" 647394 "PrismSave`Prism"
newSubMenu.CreateAction "bb767ab4-b239-414f-80dd-d55b0a991ce2" 647394 "PrismCommentsave`Prism"
newSubMenu.CreateAction "bb767ab4-b239-414f-80dd-d55b0a991ce3" 647394 "OpenProjectBrowser`Prism"
newSubMenu.CreateAction "bb767ab4-b239-414f-80dd-d55b0a991ce4" 647394 "PrismStateManager`Prism"
newSubMenu.CreateAction "bb767ab4-b239-414f-80dd-d55b0a991ce5" 647394 "PrismSettings`Prism"
)
callbacks.removeScripts id:#prismMenu
callbacks.addScript #cuiRegisterMenus prismMenuCallback id:#prismMenu
mng = maxops.GetICuiMenuMgr()
mng.LoadConfiguration("")
) else (
if menuMan.findMenu "Prism" != undefined then
(
menuMan.unRegisterMenu (menuMan.findMenu "Prism")
)
(
local mainMenuBar = menuMan.getMainMenuBar()
local subMenu = menuMan.createMenu "Prism"
local psaveItem = menuMan.createActionItem "PrismSave" "Prism"
subMenu.addItem psaveItem -1
local pcommentsaveItem = menuMan.createActionItem "PrismCommentsave" "Prism"
subMenu.addItem pcommentsaveItem -1
local browserItem = menuMan.createActionItem "OpenProjectBrowser" "Prism"
subMenu.addItem browserItem -1
local pmanagerItem = menuMan.createActionItem "PrismStateManager" "Prism"
subMenu.addItem pmanagerItem -1
local settingsItem = menuMan.createActionItem "PrismSettings" "Prism"
subMenu.addItem settingsItem -1
local subMenuItem = menuMan.createSubMenuItem "Prism" subMenu
local subMenuIndex = mainMenuBar.numItems()
mainMenuBar.addItem subMenuItem subMenuIndex
menuMan.updateMenuBar()
menuMan.saveMenuFile (menuMan.getMenuFile())
--menuMan.unRegisterMenu (menuMan.findMenu "Prism")
)
)
1 change: 1 addition & 0 deletions Prism/Plugins/Apps/3dsMax/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PrismPlugin_3dsMax
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, core, plugin):

if platform.system() == "Windows":
self.examplePath = (
os.environ["localappdata"] + "\\Autodesk\\3dsMax\\2024 - 64bit"
os.environ["localappdata"] + "\\Autodesk\\3dsMax\\2025 - 64bit"
)

@err_catcher(name=__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

class Prism_3dsMax_Variables(object):
def __init__(self, core, plugin):
self.version = "v2.0.3"
self.version = "v2.0.5"
self.pluginName = "3dsMax"
self.pluginType = "App"
self.appShortName = "Max"
Expand Down
6 changes: 3 additions & 3 deletions Prism/Plugins/Apps/Blender/Integration/PrismInit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
sys.path.insert(0, os.path.join(prismRoot, "Scripts"))
import PrismCore

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *


from bpy.app.handlers import persistent
Expand Down
203 changes: 153 additions & 50 deletions Prism/Plugins/Apps/Blender/Scripts/Prism_Blender_Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ def openScene(self, origin, filepath, force=False):
if bpy.app.version < (4, 0, 0):
bpy.ops.wm.open_mainfile(ctx, "INVOKE_DEFAULT", filepath=filepath, display_file_selector=False)
else:
bpy.ops.wm.open_mainfile(filepath=filepath, display_file_selector=False)
with bpy.context.temp_override(**ctx):
bpy.ops.wm.open_mainfile("INVOKE_DEFAULT", filepath=filepath, display_file_selector=False)
except Exception as e:
if "File written by newer Blender binary" in str(e):
msg = "Warning occurred while opening file:\n\n%s" % str(e)
Expand Down Expand Up @@ -564,6 +565,31 @@ def exportObj(self, outputName, origin, startFrame, endFrame, expNodes):
outputName = foutputName
return outputName

@err_catcher(name=__name__)
def exportSelectionToObj(self, outputName):
with bpy.context.temp_override(**self.getOverrideContext()):
bpy.ops.wm.obj_export(
filepath=outputName,
export_selected_objects=True,
export_colors=True,
)

return True

@err_catcher(name=__name__)
def exportSelectionToFbx(self, outputName):
with bpy.context.temp_override(**self.getOverrideContext()):
bpy.ops.export_scene.fbx(
filepath=outputName,
use_selection=True,
bake_anim=False,
colors_type="LINEAR",
apply_unit_scale=False,
global_scale=0.01,
)

return True

@err_catcher(name=__name__)
def exportFBX(self, outputName, origin, startFrame, endFrame, expNodes):
useAnim = startFrame != endFrame
Expand Down Expand Up @@ -754,6 +780,51 @@ def getOverrideContext(self, origin=None, context=None, dftContext=True):

return ctx

@err_catcher(name=__name__)
def registerOperator(self, name, label, code):
def execute(self, context):
exec(code)
return {"FINISHED"}

opClass = type(
"Prism_" + name,
(bpy.types.Operator,),
{
"bl_idname": "object.prism_%s" % name,
"bl_label": label,
"execute": execute
},
)

bpy.utils.register_class(opClass)

@err_catcher(name=__name__)
def addMenuToMainMenuBar(self, name, label, options):
for option in options:
self.registerOperator(option["name"], option["label"], option["code"])

def draw(self, context):
layout = self.layout

for option in options:
row = layout.row()
row.operator("object.prism_%s" % option["name"])

menuClass = type(
"TOPBAR_MT_" + name,
(bpy.types.Menu,),
{
"bl_label": label,
"draw": draw,
},
)

def draw(self, context):
self.layout.menu("TOPBAR_MT_" + name)

bpy.utils.register_class(menuClass)
bpy.types.TOPBAR_MT_editor_menus.append(draw)

@err_catcher(name=__name__)
def sm_export_preExecute(self, origin, startFrame, endFrame):
warnings = []
Expand Down Expand Up @@ -995,58 +1066,63 @@ def sm_render_preSubmit(self, origin, rSettings):
if len(list(i.links)) > 0:
connections.append([i.links[0], idx])

m.base_path = os.path.dirname(rSettings["outputName"])
extensions = {
"PNG": ".png",
"JPEG": ".jpg",
"JPEG2000": "jpg",
"TARGA": ".tga",
"TARGA_RAW": ".tga",
"OPEN_EXR_MULTILAYER": ".exr",
"OPEN_EXR": ".exr",
"TIFF": ".tif",
}
nodeExt = extensions[m.format.file_format]
if m.format.file_format == "OPEN_EXR_MULTILAYER":
m.base_path = rSettings["outputName"]
newOutputPath = rSettings["outputName"]
if connections:
usePasses = True
else:
m.base_path = os.path.dirname(rSettings["outputName"])
for i, idx in connections:
passName = i.from_socket.name

for i, idx in connections:
passName = i.from_socket.name
if passName == "Image":
passName = "beauty"

if passName == "Image":
passName = "beauty"
if i.from_node.type == "R_LAYERS":
if len(rlayerNodes) > 1:
passName = "%s_%s" % (i.from_node.layer, passName)

if i.from_node.type == "R_LAYERS":
if len(rlayerNodes) > 1:
passName = "%s_%s" % (i.from_node.layer, passName)
else:
if hasattr(i.from_node, "label") and i.from_node.label != "":
passName = i.from_node.label

else:
if hasattr(i.from_node, "label") and i.from_node.label != "":
passName = i.from_node.label

extensions = {
"PNG": ".png",
"JPEG": ".jpg",
"JPEG2000": "jpg",
"TARGA": ".tga",
"TARGA_RAW": ".tga",
"OPEN_EXR_MULTILAYER": ".exr",
"OPEN_EXR": ".exr",
"TIFF": ".tif",
}
nodeExt = extensions[m.format.file_format]
curSlot = m.file_slots[idx]
if curSlot.use_node_format:
ext = nodeExt
else:
ext = extensions[curSlot.format.file_format]

curSlot.path = "../%s/%s" % (
passName,
os.path.splitext(os.path.basename(rSettings["outputName"]))[
0
].replace("beauty", passName)
+ ext,
)
newOutputPath = os.path.abspath(
os.path.join(
rSettings["outputName"],
"../..",
curSlot = m.file_slots[idx]
if curSlot.use_node_format:
ext = nodeExt
else:
ext = extensions[curSlot.format.file_format]

curSlot.path = "../%s/%s" % (
passName,
os.path.splitext(os.path.basename(rSettings["outputName"]))[
0
].replace("beauty", passName)
+ ext,
)
)
usePasses = True
newOutputPath = os.path.abspath(
os.path.join(
rSettings["outputName"],
"../..",
passName,
os.path.splitext(os.path.basename(rSettings["outputName"]))[
0
].replace("beauty", passName)
+ ext,
)
)
usePasses = True

if usePasses:
rSettings["outputName"] = newOutputPath
Expand Down Expand Up @@ -1259,10 +1335,10 @@ def sm_render_preExecute(self, origin):
return warnings

@err_catcher(name=__name__)
def sm_render_fixOutputPath(self, origin, outputName, singleFrame=False):
if not singleFrame:
def sm_render_fixOutputPath(self, origin, outputName, singleFrame=False, state=None):
if (not singleFrame) or self.useNodeAOVs() or (state and not state.gb_submit.isHidden() and state.gb_submit.isChecked()):
outputName = (
os.path.splitext(outputName)[0]
os.path.splitext(outputName)[0].rstrip("#")
+ "." + "#"*self.core.framePadding
+ os.path.splitext(outputName)[1]
)
Expand Down Expand Up @@ -1343,7 +1419,7 @@ def importFBX(self, importPath, origin):
bpy.ops.import_scene.fbx(filepath=importPath)

@err_catcher(name=__name__)
def importObj(self, importPath, origin):
def importObj(self, importPath, origin=None):
if bpy.app.version < (4, 0, 0):
bpy.ops.import_scene.obj(self.getOverrideContext(origin), filepath=importPath)
else:
Expand Down Expand Up @@ -1465,6 +1541,18 @@ def getObject(self, node):
):
return obj

@err_catcher(name=__name__)
def isolateSelection(self):
if bpy.app.version < (4, 0, 0):
bpy.ops.view3d.localview(self.getOverrideContext(context="VIEW_3D"))
else:
with bpy.context.temp_override(**self.getOverrideContext(context="VIEW_3D")):
print(bpy.context.space_data.local_view)
if bpy.context.space_data.local_view:
bpy.ops.view3d.localview()

bpy.ops.view3d.localview()

@err_catcher(name=__name__)
def sm_import_disableObjectTracking(self, origin):
stateGroup = [x for x in self.getGroups() if x.name == origin.setName]
Expand Down Expand Up @@ -1514,18 +1602,27 @@ def sm_playblast_startup(self, origin):
origin.b_resPresets.setMinimumWidth(30 * self.core.uiScaleFactor)
origin.b_resPresets.setMinimumHeight(0)
origin.b_resPresets.setMaximumHeight(500 * self.core.uiScaleFactor)
origin.cb_formats.addItem(".mp4 (with audio)")

@err_catcher(name=__name__)
def prePlayblast(self, **kwargs):
outputName = origOutputName = kwargs["outputpath"]
tmpOutputName = os.path.splitext(kwargs["outputpath"])[0].rstrip("#")
tmpOutputName = tmpOutputName.strip(".")
selFmt = kwargs["state"].cb_formats.currentText()
if selFmt == ".mp4 (with audio)":
outputName = tmpOutputName + ".mp4"

renderAnim = kwargs["startframe"] != kwargs["endframe"]
if not renderAnim:
outputName = (
os.path.splitext(kwargs["outputpath"])[0]
os.path.splitext(outputName)[0]
+ "."
+ ("%0" + str(self.core.framePadding) + "d") % kwargs["startframe"]
+ os.path.splitext(kwargs["outputpath"])[1]
+ os.path.splitext(outputName)[1]
)

if outputName != origOutputName:
return {"outputName": outputName}

@err_catcher(name=__name__)
Expand Down Expand Up @@ -1560,7 +1657,13 @@ def sm_playblast_createPlayblast(self, origin, jobFrames, outputName):
bpy.context.scene.render.resolution_percentage = 100

bpy.context.scene.render.filepath = os.path.normpath(outputName)
bpy.context.scene.render.image_settings.file_format = "JPEG"
base, ext = os.path.splitext(outputName)
if ext == ".jpg":
bpy.context.scene.render.image_settings.file_format = "JPEG"
if ext == ".mp4":
bpy.context.scene.render.image_settings.file_format = "FFMPEG"
bpy.context.scene.render.ffmpeg.format = "MPEG4"
bpy.context.scene.render.ffmpeg.audio_codec = "MP3"

if bpy.app.version < (4, 0, 0):
bpy.ops.render.opengl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

class Prism_Blender_Variables(object):
def __init__(self, core, plugin):
self.version = "v2.0.4"
self.version = "v2.0.10"
self.pluginName = "Blender"
self.pluginType = "App"
self.appShortName = "Bld"
Expand Down
Loading

0 comments on commit ac5526f

Please sign in to comment.