I wouldn't suggest using this code as you are constantly making new shading graphs. You should probably catch the exit way earlier by asking for the texture first and early out then if the user cancelled. At the moment if you cancel you leave the shading networks around. Anywho here is a way to do the conditional check.…
Hi, I'm just trying to create a blinn material in which it has the attached 2D texture. I got some mel line but it seems like they are not connecting to the blinn material. Here is the command so far string $myBlinn = `shadingNode -asShader blinn`;hyperShade -assign $myBlinn;string $selection[] = `ls…
Do you have any idea regarding condition because when I run this command it's opening texture filedialog but when I cancel that file dialog it's still assigning blinn material it shouldn't happen. Any idea?
in another version of Maya I'm getting this error cannot find AEfileTemplate procedure. I think @haiddasalami is right I have load texture through file dialog which I don't know.
hi seems a bit complex for me. Hi, I got this file dialog command but it's not showing images on my desktop why? string $singleFilter = "image";string $result[] = `fileDialog2 -fileFilter $singleFilter -dialogStyle 1`;
you probably need to source "AEfileTemplate" as that may get sourced somewhere else which is why it works the second time around. (C:\Program Files\Autodesk\Maya\scripts\AETemplates\AEfileTemplate.mel). Probably better to use filedialog or filebrowserdialog to do the UI for selecting a texture rather than dealing with mel…