How can I add a file path to MEL using Hypershade?

How can I add a file path to MEL using Hypershade?

Anonymous
Not applicable
895 Views
2 Replies
Message 1 of 3

How can I add a file path to MEL using Hypershade?

Anonymous
Not applicable

Hello!

 

I'm very new to using Maya, and I have a full project that I want to automate using code (either MEL or PyMel).

I have a material made using two different file nodes that refer to two jpg images on my computer. When I copy the MEL script output, it looks like this.

Screen Shot 2020-01-24 at 7.31.00 PM.png

 

shadingNode -asTexture -isColorManaged file;
shadingNode -asUtility place2dTexture;
connectAttr -f place2dTexture1.coverage file1.coverage;
connectAttr -f place2dTexture1.translateFrame file1.translateFrame;
connectAttr -f place2dTexture1.rotateFrame file1.rotateFrame;
connectAttr -f place2dTexture1.mirrorU file1.mirrorU;
connectAttr -f place2dTexture1.mirrorV file1.mirrorV;
connectAttr -f place2dTexture1.stagger file1.stagger;
connectAttr -f place2dTexture1.wrapU file1.wrapU;
connectAttr -f place2dTexture1.wrapV file1.wrapV;
connectAttr -f place2dTexture1.repeatUV file1.repeatUV;
connectAttr -f place2dTexture1.offset file1.offset;
connectAttr -f place2dTexture1.rotateUV file1.rotateUV;
connectAttr -f place2dTexture1.noiseUV file1.noiseUV;
connectAttr -f place2dTexture1.vertexUvOne file1.vertexUvOne;
connectAttr -f place2dTexture1.vertexUvTwo file1.vertexUvTwo;
connectAttr -f place2dTexture1.vertexUvThree file1.vertexUvThree;
connectAttr -f place2dTexture1.vertexCameraOne file1.vertexCameraOne;
connectAttr place2dTexture1.outUV file1.uv;
connectAttr place2dTexture1.outUvFilterSize file1.uvFilterSize;
shadingNode -asTexture -isColorManaged file;
shadingNode -asUtility place2dTexture;
connectAttr -f place2dTexture1.coverage file2.coverage;
connectAttr -f place2dTexture1.translateFrame file2.translateFrame;
connectAttr -f place2dTexture1.rotateFrame file2.rotateFrame;
connectAttr -f place2dTexture1.mirrorU file2.mirrorU;
connectAttr -f place2dTexture1.mirrorV file2.mirrorV;
connectAttr -f place2dTexture1.stagger file2.stagger;
connectAttr -f place2dTexture1.wrapU file2.wrapU;
connectAttr -f place2dTexture1.wrapV file2.wrapV;
connectAttr -f place2dTexture1.repeatUV file2.repeatUV;
connectAttr -f place2dTexture1.offset file2.offset;
connectAttr -f place2dTexture1.rotateUV file2.rotateUV;
connectAttr -f place2dTexture1.noiseUV file2.noiseUV;
connectAttr -f place2dTexture1.vertexUvOne file2.vertexUvOne;
connectAttr -f place2dTexture1.vertexUvTwo file2.vertexUvTwo;
connectAttr -f place2dTexture1.vertexUvThree file2.vertexUvThree;
connectAttr -f place2dTexture1.vertexCameraOne file2.vertexCameraOne;
connectAttr place2dTexture1.outUV file2.uv;
connectAttr place2dTexture1.outUvFilterSize file2.uvFilterSize;
connectAttr -f file2.outColor aiStandardSurface1SG.displacementShader;
connectAttr -f file1.outColor aiStandardSurface1.baseColor;
closeNodeEditorEd hyperShadePrimaryNodeEditor;
setAttr "aiStandardSurface1.specularColor" -type double3 0.448276 0.448276 0.448276 ;
setAttr "aiStandardSurface1.specular" 0;
closeNodeEditorEd hyperShadePrimaryNodeEditor;

Notice that there aren't any references for the file paths that I added. How would I reference and attach the file paths to the file nodes using code?

 

I have a programming background but i'm quite new to MEL, so any tips are appreciated! 

Thanks!

0 Likes
Accepted solutions (1)
896 Views
2 Replies
Replies (2)
Message 2 of 3

mspeer
Consultant
Consultant
Accepted solution

Hi!

 

Try this (replace node name and image name + ext with what you need)

setAttr "file1.ftn" -type "string" "sourceimages/IMAGE_NAME.jpg";
Message 3 of 3

Anonymous
Not applicable

Worked like a charm! Thank you!

0 Likes