Studio Switching to Perforce..need good introduction / ramp up

[QUOTE=Mambo4;24304]Have I thanked everyone for their replies yet? thanks!
We hired a new Technical Director who has better perforce chops and things are being smoothed out.

My current concern is about tools exporting content to the right spot when everyone can potentially create their own work space configuration.

I like parallel source and production directories. My export tools ‘figure out’ where to place the exported asset by replacing the root level folder in the path string
so
“<source_art_path>\characters\heroGuy\mesh\heroGuy.max”
becomes
“<production_art>\characters\heroGuy\mesh\heroGuy.fbx”

but perforce lets a variety of work spaces be created all over the place,
and I need a reliable way to determine what is <source_art_path> and <production_art>.
based on either:
1.) make artists choose the right spot manullay
2.) somehow getting info from perforce
3.) enforcing a convention for work spaces on the art team.

3.) seems like the obvious approach. If so, can I script the creation of the workspace to force artists to adapt a common workspace configuration?
If so what scripting language? .bat with command lines? C# api? pyhton?

any experience you can share would help.[/QUOTE]

As part of our tool setup process, I end up mapping everyone’s source depot to a virtual drive using the subst command.

It ends up causing some headaches when scripting perforce, because perforce still thinks the files are located elsewhere, but overall it is much easier to maintain then our old system of trying to account for every absurd way that someone can build a workspace.

I might go with environment variables that reflect the current state of the user’s machine over conventions – there will always be somebody who wants to do something weird, and often their reasons are good (working in a branch, or they’re doing two projects at once and need to hop around, or they’re an engineer with a special setup for the build system, etc)

If you use environment variables for the roots of your source and target trees and store everything else relatively, the only point of failure is an incorrectly set variable which is easy to inspect and fix. You can easily make a little app in any language (even a bat file) that lets the user change the environment variables if they have to alter their configurations

@theodox:
light bulb moment for me!
I was looking for a way to save such data in my C# tool, and even got to the setting environment variables in my test app, but went with Application Settings because they seemed simpler.
But now I realize that if I use windows environment variables they can be accessed by any tool or script and will be more reliable

I have used stock windows Env Vars like %userProfile% and %programFiles% i my batch / mxs / C# code.
I distantly recall setting environment vars using window’s horrid mycomputer/advanced/environment variables interface.

is there a good primer on setting and accessing environment variables via scripts? either batch or c# or python?
can Perforce be controlled to use these for setting up work spaces?

os.environ in the python os module is dictionary of env vars you can get and set. Or, use the DOS SETX command to set them persistently or SET to set them temporarily.

Lots of folks make batch files which set a var before launching a tool so it’s easy to have multiple projects side by side in the same tool.

one note about setx, theres a 1024 character limit to each variable

I noticed that Rob Galanakis suggests using a registry key as opposed to an environment variable inthis old thread
but he doesn’t explain his preference.

I’d also be curious to see the script mentioned by Adam Plechter in the same thread…

which leads me to my relatedissue of the day

What is the best approach to reorganize the folder structure, when we have a unity project tracked in perforce?
Unity project view?
Perforce move/rename?

I think I need to start by checking out of perforce the root of the folders I wish to rearrange and then rearrange them in Unity…but I feat this will create a mismatch between P4 and unity.
(at this point I am the only user of the game assets folder, we haven’t ‘passed out’ perforce to the art team yet)

[QUOTE=Mambo4;24396]What is the best approach to reorganize the folder structure, when we have a unity project tracked in perforce?
Unity project view?
Perforce move/rename?

I think I need to start by checking out of perforce the root of the folders I wish to rearrange and then rearrange them in Unity…but I feat this will create a mismatch between P4 and unity.
(at this point I am the only user of the game assets folder, we haven’t ‘passed out’ perforce to the art team yet)[/QUOTE]

If you don’t care so much about file history within perforce. You can move everything around inside Unity, which I generally prefer so that the metafiles don’t get out of sync with their asset. And then in perforce run a ‘Reconcile offline work’ on your assets folder. This should go through and identify everything different between the depot and workspace and try its best to align the two.

Otherwise, you’ll probably want to do the move/renames in perforce while Unity isn’t running. Taking extra care to move/rename the meta files in sync with their assets. Nuke your library folder, and then relaunch Unity. Let it rebuild the local project, and test everything to make sure it hasn’t lost track of any files or freaked out over anything.

You should be able to derive the mappings from the depot names in perforce by looking at the user’s client spec. The p4 where command will tell you where a file is in the depot and where that maps to on the client.

That said, there’s very little value to having users put things all over the place. If somebody really wants to put things on their X:\drive they should have to make a case beyond ‘that’s how I’ve always done it’ before making you do a lot of work to support their personal style.

Our latest discovery: Unity hides .meta files form Perforce by default.
You have to manually Edit> ProjectSettings> Editor and set the Version Control Mode to “visible meta files”