Return to Snippet

Revision: 14917
at June 17, 2009 06:56 by volvis


Updated Code
callbacks.addScript #filePostOpen "phTraverseProjectPath()" id:("phTraverseProjectPath" as name)

fn phTraverseProjectPath = (

	curPath = maxFilePath
	queryAnswer = false

	for i = 1 to 15 do (
		if curPath == "" do continue;
		if pathConfig.isProjectFolder curPath then (
			if (pathConfig.getCurrentProjectFolder() != curPath) do (
				if (queryAnswer == false) do (
					if (queryBox ("Change Project Folder?\n" + (curPath as String))) do (
						pathConfig.setCurrentProjectFolder curPath
					)
					queryAnswer = true
				)
			)
		)
		curPath = pathConfig.removePathLeaf curPath
	)

)

Revision: 14916
at June 17, 2009 06:53 by volvis


Initial Code
callbacks.addScript #filePostOpen "phTraverseProjectPath()" id:("phTraverseProjectPath" as name)

fn phTraverseProjectPath = (

	curPath = maxFilePath
	queryAnswer = false

	for i = 1 to 15 do (
		if curPath == "" do continue;
		if pathConfig.isProjectFolder curPath then (
			if (pathConfig.getCurrentProjectFolder() != curPath) do (
				if (queryAnswer == false) do (
					if (queryBox ("Change Project Folder?\n" + (curPath as String))) do (
						pathConfig.setCurrentProjectFolder curPath
					)
					queryAnswer = true
				)
			)
			curPath = pathConfig.removePathLeaf curPath
		) else (
			curPath = pathConfig.removePathLeaf curPath
		)
	)

)

Initial URL
http://karkijoukkue.fi

Initial Description
When placed in startup scripts, this snippet activates every time user opens a file. It then traverses the directory path backwards and looks for user created project folders. If one is found, script offers to switch it on.

This is very useful when working with a number of projects at a time.

Initial Title
Change Project Folder automatically if present

Initial Tags


Initial Language
Maxscript