Add Browse Button to Attribute


#1

Hi,

i’m still trying to figure this out since i’m still relatively new to MEL.
I’ve tried searching google/this forum and some answers have come up but none helped me out and i couldn’t figure them out.

I just want to have a “browse for file” button next to an attribute i’ve added to a controller and i guess there isn’t just a “makeBrowsable” command :slight_smile:

I’ve come across the AETemplate, which didn’t help, and the ‘attrNavigationControlGrp;’ command…which…didn’t help either, so i’m asking you to help me out and point me in the right direction :frowning:


#2

an attribute ‘connectable’ to a file has to be a ‘color’ attribute:

$cube = `polyCube`;
addAttr -ln "foo" -sn "foo" -at float3 -usedAsColor -k 1 "pCubeShape1";
addAttr -ln  "r" -at "float" -k 1 -p "foo" "pCubeShape1";
addAttr -ln  "g" -at "float" -k 1 -p "foo" "pCubeShape1";
addAttr -ln  "b" -at "float" -k 1 -p "foo" "pCubeShape1";
setAttr "pCubeShape1.foo" -type "float3" 1 1 1;

#3

You mean like this?


$cube = `polyCube`;
addAttr -ln "filePathAttribute" -sn "fap" -dt "string" -usedAsFilename $cube;


#4

Yes!! Exactly like that, thank you so much kroopson :slight_smile:

The color-attribute was not quite was i was looking for but i’m sure it will come in handy soon, thanks denisT :slight_smile: