Posted 24 July 2019 - 07:39 PM
Posted 24 July 2019 - 07:44 PM
Thank you so much for your help - I really appreciate it!
Posted 24 July 2019 - 09:32 PM
It's kind of amazing to me that the UE plugin doesn't just do this automatically when you create a new project as a single "add to source control" operation. It has all the information (it knows what the project's name is and it knows where it is on the local disk) and just needs to execute a few very simple commands directly against the server to get everything set up for you. If it already has the infrastructure set up to get your connection info and authenticate against the server (which I think it does), this is something like five more lines of code. Instead the plugin makes everyone hunt through P4V dialogs to try to figure out where to input that information to get things configured correctly, and based on the volume of questions I see about it, this is clearly not a frictionless process.
I might just write a quick Python script that does this and can be set up to run as a P4V custom tool. Of course then people have to figure out how to install a custom tool and deal with P4V to input the information manually, so I don't think it actually solves the problem of "this should just work from UE automatically," but I want to see how far off my "five lines of code" estimate is.
Posted 25 July 2019 - 07:07 AM
""" new_project.py -- creates a new stream depot for a project. Usage: new_project.py project_name local_path project_name: The name of the project, e.g. 'Widget'. local_path: The absolute path to the project on the local disk. """ import os import sys from P4 import P4 try: depot_name = sys.argv local_path = sys.argv except: sys.exit("Usage: new_project.py name path") p4 = P4() p4.connect() config_name = p4.env("P4CONFIG") client_name = "%s-%s" % (depot_name, p4.host) # e.g. Widget-MYHOST stream_name = "//%s/main" % depot_name # e.g. //Widget/main if config_name: # Write a P4CONFIG file to the project path. # Do this first so we'll raise if the user gave us a bogus path # and they can fix it before we start writing to the server. with open(os.path.join(local_path, config_name), "w+") as f: f.write("P4PORT=%s" % p4.port) f.write("P4USER=%s" % p4.user) f.write("P4CLIENT=%s" % client_name) # Create the new stream depot. depot = p4.fetch_depot(depot_name) depot["Type"] = "stream" p4.save_depot(depot) # Create the new mainline stream. stream = p4.fetch_stream(stream_name) stream["Type"] = "mainline" if config_name: stream["Ignored"] = config_name p4.save_stream(stream) # Create a client of that stream. client = p4.fetch_client(client_name) client["Root"] = local_path client["Stream"] = stream_name p4.save_client(client) print("Created %s with a workspace at %s." % (stream_name, local_path))
Set that up in P4V as a custom tool with arguments of "$D $D" (so you can manually enter in the project name and the local path) and you're off to the races.
If anyone happens to know whoever it is maintains the UE plugin (I don't even know if that's something that's maintained by Perforce or not), tell them they're free to compile this script into it. They don't even have to credit me.
Posted 25 July 2019 - 02:53 PM
I've noticed something with how I've set things up though.
When I connect a project to Perforce, make a change, submit it etc, close the project then reopen it's not connected to perforce. I have to manually keep reconnecting it every time. Any ideas?
Posted 25 July 2019 - 03:02 PM
Posted 25 July 2019 - 03:05 PM
I'll connect to it within UE4's Source Controls section, which connects fine, but it's not connected when I reopen the project after closing it.
Edit: Managed to solve it. The Settings that save Source control details was set to Read-Only. Unticking this has solved the issue.
Posted 25 July 2019 - 04:19 PM
If that's a file that got added to Perforce, you might want to change its filetype to "+w" so that its writable-ness will persist. If it's something that shouldn't be shared (i.e. it contains configuration that's specific to your machine and would mess someone else up if they synced it), you might instead want to add it to the "Ignored" section of the stream definition.
This is something that the UE plugin could very easily do for you if it were setting up the streams itself. There are probably a bunch of standard best practices around what should and shouldn't be checked in to source control (any local settings that are specific to your machine should not be checked in); if you looked over the script I posted above you might have noticed that it adds the P4CONFIG file (if one exists) to the "Ignored" section of the stream, which is to make sure that doesn't get checked in. If the UE plugin was doing this, it could do the exact same thing to exclude its own local settings files, compiled assets, etc. where relevant, and everything would just automatically work more smoothly with zero user effort (with nothing more than extremely minimal coding effort in the plugin to add in an appropriate list of file names/paths/types).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users