Last active
December 31, 2015 15:19
Revisions
-
cg-cnu revised this gist
May 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def patchBake(): uv = patch.uvIndex() curPatchIndex = str(patch.udim()) savePath = curGeo.name() + "_" +curChanName + '_' + curPatchIndex + '.tif' patchImg = curImgSet.image(uv, -1) patchImg.saveAs(savePath) -
cg-cnu revised this gist
Jan 12, 2014 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,11 +34,10 @@ def patchBake(): return if mari.app.version().isWindows(): path = str(mari.resources.path("MARI_USER_PATH")).replace("\\", "/") else: path = str( mari.resources.path("MARI_USER_PATH") ) curChan = curGeo.currentChannel() curChanName = str(curChan.name()) -
cg-cnu revised this gist
Jan 4, 2014 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,13 +30,14 @@ def patchBake(): selPatchList = [patch for patch in patchList if patch.isSelected() ] if len(selPatchList) == 0: mari.utils.meesage('Select atleast one patch', title = 'Error') return if mari.app.version().isWindows(): path = str("C:\\") else: user = os.popen('whoami').read().split()[0] path = str ('/home/'+ user + '/Desktop/' ) curChan = curGeo.currentChannel() curChanName = str(curChan.name()) -
cg-cnu revised this gist
Dec 28, 2013 . 1 changed file with 21 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,15 @@ # Patch Bake # ------------------------------------------------------------------------------ # Bakes the selected patches to images manager. # Works the same as patches > extract selected but for the whole channel # and on all the selected patches. # # copy the script to the same location as your log folder in # windows: C:\Users\[user_name]\Documents\Mari\Scripts # linux: /home/[user_name]/Mari/Scripts # Mac: /home/[Username]/Mari/Scripts # # Creates a menu item in Patches > Patch Bake # # @uthor sreenivas alapati (cg-cnu) # ------------------------------------------------------------------------------ @@ -22,7 +22,7 @@ def patchBake(): '''Bake the selected patches to image manager''' if not mari.projects.current(): mari.utils.message('No project currently open', title = 'Error') return curGeo = mari.geo.current() @@ -32,15 +32,19 @@ def patchBake(): if len(selPatchList) == 0: mari.utils.meesage('Select atleast one patch') return # get the windows path working user = os.popen('whoami').read().split()[0] path = str ('/home/'+ user + '/Desktop/' ) curChan = curGeo.currentChannel() curChanName = str(curChan.name()) layers = curChan.layerList() mari.history.startMacro('Patch Bake') mari.app.setWaitCursor() for layer in layers: layer.setSelected(True) @@ -57,17 +61,21 @@ def patchBake(): curImgSet = curLayer.imageSet() for patch in selPatchList: uv = patch.uvIndex() curPatchIndex = str(patch.udim()) savePath = path + curChanName + '.' + curPatchIndex + '.tif' patchImg = curImgSet.image(uv, -1) patchImg.saveAs(savePath) mari.images.load(savePath) os.remove(savePath) curChan.removeLayers() mari.history.stopMacro() mari.app.restoreCursor() mari.menus.addAction(mari.actions.create('Patch Bake', 'patchBake()'), "MainWindow/Patches") -
cg-cnu revised this gist
Dec 28, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ # ------------------------------------------------------------------------------ # Patch Bake # ------------------------------------------------------------------------------ # Bakes the selected patches to images manager. # Works the same as patches > extract selected but for the whole channel. # And on all the selected patches. # # copy the script to the same location as your log folder in # windows: C:\Users\[user_name]\Documents\Mari\Scripts -
cg-cnu created this gist
Dec 17, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ # ------------------------------------------------------------------------------ # Patch Bake # ------------------------------------------------------------------------------ # Bakes the selected patches to images manager # Works the same as patches > extract selected but for the whole channel # and on all the selected patches. # # copy the script to the same location as your log folder in # windows: C:\Users\[user_name]\Documents\Mari\Scripts # linux: /home/[user_name]/Mari/Scripts # Mac: /home/[Username]/Mari/Scripts # # Creates a menue item in Patches > Patch Bake # # @uthor sreenivas alapati (cg-cnu) # ------------------------------------------------------------------------------ import mari import os def patchBake(): '''Bake the selected patches to image manager''' if not mari.projects.current(): mari.utils.message('No project currently open') return curGeo = mari.geo.current() patchList = list (curGeo.patchList() ) selPatchList = [patch for patch in patchList if patch.isSelected() ] if len(selPatchList) == 0: mari.utils.meesage('Select atleast one patch') return mari.history.startMacro('Patch Bake') mari.app.setWaitCursor() user = os.popen('whoami').read().split()[0] path = str ('/home/'+ user + '/Desktop/tmp_bake_tmp.tga' ) curChan = curGeo.currentChannel() layers = list(curChan.layerList()) for layer in layers: layer.setSelected(True) copyAction = mari.actions.find('/Mari/Layers/Copy') copyAction.trigger() pasteAction = mari.actions.find('/Mari/Layers/Paste') pasteAction.trigger() curChan.mergeLayers() curLayer = curChan.currentLayer() curImgSet = curLayer.imageSet() for patch in selPatchList: uv = patch.uvIndex() patchImg = curImgSet.image(uv, -1) patchImg.saveAs(path) mari.images.load(path) os.remove(path) curChan.removeLayers() mari.history.stopMacro() mari.app.restoreCursor() mari.menus.addAction(mari.actions.create('Patch Bake', 'patchBake()'), "MainWindow/Patches")