Skip to content

Commit

Permalink
v1.0.9 - Add Extreme Isolate & More
Browse files Browse the repository at this point in the history
- added ability to hided axes when isolating objects
- added "use extreme isolate"
- improved compatibility with other addons when performing UNDO or REDO
- removed some console print messages
- removed some unnecessary code that apparently did nothing
- removed some code that was supposed to improve camera distance when framing only vertice, but in many cases was causing camera to be too zoomed out
  • Loading branch information
Neltulz committed Dec 7, 2019
1 parent fca9919 commit abae91b
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 42 deletions.
18 changes: 15 additions & 3 deletions README_Neltulz_Smart_Frame_Selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<meta name="twitter:card" value="summary">

<!-- Open Graph data -->
<meta property="og:title" content="Neltulz - Smart Frame Selection v1.0.8" />
<meta property="og:title" content="Neltulz - Smart Frame Selection v1.0.9" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.logichaos.com/neltulz_blender_addons/neltulz_smart_frame_selection/README_Neltulz_Smart_Frame_Selection"/>
<meta property="og:image" content="https://www.logichaos.com/neltulz_blender_addons/neltulz_smart_frame_selection/readme_html_files/img/logo.png" />
<meta property="og:description" content="Updated: 10/12/2019 - A blender addon that provides a quick way to frame selected objects, or frame all objects if nothing is selected." />
<meta property="og:description" content="Updated: 12/07/2019 - A blender addon that provides a quick way to frame selected objects, or frame all objects if nothing is selected." />

<link href="readme_html_files/fontawesome-free-5.10.1-web/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="readme_html_files/css/bootstrap-reboot.min.css">
Expand Down Expand Up @@ -83,7 +83,7 @@
</picture>

<h1 class="pageTitle">
Neltulz - Smart Frame Selection<br><span class="versionNum">Version: 1.0.8<br>Updated: 10/12/2019</span>
Neltulz - Smart Frame Selection<br><span class="versionNum">Version: 1.0.9<br>Updated: 12/07/2019</span>
</h1>

<div class="versionAndDownloadBar">
Expand Down Expand Up @@ -295,6 +295,18 @@ <h1>From the GNU GPL v3.0:</h1>
<h3 id="changelog">Changelog</h3>

<ul>
<li>2019-12-07
<ul>
<li>Added ability to hide axes when isolating objects</li>
<li>Added "Use Extreme Isolate". When enabled, hidden objects will be "truly" hidden, granting a huge performance increase when adding objects to the scene and adjusting their operator properties.<br><br>
Use caution, this setting can cause the scene to take a very long time to refresh when unhiding all previously hidden objects, depending on scene complexity and total scene poly count.
</li>
<li>Improve compatibility with other addons when performing UNDO or REDO. (Added "UNDO" to the operator options</li>
<li>Removed some console print messages.</li>
<li>Removed some unnecessary code that apparently did nothing.</li>
<li>Removed some code that was supposed to improve camera distance when framing only 1 vertice, but in many cases, was causing the camera to be too zoomed out.</li>
</ul>
</li>
<li>2019-10-12b
<ul>
<li>Added ability to move the viewport to the origin</li>
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author" : "Neil V. Moore",
"description" : 'More ways to "Frame Selection" when pressing the keyboard shortcut',
"blender" : (2, 80, 0),
"version" : (1, 0, 8),
"version" : (1, 0, 9),
"location" : "View3D",
"warning" : "",
"category" : "Generic",
Expand Down
26 changes: 10 additions & 16 deletions main_ot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OBJECT_OT_NeltulzSmartFrameSel(bpy.types.Operator):
bl_idname = "object.neltulz_smart_frame_sel"
bl_label = "Neltulz - Smart Frame Selection"
bl_description = 'More ways to "Frame Selection" when pressing the keyboard shortcut'
bl_options = {'REGISTER'}
bl_options = {'REGISTER', 'UNDO'}

frameSelection : BoolProperty(
name="Frame Selection",
Expand All @@ -45,8 +45,6 @@ def poll(cls, context):

def execute(self, context):



scene = context.scene

showErrorMessages = True #declare
Expand All @@ -68,18 +66,13 @@ def execute(self, context):
active_obj = obj_sel[0]

try:
print( "object mode: " + bpy.context.object.mode)
#try to determine objectMode
objectMode = bpy.context.object.mode
except:
#Object Mode is unknown
for obj in bpy.data.objects:
active_obj = obj
break
print( "object mode: Unknown" )

if active_obj is not None:
print( "active object type: " + active_obj.type)
else:
print( "active object type: Unknown")

visibilityCommandList = [
"bpy.context.space_data.show_object_viewport_mesh",
Expand Down Expand Up @@ -123,7 +116,7 @@ def execute(self, context):

if objectMode == "Unknown" and active_obj == None:
if len(bpy.context.scene.objects) <= 0:
print('No objects found!')
#No objects found!
bpy.ops.object.neltulz_smart_frame_sel_viewport_to_origin()

else:
Expand Down Expand Up @@ -166,6 +159,11 @@ def execute(self, context):

if totalNumVertsSel > 0:

if self.frameSelection:
bpy.ops.view3d.view_selected(use_all_regions=bUseAllRegions)

'''
#OLD ZOOM CODE FOR WHEN ONLY 1 VERT IS SELECTED. DISABLED UNTIL FURTHER NOTICE BECAUSE IT'S PROBLEMATIC FOR OBJECTS THAT ARE VERY SMALL OR VERY LARGE.
if totalNumVertsSel == 1:
#self.report({'INFO'}, 'edit mode: object selected: SINGLE vert selected' )
if self.frameSelection:
Expand All @@ -184,6 +182,7 @@ def execute(self, context):
#self.report({'INFO'}, 'edit mode: object selected: multiple verts selected' )
if self.frameSelection:
bpy.ops.view3d.view_selected(use_all_regions=bUseAllRegions)
'''



Expand Down Expand Up @@ -225,11 +224,6 @@ def execute(self, context):
totalNumCurveHandlesRight += len( selectedCurvePointsAndHandles[2] )
totalNumCurvePointsAndHandles = totalNumCurvePointsSel + totalNumCurveHandlesLeft + totalNumCurveHandlesRight

#print( "Total Selected Curve Points: " + str(totalNumCurvePointsSel) )
#print( "Total Selected Curve Handles (LEFT): " + str(totalNumCurveHandlesLeft) )
#print( "Total Selected Curve Handles (RIGHT): " + str(totalNumCurveHandlesRight) )
#print( "Total Selected Curve Points & Handles: " + str(totalNumCurvePointsAndHandles) )

if totalNumCurvePointsAndHandles > 0:

if self.frameSelection:
Expand Down
37 changes: 37 additions & 0 deletions misc_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ def hideUnselected_Objs(self, context, scene, obj_sel, active_obj):
pass
else:
obj['neltulzSmartFrameSel_hidden'] = 1

#should object use extreme hidden to grant a big performance increase?
if scene.neltulzSmartFrameSel.useExtremeHideOnIsolate:
if obj.hide_viewport == False:
obj.hide_viewport = True

foundObjectToHide = True

'''
if bpy.context.object.mode == "EDIT":
if obj is not active_obj:
if not obj.type == active_obj.type:
Expand All @@ -165,6 +172,7 @@ def hideUnselected_Objs(self, context, scene, obj_sel, active_obj):
else:
obj['neltulzSmartFrameSel_hidden'] = 1
foundObjectToHide = True
'''


if foundObjectToHide:
Expand All @@ -173,9 +181,19 @@ def hideUnselected_Objs(self, context, scene, obj_sel, active_obj):
#store current floor visibility for use later:
scene.neltulzSmartFrameSel.floorWasPreviouslyVisible = bpy.context.space_data.overlay.show_floor

#store current axes visibility for use later:
scene.neltulzSmartFrameSel.axis_x_wasPreviouslyVisible = bpy.context.space_data.overlay.show_axis_x
scene.neltulzSmartFrameSel.axis_y_wasPreviouslyVisible = bpy.context.space_data.overlay.show_axis_y
scene.neltulzSmartFrameSel.axis_z_wasPreviouslyVisible = bpy.context.space_data.overlay.show_axis_z

if scene.neltulzSmartFrameSel.hideFloorOnIsolate:
bpy.context.space_data.overlay.show_floor = False

if scene.neltulzSmartFrameSel.hideAxesOnIsolate:
bpy.context.space_data.overlay.show_axis_x = False
bpy.context.space_data.overlay.show_axis_y = False
bpy.context.space_data.overlay.show_axis_z = False

#hide all but selected
for obj in bpy.context.scene.objects:
if 'neltulzSmartFrameSel_hidden' in obj:
Expand All @@ -187,14 +205,33 @@ def hideUnselected_Objs(self, context, scene, obj_sel, active_obj):

def unhidePreviouslyHidden_Objs(self, context, scene):

#restore floor visibility
if scene.neltulzSmartFrameSel.floorWasPreviouslyVisible:
bpy.context.space_data.overlay.show_floor = True

#restore axes visibility
if scene.neltulzSmartFrameSel.axis_x_wasPreviouslyVisible:
bpy.context.space_data.overlay.show_axis_x = True

if scene.neltulzSmartFrameSel.axis_y_wasPreviouslyVisible:
bpy.context.space_data.overlay.show_axis_y = True

if scene.neltulzSmartFrameSel.axis_z_wasPreviouslyVisible:
bpy.context.space_data.overlay.show_axis_z = True



#loop through all objects in scene check the custom prop
for obj in bpy.context.scene.objects:
if 'neltulzSmartFrameSel_hidden' in obj:
if obj['neltulzSmartFrameSel_hidden'] == 1:
obj.hide_set(False) #unhide object


#Ensure "Show in Viewports" is enabled
if obj.hide_viewport == True:
obj.hide_viewport = False

del obj['neltulzSmartFrameSel_hidden']

scene.neltulzSmartFrameSel.currentlyBusyIsolating = False
Expand Down
30 changes: 10 additions & 20 deletions misc_ot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def execute(self, context):

obj['neltulzSmartFrameSel_isolateExcluded'] = 1

print('Added!')
#Object added to the "excludedIsolateObjects" list

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -108,7 +108,7 @@ def execute(self, context):
if key == 'neltulzSmartFrameSel_isolateExcluded':
del obj[key]

print('Removed!')
#removed custom property from object

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -143,7 +143,7 @@ def execute(self, context):
scene.neltulzSmartFrameSel.excludedIsolateObjects.add(obj.name)


print('Refreshed!')
#Refreshed

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -180,7 +180,7 @@ def execute(self, context):



print('Cleared!')
#Cleared

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -221,13 +221,8 @@ def execute(self, context):
obj.display_type = 'WIRE'
obj.hide_select = True
obj['neltulzSmartFrameSel_template'] = 1






print('Templated!')

#Templated

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -264,7 +259,7 @@ def execute(self, context):
scene.neltulzSmartFrameSel.templatedObjects.add(obj.name)


print('Refreshed Template Objects!')
#Refreshed Template Objects

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -325,8 +320,7 @@ def execute(self, context):




print('Removed Template Object!')
#Removed Template Object!

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -377,11 +371,7 @@ def execute(self, context):
obj.display_type = originalDisplay
obj.hide_select = False





print('Cleared Template Objects!')
#Cleared Template Objects

return {'FINISHED'}
# END execute()
Expand Down Expand Up @@ -417,7 +407,7 @@ def execute(self, context):

bpy.ops.object.delete(use_global=False, confirm=False)

print('Viewport moved to Origin!')
#Viewport moved to Origin

return {'FINISHED'}
# END execute()
Expand Down
12 changes: 10 additions & 2 deletions panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class OBJECT_PT_NeltulzSmartFrameSel(Panel):

bl_idname = "object.neltulz_smart_frame_sel_panel"
bl_label = "Smart Frame Selection v1.0.8"
bl_label = "Smart Frame Selection v1.0.9"
bl_category = "Smart Frame Sel"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
Expand Down Expand Up @@ -222,8 +222,16 @@ def draw(self, context):
row.prop(context.scene.neltulzSmartFrameSel, "use_all_regions_when_framing", expand=True)

col = layout.column(align=True)
col.label(text="On Isolate, hide:")

row = col.row(align=True)
row.prop(context.scene.neltulzSmartFrameSel, "hideFloorOnIsolate", expand=True)

row.prop(context.scene.neltulzSmartFrameSel, "hideFloorOnIsolate", expand=True, text="Floor", toggle=True, icon="MESH_GRID")

row.prop(context.scene.neltulzSmartFrameSel, "hideAxesOnIsolate", expand=True, text="Axes", toggle=True, icon="EMPTY_AXIS")

col = layout.column(align=True)
col.prop(context.scene.neltulzSmartFrameSel, "useExtremeHideOnIsolate", expand=True)


'''
Expand Down
30 changes: 30 additions & 0 deletions properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,36 @@ class NeltulzSmartFrameSel_IgnitProperties(bpy.types.PropertyGroup):
default = True
)

axis_x_wasPreviouslyVisible : BoolProperty(
name="Previous X Axis Visibility",
description="X Axis was visible before user entered isolate mode (Default: False)",
default = False
)

axis_y_wasPreviouslyVisible : BoolProperty(
name="Previous Y Axis Visibility",
description="Y Axis was visible before user entered isolate mode (Default: False)",
default = False
)

axis_z_wasPreviouslyVisible : BoolProperty(
name="Previous Z Axis Visibility",
description="Z Axis was visible before user entered isolate mode (Default: False)",
default = False
)

hideAxesOnIsolate : BoolProperty(
name="Hide Axes on Isolate",
description="Hides the axes when you isolate an object. (Default: True)",
default = True
)

useExtremeHideOnIsolate : BoolProperty(
name="Use Extreme Isolate (Use Caution)",
description='Sets "Show in Viewports" to "False" to grant a super performance increase. Useful for adding objects to the scene and adjusting operator properties with minimal performance lag. (Default: False)',
default = False
)

hideErrorMessages : BoolProperty(
name="Hide Error Messages",
description="Hide Error Messages (Default: False)",
Expand Down

0 comments on commit abae91b

Please sign in to comment.