Author: MastaMan
Date: September 22, 2021
Updated on: March 15, 2023

What is API in Model Packer

API stands for Application Programming Interface.
In Model Packer, the API is represented as a Structure, and allows automatic packing entirely at the software level without human intervention.

Also, this tutorial will describe how to work with manifest files to get programmatic access to the information they contain.

Important!
To use the API, you must have minimal knowledge of Maxscript!
Download Model Packer

API

A simple example of using the API

To use the API, you need to enable them with:

::MODEL_PACKER_USE_API = true

Next, you need to run the script and initialize:

script = (getDir #temp) + @"/ModelPacker/ModelPacker.mse"
try(fileIn script) catch()

api = ::MODEL_PACKER_API()

Next, enable the desired preset, transfer the data and start packing:

api.usePreset "FULL CUSTOM"
api.inputData() -- How to use see example
api.beginPack()

See an example for a detailed breakdown.



An example of batch packing using the API

Parsing data from manifest files

Extracting data with Maxscript

Using the Maxscript example below, you can extract files from the archive, find the *.ini file and get any information from it. The code is not complicated and there are many comments to it.



Maxscript execution result:

example parse ini maxscript
Loading...

Extracting data with PHP

Using the PHP example below, you can extract files from the archive, find the * .xml file and get any information from it. The code is not complicated and there are many comments to it.



PHP execution result:

example parse zip xml php
Loading...

Search in manifest files

Copy the code below, save it to a file with the "bat" extension, for example "Find in my library.bat".

Place "Find in my library.bat" in your 3D model library folder. The search will be carried out in all subfolders, start with the one containing the * .bat file.



The main condition is that the archives must be unzipped.

Run "Find in my library.bat", enter search words separated by a space and press Enter. Folders will be opened for all found models.

test find 3d models in library
Loading...

This is a fairly primitive way to search, but it works well for small libraries.

{{commentsMsg}}
  

No one has posted a comment yet
{{comment.lastname}} {{comment.name}} {{comment.date}}
{{comment.text}}
Sponsored content