Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup deduplication #656

Open
BradyAJohnston opened this issue Nov 14, 2024 · 0 comments
Open

cleanup deduplication #656

BradyAJohnston opened this issue Nov 14, 2024 · 0 comments

Comments

@BradyAJohnston
Copy link
Owner

Code for deduplication can be cleaned up, similar to this example:

import bpy
import re
   
def remove_duplicate_groups():
    node_groups = bpy.data.node_groups

    for group in node_groups:
        unduped_name, *_ = re.split("\.\d+$", group.name)

        if unduped_name in node_groups:
            group.user_remap(node_groups[unduped_name])
        else:
            group.name = unduped_name
    
    for group in node_groups:
        split_name, *_ = re.split("\.\d+$", group.name)
    
        if len(_) > 0 and split_name in node_groups:
            node_groups.remove(group)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant