-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add decimate and weld operators under the new simplify menu
- Loading branch information
1 parent
c44e0b1
commit 1c7b454
Showing
7 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# ███╗ ██╗██████╗ | ||
# ████╗ ██║██╔══██╗ | ||
# ██╔██╗ ██║██║ ██║ | ||
# ██║╚██╗██║██║ ██║ | ||
# ██║ ╚████║██████╔╝ | ||
# ╚═╝ ╚═══╝╚═════╝ | ||
# | ||
# “Commons Clause” License Condition v1.0 | ||
# | ||
# See LICENSE for license details. If you did not receive a copy of the license, | ||
# it may be obtained at https://github.com/hugemenace/nd/blob/main/LICENSE. | ||
# | ||
# Software: ND Blender Addon | ||
# License: MIT | ||
# Licensor: T.S. & I.J. (HugeMenace) | ||
# | ||
# --- | ||
# Contributors: Tristo (HM) | ||
# --- | ||
|
||
import bpy | ||
from .. import bl_info | ||
|
||
|
||
class ND_MT_simplify_menu(bpy.types.Menu): | ||
bl_label = "Simplify" | ||
bl_idname = "ND_MT_simplify_menu" | ||
|
||
|
||
def draw(self, context): | ||
layout = self.layout | ||
layout.operator_context = 'INVOKE_DEFAULT' | ||
layout.operator("nd.decimate", icon='MOD_DECIM') | ||
layout.operator("nd.weld", icon='AUTOMERGE_ON') | ||
|
||
|
||
def draw_item(self, context): | ||
layout = self.layout | ||
layout.menu(ND_MT_simplify_menu.bl_idname) | ||
|
||
|
||
def register(): | ||
bpy.utils.register_class(ND_MT_simplify_menu) | ||
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(ND_MT_simplify_menu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# ███╗ ██╗██████╗ | ||
# ████╗ ██║██╔══██╗ | ||
# ██╔██╗ ██║██║ ██║ | ||
# ██║╚██╗██║██║ ██║ | ||
# ██║ ╚████║██████╔╝ | ||
# ╚═╝ ╚═══╝╚═════╝ | ||
# | ||
# “Commons Clause” License Condition v1.0 | ||
# | ||
# See LICENSE for license details. If you did not receive a copy of the license, | ||
# it may be obtained at https://github.com/hugemenace/nd/blob/main/LICENSE. | ||
# | ||
# Software: ND Blender Addon | ||
# License: MIT | ||
# Licensor: T.S. & I.J. (HugeMenace) | ||
# | ||
# --- | ||
# Contributors: Tristo (HM) | ||
# --- | ||
|
||
import bpy | ||
from math import radians | ||
|
||
class ND_OT_decimate(bpy.types.Operator): | ||
bl_idname = "nd.decimate" | ||
bl_label = "Decimate" | ||
bl_description = "Add a decimate modifier to the selected objects" | ||
bl_options = {'UNDO'} | ||
|
||
|
||
@classmethod | ||
def poll(cls, context): | ||
if context.mode == 'OBJECT' and len(context.selected_objects) > 0: | ||
return all(obj.type == 'MESH' for obj in context.selected_objects) | ||
|
||
|
||
def invoke(self, context, event): | ||
for obj in context.selected_objects: | ||
modifier = obj.modifiers.new('Decimate — ND', 'DECIMATE') | ||
modifier.decimate_type = 'DISSOLVE' | ||
modifier.angle_limit = radians(1) | ||
|
||
return {'FINISHED'} | ||
|
||
|
||
def register(): | ||
bpy.utils.register_class(ND_OT_decimate) | ||
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(ND_OT_decimate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ███╗ ██╗██████╗ | ||
# ████╗ ██║██╔══██╗ | ||
# ██╔██╗ ██║██║ ██║ | ||
# ██║╚██╗██║██║ ██║ | ||
# ██║ ╚████║██████╔╝ | ||
# ╚═╝ ╚═══╝╚═════╝ | ||
# | ||
# “Commons Clause” License Condition v1.0 | ||
# | ||
# See LICENSE for license details. If you did not receive a copy of the license, | ||
# it may be obtained at https://github.com/hugemenace/nd/blob/main/LICENSE. | ||
# | ||
# Software: ND Blender Addon | ||
# License: MIT | ||
# Licensor: T.S. & I.J. (HugeMenace) | ||
# | ||
# --- | ||
# Contributors: Tristo (HM) | ||
# --- | ||
|
||
import bpy | ||
|
||
|
||
class ND_OT_weld(bpy.types.Operator): | ||
bl_idname = "nd.weld" | ||
bl_label = "Weld" | ||
bl_description = "Add a weld modifier to the selected objects" | ||
bl_options = {'UNDO'} | ||
|
||
|
||
@classmethod | ||
def poll(cls, context): | ||
if context.mode == 'OBJECT' and len(context.selected_objects) > 0: | ||
return all(obj.type == 'MESH' for obj in context.selected_objects) | ||
|
||
|
||
def invoke(self, context, event): | ||
for obj in context.selected_objects: | ||
modifier = obj.modifiers.new('Weld — ND', 'WELD') | ||
modifier.merge_threshold = 0.001 | ||
|
||
return {'FINISHED'} | ||
|
||
|
||
def register(): | ||
bpy.utils.register_class(ND_OT_weld) | ||
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(ND_OT_weld) |