...
 
Commits (38)
This diff is collapsed.
This diff is collapsed.
......@@ -40,36 +40,54 @@ else:
import bpy
class XEditPanel(bpy.types.Panel):
# Creates a panel in the 3d view Toolshelf window
class XEDIT_PT_ui_pan(bpy.types.Panel):
# Creates a panel in the 3d view N Panel
bl_label = 'Exact Edit'
bl_idname = 'xedit_base_panel'
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_region_type = 'UI'
#bl_context = 'objectmode'
bl_category = 'Tools'
def draw(self, context):
#layout = self.layout
row = self.layout.row(align=True)
col = row.column()
col.operator("view3d.xedit_set_meas_op", text="Set Measure", icon="EDIT")
col.operator("view3d.xedit_free_rotate_op", text="Free Rotate", icon="FORCE_MAGNETIC")
classes = (
xedit_set_meas.XEDIT_OT_store_meas_btn,
xedit_set_meas.XEDIT_OT_meas_inp_dlg,
xedit_set_meas.XEDIT_OT_set_meas,
xedit_free_rotate.XEDIT_OT_free_rotate,
XEDIT_PT_ui_pan
)
def register():
for c in classes:
bpy.utils.register_class(c)
#
'''
bpy.utils.register_class(xedit_set_meas.XEditStoreMeasBtn)
bpy.utils.register_class(xedit_set_meas.XEditMeasureInputPanel)
bpy.utils.register_class(xedit_set_meas.XEditSetMeas)
bpy.utils.register_class(xedit_free_rotate.XEditFreeRotate)
bpy.utils.register_class(XEditPanel)
'''
def unregister():
bpy.utils.unregister_class(xedit_set_meas.XEditStoreMeasBtn)
bpy.utils.unregister_class(xedit_set_meas.XEditMeasureInputPanel)
bpy.utils.unregister_class(xedit_set_meas.XEditSetMeas)
for c in reversed(classes):
bpy.utils.unregister_class(c)
#
'''
bpy.utils.unregister_class(xedit_set_meas.XEDIT_OT_store_meas_btn)
bpy.utils.unregister_class(xedit_set_meas.XEDIT_OT_meas_inp_dlg)
bpy.utils.unregister_class(xedit_set_meas.XEDIT_OT_set_meas)
bpy.utils.unregister_class(xedit_free_rotate.XEditFreeRotate)
bpy.utils.unregister_class(XEditPanel)
bpy.utils.unregister_class(XEDIT_PT_ui_pan)
'''
if __name__ == "__main__":
register()
......@@ -1054,9 +1054,9 @@ def get_reg_overlap():
return rtoolsw
class XEditFreeRotate(bpy.types.Operator):
class XEDIT_OT_free_rotate(bpy.types.Operator):
bl_idname = "view3d.xedit_free_rotate_op"
bl_label = "XEdit Free Rotate"
bl_label = "Exact Edit Free Rotate"
# Only launch Add-On from OBJECT or EDIT modes
@classmethod
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
#
#
# Authors : Clemens Barth (Blendphys@root-1.de), ...
#
# Homepage : http://development.root-1.de/Atomic_Blender.php
#
# Start of project : 2012-11-12 by Clemens Barth
# First publication in Blender : 2012-11-19
# Last modified : 2012-11-19
#
# Acknowledgements
# ================
#
# Other: Frank Palmino
#
bl_info = {
"name": "Atomic Blender - Gwyddion",
"description": "Loading Gwyddion Atomic Force Microscopy images",
"author": "Clemens Barth",
"version": (0, 1),
"blender": (2, 60, 0),
"location": "File > Import > Gwyddion (.gwy)",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Import-Export/Gwyddion",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Import-Export"}
import bpy
from bpy.types import Operator
from bpy_extras.io_utils import ImportHelper
from bpy.props import (BoolProperty,
StringProperty,
EnumProperty,
FloatProperty)
from . import import_gwyddion
# -----------------------------------------------------------------------------
# GUI
# This is the class for the file dialog of the importer.
class ImportGwyddion(Operator, ImportHelper):
bl_idname = "import_mesh.gwy"
bl_label = "Import Gwyddion (*.gwy)"
bl_options = {'PRESET', 'UNDO'}
filename_ext = ".gwy"
filter_glob: StringProperty(default="*.gwy", options={'HIDDEN'},)
use_camera: BoolProperty(
name="Camera", default=False,
description="Do you need a camera?")
use_lamp: BoolProperty(
name="Lamp", default=False,
description = "Do you need a lamp?")
use_smooth: BoolProperty(
name="Smooth image data", default=False,
description = "Smooth the images")
scale_size: FloatProperty (
name = "Scale xy", default=0.5,
description = "Scale the lateral size")
scale_height: FloatProperty (
name = "Scale h", default=3.0,
description = "Scale the height")
use_all_channels: BoolProperty(
name="All channels", default=False,
description = "Load all images")
use_c1: BoolProperty(
name="1", default=True,
description = "Channel 1")
use_c2: BoolProperty(
name="2", default=False,
description = "Channel 2")
use_c3: BoolProperty(
name="3", default=False,
description = "Channel 3")
use_c4: BoolProperty(
name="4", default=False,
description = "Channel 4")
use_c5: BoolProperty(
name="5", default=False,
description = "Channel 5")
use_c6: BoolProperty(
name="6", default=False,
description = "Channel 6")
use_c7: BoolProperty(
name="7", default=False,
description = "Channel 7")
use_c8: BoolProperty(
name="8", default=False,
description = "Channel 8")
def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(self, "use_camera")
row.prop(self, "use_lamp")
row = layout.row()
row.prop(self, "use_smooth")
row = layout.row()
row.prop(self, "scale_size")
row.prop(self, "scale_height")
row = layout.row()
row.label(text="Channels")
row.prop(self, "use_all_channels")
row = layout.row()
row.prop(self, "use_c1")
row.prop(self, "use_c2")
row.prop(self, "use_c3")
row.prop(self, "use_c4")
row = layout.row()
row.prop(self, "use_c5")
row.prop(self, "use_c6")
row.prop(self, "use_c7")
row.prop(self, "use_c8")
if self.use_all_channels:
self.use_c1, self.use_c2, self.use_c3, self.use_c4, \
self.use_c5, self.use_c6, self.use_c7, self.use_c8 \
= True, True, True, True, True, True, True, True
def execute(self, context):
# This is in order to solve this strange 'relative path' thing.
filepath_par = bpy.path.abspath(self.filepath)
channels = [self.use_c1, self.use_c2, self.use_c3, self.use_c4,
self.use_c5, self.use_c6, self.use_c7, self.use_c8]
# Execute main routine
#print("passed - 1")
images, AFMdata = import_gwyddion.load_gwyddion_images(filepath_par,
channels)
#print("passed - 3")
import_gwyddion.create_mesh(images,
AFMdata,
self.use_smooth,
self.scale_size,
self.scale_height,
self.use_camera,
self.use_lamp)
#print("passed - 4")
return {'FINISHED'}
# The entry into the menu 'file -> import'
def menu_func_import(self, context):
self.layout.operator(ImportGwyddion.bl_idname, text="Gwyddion (.gwy)")
def register():
bpy.utils.register_module(__name__)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
if __name__ == "__main__":
register()
This diff is collapsed.
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
#
#
# Authors : Clemens Barth (Blendphys@root-1.de), ...
#
# Homepage(Wiki) : http://development.root-1.de/Atomic_Blender.php
#
# Start of project : 2011-12-01 by Clemens Barth
# First publication in Blender : 2011-12-18
# Last modified : 2014-08-19
#
# Acknowledgements
# ================
#
# Blender: ideasman, meta_androcto, truman, kilon, CoDEmanX, dairin0d, PKHG,
# Valter, ...
# Other: Frank Palmino
#
bl_info = {
"name": "Atomic Blender - XYZ",
"description": "Import/export of atoms described in .xyz files",
"author": "Clemens Barth",
"version": (1, 0),
"blender": (2, 71, 0),
"location": "File -> Import -> XYZ (.xyz)",
"warning": "",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Import-Export/XYZ",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Import-Export"}
import bpy
from bpy.types import Operator
from bpy_extras.io_utils import ImportHelper, ExportHelper
from bpy.props import (StringProperty,
BoolProperty,
EnumProperty,
IntProperty,
FloatProperty)
from . import import_xyz
from . import export_xyz
# -----------------------------------------------------------------------------
# GUI
# This is the class for the file dialog.
class ImportXYZ(Operator, ImportHelper):
bl_idname = "import_mesh.xyz"
bl_label = "Import XYZ (*.xyz)"
bl_options = {'PRESET', 'UNDO'}
filename_ext = ".xyz"
filter_glob: StringProperty(default="*.xyz", options={'HIDDEN'},)
use_camera: BoolProperty(
name="Camera", default=False,
description="Do you need a camera?")
use_lamp: BoolProperty(
name="Lamp", default=False,
description = "Do you need a lamp?")
ball: EnumProperty(
name="Type of ball",
description="Choose ball",
items=(('0', "NURBS", "NURBS balls"),
('1', "Mesh" , "Mesh balls"),
('2', "Meta" , "Metaballs")),
default='0',)
mesh_azimuth: IntProperty(
name = "Azimuth", default=32, min=1,
description = "Number of sectors (azimuth)")
mesh_zenith: IntProperty(
name = "Zenith", default=32, min=1,
description = "Number of sectors (zenith)")
scale_ballradius: FloatProperty(
name = "Balls", default=1.0, min=0.0001,
description = "Scale factor for all atom radii")
scale_distances: FloatProperty (
name = "Distances", default=1.0, min=0.0001,
description = "Scale factor for all distances")
atomradius: EnumProperty(
name="Type of radius",
description="Choose type of atom radius",
items=(('0', "Pre-defined", "Use pre-defined radius"),
('1', "Atomic", "Use atomic radius"),
('2', "van der Waals", "Use van der Waals radius")),
default='0',)
use_center: BoolProperty(
name = "Object to origin (first frames)", default=False,
description = "Put the object into the global origin, the first frame only")
use_center_all: BoolProperty(
name = "Object to origin (all frames)", default=True,
description = "Put the object into the global origin, all frames")
datafile: StringProperty(
name = "", description="Path to your custom data file",
maxlen = 256, default = "", subtype='FILE_PATH')
use_frames: BoolProperty(
name = "Load all frames?", default=False,
description = "Do you want to load all frames?")
skip_frames: IntProperty(
name="", default=0, min=0,
description="Number of frames you want to skip.")
images_per_key: IntProperty(
name="", default=1, min=1,
description="Choose the number of images between 2 keys.")
def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(self, "use_camera")
row.prop(self, "use_lamp")
row = layout.row()
col = row.column()
col.prop(self, "ball")
row = layout.row()
row.active = (self.ball == "1")
col = row.column(align=True)
col.prop(self, "mesh_azimuth")
col.prop(self, "mesh_zenith")
row = layout.row()
col = row.column()
col.label(text="Scaling factors")
col = row.column(align=True)
col.prop(self, "scale_ballradius")
col.prop(self, "scale_distances")
row = layout.row()
row.prop(self, "use_center")
row = layout.row()
row.prop(self, "use_center_all")
row = layout.row()
row.prop(self, "atomradius")
row = layout.row()
row.prop(self, "use_frames")
row = layout.row()
row.active = self.use_frames
col = row.column()
col.label(text="Skip frames")
col = row.column()
col.prop(self, "skip_frames")
row = layout.row()
row.active = self.use_frames
col = row.column()
col.label(text="Frames/key")
col = row.column()
col.prop(self, "images_per_key")
def execute(self, context):
del import_xyz.ALL_FRAMES[:]
del import_xyz.ELEMENTS[:]
del import_xyz.STRUCTURE[:]
# This is to determine the path.
filepath_xyz = bpy.path.abspath(self.filepath)
# Execute main routine
import_xyz.import_xyz(
self.ball,
self.mesh_azimuth,
self.mesh_zenith,
self.scale_ballradius,
self.atomradius,
self.scale_distances,
self.use_center,
self.use_center_all,
self.use_camera,
self.use_lamp,
filepath_xyz)
# Load frames
if len(import_xyz.ALL_FRAMES) > 1 and self.use_frames:
import_xyz.build_frames(self.images_per_key,
self.skip_frames)
return {'FINISHED'}
# This is the class for the file dialog of the exporter.
class ExportXYZ(Operator, ExportHelper):
bl_idname = "export_mesh.xyz"
bl_label = "Export XYZ (*.xyz)"
filename_ext = ".xyz"
filter_glob: StringProperty(
default="*.xyz", options={'HIDDEN'},)
atom_xyz_export_type: EnumProperty(
name="Type of Objects",
description="Choose type of objects",
items=(('0', "All", "Export all active objects"),
('1', "Elements", "Export only those active objects which have"
" a proper element name")),
default='1',)
def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(self, "atom_xyz_export_type")
def execute(self, context):
export_xyz.export_xyz(self.atom_xyz_export_type,
bpy.path.abspath(self.filepath))
return {'FINISHED'}
# The entry into the menu 'file -> import'
def menu_func(self, context):
self.layout.operator(ImportXYZ.bl_idname, text="XYZ (.xyz)")
# The entry into the menu 'file -> export'
def menu_func_export(self, context):
self.layout.operator(ExportXYZ.bl_idname, text="XYZ (.xyz)")
def register():
bpy.utils.register_module(__name__)
bpy.types.TOPBAR_MT_file_import.append(menu_func)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.TOPBAR_MT_file_import.remove(menu_func)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
if __name__ == "__main__":
register()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.