[Bf-extensions-cvs] [cfc5f457] master: initial commit mesh tissue tesselation: T51508 by @Alessandro Zomparelli (alessandrozompa)
meta-androcto
noreply at git.blender.org
Mon May 22 02:02:02 CEST 2017
Commit: cfc5f457766db91e26fd00c9317ee1261d688181
Author: meta-androcto
Date: Mon May 22 10:01:22 2017 +1000
Branches: master
https://developer.blender.org/rBAcfc5f457766db91e26fd00c9317ee1261d688181
initial commit mesh tissue tesselation: T51508 by @Alessandro Zomparelli (alessandrozompa)
===================================================================
A mesh_tissue/README.md
A mesh_tissue/__init__.py
A mesh_tissue/colors_groups_exchanger.py
A mesh_tissue/dual_mesh.py
A mesh_tissue/tessellate_numpy.py
===================================================================
diff --git a/mesh_tissue/README.md b/mesh_tissue/README.md
new file mode 100644
index 00000000..9998d1cf
--- /dev/null
+++ b/mesh_tissue/README.md
@@ -0,0 +1,14 @@
+# Tissue
+Tissue - Blender's add-on for computational design by Co-de-iT
+http://www.co-de-it.com/wordpress/code/blender-tissue
+
+Latest version (master): https://github.com/alessandro-zomparelli/tissue/archive/master.zip
+
+Releases: https://github.com/alessandro-zomparelli/tissue/releases
+
+Installation:
+
+1. Start Blender. Open User Preferences, the addons tab
+2. Click "install from file" and point Blender at the downloaded zip
+3. Activate Tissue add-on from user preferences
+3. Save user preferences if you want to have it on at startup.
diff --git a/mesh_tissue/__init__.py b/mesh_tissue/__init__.py
new file mode 100644
index 00000000..1c0945ed
--- /dev/null
+++ b/mesh_tissue/__init__.py
@@ -0,0 +1,77 @@
+# ##### 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 #####
+
+# --------------------------------- TISSUE ------------------------------------#
+#-------------------------------- version 0.29 --------------------------------#
+# #
+# Creates duplicates of selected mesh to active morphing the shape according #
+# to target faces. #
+# #
+# Alessandro Zomparelli #
+# (2017) #
+# #
+# http://www.co-de-it.com/ #
+# http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Mesh/Tissue #
+# #
+################################################################################
+
+
+if "bpy" in locals():
+ import importlib
+ importlib.reload(tessellate_numpy)
+ importlib.reload(colors_groups_exchanger)
+ importlib.reload(dual_mesh)
+
+else:
+ from . import tessellate_numpy
+ from . import colors_groups_exchanger
+ from . import dual_mesh
+
+import bpy
+from mathutils import Vector
+#bpy.types.Object.vertexgroup = bpy.props.StringProperty()
+#bpy.types.Panel.vertexgroup = bpy.props.StringProperty()
+
+bl_info = {
+ "name": "Tissue",
+ "author": "Alessandro Zomparelli (Co-de-iT)",
+ "version": (0, 2, 9),
+ "blender": (2, 7, 8),
+ "location": "",
+ "description": "Tools for Computational Design",
+ "warning": "",
+ "wiki_url": ("http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/M"
+ "esh/Tissue"),
+ "tracker_url": "https://plus.google.com/u/0/+AlessandroZomparelli/",
+ "category": "Mesh"}
+
+
+def register():
+ bpy.utils.register_module(__name__)
+ bpy.types.Object.tissue_tessellate = bpy.props.PointerProperty(
+ type=tessellate_numpy.tissue_tessellate_prop)
+
+
+def unregister():
+ tessellate_numpy.unregister()
+ colors_groups_exchanger.unregister()
+ dual_mesh.unregister()
+
+
+if __name__ == "__main__":
+ register()
diff --git a/mesh_tissue/colors_groups_exchanger.py b/mesh_tissue/colors_groups_exchanger.py
new file mode 100644
index 00000000..c2e45e6f
--- /dev/null
+++ b/mesh_tissue/colors_groups_exchanger.py
@@ -0,0 +1,300 @@
+# ##### 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 #####
+
+#-------------------------- COLORS / GROUPS EXCHANGER -------------------------#
+# #
+# Vertex Color to Vertex Group allow you to convert colors channles to weight #
+# maps. #
+# The main purpose is to use vertex colors to store information when importing #
+# files from other softwares. The script works with the active vertex color #
+# slot. #
+# For use the command "Vertex Clors to Vertex Groups" use the search bar #
+# (space bar). #
+# #
+# (c) Alessandro Zomparelli #
+# (2017) #
+# #
+# http://www.co-de-it.com/ #
+# #
+################################################################################
+
+import bpy
+import math
+
+bl_info = {
+ "name": "Colors/Groups Exchanger",
+ "author": "Alessandro Zomparelli (Co-de-iT)",
+ "version": (0, 2),
+ "blender": (2, 7, 8),
+ "location": "",
+ "description": ("Convert vertex colors channels to vertex groups and vertex"
+ " groups to colors"),
+ "warning": "",
+ "wiki_url": "",
+ "tracker_url": "",
+ "category": "Mesh"}
+
+class vertex_colors_to_vertex_groups(bpy.types.Operator):
+ bl_idname = "object.vertex_colors_to_vertex_groups"
+ bl_label = "Weight from Colors"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ red = bpy.props.BoolProperty(
+ name="red channel", default=False, description="convert red channel")
+ green = bpy.props.BoolProperty(
+ name="green channel", default=False,
+ description="convert green channel")
+ blue = bpy.props.BoolProperty(
+ name="blue channel", default=False, description="convert blue channel")
+ value = bpy.props.BoolProperty(
+ name="value channel", default=True, description="convert value channel")
+ invert = bpy.props.BoolProperty(
+ name="invert", default=False, description="invert all color channels")
+
+ def execute(self, context):
+ obj = bpy.context.active_object
+ id = len(obj.vertex_groups)
+ id_red = id
+ id_green = id
+ id_blue = id
+ id_value = id
+
+ boolCol = len(obj.data.vertex_colors)
+ if(boolCol): col_name = obj.data.vertex_colors.active.name
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.select_all(action='SELECT')
+
+ if(self.red and boolCol):
+ bpy.ops.object.vertex_group_add()
+ bpy.ops.object.vertex_group_assign()
+ id_red = id
+ obj.vertex_groups[id_red].name = col_name + '_red'
+ id+=1
+ if(self.green and boolCol):
+ bpy.ops.object.vertex_group_add()
+ bpy.ops.object.vertex_group_assign()
+ id_green = id
+ obj.vertex_groups[id_green].name = col_name + '_green'
+ id+=1
+ if(self.blue and boolCol):
+ bpy.ops.object.vertex_group_add()
+ bpy.ops.object.vertex_group_assign()
+ id_blue = id
+ obj.vertex_groups[id_blue].name = col_name + '_blue'
+ id+=1
+ if(self.value and boolCol):
+ bpy.ops.object.vertex_group_add()
+ bpy.ops.object.vertex_group_assign()
+ id_value = id
+ obj.vertex_groups[id_value].name = col_name + '_value'
+ id+=1
+
+ mult = 1
+ if(self.invert): mult = -1
+ bpy.ops.object.mode_set(mode='OBJECT')
+ sub_red = 1 + self.value + self.blue + self.green
+ sub_green = 1 + self.value + self.blue
+ sub_blue = 1 + self.value
+ sub_value = 1
+
+ id = len(obj.vertex_groups)
+ if(id_red <= id and id_green <= id and id_blue <= id and id_value <= \
+ id and boolCol):
+ v_colors = obj.data.vertex_colors.active.data
+ i = 0
+ for f in obj.data.polygons:
+ for v in f.vertices:
+ gr = obj.data.vertices[v].groups
+ if(self.red): gr[min(len(gr)-sub_red, id_red)].weight = \
+ self.invert + mult * v_colors[i].color.r
+ if(self.green): gr[min(len(gr)-sub_green, id_green)].weight\
+ = self.invert + mult * v_colors[i].color.g
+ if(self.blue): gr[min(len(gr)-sub_blue, id_blue)].weight = \
+ self.invert + mult * v_colors[i].color.b
+ if(self.value): gr[min(len(gr)-sub_value, id_value)].weight\
+ = self.invert + mult * v_colors[i].color.v
+ i+=1
+ bpy.ops.paint.weight_paint_to
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list