Maxscript garbage collection error что это

Обновлено: 05.07.2024

I'm working on a script and observed a weird behavior and wanted to share it with you guys. I deleted everything which isn't necessary - that's why the structure of the script might seems confuse.

Situation
I use a DotNet DataGridView and fill it via MultiThreading (CSharpUtilities.SynchronizingBackgroundWorker) with data.

Problem
When i start the script and do a manual garbage collection afterwards (enter gc() in the script listener and hit enter), i get this error in some cases:

An unknown error occurred while MAXScript was
performing garbage collection.
If you get this error multiple times, recommend restarting max

Test Results
I found several places in the script which i can change to fix the problem. I can't explain why that is, but i want to share the knowledge with you and maybe you can explain it to me or it helps other people in the future.

1. Copy this code and execute it in 3Ds Max
2. Do a manual garbage collection (via gc() in the script listener)
3. You should get the error message (see above)

(Not really a solution because it will disable the multithreading, but at least you don't get the GC error anymore)

1. Restart 3Ds Max (and revert all your previous script-changes if you made any)
2. Change the line gckick.height = 600 + 60 to gckick.height = 660 in the resizeList -function.
3. Execute the script
4. When i do a manueal garbage collection now, i DON'T get any error

I have no idea why the GC doesn't drop an error after the change in the resizeList function. But I'm happy that i found a "solution" and hope this post will help future people. Or someone can explain what's going on here.

Kind of a solution was to not call the resizeList() function directly from the multi threaded function addItemImage() since this seems to produce problems. I used a timer which is started before i call the multithreaded function and this timer checks a global bool-variable. This variable is set to true by the multithreaded function when it's done. Then the timer reacts to the now true variable, calls resizeList() and deactives itself again.

Maxscript garbage collection error что это

Насколько я понимаю максскрипт, это некая виртуальная машина, не предоставляющая юзеру прямого доступа к памяти и заменяющая его массивами, стримами и пр. и имеющая (вследствие отсутствия явных деструкторов) сборщик мусора. Сборщику можно помогать (если большие объемы данных надо быстро брать-отдавать), но вообще-то он сам.

В общем все это выглядит так, словно бы я работал с памятью макса напрямую и у меня постоянно были лики и перехлесты.

НО: зная макс и то как он себя ведет в обычной жизни (когда я делаю в нем какую-то сцену) и как он вылетает, виснет, бьёт файлы, теряет пути и пр., можно заключить что все нормально и глючит макс.

Вот собственно задача - отделить собственные ошибки от максовых. Чтобы как-то поуверенней себя чувствовать.

Спецы, написавшие не один десяток скриптов, что скажете о вопросах стабильности MAXScript? Есть ли какие-то конкретные ситуации, приводящие скрипт и макс к крашу?

Ну например, не приводит ли к пролемам, когда

Ошибки (точнее - вроде как их симптомы), которые меня беспокоят, не выводят услужливо описание ошибки. Они рушат макс. А когда пытаешься отладить и ставишь break() - все наглухо виснет.

(кстати, в Borland C++Builder класс-потомок TForm, названный не на "Т", не компилица и выдает кучу мата. Когда до меня этот факт дошел - это был глубокий шок )


denissavin

UV Tools 2.1


+ NEW. All "by shell" operations can be stopped by Esc.

+ NEW. Hidden setting. Enable borders for all buttons. Set main_iconBorders=true in ini file.

- Improved. Better progressbar behavior.

- Improved. Better high poly mesh handling.

+ NEW. Select longest UV edges. Right click on Rotate shell to edge.

+ NEW. Relax by shell. By Edges and Poly angles.

- Improved. Get size from selected polygons, not shell.

+ NEW. Switch material bitmaps in viewport.

+ NEW. Backface Cull selected objects. Click: Enable. Right Click: Disable.

+ NEW. Display material in viewport. Click: Switch. Right Click: Enable.

+ NEW. Checker list replaced by button. Click: Switch checker textures. Right Click: Restore object material.

+ NEW. Checker mapping channel get from UVW Map and UVW Xform.

- Improved. Added small horizontal arrow to Arrow Up checker.

- Fix. Issues with checker tiling update.

+ NEW. Spinners for scale U and V axes. Lock axes checkbutton for uniform scale.

- Improved. Scale minimum 1% to avoid flip.

+ NEW. Step button instead of checkbox. No need to setup step mode anymore.

+ NEW. Tootips with randomize values.

- Improved. Scale maximum +-90%.

- Fix. Full stack collapse if you have Turbosmooth at the top of current modifier.

+ NEW. Modular Rollouts UI with icons. You can hide rollouts with tools you don't need.

+ NEW. Many tools works with all sub objects.

- Improved. Status bar is now more helpful.

- Improved. Progress bar 3 colors: Green - ok, Yellow - processing, Red - error.

- Improved. Removed UI controls disabling.

- Improved. Auto add Unwrap on start is removed. It's became annoying.

- Fix. SubObjects selection reset.

- Fix. 3dsMax 2009 Angle snap disable error.

- Fix. Closing Unwrap UV Editor at start.

- Fix. Group head selection error.

- Fix. Macro tooltip mistype :)

+ NEW. SubObject level checkbuttons.

+ NEW. SubObjects conversions.

+ NEW. Select open uv edges.

+ NEW. Select edges outline from current selection. Doesn't work if you will select whole UV Shell.

+ NEW. Grow selection to UV Shells or Geo Elements.

+ NEW. Select same material IDs.

+ NEW. Select same Smooth Groups.

+ NEW. Loop/Ring like in UV Editor.

+ NEW. Transfer SubObject selection from Unwrap to Editable Poly or Edit_Poly and vise versa.

+ NEW. Collapse and Delete any modifier, not only Unwrap. Multiple objects selection supported.

+ NEW. Flatten mapping to realworld size.

+ NEW. Box mapping to realworld size.

+ NEW. Get size of selected polygons and paste into Scale To spinner.

+ NEW. Fit and center UV to tile.

+ NEW. Normalize UV Shells. Make mapping scale the same.

+ NEW. Match height and width of UV Shells.

+ NEW. Rotate UV Shells to selected vertices or edges.

+ NEW. Align UV Shells. 18 methods.

+ NEW. Checker materials. 4 bitmaps included, and you can add/remove them.

+ NEW. Original material can always be restored, even after 3dsMax crash.

+ NEW. Checker can use realworld size.

+ NEW. UV Smooth. Create SmoothGroups based on mapping elements.

+ NEW. UV Morpher. Create flat UV object in same size as original and morph it to model. Useful for retopology and skinning.

+ NEW. Auto multiplier based on selected UV Shells size.

+ NEW. Press Shift while drag Offset to change axis.

+ NEW. Remaining time.

+ NEW. Press Esc to cancel randomizer.

- Fix. Randomize by polygons removed. It can be extremely slow, you , and alsmost nobody need it.

+ NEW. Randomizer - 1 Tile Limit.

+ NEW. Fast and automatic "Reset W position" before "Scale to" procedure.

- Improved. "Reset W position" removed from "Scale to" right click.

- Fix. Undo UV transform was broken.

- Fix. Add Unwrap button errors.

- Fix. Randomizer wrong vertices selection.

+ NEW. AutoSelect option. Automatically grow selection to UV Shells before transform.

+ NEW. Break buttons is back again.

- Improved. Modes now only for Randomizer.

- Fix. Toolbar button now pressed if dialog is opened.

- Fix. Primitives re-enabled :) errors fixed. I hope so.

- Fix. Only poly or mesh now supported. No primitives or splines, to prevent some errors.

- Fix. UI lock behavior.

- Fix. DestroyDialog bug and crash in max2017.

+ NEW. Modes radiobuttons.

+ NEW. Polygons Mode.

+ NEW. Auto break selected polygons in Polygons mode. Break button removed.

+ NEW. Auto add "Turn to Poly" modifier if object is not EditablePoly.

+ NEW. Randomizer settings reset by right click on "Randomize" button. Reset button removed.

+ NEW. Optimized prevent freeze on heavy calculations.

- Fix. Unwrap will be added only if one object is selected.

- Fix. FlipU and FlipV randomizer was broken.

- Fix. Disable angle snap only in rotate operation.

- Fix. "Reset W fix" behavior.

- Fix. Some tootips and messages.

- Fix. Interactive UV transform memory leak.

- Fix. Redraw in randomizer now disabled. Speedup randomizer on small selections.

- Fix. Randomizer on mesh object was broken.

- Fix. Randomizer ram issue.

+ NEW. Scale U and V separately or both (by default).

+ NEW. Offset multiplier list. Useful to get higher precision UV offset.

+ NEW. Collapse Unwrap will select base object in modifier stack.

+ NEW. "Reset W fix" moved to "ScaleTo" Right Click.

+ NEW. Collapse Unwrap modifier.

- Fix. Add Unwrap while another modifiers are existed.

- Fix. Randomize on mesh error.

+ NEW. Stepped random mode for each transformation.

+ NEW. Randomize by geometry element option.

+ NEW. Automatically Add/Find unwrap at first start.

+ NEW. Settings saved: window position, scale to value, randomize settings

+ NEW. Reset W position of all mapping vertices when adding Unwrap by button. For correct Scale To function.

- Improved. Scale to now doesn't find different elements to speedup rescale process.

+ NEW. Scale to. Scale selected UV elements to realworld size.

+ NEW. Progress bar.

Привет! Может об этом уже писали. но все же. Если выделен объект, на который назначен модификатор Unwrap UV Tools, то не работают хоткеи.. все не проверял, но такие как Ctrl+S, Ctrl+Del точно не работают.. Привет! Может об этом уже писали. но все же. Если выделен объект, на который назначен модификатор Unwrap UV Tools, то не работают хоткеи.. все не проверял, но такие как Ctrl+S, Ctrl+Del точно не работают..

Скрипт к этому не имеет отношения. Я не уверен что на это вообще можно повлиять через maxscript.

Но я знаю из-за чего это. Анврап (и не только анврап) может перехватывать сочетания клавиш в 3дмаксе. Это можно отключить.

На скриншоте показано как это сделать.


Сори, не подумал об этом.. Переназначил у анврапа "пересекающиеся" хоткеи.

А за скрипт спасибо, очень годное дополнение.

Привет! Может об этом уже писали. но все же. Если выделен объект, на который назначен модификатор Unwrap UV Tools, то не работают хоткеи.. все не проверял, но такие как Ctrl+S, Ctrl+Del точно не работают..

Для этого есть кнопка Keyboard Shortcut Override Toggle

Я решил подразнить вас демонстрацией новых плюшек. Возможно кто-то подскажет что изменить или добавить.

- Сразу самое интересное. Цикличная смена битмап во вьюпорте. Поддерживаются Bitmaps, FstormBitmaps, CoronaBitmaps. Не важно где они находятся в материале, хоть внутри мультитекстуры. Левый клик - менять текстуры одну за другой. Правый клик - скрыть все.

Если выделен полигон с определенным material id, то текстуры будут меняться только на этом id.

- Интерактивный скейл теперь работает по аналогии с оффсетом. Во первых, появился замок для скейла по обеим осям или раздельно. Во вторых, зажатый шифт меняет ось как в оффсете.

- Интерфейс чекера претерпел изменения. Сделал компактнее и убрал список. Теперь это кнопка меняющая чекеры один за другим. В остальном всё также, вы можете удалять и добавлять свои.

Весь роллаут переименован во Viewport и туда добавились два переключателя, один для Backface Cull, а второй для отображения объектов в виде цвета сетки.

Дальше просто списком.

- Выделение самых длинных UV эджей. Например для выравнивания шеллов по ним.

- Релакс по шеллам. Если выделены полигоны, то by poly angle, в противном случае by edge angle. Почему по шеллам? Точно сказать не могу, но это приводит к иным результатам, нежели обычный релакс всех шеллов сразу.

- Правый клик на ресайзе теперь берет размер маппинга не с шелла а только с выделенных полигонов.

- Канал для чекера теперь будет находиться даже из UVW Map и UVW Xform модификаторов.

- Кнопки Step вместо галочек в рандомайзере запускают рандомайз в этом режиме. Теперь нет нужды это настраивать.

- Улучшено поведение скрипта с хайполи объектами.

- Ну и всякие мелкие багфиксы и улучшения.

2.1 готова и ждет модерации.

Не особо заметно, чтобы меня кто-то читал, но я напишу тут вместо создания очередного блога.

Плохая новость в том, что я не буду раздавать 2.1 бесплатно, как обновление. Объясню.

Это не хотфикс, хотя фиксов там хватает. В 2.1 есть новые хорошие фичи и улучшенные старые.

В производстве скрипты отнимают многократно больше времени, чем модели. Не дни, а месяцы. Профит со скриптов конечно символический и никогда не окупит временные затраты, но я не спешу лишиться даже этого только потому, что мой контент необходимо обновлять.

PDF документация из 2.1 выкинута, т.к. вся она написана в подсказках на кнопках.

UPD 2018.07.10

Всем привет. Хороших новостей нет, зато есть плохая :)

У некоторых пользователей max2017-max2018 возникает ошибка связанная с garbage collect'ом. Выглядит вот так

Текст ошибки - "An unknown error occured while MAXScript was performing garbage collection.If you get this error multiple times, recommended restarting max".

В скрипте в общем то много комманд "gc light:on". Она нужна для чистки памяти после интенсивных задач, и насколько я знаю используется в очень многих скриптах и не должна вызывать проблем.

Если кто-то знает причину таких ошибок, то пожалуйста посоветуйте. Тем временем, я продолжу свои поиски и если они принесут результат, сообщу здесь.

Нашел упоминания об этой ошибке аж за 2009 год. Были жалобы даже на Forest Pack. Вероятно дело не сколько в скриптах, сколько в сочетаниях системы, макса и скрипта.

maxscript auto-load script error


какой-то скрипт в автозагрузке не может автозагрузиться какой-то скрипт в автозагрузке не может автозагрузиться

если удалить эту папку может помочь?

какой-то скрипт в автозагрузке не может автозагрузиться

если удалить эту папку может помочь?

если кому интересно то я разобрался, просто удаляете эту папку и вуаля!)

Запустил проверку на вирусы (утилита др. веб). Как и ожидалось вирусы. И данные всплывающие окна с ошибками как ветром сдуло. А также поглядите здесь: C:\Program Files\Autodesk\3ds Max 2017\scripts\Startup, возможно тут находится скрипт, который не может автозагрузится, например, визуализатор какой-то удалили, да не до конца, тогда надо отсюда этот скрипт удалить и все будет ок C:\Users\Hasan\AppData\Local\Autodesk\3dsMax\2015 - 64bit\ENU если удалить эту папку может помочь?

Можно таким образом "обнулить" интерфейс, такое лекарство от всех проблем, но все настройки и некоторые скрипты тоже слетят.

Лучше в папке script/Startup удалить файл CoronaRenderer_InitScripts

Проблема заключается в том, что этот скрипт при каждом запуске обнуляет Corona official Toolbar и это может конфликтовать с Customize User Interface Toolbars где уже имеются короновские иконки.

P.S. Пришлось пересаживаться сегодня с 2016-го на 2021, целый день "приручаю"

C:\Users\Hasan\AppData\Local\Autodesk\3dsMax\2015 - 64bit\ENU если удалить эту папку может помочь?

Можно таким образом "обнулить" интерфейс, такое лекарство от всех проблем, но все настройки и некоторые скрипты тоже слетят.

Лучше в папке script/Startup удалить файл CoronaRenderer_InitScripts

Проблема заключается в том, что этот скрипт при каждом запуске обнуляет Corona official Toolbar и это может конфликтовать с Customize User Interface Toolbars где уже имеются короновские иконки.

Читайте также: