Skip to content

Commit

Permalink
Online documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-abdellah committed Apr 14, 2020
1 parent f9bc9d9 commit 6e46dca
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 11 deletions.
4 changes: 3 additions & 1 deletion nmv/interface/ui/analysis/analysis_panel_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ def sketch_morphology_skeleton_guide(morphology,
nmv.scene.clear_scene()

# Create a skeletonizer object to build the morphology skeleton
builder = nmv.builders.DisconnectedSectionsBuilder(morphology, options)
options_clone = copy.deepcopy(options)
options_clone.morphology.branching = nmv.enums.Skeleton.Branching.RADII
builder = nmv.builders.ConnectedSectionsBuilder(morphology, options_clone)

# Draw the morphology skeleton and return a list of all the reconstructed objects
nmv.interface.ui_reconstructed_skeleton = builder.draw_morphology_skeleton()
Expand Down
15 changes: 13 additions & 2 deletions nmv/interface/ui/edit/edit_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ def execute(self,
# Clear the scene
nmv.scene.ops.clear_scene()

# Switch to the wire-frame mode
nmv.scene.switch_interface_to_edit_mode()

# Sketch the guide to make sure users can see something
nmv.interface.ui.sketch_morphology_skeleton_guide(
morphology=nmv.interface.ui_morphology,
options=copy.deepcopy(nmv.interface.ui_options))

# Sketch the morphological skeleton for repair
morphology_editor = nmv.edit.MorphologyEditor(
morphology=nmv.interface.ui_morphology, options=nmv.interface.ui_options)
Expand Down Expand Up @@ -235,6 +243,9 @@ def execute(self,
'FINISHED'
"""

# Switch back to the solid mode
nmv.scene.switch_interface_to_visualization_mode()

# Create an object of the repairer
global morphology_editor

Expand Down Expand Up @@ -312,11 +323,11 @@ def execute(self,
# @MorphologyEditingDocumentation
####################################################################################################
class MorphologyEditingDocumentation(bpy.types.Operator):
"""Open the documentation page of the Morphology Editing panel."""
"""Open the online documentation page of the Morphology Editing panel."""

# Operator parameters
bl_idname = "nmv.documentation_editing"
bl_label = "Documentation"
bl_label = "Online User Guide"

################################################################################################
# @execute
Expand Down
4 changes: 2 additions & 2 deletions nmv/interface/ui/io/io_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ def execute(self,
# @InputOutputDocumentation
####################################################################################################
class InputOutputDocumentation(bpy.types.Operator):
"""Open the documentation page of the IO module."""
"""Open the online documentation page of the IO panel."""

# Operator parameters
bl_idname = "nmv.documentation_io"
bl_label = "Documentation"
bl_label = "Online User Guide"

################################################################################################
# @execute
Expand Down
4 changes: 2 additions & 2 deletions nmv/interface/ui/mesh/mesh_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ def execute(self, context):
# @InputOutputDocumentation
####################################################################################################
class MeshReconstructionDocumentation(bpy.types.Operator):
"""Open the documentation page of the Mesh Reconstruction panel."""
"""Open the online documentation page of the Mesh Reconstruction panel."""

# Operator parameters
bl_idname = "nmv.documentation_mesh"
bl_label = "Documentation"
bl_label = "Online User Guide"

################################################################################################
# @execute
Expand Down
4 changes: 2 additions & 2 deletions nmv/interface/ui/morphology/morphology_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,11 @@ def execute(self,
# @MorphologyReconstructionDocumentation
####################################################################################################
class MorphologyReconstructionDocumentation(bpy.types.Operator):
"""Open the documentation page of the Morphology Reconstruction panel."""
"""Open the online documentation page of the Morphology Reconstruction panel."""

# Operator parameters
bl_idname = "nmv.documentation_morphology"
bl_label = "Documentation"
bl_label = "Online User Guide"

################################################################################################
# @execute
Expand Down
4 changes: 2 additions & 2 deletions nmv/interface/ui/soma/soma_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,11 +1104,11 @@ def execute(self,
# @SomaReconstructionDocumentation
####################################################################################################
class SomaReconstructionDocumentation(bpy.types.Operator):
"""Open the documentation page of the Soma Reconstruction panel."""
"""Open the online documentation page of the Soma Reconstruction panel."""

# Operator parameters
bl_idname = "nmv.documentation_soma"
bl_label = "Documentation"
bl_label = "Online User Guide"

################################################################################################
# @execute
Expand Down
31 changes: 31 additions & 0 deletions nmv/scene/ops/scene_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,3 +1162,34 @@ def view_all_scene():

# View all the objects in the scene
bpy.ops.view3d.view_all()


####################################################################################################
# @switch_scene_shading
####################################################################################################
def switch_scene_shading(shading_type='SOLID'):
"""Switches the scene panel to the given shading type
:param shading_type:
One of the following: 'WIREFRAME' '(SOLID)' 'MATERIAL' 'RENDERED'
"""

areas = bpy.context.workspace.screens[0].areas
for area in areas:
for space in area.spaces:
if space.type == 'VIEW_3D':
space.shading.type = shading_type


def switch_interface_to_edit_mode():
nmv.scene.switch_scene_shading('WIREFRAME')
bpy.context.preferences.themes['Default'].view_3d.vertex_size = 8


def switch_interface_to_visualization_mode():
nmv.scene.switch_scene_shading('SOLID')

bpy.context.preferences.themes['Default'].view_3d.vertex.r = 0
bpy.context.preferences.themes['Default'].view_3d.vertex.g = 0
bpy.context.preferences.themes['Default'].view_3d.vertex.b = 0
bpy.context.preferences.themes['Default'].view_3d.vertex_size = 3

0 comments on commit 6e46dca

Please sign in to comment.