MX_Roundish Can't find it anywhere.

Discussions concerning plugins for SOFTIMAGE©
User avatar
mc_axe
Posts: 415
Joined: 12 Mar 2013, 18:44

Re: MX_Roundish Can't find it anywhere.

Post by mc_axe » 16 Aug 2023, 18:05

Man, Im so bad at scripting, I feel like the SI SDK is like a desert, filled with super sparse cactus aples, that i need to find,
So hard to find answers in simple questions, maybe creators assume you knwo everything about the involved languages? Or the application?

Here is a version of the script that prepares NGons for MXRoundish,

Code: Select all

LogMessage("Preparing Geom'");
var sel = Selection;
var subcmp = sel(0).SubComponent;
var ctrlpts = subcmp.ComponentCollection;
NGonID=ctrlpts(0).Index;
MyNgon = "poly["+NGonID+"]";
MyObj = sel(0).name;
SetSelFilter("Polygon");
SelectMembers(null, null, null);
DuplicateMeshComponent("."+MyNgon, siPersistentOperation, null, null, null, null, null, null, null, null, null, null, null, null, null);
GrowSelection(null);
CreateCluster(null);//Ideally the new cluster should get a unique name
ShrinkSelection();
ApplyTopoOp("Collapse", MyObj+"."+MyNgon, siUnspecified, siPersistentOperation, null);
SelectObj(MyObj+".polymsh.cls.Polygon", null, null); //name of cluster appears here
SelectMembers(null, null, null);
GrowSelection(null);
ShrinkSelection();
ShrinkSelection();
LogMessage("\n\nReady to apply MXRoundish'");
--
Known issues cluster name, Idealy i shound name the cluster something random, and delete by the end -> Sometimes the script meshes up preexisting clusters, and when that happens you might see selection acting funny, or the proccess failing
If you select 2 or more ngons, it will applied in the first, if you want to disolve your selection by default add one more disolve in the second line,

I didnt even tried what happens when you have 2 or more ojects selected :-

Freezing the geometry is nessesary, i belive Vitaly works on immed mode, guy is such a great inspiration,
From playing around y/day (havent touch softy 10thousand years):

Image

User avatar
FXDude
Posts: 1129
Joined: 19 Jun 2012, 21:59

Re: MX_Roundish Can't find it anywhere.

Post by FXDude » 18 Aug 2023, 22:22

Hi,

I also stumbled on the current poly selection,
otherwise I don't know (I have yet to test your new script), but you seem to have figured it out !

And your not at all "bad" at scripting .... ( just maybe starting ? )

for me scripting is like an internet search challenge lol
( I would have a very hard time just typing a script from scratch lol )

Sometimes editing other authors code, (or ICE trees lol ) and learning from them !

I made it sound "easy" earlier, and it CAN be ... but can also be "hard" or "finnicky",
like don't miss a comma lol
also like in my own script earlier ... how to point to relative paths was not easy to find.


At the same time is scripting even VERY easy in XSI .. relative to Blender AND Maya AND 3dsMax ...
( Houdini is in it's own "class" )

The "object model" is AMAZING and makes everything SUPER-easy
no need for "pySI" or a "pyMel" equivalent ...
because pyMel makes python in Maya look like "more native python" much like in xsi which could "write" native Java or whatever !
At some point, I heard that there was .. or the beginnings of a Perl implementation early-on.

Nevertheless, LumaPictures ( authors of pyMel ) were very invested in XSI, and wrote a "mel wrapper" in Pyhon.

Otherwise, had xsi went-on with it's historically very-very strong "backwards compatibility" ....
( not always for everything , but to a -very- high degree )

... then Python 3 would've been just yet another interpreter following VB, Java and Py2
with NO NEED to forsake all python scripts ever written for/in XSI
technically, n'or was incompatibilizing all python scripts in Maya (or any other major app) really necessary,

Other than just keeping their old Py2 interpreters, while just ADDING a new Py3 interpreter,
software manufacturers COULD have gone with "PyPy: ,
being a VERY well established, and well maintained interpreter/fork of Python
which can read or parse BOTH Py2 AND Py3 ,

While doing so VERY-VERY fast ( for some things more than others ) because of "on the fly" compiling and running of scripts.
( some 30 to 90 of times faster for some things .. alot like CPython except that is Py3 only )




Otherwise In Maya, the native Python interpreter ... (without PyMel)
... is like sending mel commands in brackets from Python, which can sometimes defeat the purpose of using Python in the first place, rather than just using Mel , which also runs faster, and is what gets logged by Maya, instead of having to translate logged Mel commands into Python.

But Mel not as "easy to read" and lacks certain things that Python allows,
while Pymel has become a "separate install", so if people have PyMel with Py3 issues,
report it in the Pymel Github Page.



For Blender, In terms of "finnickyness" is I would say quite "finnicky" .... or it's very sensitive to "context" or which viewport your using .. like you can't run scripts that do things in 3d from a panel button or from the script editor just like that, because it would try to run it in the panel context, unless you specify exactly what and were your script would operate, and it's not always so easy find-out what the various contexts are for different things, and copying from the log to a script can be QUITE challenging, or can involve alot of editing of very very long commands.

I hope they address some of that.. there was some discussion way back when they were doing their Py3 API about a "MacroStyle" ( or Mel or XSI style ) logging / scripting interface.

But that never happened ( or not yet anyhoo )

Anyways, I'll try your script a little later !
Cheers!
Last edited by FXDude on 13 Sep 2023, 03:33, edited 1 time in total.

User avatar
FXDude
Posts: 1129
Joined: 19 Jun 2012, 21:59

Re: MX_Roundish Can't find it anywhere.

Post by FXDude » 23 Aug 2023, 01:09

Hi Mc_Axe,

Try this !

Code: Select all

sel = application.Selection;

GrowSelection(null);
             // Grow poly selection to survive subsequent poly collapse

CreateCluster(null);
             // Creates Temp  Poly Cluster 
             //( without re-naming it .. as doesn't seem to work, but no matter  )

SelectMembers( sel + ".polymsh.cls.Polygon", null, null);
             // select new cluster polys

ShrinkSelection();
             // shrink the grown poly selection in the cluster 


subcmp = sel(0).SubComponent;
ctrlpts = subcmp.ComponentCollection;
NGonID=ctrlpts(0).Index;
MyNgon = "poly["+NGonID+"]";
MyObj = sel(0).name;
             // set current selection name and current Ngon Variables


DuplicateMeshComponent( sel + MyNgon, siPersistentOperation, null, null, null, null, null, null, null, null, null, null, null, null, null);
             // Duplicate current poly selection

ApplyTopoOp("Collapse",  sel + MyNgon, siUnspecified, siPersistentOperation, null);
             // collapse current poly selection to a point
			 
ActivateRaycastPolySelTool(null);
             // Raycast poly select mode

SelectMembers( MyObj + ".polymsh.cls.Polygon", null, null);
             // select the grown poly selection 
             // ( would not have been there if they were not initially grown )

ShrinkSelection();
             // Shrink selection to get the original selection
			 
Application.Applymx_Roundish();
             // Mx Roundish selected polys
			 
ActivateRaycastPolySelTool(null);
             // Raycast poly select mode
			 
SetValue( MyObj + ".polymsh.mx_Roundish.stick", true, null);
             // set default "stick on surface" ... just because   :-)
  
DeleteObj( MyObj + ".polymsh.cls.Polygon");
             // Delete temp cluster initially created

  
I used your "current poly selection variable" ...
( that I couldn't figure-out myself initially .. thanks ! )

... and as you apparently also noticed by your "now apply MX_Roundish" log message
at the end of your script, that if you run mxRoundish,
it logs a command that you can't re-execute, or reapply on a new object.

Code: Select all

SelectObj("mx_Roundish<1781>", null, null);
which just returns an error.

So I found out the "scripting name" of MxRoundish in the plugin manager

Code: Select all

Application.Applymx_Roundish();
and seems to work !
( at least on my side )

Would have to ask RRay to update the mxRoundish entry in the resource section
( uhm ... if he's still around ?? --> or WHERE's RRAY ?? )

In any event, thanks for your efforts and Cheers !

Talik
Posts: 56
Joined: 09 May 2017, 11:13
Skype: nihao00042

Re: MX_Roundish Can't find it anywhere.

Post by Talik » 23 Aug 2023, 01:56

FXDude wrote: 23 Aug 2023, 01:09 Hi Mc_Axe,
Try this !
Niceeeee
Image

But sometimes unpredictables happen. When using it again on same mesh
Image

User avatar
FXDude
Posts: 1129
Joined: 19 Jun 2012, 21:59

Re: MX_Roundish Can't find it anywhere.

Post by FXDude » 24 Aug 2023, 20:56

Seems to work here ...

Image

What's NOT working though, is the last bit setting the "stick on surface" by default
which only applies to the first mxRoundish
( because they are all of the same name, not a big deal though, so might just remove that )

Also, for anyone who would want to use it,
freezing the modeling stack may be required before dissolving the components,
( to get rid of all segments in the rounded part, making it an Ngon again,
because the previously mentioned "collapse operator" would be very "hit and miss",
or would SOMETIMES work for this )

BUT ...

If you want to (more reliably) keep the modeling stack,
( say you are working on a "live clone" mesh )

... you can duplicate the rounded selection, and THEN would the dissolve work.

before doing "Modify > PolyMesh > Filter Points" on the whole object
to merge all vertices that have the same position,
to filter-out overlapping verts from the un-transformed duplicate polys
which should do the trick ! ( while everything remaining "live" )

Otherwise, note that this script is like << Apply mxRoundish for Ngons >>
so if not dealing with Ngons, mxRoundish works just fine "as is".

Cheers!
Last edited by FXDude on 12 Sep 2023, 23:30, edited 1 time in total.

User avatar
mc_axe
Posts: 415
Joined: 12 Mar 2013, 18:44

Re: MX_Roundish Can't find it anywhere.

Post by mc_axe » 02 Sep 2023, 19:25

Sorry dudes i have been AFK my area affected by wildfires,

@FXdude: With a quick look the MX roundish script seem to work fine, :ymparty:

As stated earlier, Vitaly super fast paced modeling style, is most likely done on immed mode, (consecutive booleans Etc)
So i think any bugs with consecutive operators are a bit irrelevant,

Personaly i would dissolve my selection before applying,
Because in most cases im not starting from a single ngon,

Also on top of what you did, apply some 0.9 scale to the cirlce
and maybe also make all edges equal,
and then freeze instantly,

The ultimate goal of course is to have The MX Roundish fix script, on a shortcut so later when i get my pieces together, i will try your sugestions to register a command,
Thanks again for your effort :ympeace:

Talik
Posts: 56
Joined: 09 May 2017, 11:13
Skype: nihao00042

Re: MX_Roundish Can't find it anywhere.

Post by Talik » 03 Sep 2023, 01:32

mc_axe wrote: 02 Sep 2023, 19:25
The ultimate goal of course is to have The MX Roundish fix script, on a shortcut so later when i get my pieces together
I hope that it will be "one click solution" without any need to go in menus to use this new feature. The beauty of Softimage is in easy solutions that can be used for fast modeling.

User avatar
FXDude
Posts: 1129
Joined: 19 Jun 2012, 21:59

Re: MX_Roundish Can't find it anywhere.

Post by FXDude » 12 Sep 2023, 22:54

mc_axe wrote: 02 Sep 2023, 19:25 As stated earlier, Vitaly super fast paced modeling style, is most likely done on immed mode, (consecutive booleans Etc)
So i think any bugs with consecutive operators are a bit irrelevant,
Indeed I agree about working in Immediate mode, or about freezing modeling frequently,
the procedural modeling stack is even typically mostly used as a:
"per-object local undo stack"

Otherwise, the importance of keeping everything "procedural", is only in rare-er circumstances when dealing with "poly extracts" or "ICE clones" or regular clones, as freezing modeling also "breaks" the connection to source meshes.

( I personally have several modeling "helpers" that break-up swappable input meshes into peices
before doing stuff to them individually, & merging everything back together again. )
The ultimate goal of course is to have The MX Roundish fix script,
on a shortcut so later when i get my pieces together, i will try your suggestions to register a command,
Although registering a command isn't such a big deal, it can indeed be like "a step".

But can addons (scripts) set their own hotkeys ?

( Would have to look into that )

Thanks again for your effort :ympeace:
No no! Thank YOU for your input and to Talik for this conversation !

~o) *-:) :-B 3:-O

Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests