<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Creating a .mzp package in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7468178#M11821</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to create a folder containing a .ms script, zip that folder, and rename it to a .mzp file. This allows me to drag this .mzp file into the 3ds max viewport, and that runs the .ms script by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I have read I am supposed to be able to use a file in the folder described above called mzip.run, which allows scripts to be copied to proper directories, and a command called 'drop' which runs a script upon dragging the .mzp file into the viewport.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to drag the package into the viewport, copy a .ms file (which creates a menu and assigns a python script to be executed on click) and a python script to the scripts directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not been able to get the mzip.run file to do anything it is supposed to do, and there appears to be limited documentation on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This forum unfortunately won't let me post any of my code. As a simple demo, if anyone could show me how to create a mzip.run file which copies two scripts to the $script directory and runs one of them, I would be very pleased.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Jed&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2017 17:51:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-10-17T17:51:33Z</dc:date>
    <item>
      <title>Creating a .mzp package</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7468178#M11821</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to create a folder containing a .ms script, zip that folder, and rename it to a .mzp file. This allows me to drag this .mzp file into the 3ds max viewport, and that runs the .ms script by default.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I have read I am supposed to be able to use a file in the folder described above called mzip.run, which allows scripts to be copied to proper directories, and a command called 'drop' which runs a script upon dragging the .mzp file into the viewport.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to drag the package into the viewport, copy a .ms file (which creates a menu and assigns a python script to be executed on click) and a python script to the scripts directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not been able to get the mzip.run file to do anything it is supposed to do, and there appears to be limited documentation on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This forum unfortunately won't let me post any of my code. As a simple demo, if anyone could show me how to create a mzip.run file which copies two scripts to the $script directory and runs one of them, I would be very pleased.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Jed&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 17:51:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7468178#M11821</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-17T17:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a .mzp package</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7468190#M11822</link>
      <description>&lt;P&gt;My mzip.run file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;name "MZP test"

version 0.1

copy menuCreate.ms to $scripts
copy organizeLayers.py to $scripts

drop "menuCreate.ms"&lt;/PRE&gt;&lt;P&gt;menuCreate.ms :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;macroScript Command category:"Custom Plugins" 
(
	print "menu create ran"
	python.ExecuteFile ("organizeLayers.py")
)

theMainMenu = menuMan.getMainMenuBar() --get the main menu bar
theMenu = menuMan.createMenu "Custom Plugins" --create a menu called Forum Help
theSubMenu = menuMan.createSubMenuItem "Command" theMenu --create a SubMenuItem
theMainMenu.addItem theSubMenu (theMainMenu.numItems()+1) --add the SubMenu to the Main Menu
theAction = menuMan.createActionItem "Command" "Custom Plugins" --create an ActionItem from the MacroScript
theMenu.addItem theAction (theMenu.numItems()+1) --add the ActionItem to the menu
menuMan.updateMenuBar() --update the menu bar &lt;/PRE&gt;&lt;P&gt;organizeLayers (the content doesn't matter, not the issue, even a simple printing script in python would be enough to prove it works):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import MaxPlus, pymxs
from pymxs import runtime as rt

def getRTLayer(name):
	for i in range(rt.LayerManager.count):
		ilayer = rt.layerManager.getLayer(i)
		layerName = ilayer.name
		layer = rt.ILayerManager.getLayerObject(i)
		if(layerName == name):
			print "layerName: " + layerName
			return ilayer
			
def testLayer(layerName):
	
	print "in testlayer"
	layer = MaxPlus.LayerManager.GetLayer(layerName)
	name = ""
	print "before tyr"

	try:
		name = layer.GetName()
	except:
		name = "null"

	if (name != "null"):
		return True
	else:
		return False
		
nodeList = []
nodes = MaxPlus.SelectionManager.GetNodes()

for x in nodes:
	name = x.Name
	nameSplit = name.split('__')
	nodeList.append((nameSplit, x))

sortedNodes = sorted(nodeList, key = lambda x: 0- len(x[0]))
nodeCount = 0

for node in sortedNodes:
	
	hierarchy = node[0]
	value = node[1]

	hLength = len(hierarchy)
	pastLayerName = "none"
	layers = []
	
	print("Node: " + str(nodeCount))
	nodeCount += 1

	for i in range(hLength):
		
		# print("i: " + str(i))
		# print("h: " + hierarchy[i])
		
		test = testLayer(str(hierarchy[i]))
		print str(test)
		
		if(test == False):
			layer = rt.LayerManager.NewLayerFromName(hierarchy[i])
			print("layer " + hierarchy[i] + " is appended")
		else:
			print "else"		
			layer = getRTLayer(hierarchy[i])

		layers.append(layer)
		
		if(i &amp;gt;0):
			try:
				print("layer " + hierarchy[i-1] + " is the parent")
				# print("Layer i-1: " + layers[i-1].
				layer.setParent(layers[i-1])
			except:
				print("no")
			
		if(hLength - 1 == i):
			# print("hLength is greater than 1")
			maxLayer = MaxPlus.LayerManager.GetLayer(hierarchy[i])
			maxLayer.AddToLayer(value)
			print("Adding value...")
			

		'''
		if(pastLayerName == "none"):
			layer = rt.LayerManager.NewLayerFromName(hierarchy[i])
		else:
			layer = rt.LayerManager.NewLayerFromName(hierarchy[i])

			layer.setParent(pastLayer)
			parent = rt.LayerManager.NewLayerFromName("C")
			child = rt.LayerManager.NewLayerFromName("D")
			child.setParent(parent)
			
		print ("create layer: " + str(i))
		if(layer):
			pastLayerName = layer.getmxsprop.__name__
			pastLayer = layer
		'''
		&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Oct 2017 17:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7468190#M11822</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-17T17:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a .mzp package</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7492044#M11823</link>
      <description>&lt;P&gt;So found some scripts online that do this sort of thing. I noticed whenever I can successfully get a copy of a python script to the temp folder it stops the plugin from installing. There seems to be some serious incompatibilities with python files and mzip.run files. Kinda talking to myself on this one but just trying to expose the root of the problem&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 00:42:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7492044#M11823</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-26T00:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a .mzp package</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7497618#M11824</link>
      <description>&lt;P&gt;For anyone struggling with mzp package development here is my solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/jlankitus/Easy-MZP-Plugin" target="_blank"&gt;https://github.com/jlankitus/Easy-MZP-Plugin&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With a bit of editing, you can include any number of scripts including both python and maxscript. This also automatically creates a toolbar and sub category item which activates the plugin. I included my email in the readme, let me know if you have any questions!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Jed&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 18:06:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/creating-a-mzp-package/m-p/7497618#M11824</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-27T18:06:31Z</dc:date>
    </item>
  </channel>
</rss>

