Home Website Youtube GitHub

Animpicker relative path?

Hi everybody!

I have some people asking me why the animpicker is not showing any background images.
I checked the file and It seems like animpicker images are set to absolute path:

can it be set to relative to the project set, so it will load for everyone using it?

Cheers.

1 Like

Hey @Milio

Is the path shown not one accessible to everyone on the network?

Further to your point tho, we only have a basic implementation of images and pathing thus far. So everything does get baked down to an absolute path. We havenā€™t really discussed any options for handling that differently.

If you, or anyone, have any suggestions on how we could go about this lets talk!

1 Like

There is an environment variable for anim_picker to set relative paths: ANIM_PICKER_PATH

should be used as a token in the path: [ANIM_PICKER_PATH]/your_picker_folder/your_picker.pkr

image

But you need to set it manually in de node :stuck_out_tongue:

5 Likes

Thank you Rafael!

It is mostly for people who downloaded the rig place it locally and therefore having a different path.
I guess, for this sort of rig distribution, where every single user can potentially have a different location, a setup like source images will be ideal: just relative to the project set. People can edit the animpicker file in Maya and save it, or also use notepad++ for setting the correct path for the backgrounds, but I think pretty much nobody will ever do that.

Cheers.

1 Like

ohhhh! That will do! Iā€™ll give it a go after work.
thank you @Miquel!!!

Even in my current productions, weā€™re cross-platform. Iā€™m on Mac, and most of my animators are on Windows.

What could be interesting is if we could embed the image pixel information directly in the picker node in the scene. (As an option.) Not sure if that is feasible or desirable.

4 Likes

haha! I didnt manage to understand where to set that ā€œtokenā€! Iā€™m quite limited! 8-o

1 Like

Hi All,
Sorry this is a very old thread Iā€™m replying toā€¦ I to am having a headache dealing with the file pathing specifically for the background image of the picker since we have artists using different drives on the network.

The environment variable [ANIM_PICKER_PATH] you mentioned previously works great only for the pkr file itself:
ā€˜[ANIM_PICKER_VAR]/MyPickerFolder/MyPicke.pkrā€™

But the file path for the background image in the data attr on the picker node (DATAS_ATTR ) is different?

Example: ā€˜backgroundā€™ : E:\\\\Main\\\\ContentSource\\\\Animation\\\\Pickers\\\\MyPickerFolder\\\\MyPickerBackround.pngā€™

So this wonā€™t work:
[ā€˜ANIM_PICKER_VARā€™]\\\\MyPickerFolder\\\\MyPickerBackround.pngā€™

How do you guys get around this?

:thinking:Modify the MainDockWindow class to point directly to the file path? Forgoing the picker node?

:thinking:Have a special pkr button that kills all picker nodes in a preexisting scene and creates new ones with proper pathing?

:unamused:Got my 23andme back an found out Iā€™m more neanderthal than anything else, so maybe thatā€™s the issue to: )

Iā€™m assuming you have to add to your Maya.env file, to define what the path is. The ā€œANIM_PICKER_VARā€ isnā€™t magic. Itā€™s just a keyword you can use to store a path. (If it is magic, please correct me, Miquel. :wink: )

Close Maya first. Then in Maya.env in your Maya preferences, add:
ANIM_PICKER_VAR = /YOUR/PATH/HERE

(And make sure you replace /YOUR/PATH/HERE with your actual path to where youā€™ll store the images.)

(Or else, you could probably add it to your environment variables in your operating system. But I think it would make more sense to store it in your Maya.env)

(Also, maybe Iā€™m wrong since you said the token already worked for you for the Picker itself.)

Thanks @chrislesage!
Ah, I should have mentioned I was setting that Var on my instance of maya manually before testing.
os.environ[ā€˜ANIM_PICKER_VARā€™] = os.getenv(ā€œMAYA_PROJECTā€).replace("\", ā€œ/ā€) + ā€˜/ContentSource/Animation/Pickersā€™
So [ā€˜ANIM_PICKER_VARā€™] = 'E:/Main/ContentSource/Animation/Pickersā€™

But yea, I think the maya.env would be a lovely place to set that.

At least ā€œI thinkā€ the .pkr file is being loaded in correctly? Iā€™m writing it manually like so in thePickerDatasFile Attr on the picker node :
[ANIM_PICKER_VAR]/MyPickerFolder/MyPicker.pkr

But, it could be just looking at the PickerDatas Attr and building the picker from it, instead of the actual file? Either way I get a functioning picker with no background and the following error. :thinking:

**# background image not found: ā€˜C:\Users\Me\AppData\Local\UnrealGameSync\Tools\Maya2022\Current[ANIM_PICKER_VAR]\MyPickerFolder\MyPickerBackround.pngā€™ (very confused why i get this but am looking into it now)

1 Like

On a side note, and just my opinion:
I love the Picker and where its going! But Iā€™m not a fan of extra import/export nodes cluttering up the scene, Iā€™m wondering if it would possible at some point in time to just add the picker path an info on the rigā€™s assemble node or somewhere else on the Rig instead?

Can you elaborate on how they are cluttering your scene? You can parent them under another transform to tuck them away.

Also I hide the transform of my Picker nodes, because technically they are selectable in the viewport, which affects viewport-framing too.

But there are commands to load a picker via Python. So you could likely store that info somehow and call it with a Callback or a shelf or menu tool. Or during the Shifter build if thatā€™s what you meant. If Iā€™m not misunderstanding what youā€™re talking about, maybe this is relevant: Load .pkr File Using Python - #2 by chrislesage and Load .pkr File Using Python - #5 by RagnarB

Thanks Chrislesage,

All great pointsā€¦ An yea, I can hide them, tuck them away, but there still there, itā€™s still an extra node that needs maintaining? I know thereā€™s lots of reasons itā€™s a good idea to have a picker node (moving files around, dealing with outsourcers ect.) So this is all purely a suggestion and maybe not a good oneā€¦

My initial thought was to those Attrs on a specific location on the rig itself (maybe the rigs top assemble node?). That way it always goes along for the ride with the rig. You could maybe use the namespace when the rig is referenced as default naming or something for the animpicker. We would always know where those attrs are as well. Anyways, Iā€™m sure thereā€™s very good reasons against thisā€¦

Thanks for the links to the conversations about updating and creating Picker nodes. Sorry if Iā€™m overlooking something here. The issue is if I make a new node in my animation source file and save my scene then someone else opens up my scene but is mapped to a different drive they will have to create another node?

Your script that updates the picker node based off of the file is close to what i need and i can probably get something working off of that. But It would be super nice to get that [ANIM_PICKER_VAR] token to work?

Iā€™m trying the following:

First Iā€™m manually creating a Environment variable called ANIM_PICKER_VAR with the first half of my path.

import pymel.core as pm
from mgear import anim_picker

# If you already have picker nodes in the scene, you can find them this way.
pickerNodes = anim_picker.picker_node.get_nodes()

# Set the file path on the node
yourDataPath = ā€˜[ANIM_PICKER_VAR]/Drone/Drone_Picker.pkrā€™
pickerNodes[0]._set_str_attr(newPicker.FILE_ATTR, value=yourDataPath)
# This writes ā€˜[ANIM_PICKER_VAR]/MyPickerDir/My_Picker.pkrā€™ string in the FILE_ATTR

# Reads the data from the file attribute on the picker node
pickerDataFromFile = pickerNodes[0].read_data_from_file()
# pickerDataFromFile is None after running this.

Also I noticed a little thing hereā€¦ On this function the env is called two different things (ANIM_PICKER_PATH, and ANIM_PICKER_VAR?). I went with ANIM_PICKER_VAR as that is what seems to be what the function is looking for but no diceā€¦


At the end of the day i just need a relative path for the file FILE_ATTR but canā€™t seem to get it working.