Jump to content

Toggle modelling mode AND convert selection at once


Smolak

Recommended Posts

Hello,

 

Does anyone knows script for toggle modelling mode and convert selections at once ? Just combination of pressing enter and clicking with control key on different modelling mode. Edge mode is not as important...

Link to comment

In its simplest form such a script would be just a combination of SendModelingCommand() with MCOMMAND_CONVERTSELECTION to convert the selection and CallCommand() to switch the mode (command ID can be found in Script Log).
Right now, I'm in a hurry. Pretty sure, until I will find some time tomorrow, somebody will have copy/pasted something for you. If not, please ping me via PM and I can do it for you in a few minutes.

 

Link to comment

I do have the basics for such a script in the Python course already (I am too lazy to look up the exact chapter now), but here is an alternative with another MCOMMAND:

 

import c4d
from c4d import gui

def main():
    bc = c4d.BaseContainer()
    if doc.GetMode() == c4d.Mpolygons:
        c4d.utils.SendModelingCommand(c4d.MCOMMAND_SELECTPOLYTOPOINT, [op],
                    c4d.MODELINGCOMMANDMODE_ALL, bc, doc)
        doc.SetMode(c4d.Mpoints)
    else:
        c4d.utils.SendModelingCommand(c4d.MCOMMAND_SELECTPOINTTOPOLY, [op],
                    c4d.MODELINGCOMMANDMODE_ALL, bc, doc)
        doc.SetMode(c4d.Mpolygons)
    c4d.EventAdd()


if __name__=='__main__':
    main()

 

For some reason there is no equivalent command for edges, so if you want a three-step toggle, you need to use MCOMMAND_CONVERTSELECTION as MighT said.

 

----------
Learn more about Python for C4D scripting:
https://www.patreon.com/cairyn

 

Link to comment
4 hours ago, Smolak said:

Hello,

 

Does anyone knows script for toggle modelling mode and convert selections at once ? Just combination of pressing enter and clicking with control key on different modelling mode. Edge mode is not as important...

 

Perhaps I'm misunderstanding the question, but already you can convert from one selection type to another by using Ctrl-Click or Shift-Click. For example, if you have a poly selection and Ctrl-Click the Edge Mode icon, the selection will convert to an edge selection and the modeling mode will change all at once. Shift-Click converts the selection more expansively.  

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community