Primitive Maker

75 votes
Version: 
1.1
Date Updated: 
01/01/2011
Author Name: 
Garp

Creates a new Primitive from a template object.

Additional Info: 

This script creates a simpleObject plugin and registers the new primitive. Works with both geometry and shape objects. In the case of shapes, the primitive is of geometry type, based on the renderable version of the template shape as defined by the settings in the Rendering rollout, even if the Enable options are off.

The script supports smoothing groups, material IDs and mapping coordinates for all map channels (except -1 and -2, respectively alpha and illum).

The only parameter for the new primitive is Size. Its value corresponds to whichever dimension of the object's bounding box is the largest.

The Original Size button resets the size to that of the original object.

The Show Location button displays the path and name of the plugin's file.

The Sub-Folder from Category option creates a new folder in the current location - if it doesn't already exist - based on the primitive's category.

The Discard Mapping Coords option ensures that no mapping coordinates are passed from the template.

The name of the plugin file is of the form name_category.ms as entered in the dialog. Edit it at your own risks!

To make the primitive permanent, choose as location one of max's startup folders, like \$max\plugins (the default).

You can easily edit the various default values (default folder, legal characters for Name and Category  and option states) in the script's file. These are set at the top of the code for easy access.

Each new primitive class is scriptable. Just replace any eventual space in its name by an underscore. If the size property is not specified, the size of the original template object is used.

In the same fashion, there is also a Helper Maker.

 

v. 1.1: fixed a few loose ends.

v. 1.2: fixed a major bug that prevented cloning correctly (thanks to gramx for finding it).

Version Requirement: 
max 9 and above
AttachmentSize
PrimitiveMaker.ms14.43 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fraggle's picture

I would like to hire you!

Incredble, I was looking for something like this to build my own library since 5 years now.
I would like to hire you to customized your script for my own use bu I have no idea how to contact you!

In case I do have the right, here is my contact : [email protected].

Thanks to keep in toutch.

z0mbie's picture

cool

cool

Garp's picture

Howdy!

Hi Michele!
Thanks. I'm glad you like it.

Michele71's picture

Nice Plug!! :) One point to

Nice Plug!! :) One point to you Garp :) :)

omid3098's picture

you're right, I will save my

you're right, I will save my material library in the same path as primitiv scripts. thank you very much :)

Garp's picture

It si possible but...

... not a good idea.
If you save a scene with a custom primitive in it and in the meantime the corresponding material - or one of its maps - is moved, this might cause problems when trying to reopen the scene.
Also these tools are meant to be as generic as possible.

My advice would be to store your materials in a library and have a small script do the work of applying them. Something like:

for obj in objects do  -- or the next line
--for obj in selection do
    if obj.material == undefined do
        obj.material = case classOf obj
        (
            plate: plateMtl
            bowl: bowlMtl
            ashtray: ashtrayMtl
            bottle: bottleMtl
        )

where the various materials can be in the material editor, in a material library or already defined in the scene.

Note that the mapping applied to the template is passed to the primitive objects.

omid3098's picture

Save materials and textures with primitive?

Hi.
thank you very much for this great script.
I want to know is there any way to save materials and textures with each primitive?
I know that normal primitives do not have textures or materials. but if there is any possibility to save them with our primitives would be great.
if this is not possible can you suggest a way to make it easier to access materials and textures? should we just put them into material library?

Garp's picture

Set the viewport background

Set the viewport background to the same color than the background here.
Then capture. Then in photoshop import > video frames to layers, edit and save for web and devices as gif.

gramx's picture

Great tool Garp! Thanks Just

Great tool Garp! Thanks

Just one question how did you create the animated demo image? Its very cool!

g

Garp's picture

You're welcome :)

You're welcome :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.