Author Topic: Reset Xref/Collapse/Edit Poly  (Read 3226 times)

2023-01-26, 08:30:12

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
I'm a big fan of speeding up my workflow as much as possible... I'm not great with scripting but I get by with basic skills.

One thing I've never been able to figure out is how to make a multi-command script (accessible by toolbar button OR hotkey OR both?) is:
 - (with selected object)
 - Reset Xref, then
 - Collapse, then
 - Convert to Edit Poly

I find myself doing this hundreds of times when setting up a new imported file.

Does this tool exist? If not, are there any super smart scripters out there that can quickly help me out?

Thanks for any tips!
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 09:51:53
Reply #1

James Vella

  • Active Users
  • **
  • Posts: 542
    • View Profile
I assume you mean Reset Xform instead of Reset Xref?

You could do this for multiple objects by using this code:

Code: [Select]
for obj in selection do
(
  ResetXForm obj
  ConvertToPoly obj
)

Copy this into your Maxscript editor:
editor" border="0

Then drag and drop to your toolbar, it will create a button
drag" border="0

You can then right click on that button, change the icon/name etc.


2023-01-26, 10:10:24
Reply #2

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
Hi James - you are indeed right with your assumption... ugh I'm obviously tired...

I'll test this out and let you know how I go. A million thanks for the help mate!
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 10:15:52
Reply #3

James Vella

  • Active Users
  • **
  • Posts: 542
    • View Profile

2023-01-26, 10:35:50
Reply #4

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
Oddly enough, every time I drag into the toolbar Max decides to crash.

I've made previous little script toolbar buttons with the following code (and adding the toolbar button via the settings)

macroScript 'NAME'
   category:"AAScripts"
   toolTip:""
( code here
)

I tried adapting this with your code but getting errors.

Any idea where I'm going wrong?
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 10:39:31
Reply #5

James Vella

  • Active Users
  • **
  • Posts: 542
    • View Profile
Did you drag and drop the exact code I wrote? Or did you edit it with your code?

I suggest copy it as I have first, test that if it works, if it crashes let me know.

Also which 3dsmax version are you using?

FYI if you are going to put your code then you need to evaluate the script, drag and drop wont work, it only works for code without the header, so for example:

Code: [Select]
macroScript ResetAndCollapse
   category:"AAScripts"
   toolTip:"ResetAndCollapse"
   
(
for obj in selection do
(
  ResetXForm obj
  ConvertToPoly obj
)
)

Once this is in your Editor you press CTRL+E (not drag and drop).

You can then go to Customize > Customize User Interface > Toolbars
toolbar" border="0
« Last Edit: 2023-01-26, 10:47:53 by James Vella »

2023-01-26, 10:40:59
Reply #6

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
Yes, was crashing with your code exactly.

Very odd.

Max 2023.1


When I try to run it with my own code (below) this is the error:
- Runtime error: ResetXForm requires a node

Code: [Select]
macroScript AAResetXformCollapse
category:"1AAScripts"
toolTip:""
for obj in selection do
(
  ResetXForm obj
  ConvertToPoly obj

)
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 10:49:32
Reply #7

James Vella

  • Active Users
  • **
  • Posts: 542
    • View Profile
you are missing another set of parenthesis, check my code above. I don't use 3dsmax 2023, so if its still an issue after using the additional parenthesis you might need someone who's using the latest version to help.

2023-01-26, 10:50:26
Reply #8

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
Yes, was crashing with your code exactly.

Very odd.

Max 2023.1


When I try to run it with my own code (below) this is the error:
- Runtime error: ResetXForm requires a node

Code: [Select]
macroScript AAResetXformCollapse
category:"1AAScripts"
toolTip:""
for obj in selection do
(
  ResetXForm obj
  ConvertToPoly obj

)

P.S. I don't think it's your code that's causing the crash but rather something buggy with my max...
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 10:53:19
Reply #9

James Vella

  • Active Users
  • **
  • Posts: 542
    • View Profile
Make sure you add the additional parenthesis:

Code: [Select]
macroScript ResetAndCollapse
   category:"AAScripts"
   toolTip:"ResetAndCollapse"
   
(
for obj in selection do
(
  ResetXForm obj
  ConvertToPoly obj
)
)

2023-01-26, 10:55:25
Reply #10

clemens_at

  • Active Users
  • **
  • Posts: 142
    • View Profile
btw soulburnscripts has this functionality too:


2023-01-26, 11:03:17
Reply #11

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
btw soulburnscripts has this functionality too:



Doesn't seem to work with 2023 unfortunately.

(Or, it is crashing for me, at least).
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 11:07:18
Reply #12

aaouviz

  • Active Users
  • **
  • Posts: 883
    • View Profile
    • Another Angle 3D
Hi,

I am SO sorry to be one of those annoying-people-you're-helping-with-nothing-in-return... BUT

Please see attached screencapture.

Either I'm doing something wrong, or something buggy is up with my max. Either is very likely...

Can you spot a problem? Thanks again James you're skills are impressive
Nicolas Pratt
Another Angle 3D
https://www.instagram.com/anotherangle3d/

2023-01-26, 11:10:52
Reply #13

romullus

  • Global Moderator
  • Active Users
  • ****
  • Posts: 8781
  • Let's move this topic, shall we?
    • View Profile
    • My Models
I use transform toolbox for this. It lets you reset transforms without adding modifier in the stack. Single press of a button and no need to constantly go to utilities panel and collapsing the stack. On top of that it also has some quick pivot alignment and other useful tools. I always summon this window at the start of modelling sessions and park it somewhere in the corner. I would permanently dock it in a toolbar, but unfortunately that way it creates too much wasted space.
I'm not Corona Team member. Everything i say, is my personal opinion only.
My Models | My Videos | My Pictures

2023-01-26, 11:11:48
Reply #14

clemens_at

  • Active Users
  • **
  • Posts: 142
    • View Profile
Quote
Doesn't seem to work with 2023 unfortunately.

(Or, it is crashing for me, at least).

works fine in 2023.1 here...