P4 struct

I started building a library for this but don’t have the requisite knowledge yet. I wonder if anyone is very experienced with p4 who can help, or have their own functions to share? Obviously the stuff like add, edit, sync, etc., all work fine- I’m more having to deal with logging, creating changelists, etc, all through script/max.

On your p4ops, looks good but you can’t really get any info back from perforce because of the dos command. I am working on a perforce .NET integration right now, using the P4.net api. This allows you to get data back from perforce and parse it out, but I will have to check with the higher ups on if I can release it. Right now is in a real simple state, but converting your DOS struct to a .net shouldn’t be too difficult. Although that would eliminate anyone using anything pre-max 9. Maybe have both versions available?

whats the question in particular? p4 cmd-line is a minor pain to work with, but totally do-able. but if you’re able to use python as ur scripting language, just grab the official p4 python module from perforce. it makes working with changelists as simple as accessing a dict. its still convenient to wrap it up with more specific code relevant to your pipeline/toolset, but it makes the wrapper very thin…

incidentally the p4 help will give you reasonably concise help on how to use each p4 command. or u can browse the help online here:

http://www.perforce.com/perforce/doc.061/manuals/cmdref/index.html

or whatever version ur using…

Well this struct is for MAXscript, so not Python. Right now I’m planning on using Jeff Hanna’s Perforce integration stuff as a model to learn from, but I haven’t had the time to dissect it enough. I’m sure I will be able to figure it out, it isn’t too hard.

Using the commands is not hard (actually the doc string of each function in the struct links to the perforce help page)- the hard part is working with P4’s feedback, logging, etc., stuff that isn’t as simple as ‘p4 add <filename>’ with some flags.

And obviously anyone can clone the tao_tools repository and base off my p4 struct if anyone feels like helping, and I’d love to merge it into the trunk again. That’s the whole idea of the CR’s- collaboration, a step up from just questions and answers.

Our P4 stuff uses the p4com stuff with a c# wrapper that was written before
the .net integration showed up on perforce’s site.

It seems like the .net route would be the simplest to integrate into a maxscript
solution.

http://www.perforce.com/perforce/products/p4scc.html

Check the release notes for what it doesn’t do in case there’s a collision
between your desires and reality :slight_smile:

One thing we stumbled on was our use of multiple servers for different
projects. Attempts to find a project would fail unless we had the server
containing the project set as default. Don’t know if that’s an issue with
their .net implementation or not.

I hope that’s a help. I’m not able to release any of our stuff into the wild
even though I do think it’s healthier. If you have any specific questions
about it poke Shea (member name) he wrote our P4 com stuff.

This function may help with the p4 stuff you are working on as a replacement
for the doscommand in mxs.
The best part about it…no dos window pops up, not even for a second.
Credit goes to Shea for this…

	function launchProcess command arguments:"" window:false workingDirectory:undefined wait:true waitTime:300000 =
	(
		process = DotNetObject "System.Diagnostics.Process"
	
		-- set up the process --
		process.StartInfo.FileName = command
		process.StartInfo.Arguments = arguments
	
		process.StartInfo.CreateNoWindow = NOT window
		process.StartInfo.UseShellExecute = false
	
		if (workingDirectory != undefined) then
		(
			process.StartInfo.WorkingDirectory = workingDirectory
		)
	
		-- start the process! (and maybe wait for it to finish) --
		process.Start()
	
		if (wait == true) then
		(
			-- wait for the process to finish before executing more script --
			process.WaitForExit(waitTime)
		)
	
		process.Close()
	)