[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43460] trunk/blender: Uv Tools branch GSOC 2011

Antony Riakiotakis kalast at gmail.com
Tue Jan 17 17:31:20 CET 2012


Revision: 43460
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43460
Author:   psy-fi
Date:     2012-01-17 16:31:13 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
Uv Tools branch GSOC 2011
=========================
Documentation: http://wiki.blender.org/index.php/User:Psy-Fi/UV_Tools

Major features include:

*16 bit image support in viewport
*Subsurf aware unwrapping
*Smart Stitch(snap/rotate islands, preview, middlepoint/endpoint stitching)
*Seams from islands tool (marks seams and sharp, depending on settings)
*Uv Sculpting(Grab/Pinch/Rotate)

All tools are complete apart from stitching that is considered stable but with an extra edge mode under development(will be in soc-2011-onion-uv-tools).

Modified Paths:
--------------
    trunk/blender/intern/boolop/intern/BOP_CarveInterface.cpp
    trunk/blender/release/scripts/modules/bpy_extras/keyconfig_utils.py
    trunk/blender/release/scripts/startup/bl_ui/space_image.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
    trunk/blender/source/blender/blenkernel/BKE_mesh.h
    trunk/blender/source/blender/blenkernel/intern/paint.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenlib/BLI_math_vector.h
    trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/editors/include/ED_image.h
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/include/ED_screen.h
    trunk/blender/source/blender/editors/include/ED_uvedit.h
    trunk/blender/source/blender/editors/include/ED_view3d.h
    trunk/blender/source/blender/editors/include/UI_resources.h
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/mesh/editmesh_lib.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/sculpt_paint/CMakeLists.txt
    trunk/blender/source/blender/editors/sculpt_paint/SConscript
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/editors/space_image/space_image.c
    trunk/blender/source/blender/editors/uvedit/CMakeLists.txt
    trunk/blender/source/blender/editors/uvedit/uvedit_draw.c
    trunk/blender/source/blender/editors/uvedit/uvedit_intern.h
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    trunk/blender/source/blender/gpu/intern/gpu_draw.c
    trunk/blender/source/blender/imbuf/IMB_imbuf.h
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/RNA_access.h
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_sculpt_paint.c
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c
    trunk/blender/source/blender/windowmanager/intern/wm_keymap.c
    trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c

Added Paths:
-----------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_uv.c
    trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c

Modified: trunk/blender/intern/boolop/intern/BOP_CarveInterface.cpp
===================================================================
--- trunk/blender/intern/boolop/intern/BOP_CarveInterface.cpp	2012-01-17 16:22:22 UTC (rev 43459)
+++ trunk/blender/intern/boolop/intern/BOP_CarveInterface.cpp	2012-01-17 16:31:13 UTC (rev 43460)
@@ -1,403 +0,0 @@
-/*
- * ***** 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file boolop/intern/BOP_CarveInterface.cpp
- *  \ingroup boolopintern
- */
-
-#include "../extern/BOP_Interface.h"
-#include "../../bsp/intern/BSP_CSGMesh_CFIterator.h"
-
-#include <carve/csg_triangulator.hpp>
-#include <carve/interpolator.hpp>
-#include <carve/rescale.hpp>
-
-typedef unsigned int uint;
-
-#define MAX(x,y) ((x)>(y)?(x):(y))
-#define MIN(x,y) ((x)<(y)?(x):(y))
-
-static int isFacePlanar(CSG_IFace &face, std::vector<carve::geom3d::Vector> &vertices)
-{
-	carve::geom3d::Vector v1, v2, v3, cross;
-
-	if (face.vertex_number == 4) {
-		v1 = vertices[face.vertex_index[1]] - vertices[face.vertex_index[0]];
-		v2 = vertices[face.vertex_index[3]] - vertices[face.vertex_index[0]];
-		v3 = vertices[face.vertex_index[2]] - vertices[face.vertex_index[0]];
-
-		cross = carve::geom::cross(v1, v2);
-
-		float production = carve::geom::dot(cross, v3);
-		float magnitude = 1e-6 * cross.length();
-
-		return fabs(production) < magnitude;
-	}
-
-	return 1;
-}
-
-static carve::mesh::MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor& face_it,
-                                              CSG_VertexIteratorDescriptor& vertex_it,
-                                              carve::interpolate::FaceAttr<uint> &oface_num,
-                                              uint &num_origfaces )
-{
-	CSG_IVertex vertex;
-	std::vector<carve::geom3d::Vector> vertices;
-
-	while (!vertex_it.Done(vertex_it.it)) {
-		vertex_it.Fill(vertex_it.it,&vertex);
-		vertices.push_back(carve::geom::VECTOR(vertex.position[0],
-		                                       vertex.position[1],
-		                                       vertex.position[2]));
-		vertex_it.Step(vertex_it.it);
-	}
-
-	CSG_IFace face;
-	std::vector<int> f;
-	int numfaces = 0;
-
-	// now for the polygons.
-	// we may need to decalare some memory for user defined face properties.
-
-	std::vector<int> forig;
-	while (!face_it.Done(face_it.it)) {
-		face_it.Fill(face_it.it,&face);
-
-		if (isFacePlanar(face, vertices)) {
-			f.push_back(face.vertex_number);
-			f.push_back(face.vertex_index[0]);
-			f.push_back(face.vertex_index[1]);
-			f.push_back(face.vertex_index[2]);
-
-			if (face.vertex_number == 4)
-				f.push_back(face.vertex_index[3]);
-
-			forig.push_back(face.orig_face);
-			++numfaces;
-			face_it.Step(face_it.it);
-			++num_origfaces;
-		}
-		else {
-			f.push_back(3);
-			f.push_back(face.vertex_index[0]);
-			f.push_back(face.vertex_index[1]);
-			f.push_back(face.vertex_index[2]);
-
-			forig.push_back(face.orig_face);
-			++numfaces;
-
-			if (face.vertex_number == 4) {
-				f.push_back(3);
-				f.push_back(face.vertex_index[0]);
-				f.push_back(face.vertex_index[2]);
-				f.push_back(face.vertex_index[3]);
-
-				forig.push_back(face.orig_face);
-				++numfaces;
-			}
-
-			face_it.Step(face_it.it);
-			++num_origfaces;
-		}
-	}
-
-	carve::mesh::MeshSet<3> *poly = new carve::mesh::MeshSet<3> (vertices, numfaces, f);
-
-	uint i;
-	carve::mesh::MeshSet<3>::face_iter face_iter = poly->faceBegin();
-	for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
-		carve::mesh::MeshSet<3>::face_t *face = *face_iter;
-		oface_num.setAttribute(face, forig[i]);
-	}
-
-	return poly;
-}
-
-// check whether two faces share an edge, and if so merge them
-static uint quadMerge(std::map<carve::mesh::MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
-                      carve::mesh::MeshSet<3>::face_t *f1, carve::mesh::MeshSet<3>::face_t *f2,
-                      uint v, uint quad[4])
-{
-	uint current, n1, p1, n2, p2;
-	uint v1[3];
-	uint v2[3];
-
-	// get the vertex indices for each face
-	v1[0] = vertexToIndex_map->find(f1->edge->vert)->second;
-	v1[1] = vertexToIndex_map->find(f1->edge->next->vert)->second;
-	v1[2] = vertexToIndex_map->find(f1->edge->next->next->vert)->second;
-
-	v2[0] = vertexToIndex_map->find(f2->edge->vert)->second;
-	v2[1] = vertexToIndex_map->find(f2->edge->next->vert)->second;
-	v2[2] = vertexToIndex_map->find(f2->edge->next->next->vert)->second;
-
-	// locate the current vertex we're examining, and find the next and
-	// previous vertices based on the face windings
-	if (v1[0] == v) {current = 0; p1 = 2; n1 = 1;}
-	else if (v1[1] == v) {current = 1; p1 = 0; n1 = 2;}
-	else {current = 2; p1 = 1; n1 = 0;}
-
-	if (v2[0] == v) {p2 = 2; n2 = 1;}
-	else if (v2[1] == v) {p2 = 0; n2 = 2;}
-	else {p2 = 1; n2 = 0;}
-
-	// if we find a match, place indices into quad in proper order and return
-	// success code
-	if (v1[p1] == v2[n2]) {
-		quad[0] = v1[current];
-		quad[1] = v1[n1];
-		quad[2] = v1[p1];
-		quad[3] = v2[p2];
-
-		return 1;
-	}
-	else if (v1[n1] == v2[p2]) {
-		quad[0] = v1[current];
-		quad[1] = v2[n2];
-		quad[2] = v1[n1];
-		quad[3] = v1[p1];
-
-		return 1;
-	}
-
-	return 0;
-}
-
-static BSP_CSGMesh* Carve_exportMesh(carve::mesh::MeshSet<3>* &poly, carve::interpolate::FaceAttr<uint> &oface_num,
-                                     uint num_origfaces)
-{
-	uint i;
-	BSP_CSGMesh* outputMesh = BSP_CSGMesh::New();
-
-	if (outputMesh == NULL)
-		return NULL;
-
-	std::vector<BSP_MVertex>* vertices = new std::vector<BSP_MVertex>;
-
-	outputMesh->SetVertices(vertices);
-
-	std::map<carve::mesh::MeshSet<3>::vertex_t*, uint> vertexToIndex_map;
-	std::vector<carve::mesh::MeshSet<3>::vertex_t>::iterator it = poly->vertex_storage.begin();
-	for (i = 0; it != poly->vertex_storage.end(); ++i, ++it) {
-		carve::mesh::MeshSet<3>::vertex_t *vertex = &(*it);
-		vertexToIndex_map[vertex] = i;
-	}
-
-	for (i = 0; i < poly->vertex_storage.size(); ++i ) {
-		BSP_MVertex outVtx(MT_Point3 (poly->vertex_storage[i].v[0],
-		                              poly->vertex_storage[i].v[1],
-		                              poly->vertex_storage[i].v[2]));
-		outVtx.m_edges.clear();
-		outputMesh->VertexSet().push_back(outVtx);
-	}
-
-	// build vectors of faces for each original face and each vertex 
-	std::vector< std::vector<uint> > vi(poly->vertex_storage.size());
-	std::vector< std::vector<uint> > ofaces(num_origfaces);
-	carve::mesh::MeshSet<3>::face_iter face_iter = poly->faceBegin();
-	for (i = 0; face_iter != poly->faceEnd(); ++face_iter, ++i) {
-		carve::mesh::MeshSet<3>::face_t *f = *face_iter;
-		ofaces[oface_num.getAttribute(f)].push_back(i);
-		carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
-		for (; edge_iter != f->end(); ++edge_iter) {
-			int index = vertexToIndex_map[edge_iter->vert];
-			vi[index].push_back(i);
-		}
-	}
-
-	uint quadverts[4] = {0, 0, 0, 0};
-	// go over each set of faces which belong to an original face
-	std::vector< std::vector<uint> >::const_iterator fii;
-	uint orig = 0;
-	for (fii=ofaces.begin(); fii!=ofaces.end(); ++fii, ++orig) {
-		std::vector<uint> fl = *fii;
-		// go over a single set from an original face
-		while (fl.size() > 0) {
-			// remove one new face
-			uint findex = fl.back();
-			fl.pop_back();
-
-			carve::mesh::MeshSet<3>::face_t *f = *(poly->faceBegin() + findex);
-
-			// add all information except vertices to the output mesh
-			outputMesh->FaceSet().push_back(BSP_MFace());
-			BSP_MFace& outFace = outputMesh->FaceSet().back();
-			outFace.m_verts.clear();
-			outFace.m_plane.setValue(f->plane.N.v);
-			outFace.m_orig_face = orig;
-
-			// for each vertex of this face, check other faces containing
-			// that vertex to see if there is a neighbor also belonging to
-			// the original face
-			uint result = 0;
-
-			carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
-			for (; edge_iter != f->end(); ++edge_iter) {
-				int v = vertexToIndex_map[edge_iter->vert];
-				for (uint pos2=0; !result && pos2 < vi[v].size();pos2++) {
-
-					// if we find the current face, ignore it
-					uint otherf = vi[v][pos2];
-					if (findex == otherf)
-						continue;
-
-					carve::mesh::MeshSet<3>::face_t *f2 = *(poly->faceBegin() + otherf);
-
-					// if other face doesn't have the same original face,
-					// ignore it also
-					uint other_orig = oface_num.getAttribute(f2);
-					if (orig != other_orig)
-						continue;
-
-					// if, for some reason, we don't find the other face in
-					// the current set of faces, ignore it
-					uint other_index = 0;
-					while (other_index < fl.size() && fl[other_index] != otherf) ++other_index;
-					if (other_index == fl.size()) continue;
-
-					// see if the faces share an edge
-					result = quadMerge(&vertexToIndex_map, f, f2, v, quadverts);
-					// if faces can be merged, then remove the other face
-					// from the current set
-					if (result) {
-						uint replace = fl.back();
-						fl.pop_back();
-						if(otherf != replace)
-							fl[other_index] = replace;
-					}
-				}
-			}
-
-			// if we merged faces, use the list of common vertices; otherwise
-			// use the faces's vertices
-			if (result) {
-				// make quat using verts stored in result
-				outFace.m_verts.push_back(quadverts[0]);
-				outFace.m_verts.push_back(quadverts[1]);
-				outFace.m_verts.push_back(quadverts[2]);
-				outFace.m_verts.push_back(quadverts[3]);
-			} else {
-				carve::mesh::MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
-				for (; edge_iter != f->end(); ++edge_iter) {
-					//int index = ofacevert_num.getAttribute(f, edge_iter.idx());

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-blender-cvs mailing list