Jump to content

Set New Selection 1.2

   (0 reviews)

1 Screenshot

About This File

I have been using "Set Selection" on many occasions. Be it to create selection tags to apply different materials to an object.

Or simply as kind of a clipboard to temporarily hold a set of selected polygons during modeling.

However, in most cases I do not have enough with a single selection tag. It can happen that during a modeling session I need a few temporary selections, to be picked up later in the process when I need to work here and there on a model.

As such, in the past I had a love-hate relationship with the "Set Selection" command. It was a very useful tool, except that it required me to always deselect the newly created selection tag before I could create another one. Reason for this is that if you perform a "Set Selection" with a selected tag, the newly selected items would be merged into the selected tag ... instead of being created in their own separate tag.

I mostly use the Commander to quickly type "set se" and press enter. Or I would add the "Set Selection" icon into a modeling palette and dock it in the layout.

Still, in order to be able to create multiple selection tags, I would need to execute the command, deselect the tag, and proceed with creating a new selection.

 

NOT ANYMORE ...

It finally annoyed me so much that I spend some time writing a script to provide the functionality to perform a "Set New Selection" ... NOT overwriting the current selection tag. This script will create a new selection tag of its own, use an appropriate unique name (just as the native "Set Selection"), store the selected items be it polygons, edges or points.

I call it: Set New Selection.

The good thing is, that you can execute this script from the Commander, or drag the icon into a palette and dock it into the layout.

AND it can coexist next to the native "Set Selection". Which means you can still use the original behaviour if you want to overwrite a selection tag, or use the new one to create separate tags each time the script is executed.

Isn't that neat? Yes, I thought so too!

 

Does work with R16 - R23 (not tested with S22, S24)

 

HOW TO install:

- download the zip file

- go to your Cinema4D preference folder (menu Edit > Preferences ... wait for it ... click button at bottom left "Open Preferences folder").

- navigate to library, then scripts

- extract the content of the downloaded zip file here (or in a subfolder).

- restart Cinema4D.

 


What's New in Version 1.2   See changelog

Released

Added functionality to support points and edges.


User Feedback

Recommended Comments

Fantastic this has been annoying me so much 🙂 it should be like this in c4d by default. Thanks a lot

Link to comment
15 minutes ago, thanulee said:

Hello,

Is this compatible with R23? I get errors I think and script is greyed out!

Cheers

Please check the details. It mentions:

"Does probably work with R16 - R21, not sure about S22, will definitely not work with R23. "

Link to comment

Oh sorry I got confused cause I was looking at another script.
Is there a possibility to update it for R23? 🙂
Its a great addition!

Many thanks!

Link to comment

Oh now i know why i got confused about versions, i was also checking the ringloop!
U have 2 amazing utilitie plugins 🙂 cheers

Link to comment
21 hours ago, thanulee said:

Oh now i know why i got confused about versions, i was also checking the ringloop!
U have 2 amazing utilitie plugins 🙂 cheers

2 ... and all the other ones! 😉

 

This script has now been updated to be compatible with Python 3.7, which is used in R23.

 

Note that next time you have a problem, it would be handy to copy the error from the console and paste it here.

This would allow to investigate the issue. It seems this was a quick fix, as the "print" command in Python 3.7 requires parenthesis.

No other changes required.

 

Enjoy the update!

 

Link to comment

Wow you are a beast mate!! Many thanks!!

ps. I ll take a look on the rest of ur plugins/scripts probably i am not aware of these. 

Link to comment

Small update for this script, as I kept hitting a wall when using this.

In previous versions the behaviour was such that the currently selected selection tags were left as is, and the newly created selection tag was not selected. This in order to mimick the original "set selection" behaviour.

However, in recent times I found that behaviour working against me. So, I have now updated the script to deselect all previous selection tags and select the newly created one.

 

But I have made sure a user can simply revert to the old behaviour by opening the script in the editor, and replacing a single piece of text.

SetNewSelection11-option.jpg.7d910eace1787c281eaa36f62676fb86.jpg

 

For the new behaviour, leave line 10 as is:

gSelectNewTag = True

 

For the old behaviour, simply replace "True" by "False":

gSelectNewTag = False

 

New version 1.1 uploaded !

 

Link to comment

Man! This is so embarrassing ...

I never realized I hadn't completed the functionality for points and edges.

Up to now I only needed the script for polygon selections, and all was fine.

The other day I needed to create edge and point selection ... and nothing worked. Whaaat !?

 

Uploaded version 1.2 with completed functionality for polygons, edges, points. There you go!

Sorry for the inconvenience. Soooo embarrassing!

 

Link to comment

This script is great. I'm using c4d r21, everything is fine but when I set this tool as a icon in my viewport, my render view does not work. I'm using the script v1.2.

Link to comment
9 hours ago, cashmember said:

... when I set this tool as a icon in my viewport, my render view does not work. I'm using the script v1.2.

Sorry, cannot reproduce the problem.

Tried with R21.207, render view works fine using Ctrl-R shortcut, or pressing the icon.

Link to comment
15 hours ago, Smolak said:

I still don't know what is difference with orginal one ? It has exactly the same behavior 😕

(as mentioned in the details-tab)

When a selection tag is active the native "Set Selection" command will store the selection in that active selection tag.

The "Set New Selection" presented here will ALWAYS create a new selection tag before storing the selection.

This prevents from accidentally overwriting your selected tag.

Link to comment

The native "Store Selection" command ALWAYS create new seletion tag even if it is selected. To overwrite current seletion tag you must hold Shift.

 

image.png.57636401c36a53c6a33dc32801d3d296.png

Link to comment
2 minutes ago, bezo said:

This behaviour was introduced with S24

And probably the old one "Set Selection" was gone because I can't find it in R25. For my workflow the old one behavior was better. Is there way to simulate "holding shift" key in script ?

Link to comment
13 hours ago, Smolak said:

Is there way to simulate "holding shift" key in script ?

You could open the script log and check what command is performed when using the "Store Selection" with and without holding shift key.

You can then create a script that checks for the shift key being pressed, and call one or the other by copying the line of code that the script log shows you.

 

I don't have S24 or above, so cannot test this out for you.

 

Following script tests the shift key:

 

import c4d

def main():
    # check for shift-key being pressed
    result = c4d.BaseContainer()
    if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_SHIFT, result):
        if result.GetBool(c4d.BFM_INPUT_VALUE):
            print("shift was pressed")
        else:
            print("shift was not pressed")

if __name__=='__main__':
    main()

 

Link to comment
5 hours ago, dast said:

You could open the script log and check what command is performed when using the "Store Selection" with and without holding shift key.

 

 

 

 

Thank you for information. I tried this before and unfortunately it has the same command with shift pressed or not :

 

image.png.5e7bc9d258e36e5ecd46643a1cdc0668.png

Link to comment
On 5/31/2021 at 8:58 AM, cashmember said:

... when I set this tool as a icon in my viewport, my render view does not work. I'm using the script v1.2.

The problem is related to the "def state():" part in the script.

MAXON confirmed there is a bug in their Python script handling, this will be fixed in an upcoming update of Cinema4D. Most certainly R25 and above only, I am afraid.

 

One workaround is to remove the whole "def state():" function from the script ... or not dock the script icon into your layout.

Link to comment
On 11/6/2021 at 8:30 PM, Smolak said:

And probably the old one "Set Selection" was gone because I can't find it in R25. For my workflow the old one behavior was better. Is there way to simulate "holding shift" key in script ?

 

The new "Store Selection" uses the same command ID as the old "Set Selection".

My guess is that MAXON has simply renamed and reimplemented the old command with the new behaviour.

 

I have provided here a script which mimics the old behaviour.

Have not tested on S24 or above.

 

Enjoy!

 

Set Selection (legacy).zip

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community