From 0640006f319f91df1ddff0b30adcbdd271db885c Mon Sep 17 00:00:00 2001 From: strivedi1 Date: Wed, 9 Feb 2022 17:05:01 -0500 Subject: [PATCH] Add files via upload Support for 3dsmax to enable `Send for review ...` --- .../__pycache__/render_media.cpython-37.pyc | Bin 0 -> 2320 bytes hooks/tk-3dsmax/render_media.py | 78 ++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 hooks/tk-3dsmax/__pycache__/render_media.cpython-37.pyc create mode 100644 hooks/tk-3dsmax/render_media.py diff --git a/hooks/tk-3dsmax/__pycache__/render_media.cpython-37.pyc b/hooks/tk-3dsmax/__pycache__/render_media.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f265eea5623e6347364f915d6b3a01ae7fb74538 GIT binary patch literal 2320 zcma)8OK%%D5GHq553l5B(ma}?;2~(Eg9RkL8ATDqL7PKs6pot|3kA$dOG&i%Ws>U` zq?2^VFQVZ%BF*I43qQL(F zMQ-GMK#|A%OE+jl_%&)({sAj!uZ49@6sh6~>lww>=RoH<6!`!uhRg=QI0nN`S+6$NG9PKVd;RU ztZi5KEJ0v&6G{!rE)=PuQs@v*9OWK*hm|Rg@Iy5AM}FkoN8^SatJ<;J6px!$t{Zu> zVrxHgr+A7-jj1!X7?Z{njaTi8=4kbB70TMkiM-$4@!HveT2~u(Z1ZsI5?}Z4T;faT zC3^R4ygphtW39 zvxB4$b6E*w&LPQ8I4kEq`6VqRi&{4UXN6iuUIZ=&XHaSwDssx>m~Fs_EliD+Bsp~S2xngHZS8PTLbJywyT!i1lbiJ5 z*IJWn+B?j68dL{Nz2riBW@gX;=?z$W%`cd)cDYKzT;ns1&viwF>40e$5+Ya&Q=V9F z_pP!bRVb8pAvptI#vHEj19$=gXK)&<%^>qkfT6DTdRcz1JsF-bUFpS{WZD_@TAQF^ zabNrM8%H-5E(u++>8-0}GU~=c?r47=@47Y%QSFs3FC2dWi(*F8i~?PvVt88VhLYL) zEm$!$Qwg32b>koHCg8h*H;Q-vK;kQy{xAP^r_;;QJ|DMIenCDcg zOt20-M@bPYzFi)lEV>DoCUrU|PutJhPdnx~kSw1WL6}X_7?+cu#ec(&HkGXCpOA zqpU}%cmg)8mkZU`Mh9;RdIUw9zZ7-XbF8M-gcBR6BT)sdcICO$j$jZ~GD~%3$intoPv1q+Wdm@(U1mjcAb<>>JXB*@UitTkiim_@9I17F2bh KVE$`5_3D3TqN6SV literal 0 HcmV?d00001 diff --git a/hooks/tk-3dsmax/render_media.py b/hooks/tk-3dsmax/render_media.py new file mode 100644 index 0000000..14b7023 --- /dev/null +++ b/hooks/tk-3dsmax/render_media.py @@ -0,0 +1,78 @@ +# Copyright (c) 2019 Shotgun Software Inc. +# +# CONFIDENTIAL AND PROPRIETARY +# +# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit +# Source Code License included in this distribution package. See LICENSE. +# By accessing, using, copying or modifying this work you indicate your +# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights +# not expressly granted therein are reserved by Shotgun Software Inc. + + +import sgtk +import os +import sys +import re +import json +import heapq +import pymxs +from pymxs import runtime as mxs + +HookBaseClass = sgtk.get_hook_baseclass() + + +# https://github.com/ADN-DevTech/3dsMax-Python-HowTos/blob/master/src/packages/quickpreview/README.md for more information + + +class RenderMedia(HookBaseClass): + """ + RenderMedia hook implementation for the tk-3dsmax engine. + """ + + def render( + self, + input_path, + output_path, + width, + height, + first_frame, + last_frame, + version, + name, + color_space, + ): + """ + Render the media using pymxs for 3dsmax + + :param str input_path: Path to the input frames for the movie (Unused) + :param str output_path: Path to the output movie that will be rendered + :param int width: Width of the output movie (Unused) + :param int height: Height of the output movie (Unused) + :param int first_frame: The first frame of the sequence of frames. (Unused) + :param int last_frame: The last frame of the sequence of frames. (Unused) + :param int version: Version number to use for the output movie slate and burn-in + :param str name: Name to use in the slate for the output movie + :param str color_space: Colorspace of the input frames (Unused) + + :returns: Location of the rendered media + :rtype: str + """ + #current_engine = sgtk.platform.current_engine() + #tk = current_engine.sgtk + #if pymxs.runtime.maxFilePath and pymxs.runtime.maxFileName: + # path_name = os.path.join(pymxs.runtime.maxFilePath, pymxs.runtime.maxFileName) + file_no_ext = os.path.splitext(pymxs.runtime.maxFileName)[0] + filename = file_no_ext + ".mov" + base_path = os.path.dirname(pymxs.runtime.maxFilePath) + output_path = os.path.join(pymxs.runtime.getDir(pymxs.runtime.Name("preview")), filename) + view_size = pymxs.runtime.getViewSize() + anim_bmp = pymxs.runtime.bitmap(view_size.x, view_size.y, filename=output_path) + for t in range(int(pymxs.runtime.animationRange.start), int(pymxs.runtime.animationRange.end)): + pymxs.runtime.sliderTime = t + dib = pymxs.runtime.gw.getViewportDib() + pymxs.runtime.copy(dib, anim_bmp) + pymxs.runtime.save(anim_bmp) + pymxs.runtime.close(anim_bmp) + pymxs.runtime.gc() + + return output_path