Isotropix Forums

Open selected textures with Photoshop

Find useful scripts shared by the community here

Open selected textures with Photoshop

Unread postby bvaldes » Thu Nov 15, 2018 10:41 am

Hi,

A Clarisse user ask for a script to open textures in Photoshop. After looking for a way by using command line, we found a blog post that shows a way to interact with Photoshop: http://techarttiki.blogspot.com/2008/08 ... ython.html

Before using the script you have to install through pip a package called pywin32:
Code: Select all
pip install pywin32

If the command doesn't work, you probably need to upgrade pip:
Code: Select all
pip install --updgrade pip


You can find bellow a script that allow you to open the selected textures from Clarisse in Photoshop

python code

import  os, win32com.client

def checkUDIM(filenames):
udimFiles = []
for filename in filenames:
if "<UDIM>" in filename:
filenameList = os.path.basename(filename).split("<UDIM>")
udimFiles = []

for file in os.listdir(os.path.dirname(filename)):

if file.startswith(filenameList[0]) and file.endswith(filenameList[-1]):
udimFiles.append(os.path.dirname(filename) + "/" + file)
if udimFiles:
return udimFiles
return filenames

def getFilenames():
filenames = []
for i in range(ix.selection.get_count()):
item = ix.selection[i]
if item.is_kindof("Texture"):
filenameAttr = item.attribute_exists("filename")
if filenameAttr:
filename = [filenameAttr.get_string()]
for filename in checkUDIM(filename):
filenames.append(filename)
return filenames



files = getFilenames()
psApp = win32com.client.Dispatch("Photoshop.Application")
for file in files:
psApp.Open(file)


Best regards
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 315
Joined: Mon Sep 26, 2016 10:44 am

Re: Open selected textures with Photoshop

Unread postby purchasemediamonks » Thu Nov 15, 2018 12:29 pm

Fantastic! It works and thank you for your time looking into it. Have a nice day!
purchasemediamonks
 
Posts: 13
Joined: Wed Jan 25, 2017 10:03 am

Re: Open selected textures with Photoshop

Unread postby SamSmith228 » Sun Jan 13, 2019 12:57 pm

There are so much incredible information that I was looking for. Thank you for that. I'll use it in my job for the future.
Have a nice day.
Sam
SamSmith228
 
Posts: 1
Joined: Sun Jan 13, 2019 12:53 pm


Return to Useful Community Scripts