1

I am currently administrating a Perforce server that consists of both Unity groups as well as Unreal groups. I am pretty new to Perforce, my experience is with Git.

I am looking into modfiying the typemap to work for Unreal and Unity - but there might be areas where certain files are needed for one engine but not for the other.

So my question is - what would be the best way to modify the typemap so that any depot on this server could work with either engine?

The second question is - would it be possible to have different typemaps for different depots?

1 Answers1

1

Per the Unreal doc:

https://docs.unrealengine.com/5.0/en-US/using-perforce-as-source-control-for-unreal-engine/

you want a typemap of:

                binary+w //....exe
                binary+w //....dll
                binary+w //....lib
                binary+w //....app
                binary+w //....dylib
                binary+w //....stub
                binary+w //....ipa
                binary //....bmp
                text //....ini

and per this Perforce KB article on Unity:

https://portal.perforce.com/s/article/15244

the recommended typemaps for Unity files are:

   text //....js
   text //....cs
   text //...shader
   text //....meta
   text+l //....cm
   text+l //....proc
   text+l //....md5mesh
   text+l //....md5anim
   text+l //....ma
   binary //....dll
   binary //....exe
   binary //....response
   binary //....lib
   binary //....pdb
   binary //....u
   binary //....ini
   binary //....stub
   binary //....ip
   binary+l //....prefab
   binary+l //....mb
   binary+l //....mat
   binary+l //....psb
   binary+l //....mp3
   binary+l //....fbx
   binary+l //....unity
   binary+l //....asset
   binary+l //....aas
   binary+l //....tga
   binary+l //....jpg
   binary+l //....lwo
   binary+l //....wav
   binary+l //....ogg
   binary+l //....demo
   binary+l //....roq
   binary+l //....doc
   binary+l //....xls
   binary+l //....celtx
   binary+l //....pdf
   binary+l //....odt
   binary+l //....ods
   binary+l //....ppt
   binary+l //....skp
   binary+lS //....dds
   binary+lS //....bnk
   binary+lS //....light
   binary+lS //....shadow
   binary+lS //....ibl
   binary+lS //....bik
   binary+lS //....upk

There are some conflicts in there -- e.g. Unity's .ini files want to be binary whereas Unreal's .ini want to be text. As you suggest, though, that's easily resolved by just scoping the two sections of the typemap to different depots. Assuming you have two depots called "unity" and "unreal" you'd just do:

    binary+w //unreal/....app
    binary+w //unreal/....dll
    binary+w //unreal/....dylib
    binary+w //unreal/....exe
    binary+w //unreal/....ipa
    binary+w //unreal/....lib
    binary+w //unreal/....stub
    binary //unreal/....bmp
    text //unreal/....ini
    text //unity/....cs
    text //unity/....js
    text //unity/....meta
    text //unity/...shader
    text+l //unity/....cm
    text+l //unity/....ma
    text+l //unity/....md5anim
    text+l //unity/....md5mesh
    text+l //unity/....proc
    binary //unity/....dll
    binary //unity/....exe
    binary //unity/....ini
    binary //unity/....ip
    binary //unity/....response
    binary //unity/....lib
    binary //unity/....pdb
    binary //unity/....stub
    binary //unity/....u
    binary+l //unity/....prefab
    binary+l //unity/....mb
    binary+l //unity/....mat
    binary+l //unity/....psb
    binary+l //unity/....mp3
    binary+l //unity/....fbx
    binary+l //unity/....unity
    binary+l //unity/....asset
    binary+l //unity/....aas
    binary+l //unity/....tga
    binary+l //unity/....jpg
    binary+l //unity/....lwo
    binary+l //unity/....wav
    binary+l //unity/....ogg
    binary+l //unity/....demo
    binary+l //unity/....roq
    binary+l //unity/....doc
    binary+l //unity/....xls
    binary+l //unity/....celtx
    binary+l //unity/....pdf
    binary+l //unity/....odt
    binary+l //unity/....ods
    binary+l //unity/....ppt
    binary+l //unity/....skp
    binary+lS //unity/....dds
    binary+lS //unity/....bnk
    binary+lS //unity/....light
    binary+lS //unity/....shadow
    binary+lS //unity/....ibl
    binary+lS //unity/....bik
    binary+lS //unity/....upk

This can also be done at the folder level, you can use wildcard patterns to cover multiple depots that follow a similar naming convention, etc.

Samwise
  • 68,105
  • 3
  • 30
  • 44
  • Thank you, Samwise! Is there a way I could use prefixes for the depots in the typemaps? For example, say that I used UN_depotName for Unity depots and UR_depotName for Unreal depots, could I put something like UN_* and UR_* in the typemap, so that pretty much any depot name can be covered with the typemap and so that Perforce knows that depots with certain preffixes need to be treated accordingly? – Sternutation Oct 10 '22 at 15:31
  • Yup, that's what I meant by wildcard patterns. E.g. `//UN_....mp3` covers all `.mp3` files in any depot starting with `UN_`. (Paths are just treated as strings -- if your depots have a prefix you want to match on you don't need to use one wildcard for the depot name and one for the rest of the file path, just use `...` for the part where you want it to match anything.) – Samwise Oct 10 '22 at 15:49
  • I discovered that habing the prefix as UN_.... does not seem to do anything. I tested it by going to the typemap and modifying one of the filetypes, but that didnt change anything. Should I use UN_*/.... instead of UN_....? – Sternutation Oct 10 '22 at 22:57
  • I tested it out via temporarily removing the binary filetype from lib in the first half of the typemap, and then adding the binary filetype to the UN_.... and UR_.... lines for .lib. The .lib files don't get stored as binary in the test depots with those prefixxes, but as text files. – Sternutation Oct 10 '22 at 23:12
  • The typemap is applied at the time you `p4 add` the file; it's essentially a "hint" for filetype detection when adding new files, and it doesn't retroactively change existing files (the filetype is a versioned property of the file, and once set it persists unless changed explicitly). Use `p4 edit -t` to explicitly open existing files for edit with a new filetype. – Samwise Oct 10 '22 at 23:25
  • To test your typemap, do `p4 add -n FILENAME` to see what filetype would be assigned to a new file with that name. If your typemap is being applied correctly, the type should be assigned even if there's no local file called `FILENAME`. – Samwise Oct 10 '22 at 23:27
  • Yeah I am not applying it retroactively- I am doing it to new files. For example, take .lib files. The original type map stored them as binary. I removed the binary from the original typemap and instead only had UN_ and UR_ depots store .lib files as binaries. Yet, now .lib files get stored as the text file default instead of binaries in depots whose names start with UN_ or UR_. – Sternutation Oct 10 '22 at 23:54
  • Can you copy and paste the output you get from doing `p4 add -n` on a `.lib` file, and also copy and paste your typemap lines for `.lib` files? It's import to copy and paste the exact output -- I suspect it's some kind of off-by-one-character typo so I need to see the exact text of what you're putting in and what you're getting out. – Samwise Oct 12 '22 at 14:48
  • Hello Samwise, I figured it out. It needed the prefixes in the following format - //UN_.../....fileExtension, not in the //UN_....fileExtension – Sternutation Jan 27 '23 at 16:00
  • It *should* work without the extra `.../` in there; my guess is that when you changed it there was some minor typo that was fixed as a side effect. – Samwise Jan 27 '23 at 17:13