Thanks Vig, so you don't seem to have issues. I'm glad you like it. I'm sorry about the Editable Poly only support, but Edit Poly Modifier has a really restricted set of methods available compared to Editable Poly BaseObject, so it isn't likely to be coded by MaxScript only. I've been working for quite a while on a polyop class in C++ to tackle this problem by unifying those two kinds of geometry pipeline Objects, but it still needs a lot of work and testing...
It's sure I can display an error message when the current object is a Modifier, like when the edge loop is invalid. Currently the script works by automatically referencing the BaseObject, so you can use it even if you've and active TurboSmooth in the stack.
In the TO DO list with the multi average loop feature for the next update.
Hey Vig, I've done a little test, and I'm a bit lost. The script should already ignore every modifier in the stack and consider current edge selection in Editable Poly BaseObject only, even if you got an active Edit Poly Modifier. I cannot figure out how the script crashed, even if it's clear it couldn't find the Editable Poly, thus the polyOp method on line 292 failed.
Could you please tell me the steps to follow to reproduce the error? Thanks very much.
I was running the script in 2010 on a cylinder as the base object with Edit Poly on top, so my mistake. I didn't know the base object needed to be editable poly.
I didn't feel like opening the customize UI menu so I was evaluating the script with the header commented out, something most people probably won't be doing ha =P
I was able to recreate Poops issue too.
It worked once in Edit Poly as long as the base object is Editable Poly and I didn't move the edges. Once I moved the edges in Edit Poly, then every time after that it would hang like he said. BUT it works great as designed in Editable poly.
Esc did canceled it out and allow me to keep working.
Down in notification bar it said "track mouse" while it was frozen.
The vert preview was also off and not displaying correctly before clicking.
So a check and warning for that would be good?
So it works perfect in Editable Poly.
That's a bit of a bummer but totally understandable. They really need to combine all the mesh types into one super mesh type.
Editable Poly
Edit Poly
Editable Mesh
Edit Mesh
Poly Mesh
It's a big bag of chaos... =P
Thank you very much Vig, it really helps also for notifications in other IC instruments. If you have an Editable Poly as BaseObject, the script completely disregards what's currently displayed in viewport and consider that geometry, so the vertex snap is based on that faces too and could look off.
Do you think it would be better to automatically shut temporarily down modifiers visibility and show the actual Editable Poly BaseObject while picking and re-enabling previous stack status after calculation? It won't let you make mistakes about what you're currently picking, since the Edit Poly Modifier would be off in viewport too, not allowing misinterpretation.
I'm going to investigate the Edit Poly Modifier hanging issue that shouldn't be there. A warning shouldn't be needed as long as I am able to fix this issue, otherwise it is a wise practice to alert for errors before they show up.
About the 3ds internal geometry management there is a quite long discourse. And coding through SDK is quite hard. Let's say we got in the geometry branch of classes dependency tree:
- BaseObject
- Modifier (one of these is Edit Poly Modifier)
- Object
- IDerivedObject (a sort of Modifiers holder, to make it simple)
- GeomObject
- PolyObject (the Editable Poly Object)
- TriObject (the Mesh Objects)
And of course it is quite a mess, but cannot be avoided since the core has to deal with completely different data organization structures depending on TriMeshes and multi sided polygons. It won't be 3ds Max without all of this. I guess younger software, like Modo and Silo, takes advantage of a single data structure coded when CPU and memory resources aren't an issue, while 3ds Max was born when resources were very limited and everything was aiming for optimization.
Hi guys, I discovered a couple of errors. One in a rounding off that could lead to an infinite loop in the Average algorithm (remember ESC aborts the command), and another one in its logic that could stop the calculation after a single iteration.
I've already coded the multi Average option and added a feedback counter to let the user know what's going on during calculation.
I still need to code some minor fixes, but I'm quite confident to release this update later in the afternoon (GMT+2). Hang in there!
Next step is to see if is possible to extend this tool to Edit Poly Modifier. Need to check if everything I need is available in MaxScript.
SyncViewS: Awesome. Would you mind if I tried to port this script into MEL for Maya users? I haven't looked at the code yet but I imagine it should be possible.
I started writing my own version last week but the maths was getting too complicated for me, I'm not very good when it comes to doing 3d-space calculations
Maybe you'd like to wait for an updated and comfortably bug-free version. Next should be quite good, easier to read before I try to make it work on Edit Poly Modifier too.
Code is quite straightforward, as well as math. It could look a bit overcrowded by structures needed for MouseTracking but you can ignore that. Fundamental functions are just a bunch, and I don't use globals, neither to Max scope, nor to MacroScript scope, so you should be able to find always where things come from. Anyway I'm glad to give any explanation you would need.
Unfortunately I never used Maya, and don't have any clue about MEL. The only thing I know (but I could even be wrong) is that you must to add $ as prefix to variables like PHP.
Yep, hehe - int $var = 0;
I'll wait for your updated version, and take a look. I've ported a fair few things from maxscript to MEL before so I think it should be quite straightforward.
In fact a few times I've found that stuff which takes 10 lines in maxscript is a single line in MEL
I think this will be the case, as my coding style is quite plain and verbose, while keeping in mind some optimization tricks, because I don't ever want to struggle reading my own code 6 months later. I hope you'll find my Hungarian notation handy, there's a reference on top of MaxScript page, where you get the script.
I'm not sure if was Borislav Petrov who said Maya is built upon MEL, while MaxScript is built upon Max. That makes the first more powerful and requires more efforts, while the latter is a bit limited but easier to code. We could risk to say that MaxScript is a higher level language than MEL, with all benefits and limitations it involves. But again, I don't know MEL.
Don't hesitate to ask for explanation about the script if needed.
Hi guys, I've just published an update. Get IC.GeoEdgeLoop 0.2 from IllusionCatalyst website under Script section in MaxScript page. I hope you like it.
New feature:
Works on multiple closed Edge Loops providing feedback on current status.
Fixes:
Logic issue in Average function that could stop calculation after one iteration.
Rounding issue in Average function that could lead to an infinite loop.
Change:
When script is run all modifiers visibility is turned off letting the user view and pick vertexes from the BaseObject, as it is the only level it works on. The Modifier Stack status is restored after calculation or abort.
The script currently works on Editable Poly objects only. I'm already verifying if it is possible to extend it to Edit Poly Modifiers. Please report any issue and ideas for further improvement. Thank you.
Just tried newest version. Now the average doesn't hang, but it does leave me with a non planar loop. It actually started as planar, but not circular, and after running the script it is circular but not planar. This was just a basic 6 sided cylinder with two loops collapsed down to 5.
Hi Ben, that's really strange. I've just tested it and it works well for me, with single and multiple loops. I'm on Max9 x64, but it shouldn't be an issue. I know it sound a bit stupid, but could you post something to reproduce the issue on my machine? I really want to tackle this problem.
On IllusionCatalyst website you can find a newly updated version 0.3, with added support for Edit Poly Modifiers, and some security checks.
Hi Ben, I tested your geometry, and it works fine on me. I just took your Edit Poly object, selected all three edge loops and ran the script. The result is here.
I really cannot figure out what's happening on your machine. Do you have access to other systems? I'm on version 9, but just tried the 2009 as well and is fine. Meanwhile you could try the updated version, but the Average algorithm is the same. I'm deeply sorry, since you asked for the script and seems to be broken for you
Poops geo works for me too on 2008 32bit, 2009 32/64bit 2010 32/64bit. =/
It makes it planar not on an axis but on average? Could that be the problem you want it flattened to an axis? Or is it just being more weird than that?
Personally I prefer average over flatten to XYorZ, I can do that myself easy enough inside edit poly if needed.
Yes, it calculates the average plane for every loop it works on, and is not affected by active Axis Constraints. It could be an option, triggered pressing a modifier key like CTRL or SHIFT while starting the calculation. I can work on it if you consider it important, but the top priority is to make it work bug-free on every system.
Thank you very much Mark for the extensive testing, I truly appreciate it!
p.s.
Looking at the sample Ben posted, the script doesn't work at all, and makes a crappy polygon, neither regular, nor flat. I tried myself the script on provided geometry in the same Max version and it worked well, that's why I'm lost.
Hi guys, I had the chance to revise this script and caught a couple of quite subtle errors in the Averaging algorithm. They lead to an infinite loop. Some functions have been rewritten and retested to work in every allowed condition and give better results.
Get IC.GeoEdgeLoop 0.4 from IllusionCatalyst website under Script section in MaxScript page. Enjoy and please report any issue.
-- Error occurred in anonymous codeblock; position: 39475; line: 1504
>> MAXScript FileIn Exception: -- Syntax error: at else, expected <factor>
-- In line: else <<
Just a wild stab in the dark, probably wrong, but it looks like a if/else loop might be using do instead of then? At least when I change do to then it works, I didn't dig too long to see what that does or how it changes things but it seems to work... /shrug.
Thank you for the great idea, and for taking the time to leave a message here, I truly appreciate it. I don't understand the reason why previous version it didn't work for you, anyway this one is better
This script, along with IC.FrameIt, will be included in the forthcoming IC.Shape 2.0. Many other brand new instruments will wait for your care! Thank you.
Replies
It's sure I can display an error message when the current object is a Modifier, like when the edge loop is invalid. Currently the script works by automatically referencing the BaseObject, so you can use it even if you've and active TurboSmooth in the stack.
In the TO DO list with the multi average loop feature for the next update.
Could you please tell me the steps to follow to reproduce the error? Thanks very much.
I didn't feel like opening the customize UI menu so I was evaluating the script with the header commented out, something most people probably won't be doing ha =P
I was able to recreate Poops issue too.
It worked once in Edit Poly as long as the base object is Editable Poly and I didn't move the edges. Once I moved the edges in Edit Poly, then every time after that it would hang like he said. BUT it works great as designed in Editable poly.
Esc did canceled it out and allow me to keep working.
Down in notification bar it said "track mouse" while it was frozen.
The vert preview was also off and not displaying correctly before clicking.
So a check and warning for that would be good?
So it works perfect in Editable Poly.
That's a bit of a bummer but totally understandable. They really need to combine all the mesh types into one super mesh type.
Editable Poly
Edit Poly
Editable Mesh
Edit Mesh
Poly Mesh
It's a big bag of chaos... =P
Do you think it would be better to automatically shut temporarily down modifiers visibility and show the actual Editable Poly BaseObject while picking and re-enabling previous stack status after calculation? It won't let you make mistakes about what you're currently picking, since the Edit Poly Modifier would be off in viewport too, not allowing misinterpretation.
I'm going to investigate the Edit Poly Modifier hanging issue that shouldn't be there. A warning shouldn't be needed as long as I am able to fix this issue, otherwise it is a wise practice to alert for errors before they show up.
About the 3ds internal geometry management there is a quite long discourse. And coding through SDK is quite hard. Let's say we got in the geometry branch of classes dependency tree:
And of course it is quite a mess, but cannot be avoided since the core has to deal with completely different data organization structures depending on TriMeshes and multi sided polygons. It won't be 3ds Max without all of this. I guess younger software, like Modo and Silo, takes advantage of a single data structure coded when CPU and memory resources aren't an issue, while 3ds Max was born when resources were very limited and everything was aiming for optimization.
Wooo now optimizing tree branches won't be such a mission
I've already coded the multi Average option and added a feedback counter to let the user know what's going on during calculation.
I still need to code some minor fixes, but I'm quite confident to release this update later in the afternoon (GMT+2). Hang in there!
Next step is to see if is possible to extend this tool to Edit Poly Modifier. Need to check if everything I need is available in MaxScript.
Thank you.
I started writing my own version last week but the maths was getting too complicated for me, I'm not very good when it comes to doing 3d-space calculations
Maybe you'd like to wait for an updated and comfortably bug-free version. Next should be quite good, easier to read before I try to make it work on Edit Poly Modifier too.
Code is quite straightforward, as well as math. It could look a bit overcrowded by structures needed for MouseTracking but you can ignore that. Fundamental functions are just a bunch, and I don't use globals, neither to Max scope, nor to MacroScript scope, so you should be able to find always where things come from. Anyway I'm glad to give any explanation you would need.
Unfortunately I never used Maya, and don't have any clue about MEL. The only thing I know (but I could even be wrong) is that you must to add $ as prefix to variables like PHP.
I'll wait for your updated version, and take a look. I've ported a fair few things from maxscript to MEL before so I think it should be quite straightforward.
In fact a few times I've found that stuff which takes 10 lines in maxscript is a single line in MEL
I'm not sure if was Borislav Petrov who said Maya is built upon MEL, while MaxScript is built upon Max. That makes the first more powerful and requires more efforts, while the latter is a bit limited but easier to code. We could risk to say that MaxScript is a higher level language than MEL, with all benefits and limitations it involves. But again, I don't know MEL.
Don't hesitate to ask for explanation about the script if needed.
New feature:
Fixes:
Change:
The script currently works on Editable Poly objects only. I'm already verifying if it is possible to extend it to Edit Poly Modifiers. Please report any issue and ideas for further improvement. Thank you.
On IllusionCatalyst website you can find a newly updated version 0.3, with added support for Edit Poly Modifiers, and some security checks.
http://www.poopinmymouth.com/net/pcount/temp.max The mangled end is one that I ran averaged geoloop on, that's the result it gave me.
I really cannot figure out what's happening on your machine. Do you have access to other systems? I'm on version 9, but just tried the 2009 as well and is fine. Meanwhile you could try the updated version, but the Average algorithm is the same. I'm deeply sorry, since you asked for the script and seems to be broken for you
No worries, I'm just wondering why it isn't working on my machine.
It makes it planar not on an axis but on average? Could that be the problem you want it flattened to an axis? Or is it just being more weird than that?
Personally I prefer average over flatten to XYorZ, I can do that myself easy enough inside edit poly if needed.
Thank you very much Mark for the extensive testing, I truly appreciate it!
p.s.
Looking at the sample Ben posted, the script doesn't work at all, and makes a crappy polygon, neither regular, nor flat. I tried myself the script on provided geometry in the same Max version and it worked well, that's why I'm lost.
http://313designstudio.com/rappatools/
Get IC.GeoEdgeLoop 0.4 from IllusionCatalyst website under Script section in MaxScript page. Enjoy and please report any issue.
Thank you very much Mark!
EDIT: It is not enough to change the "do" with "then", the right code is up now.
This script, along with IC.FrameIt, will be included in the forthcoming IC.Shape 2.0. Many other brand new instruments will wait for your care! Thank you.
Thanks