From 5abcb511abda747cdd3b5621517654a9c456562d Mon Sep 17 00:00:00 2001 From: Neltulz Date: Sat, 24 Aug 2019 15:51:08 -0500 Subject: [PATCH] Revert "v1.0.3 - Override Edge Flow, Improved Operator Versatility" This reverts commit e45a6973916f739982ec6511efe29ac589efe8e0. --- README_Neltulz_Edge_Curve_Plus.html | 10 +-- __init__.py | 8 +-- keymaps.py | 2 +- main_ot.py | 96 +++-------------------------- misc_ot.py | 45 -------------- panels.py | 47 ++++++++++---- properties.py | 27 +++++--- 7 files changed, 68 insertions(+), 167 deletions(-) delete mode 100644 misc_ot.py diff --git a/README_Neltulz_Edge_Curve_Plus.html b/README_Neltulz_Edge_Curve_Plus.html index 2c9a0a0..152e08b 100644 --- a/README_Neltulz_Edge_Curve_Plus.html +++ b/README_Neltulz_Edge_Curve_Plus.html @@ -79,7 +79,7 @@

- Neltulz - Edge Curve Plus
Version: 1.0.1
Last Update: 8/24/2019
+ Neltulz - Edge Curve Plus
Version: 1.0.0

@@ -241,7 +241,7 @@
Hotkeys
ALT+SHIFT+E Insert Edge Loop(s) with Flow object.neltulz_edge_curve_plus - useSidebarPanelOptions = True + None @@ -344,12 +344,6 @@

From the GNU GPL v3.0:

Changelog

diff --git a/__init__.py b/__init__.py index 5ff451e..b685674 100644 --- a/__init__.py +++ b/__init__.py @@ -6,20 +6,17 @@ "version" : (1, 0, 1), "location" : "View3D", "warning" : "", - "category" : "3D View", - "tracker_url": "https://www.logichaos.com/neltulz_blender_addons/neltulz_contact_page/neltulz_contact_page", - "wiki_url": "https://www.logichaos.com/neltulz_blender_addons/neltulz_edge_curve_plus/README_Neltulz_Edge_Curve_Plus" + "category" : "Generic" } # ----------------------------------------------------------------------------- -# Import Classes and/or functions +# Import Classes and/or functions # ----------------------------------------------------------------------------- import bpy from . properties import NeltulzEdgeCurvePlus_IgnitProperties from . main_ot import OBJECT_OT_NeltulzEdgeCurvePlus -from . misc_ot import OBJECT_OT_NeltulzEdgeCurvePlus_ResetAllSettings from . addon_preferences import OBJECT_OT_NeltulzEdgeCurvePlus_Preferences from . panels import OBJECT_PT_NeltulzEdgeCurvePlus @@ -35,7 +32,6 @@ classes = ( NeltulzEdgeCurvePlus_IgnitProperties, OBJECT_OT_NeltulzEdgeCurvePlus, - OBJECT_OT_NeltulzEdgeCurvePlus_ResetAllSettings, OBJECT_OT_NeltulzEdgeCurvePlus_Preferences, OBJECT_PT_NeltulzEdgeCurvePlus, ) diff --git a/keymaps.py b/keymaps.py index c2158bb..2266ee9 100644 --- a/keymaps.py +++ b/keymaps.py @@ -12,7 +12,7 @@ def neltulz_edge_curve_plus_register_keymaps(addon_keymaps): def createEdgeCurvePlusKeymap(): #create shortcuts for keymap kmi = km.keymap_items.new("object.neltulz_edge_curve_plus", type = "E", ctrl=False, shift=True, alt=True, value = "PRESS") - kmi.properties.useSidebarPanelOptions = True + #kmi.properties.PROPERTYNAME = 1 #------------------------------Object Mode---------------------------------------------------------------------------- diff --git a/main_ot.py b/main_ot.py index 60c5c12..16fa312 100644 --- a/main_ot.py +++ b/main_ot.py @@ -3,20 +3,6 @@ from . import misc_functions from . import addon_utils -from bpy.props import (StringProperty, - BoolProperty, - IntProperty, - FloatProperty, - FloatVectorProperty, - EnumProperty, - PointerProperty, - ) -from bpy.types import (Panel, - Operator, - AddonPreferences, - PropertyGroup, - ) - # ----------------------------------------------------------------------------- # Main Addon Operator # ----------------------------------------------------------------------------- @@ -27,51 +13,7 @@ class OBJECT_OT_NeltulzEdgeCurvePlus(bpy.types.Operator): bl_label = "Neltulz - Edge Curve Plus" bl_description = "Allows you to quick insert edges with flow" - useSidebarPanelOptions : BoolProperty( - name="Use Sidebar Panel Options", - description='Choose this if you want to use the "Neltulz - Edge Curve Plus" sidebar panel options when running this operator. This will cause the panel to override these properties: "numSegments", "useEdgeFlow", "tension", "numIterations", "minAngle" (Default: True)', - default = True - ) - - numSegments : IntProperty( - name="Segment Number", - description="Number of segments to add. (Default: 1)", - default = 1, - min = 1, - soft_max = 16 - ) - - useEdgeFlow : BoolProperty( - name="Use Edge Flow", - description='Allows you to use the EdgeFlow options (Tension, Num of iterations, Min Angle). If this is disabled, then edges will be added without edge flow adjustments. (Default: True)', - default = True - ) - - - tension : IntProperty( - name="Tension", - description="Tension (Default: 180)", - default = 180, - max = 500, - min = -500 - ) - - numIterations : IntProperty( - name="Number of Iterations", - description="Number of iterations. (Default: 1)", - default = 1, - min = 1, - soft_max = 128 - ) - - - minAngle : IntProperty( - name="Minimum Angle", - description="Minimum Angle (Default: 0)", - default = 0, - max = 180, - min = 0 - ) + @classmethod def poll(cls, context): @@ -82,27 +24,6 @@ def execute(self, context): obj = context.object scene = context.scene - #declare - numSegments_final = None - useEdgeFlow_final = None - tension_final = None - numIterations_final = None - minAngle_final = None - - if self.useSidebarPanelOptions: - numSegments_final = scene.neltulzEdgeCurvePlus.numSegmentsSlider - useEdgeFlow_final = scene.neltulzEdgeCurvePlus.useEdgeFlowCheckbox - tension_final = scene.neltulzEdgeCurvePlus.tensionSlider - numIterations_final = scene.neltulzEdgeCurvePlus.numIterationsSlider - minAngle_final = scene.neltulzEdgeCurvePlus.minAngleSlider - else: - numSegments_final = self.numSegments - useEdgeFlow_final = self.useEdgeFlow - tension_final = self.tension - numIterations_final = self.numIterations - minAngle_final = self.minAngle - - selectedVerts = misc_functions.getSelectedVerts(self, context, obj) if len(selectedVerts) > 0: @@ -120,7 +41,7 @@ def execute(self, context): for edgeIndex in set(selectedEdgeIndices): - bpy.ops.mesh.loopcut(number_cuts=numSegments_final, object_index=0, edge_index=edgeIndex, mesh_select_mode_init=(False, True, False)) + bpy.ops.mesh.loopcut(number_cuts=scene.neltulzEdgeCurvePlus.numSegments, object_index=0, edge_index=edgeIndex, mesh_select_mode_init=(False, True, False)) newEdges = misc_functions.getSelectedEdges(self, context, obj) newEdgeIndices = list() @@ -142,11 +63,14 @@ def execute(self, context): #switch to edit mode bpy.ops.object.mode_set(mode='EDIT') - if useEdgeFlow_final: - if addon_utils.check("EdgeFlow")[1]: - bpy.ops.mesh.set_edge_flow(tension=tension_final, iterations=numIterations_final, min_angle=minAngle_final) - else: - self.report({'ERROR'}, 'The "EdgeFlow" add-on could not be found. Please check to see if the Edge Flow addon is installed and enabled.' ) + if addon_utils.check("EdgeFlow")[1]: + print(scene.neltulzEdgeCurvePlus.tension) + print(scene.neltulzEdgeCurvePlus.numIterations) + print(scene.neltulzEdgeCurvePlus.minAngle) + + bpy.ops.mesh.set_edge_flow(tension=scene.neltulzEdgeCurvePlus.tension, iterations=scene.neltulzEdgeCurvePlus.numIterations, min_angle=scene.neltulzEdgeCurvePlus.minAngle) + else: + self.report({'ERROR'}, 'The "EdgeFlow" add-on could not be found. Please check to see if the Edge Flow addon is installed and enabled.' ) else: self.report({'ERROR'}, 'Please select something before running the script.' ) diff --git a/misc_ot.py b/misc_ot.py deleted file mode 100644 index d79768c..0000000 --- a/misc_ot.py +++ /dev/null @@ -1,45 +0,0 @@ -import bpy -from . properties import NeltulzEdgeCurvePlus_IgnitProperties -from . import misc_functions - -from bpy.props import (StringProperty, - BoolProperty, - IntProperty, - FloatProperty, - FloatVectorProperty, - EnumProperty, - PointerProperty, - ) -from bpy.types import (Panel, - Operator, - AddonPreferences, - PropertyGroup, - ) - -# ----------------------------------------------------------------------------- -# Main Addon Operator -# ----------------------------------------------------------------------------- - -class OBJECT_OT_NeltulzEdgeCurvePlus_ResetAllSettings(bpy.types.Operator): - """Tooltip""" - bl_idname = "object.neltulz_edge_curve_plus_reset_all" - bl_label = "Neltulz - Edge Curve Plus - Reset All Settings" - bl_description = "Resets all settings" - - @classmethod - def poll(cls, context): - return True - - def execute(self, context): - - scene = context.scene - - scene.neltulzEdgeCurvePlus.numSegmentsSlider = 1 - scene.neltulzEdgeCurvePlus.useEdgeFlowCheckbox = True - scene.neltulzEdgeCurvePlus.tensionSlider = 180 - scene.neltulzEdgeCurvePlus.numIterationsSlider = 1 - scene.neltulzEdgeCurvePlus.minAngleSlider = 0 - - return {'FINISHED'} - # END execute() -# END Operator() diff --git a/panels.py b/panels.py index 9a56ec9..af2bafe 100644 --- a/panels.py +++ b/panels.py @@ -23,7 +23,7 @@ class OBJECT_PT_NeltulzEdgeCurvePlus(Panel): bl_idname = "object.neltulz_edge_curve_plus_panel" - bl_label = "Edge Curve Plus v1.0.1" + bl_label = "Edge Curve Plus v1.0.0" bl_category = "Edge Curve+" bl_space_type = "VIEW_3D" bl_region_type = "UI" @@ -35,25 +35,46 @@ def draw(self, context): obj = context.object col = layout.column(align=True) + #col.label(text="Title:") + row = col.row(align=True) - col.prop(context.scene.neltulzEdgeCurvePlus, "numSegmentsSlider", text="Number of segments" ) - - col.separator() - - col = layout.column(align=True) + #op = row.operator('object.neltulz_edge_curve_plus', text="BUTTON TEXT") + #op.PROPERTYNAME=1 - col.prop(context.scene.neltulzEdgeCurvePlus, "useEdgeFlowCheckbox", text="Use Edge Flow" ) + #END Overlay Options (Wireframe, Edge colors, etc) - if scene.neltulzEdgeCurvePlus.useEdgeFlowCheckbox: + # ----------------------------------------------------------------------------- + # Use Advanced Settings Box + # ----------------------------------------------------------------------------- - col = layout.column(align=True) + col = layout.column(align=True) + row = col.row(align=True) - col.prop(context.scene.neltulzEdgeCurvePlus, "tensionSlider", text="Tension" ) - col.prop(context.scene.neltulzEdgeCurvePlus, "numIterationsSlider", text="Number of iterations" ) - col.prop(context.scene.neltulzEdgeCurvePlus, "minAngleSlider", text="Min Angle" ) + col.prop(context.scene.neltulzEdgeCurvePlus, "numSegments", text="Number of segments" ) + col.prop(context.scene.neltulzEdgeCurvePlus, "tension", text="Tension" ) + col.prop(context.scene.neltulzEdgeCurvePlus, "numIterations", text="Number of iterations" ) + col.prop(context.scene.neltulzEdgeCurvePlus, "minAngle", text="Min Angle" ) col = layout.column(align=True) row = col.row(align=True) op = row.operator('object.neltulz_edge_curve_plus', text="Insert Edge(s)") - op = row.operator('object.neltulz_edge_curve_plus_reset_all', text="Reset All Settings") + + col.separator() + + col.prop(context.scene.neltulzEdgeCurvePlus, "advancedSettings", text="Use Advanced Settings" ) + + + if scene.neltulzEdgeCurvePlus.advancedSettings: + + boxAdvancedOptions = layout.box() + boxAdvancedOptions.label(text="Advanced Settings:") + + box = boxAdvancedOptions.column(align=True) + + row = box.row(align=True) + + #op = row.operator('object.neltulz_edge_curve_plus', text="BUTTON TEXT") + #op.PROPERTYNAME=1 + + #END Use Advanced Settings Box \ No newline at end of file diff --git a/properties.py b/properties.py index 09972c6..4dd0bab 100644 --- a/properties.py +++ b/properties.py @@ -20,13 +20,18 @@ class NeltulzEdgeCurvePlus_IgnitProperties(bpy.types.PropertyGroup): - useEdgeFlowCheckbox : BoolProperty( - name="Use Edge Flow", - description="Applies edge flow to the newly created edge loops. (Default: True)", - default = True + exampleEnumItems = [ + ("1", "Name1", "NAME1"), + ("2", "Name2", "NAME2"), + ] + + exampleEnum : EnumProperty( + items=exampleEnumItems, + description="Description (Default: 1)", + default="1" ) - numSegmentsSlider : IntProperty( + numSegments : IntProperty( name="Segment Number", description="Number of segments to add. (Default: 1)", default = 1, @@ -34,7 +39,7 @@ class NeltulzEdgeCurvePlus_IgnitProperties(bpy.types.PropertyGroup): soft_max = 16 ) - numIterationsSlider : IntProperty( + numIterations : IntProperty( name="Number of Iterations", description="Number of iterations. (Default: 1)", default = 1, @@ -42,7 +47,7 @@ class NeltulzEdgeCurvePlus_IgnitProperties(bpy.types.PropertyGroup): soft_max = 128 ) - tensionSlider : IntProperty( + tension : IntProperty( name="Tension", description="Tension (Default: 180)", default = 180, @@ -50,10 +55,16 @@ class NeltulzEdgeCurvePlus_IgnitProperties(bpy.types.PropertyGroup): min = -500 ) - minAngleSlider : IntProperty( + minAngle : IntProperty( name="Minimum Angle", description="Minimum Angle (Default: 0)", default = 0, max = 180, min = 0 ) + + advancedSettings : BoolProperty( + name="Checkbox Name", + description="Use advanced settings. (Default: False)", + default = False + ) \ No newline at end of file