diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2017-06-20 11:04:15 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2017-06-20 11:04:15 +0300 |
commit | fb45d3cdf8b0e86f3d21d1a15178249c10655226 (patch) | |
tree | a60ddbd74d507863347183be5239f0f11e54592a /mesh_tissue | |
parent | cb10969e467adee25fc8ec201a41d7d2fbebfcbf (diff) |
mesh tissue: update to correct sable version
Diffstat (limited to 'mesh_tissue')
-rw-r--r-- | mesh_tissue/__init__.py | 6 | ||||
-rw-r--r-- | mesh_tissue/colors_groups_exchanger.py | 51 | ||||
-rw-r--r-- | mesh_tissue/lattice.py | 1 | ||||
-rw-r--r-- | mesh_tissue/tessellate_numpy.py | 10 |
4 files changed, 62 insertions, 6 deletions
diff --git a/mesh_tissue/__init__.py b/mesh_tissue/__init__.py index 7c1e7fba..7d8b0078 100644 --- a/mesh_tissue/__init__.py +++ b/mesh_tissue/__init__.py @@ -36,12 +36,15 @@ if "bpy" in locals(): importlib.reload(tessellate_numpy) importlib.reload(colors_groups_exchanger) importlib.reload(dual_mesh) + importlib.reload(lattice) + importlib.reload(uv_to_mesh) else: from . import tessellate_numpy from . import colors_groups_exchanger from . import dual_mesh from . import lattice + from . import uv_to_mesh import bpy from mathutils import Vector @@ -51,7 +54,7 @@ from mathutils import Vector bl_info = { "name": "Tissue", "author": "Alessandro Zomparelli (Co-de-iT)", - "version": (0, 3, 1), + "version": (0, 3, 2), "blender": (2, 7, 9), "location": "", "description": "Tools for Computational Design", @@ -73,6 +76,7 @@ def unregister(): colors_groups_exchanger.unregister() dual_mesh.unregister() lattice.unregister() + uv_to_mesh.unregister() if __name__ == "__main__": diff --git a/mesh_tissue/colors_groups_exchanger.py b/mesh_tissue/colors_groups_exchanger.py index 39b3c115..49378c1e 100644 --- a/mesh_tissue/colors_groups_exchanger.py +++ b/mesh_tissue/colors_groups_exchanger.py @@ -35,13 +35,13 @@ import bpy import math -from math import pi +from math import pi, sin bl_info = { "name": "Colors/Groups Exchanger", "author": "Alessandro Zomparelli (Co-de-iT)", - "version": (0, 2), - "blender": (2, 7, 8), + "version": (0, 3), + "blender": (2, 7, 9), "location": "", "description": ("Convert vertex colors channels to vertex groups and vertex" " groups to colors"), @@ -259,7 +259,6 @@ class curvature_to_vertex_groups(bpy.types.Operator): return {'FINISHED'} - class face_area_to_vertex_groups(bpy.types.Operator): bl_idname = "object.face_area_to_vertex_groups" bl_label = "Area" @@ -313,6 +312,47 @@ class face_area_to_vertex_groups(bpy.types.Operator): return {'FINISHED'} +class harmonic_weight(bpy.types.Operator): + bl_idname = "object.harmonic_weight" + bl_label = "Harmonic" + bl_options = {'REGISTER', 'UNDO'} + bl_description = ("Create an harmonic variation of the active Vertex Group") + + freq = bpy.props.FloatProperty( + name="Frequency", default=20, soft_min=0, + soft_max=100, description="Wave frequency") + + amp = bpy.props.FloatProperty( + name="Amplitude", default=1, soft_min=0, + soft_max=10, description="Wave amplitude") + + midlevel = bpy.props.FloatProperty( + name="Midlevel", default=0, min=-1, + max=1, description="Midlevel") + + add = bpy.props.FloatProperty( + name="Add", default=0, min=-1, + max=1, description="Add to the Weight") + + mult = bpy.props.FloatProperty( + name="Multiply", default=0, min=0, + max=1, description="Multiply for he Weight") + + def execute(self, context): + obj = bpy.context.active_object + try: + group_id = obj.vertex_groups.active_index + for v in obj.data.vertices: + val = v.groups[group_id].weight + v.groups[group_id].weight = (self.amp*(sin(val*self.freq) - self.midlevel)/2 + 0.5 + self.add*val)*(1-(1-val)*self.mult) + except: + self.report({'ERROR'}, "Active object doesn't have vertex groups") + return {'CANCELLED'} + bpy.ops.object.mode_set(mode='WEIGHT_PAINT') + return {'FINISHED'} + + + class colors_groups_exchanger_panel(bpy.types.Panel): bl_label = "Tissue Tools" bl_category = "Tools" @@ -334,6 +374,7 @@ class colors_groups_exchanger_panel(bpy.types.Panel): "object.vertex_colors_to_vertex_groups", icon="GROUP_VCOL") col.operator("object.face_area_to_vertex_groups", icon="SNAP_FACE") col.operator("object.curvature_to_vertex_groups", icon="SMOOTHCURVE") + col.operator("object.harmonic_weight", icon="IPO_ELASTIC") col.separator() col.label(text="Vertex Color from:") col.operator("object.vertex_group_to_vertex_colors", icon="GROUP_VERTEX") @@ -346,6 +387,7 @@ def register(): bpy.utils.register_class(vertex_group_to_vertex_colors) bpy.utils.register_class(face_area_to_vertex_groups) bpy.utils.register_class(colors_groups_exchanger_panel) + bpy.utils.register_class(harmonic_weight) def unregister(): @@ -353,6 +395,7 @@ def unregister(): bpy.utils.unregister_class(vertex_group_to_vertex_colors) bpy.utils.unregister_class(face_area_to_vertex_groups) bpy.utils.unregister_class(colors_groups_exchanger_panel) + bpy.utils.unregister_class(harmonic_weight) if __name__ == "__main__": diff --git a/mesh_tissue/lattice.py b/mesh_tissue/lattice.py index 0c9e51ea..685d5664 100644 --- a/mesh_tissue/lattice.py +++ b/mesh_tissue/lattice.py @@ -278,6 +278,7 @@ class lattice_along_surface(bpy.types.Operator): bpy.ops.object.duplicate_move() grid_obj = bpy.context.active_object + bpy.ops.object.convert(target='MESH') bpy.ops.object.transform_apply(location=True, rotation=True, scale=True) grid_mesh = grid_obj.to_mesh(bpy.context.scene, apply_modifiers=True, settings = 'PREVIEW') diff --git a/mesh_tissue/tessellate_numpy.py b/mesh_tissue/tessellate_numpy.py index adf877fd..367b44f5 100644 --- a/mesh_tissue/tessellate_numpy.py +++ b/mesh_tissue/tessellate_numpy.py @@ -1280,9 +1280,17 @@ class tessellate_panel(bpy.types.Panel): sel = ob1 col.separator() - col.label(text="Add Modifier:") + col.label(text="Other:") col.operator("object.lattice_along_surface", icon="OUTLINER_OB_LATTICE") + #col.separator() + #col.label(text="Add Modifier:") + try: + if bpy.context.object.type == 'MESH': + col.operator("object.uv_to_mesh", icon="GROUP_UVS") + except: + pass + class rotate_face(bpy.types.Operator): |