-
-
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: split blank_sketch into single_vertex and make_manifold operators
- Loading branch information
1 parent
aae7e91
commit 08f6efe
Showing
6 changed files
with
117 additions
and
4 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
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,37 @@ | ||
import bpy | ||
import bmesh | ||
|
||
|
||
class ND_OT_make_manifold(bpy.types.Operator): | ||
bl_idname = "nd.make_manifold" | ||
bl_label = "Make Manifold" | ||
bl_description = "Attempts to turn the current sketch into a manifold polygon" | ||
bl_options = {'UNDO'} | ||
|
||
|
||
def execute(self, context): | ||
bpy.ops.object.mode_set_with_submode(mode='EDIT', mesh_select_mode={'VERT'}) | ||
bpy.ops.mesh.select_all(action='SELECT') | ||
bpy.ops.mesh.remove_doubles(threshold=0.0001) | ||
bpy.ops.mesh.edge_face_add() | ||
|
||
return {'RUNNING_MODAL'} | ||
|
||
|
||
@classmethod | ||
def poll(cls, context): | ||
return context.mode == 'EDIT_MESH' | ||
|
||
|
||
def menu_func(self, context): | ||
self.layout.operator(ND_OT_make_manifold.bl_idname, text=ND_OT_make_manifold.bl_label) | ||
|
||
|
||
def register(): | ||
bpy.utils.register_class(ND_OT_make_manifold) | ||
bpy.types.VIEW3D_MT_object.append(menu_func) | ||
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(ND_OT_make_manifold) | ||
bpy.types.VIEW3D_MT_object.remove(menu_func) |
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,41 @@ | ||
import bpy | ||
from .. lib.objects import add_single_vertex_object, align_object_to_3d_cursor | ||
|
||
|
||
class ND_OT_single_vertex(bpy.types.Operator): | ||
bl_idname = "nd.single_vertex" | ||
bl_label = "Single Vertex" | ||
bl_description = "Creates a single vertex object at the 3D cursor" | ||
bl_options = {'UNDO'} | ||
|
||
|
||
def execute(self, context): | ||
add_single_vertex_object(self, context, "Sketch") | ||
align_object_to_3d_cursor(self, context) | ||
self.start_sketch_editing(context) | ||
|
||
return {'FINISHED'} | ||
|
||
|
||
@classmethod | ||
def poll(cls, context): | ||
return context.mode == 'OBJECT' | ||
|
||
|
||
def start_sketch_editing(self, context): | ||
bpy.ops.object.mode_set_with_submode(mode='EDIT', mesh_select_mode={'VERT'}) | ||
bpy.ops.mesh.select_all(action='SELECT') | ||
|
||
|
||
def menu_func(self, context): | ||
self.layout.operator(ND_OT_single_vertex.bl_idname, text=ND_OT_single_vertex.bl_label) | ||
|
||
|
||
def register(): | ||
bpy.utils.register_class(ND_OT_single_vertex) | ||
bpy.types.VIEW3D_MT_object.append(menu_func) | ||
|
||
|
||
def unregister(): | ||
bpy.utils.unregister_class(ND_OT_single_vertex) | ||
bpy.types.VIEW3D_MT_object.remove(menu_func) |