I need a little script to delete last MatID(Mesh)

Hello, i spent a lot of time on making this stuff and first time i release it, but second i couldn't make it again,
to delete last MatID(mesh) by 1 click, can someone help me with this ?
IT's a simple script when you select a mesh and press button - it deletes last MaTID(mesh).

P.S.

And if it possible http://dfiles.ru/files/owsepv1vr to modifie this script(its .psk file importer) and add to it a possibility to insert special mesh(On the importing model), while importing the file, with position controlling rulers.

Comments

Comment viewing options

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

:)

Hey, how do you setup "post below" hyperlink. Very cool

bga

Anubis's picture

[link to this post is here]

Each post has link in it title ;-)

my recent MAXScripts RSS (archive here)

barigazy's picture

No "append" is fester from

No "append" is fester from "collect" probable because for append method you already have defined array and for collect you build array on the fly.
Also is better to store mesh fn in local variable before use it multiple time (in for-loop or while-loop etc..).
By the way, is there easy way to get bigest mtlID number of geometry object.
I think that's poly method is more efficient (numFaces count is twice lower).

bga

Anubis's picture

LOL

I'm sure that I done some test in the past to end with such conclusion that Collect is faster than Append :) Anyway, will test once again (some day).

Storing a function in variable,.. ya I know that helps in case the function is a Struct member, like meshOps for example, but not thought to test that for other (stay-alone) functions. So, it's help for them too?

As for easy way to get bigest mtlID, well,.. it's what I use in my function (for..if..x>y..y=x), at least don't know better :) We have #materialIDs named-prop in Mesh Constructor, but we cannot access it after that (on existing mesh), so sad, and the great ADSK is so lazy to make that property script-visible. If were exposed then all to code w'd been just this:
amax m.materialIDs
but... :)

my recent MAXScripts RSS (archive here)

barigazy's picture

:)))

Hey Panayot,
I know. I agree with you (laziness is a bad habit) :).
Also I wonder when Phyton become part of max. Like in Maya or Softimage or Cinema4d or Blender or ... 10 more softwares. .net is very useful but phyton ...

bga

barigazy's picture

Yes i tested it. Also i check

Yes i tested it. Also i check time and memory leaking and you have better solution for sure. Memory leak is the main problem in this aproch.

bga

DolVai's picture

Thx you very much!

Thx you very much!

But it gives me error

http://i.imgur.com/HdlP72N.png

barigazy's picture

:)

Sorry i forget to replace "$" with "obj" variable.
I fixed the code try now.
Try to avoid objects that have only one mtlID

bga

DolVai's picture

sorry but its still gives me

sorry but its still gives me error.

http://i.imgur.com/oBbylT7.png

Anubis's picture

are you in Max 9 or below?

if so, there no appendIfUnique function, at least until install AVG (Avguard Extensions).

my recent MAXScripts RSS (archive here)

Comment viewing options

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