svn merge ^/trunk/blender -r43751:43819, need to look into changes made to editmesh_loop.c from this range still

This commit is contained in:
Campbell Barton 2012-02-01 09:31:13 +00:00
commit 4aa82806ef
52 changed files with 2327 additions and 2043 deletions

@ -69,11 +69,9 @@ See the actuator's reference for available methods
:columns: 3
* :class:`~bge.types.BL_ActionActuator`
* :class:`~bge.types.BL_ShapeActionActuator`
* :class:`~bge.types.KX_CameraActuator`
* :class:`~bge.types.KX_ConstraintActuator`
* :class:`~bge.types.KX_GameActuator`
* :class:`~bge.types.KX_IpoActuator`
* :class:`~bge.types.KX_NetworkMessageActuator`
* :class:`~bge.types.KX_ObjectActuator`
* :class:`~bge.types.KX_ParentActuator`
@ -477,6 +475,7 @@ Action Actuator
See :class:`bge.types.BL_ActionActuator`
.. data:: KX_ACTIONACT_PLAY
.. data:: KX_ACTIONACT_PINGPONG
.. data:: KX_ACTIONACT_FLIPPER
.. data:: KX_ACTIONACT_LOOPSTOP
.. data:: KX_ACTIONACT_LOOPEND
@ -635,21 +634,6 @@ See :class:`bge.types.KX_GameActuator`
.. data:: KX_GAME_SAVECFG
.. data:: KX_GAME_LOADCFG
.. _ipo-actuator:
------------
IPO Actuator
------------
See :class:`bge.types.KX_IpoActuator`
.. data:: KX_IPOACT_PLAY
.. data:: KX_IPOACT_PINGPONG
.. data:: KX_IPOACT_FLIPPER
.. data:: KX_IPOACT_LOOPSTOP
.. data:: KX_IPOACT_LOOPEND
.. data:: KX_IPOACT_FROM_PROP
---------------
Parent Actuator
---------------
@ -691,20 +675,6 @@ See :class:`bge.types.KX_SceneActuator`
.. data:: KX_SCENE_SUSPEND
.. data:: KX_SCENE_RESUME
.. _shape-action-actuator:
---------------------
Shape Action Actuator
---------------------
See :class:`bge.types.BL_ActionActuator`
.. data:: KX_ACTIONACT_PLAY
.. data:: KX_ACTIONACT_FLIPPER
.. data:: KX_ACTIONACT_LOOPSTOP
.. data:: KX_ACTIONACT_LOOPEND
.. data:: KX_ACTIONACT_PROPERTY
.. _logic-sound-actuator:
--------------

@ -123,6 +123,29 @@ Example of a data path that can be quickly found via the console:
1.0
Data Creation/Removal
^^^^^^^^^^^^^^^^^^^^^
Those of you familiar with other python api's may be surprised that new datablocks in the bpy api can't be created by calling the class:
>>> bpy.types.Mesh()
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: bpy_struct.__new__(type): expected a single argument
This is an intentional part of the API design.
The blender/python api can't create blender data that exists outside the main blender database (accessed through bpy.data), because this data is managed by blender (save/load/undo/append... etc).
Data is added and removed via methods on the collections in bpy.data, eg:
>>> mesh = bpy.data.meshes.new(name="MyMesh")
>>> print(mesh)
<bpy_struct, Mesh("MyMesh.001")>
>>> bpy.data.meshes.remove(mesh)
Custom Properties
^^^^^^^^^^^^^^^^^

@ -17,7 +17,7 @@ done
rm -rf include
rm -rf lib
cat "files.txt" | while f=`line`; do
cat "files.txt" | while read f; do
mkdir -p `dirname $f`
cp $tmp/carve/$f $f
done

@ -48,6 +48,63 @@ namespace {
#if defined(CARVE_DEBUG_WRITE_PLY_DATA)
template<typename iter_t>
void dumpFacesAndHoles(iter_t f_begin, iter_t f_end,
iter_t h_begin, iter_t h_end,
const std::string &fname) {
std::cerr << "dumping " << std::distance(f_begin, f_end) << " faces, " << std::distance(h_begin, h_end) << " holes." << std::endl;
std::map<carve::mesh::MeshSet<3>::vertex_t *, size_t> v_included;
for (iter_t i = f_begin; i != f_end; ++i) {
for (size_t j = 0; j < (*i).size(); ++j) {
if (v_included.find((*i)[j]) == v_included.end()) {
size_t &p = v_included[(*i)[j]];
p = v_included.size() - 1;
}
}
}
for (iter_t i = h_begin; i != h_end; ++i) {
for (size_t j = 0; j < (*i).size(); ++j) {
if (v_included.find((*i)[j]) == v_included.end()) {
size_t &p = v_included[(*i)[j]];
p = v_included.size() - 1;
}
}
}
carve::line::PolylineSet fh;
fh.vertices.resize(v_included.size());
for (std::map<carve::mesh::MeshSet<3>::vertex_t *, size_t>::const_iterator
i = v_included.begin(); i != v_included.end(); ++i) {
fh.vertices[(*i).second].v = (*i).first->v;
}
{
std::vector<size_t> connected;
for (iter_t i = f_begin; i != f_end; ++i) {
connected.clear();
for (size_t j = 0; j < (*i).size(); ++j) {
connected.push_back(v_included[(*i)[j]]);
}
fh.addPolyline(true, connected.begin(), connected.end());
}
for (iter_t i = h_begin; i != h_end; ++i) {
connected.clear();
for (size_t j = 0; j < (*i).size(); ++j) {
connected.push_back(v_included[(*i)[j]]);
}
fh.addPolyline(true, connected.begin(), connected.end());
}
}
::writePLY(fname, &fh, true);
}
#endif
template<typename T>
void populateVectorFromList(std::list<T> &l, std::vector<T> &v) {
v.clear();
@ -433,6 +490,7 @@ namespace {
face_loops_sorted[m].push_back(n);
}
face_loop_areas.push_back(carve::geom2d::signedArea(face_loops_projected[m]));
std::sort(face_loops_sorted[m].begin(), face_loops_sorted[m].end(),
carve::make_index_sort(face_loops[m].begin()));
face_loop_aabb[m].fit(face_loops_projected[m].begin(), face_loops_projected[m].end());
@ -449,6 +507,7 @@ namespace {
hole_loops_sorted[m].push_back(n);
}
hole_loop_areas.push_back(carve::geom2d::signedArea(hole_loops_projected[m]));
std::sort(hole_loops_sorted[m].begin(), hole_loops_sorted[m].end(),
carve::make_index_sort(hole_loops[m].begin()));
hole_loop_aabb[m].fit(hole_loops_projected[m].begin(), hole_loops_projected[m].end());
@ -572,6 +631,10 @@ namespace {
std::vector<std::vector<int> > containing_faces;
std::map<int, std::map<int, std::pair<unsigned, unsigned> > > hole_shared_vertices;
#if defined(CARVE_DEBUG_WRITE_PLY_DATA)
dumpFacesAndHoles(f_loops.begin(), f_loops.end(), h_loops.begin(), h_loops.end(), "/tmp/pre_merge.ply");
#endif
{
// move input face and hole loops to temp vectors.
size_t m;
@ -720,6 +783,10 @@ namespace {
}
}
#endif
#if defined(CARVE_DEBUG_WRITE_PLY_DATA)
dumpFacesAndHoles(f_loops.begin(), f_loops.end(), h_loops.begin(), h_loops.end(), "/tmp/post_merge.ply");
#endif
}
@ -738,7 +805,7 @@ namespace {
* on that edge.
* @param[out] base_loop A vector of the vertices of the base loop.
*/
static void assembleBaseLoop(carve::mesh::MeshSet<3>::face_t *face,
static bool assembleBaseLoop(carve::mesh::MeshSet<3>::face_t *face,
const carve::csg::detail::Data &data,
std::vector<carve::mesh::MeshSet<3>::vertex_t *> &base_loop) {
base_loop.clear();
@ -746,6 +813,7 @@ namespace {
// XXX: assumes that face->edges is in the same order as
// face->vertices. (Which it is)
carve::mesh::MeshSet<3>::edge_t *e = face->edge;
bool face_edge_intersected = false;
do {
base_loop.push_back(carve::csg::map_vertex(data.vmap, e->vert));
@ -757,9 +825,13 @@ namespace {
for (size_t k = 0, ke = ev_vec.size(); k < ke;) {
base_loop.push_back(ev_vec[k++]);
}
face_edge_intersected = true;
}
e = e->next;
} while (e != face->edge);
return face_edge_intersected;
}
@ -789,7 +861,6 @@ namespace {
carve::csg::CSG::Hooks &hooks,
std::vector<carve::mesh::MeshSet<3>::vertex_t *> &base_loop,
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &paths,
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &loops,
std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &face_loops_out) {
const size_t N = base_loop.size();
std::vector<crossing_data> endpoint_indices;
@ -800,6 +871,7 @@ namespace {
endpoint_indices.push_back(crossing_data(&paths[i], N, N));
}
// Step 1:
// locate endpoints of paths on the base loop.
for (size_t i = 0; i < N; ++i) {
for (size_t j = 0; j < paths.size(); ++j) {
@ -872,6 +944,7 @@ namespace {
#endif
// Step 2:
// divide paths up into those that connect to the base loop in two
// places (cross), and those that do not (noncross).
std::vector<crossing_data> cross, noncross;
@ -895,7 +968,6 @@ namespace {
double area = carve::geom2d::signedArea(endpoint_indices[i].path->begin() + 1,
endpoint_indices[i].path->end(),
carve::mesh::MeshSet<3>::face_t::projection_mapping(face->project));
std::cerr << "HITS THIS CODE - area=" << area << std::endl;
if (area < 0) {
// XXX: Create test case to check that this is the correct sign for the area.
std::reverse(endpoint_indices[i].path->begin(), endpoint_indices[i].path->end());
@ -917,6 +989,7 @@ namespace {
}
}
// Step 3:
// add a temporary crossing path that connects the beginning and the
// end of the base loop. this stops us from needing special case
// code to handle the left over loop after all the other crossing
@ -931,10 +1004,12 @@ namespace {
std::cerr << "### crossing edge count (with sentinel): " << cross.size() << std::endl;
#endif
// Step 4:
// sort paths by increasing beginning point and decreasing ending point.
std::sort(cross.begin(), cross.end());
std::sort(noncross.begin(), noncross.end());
// Step 5:
// divide up the base loop based upon crossing paths.
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > divided_base_loop;
divided_base_loop.reserve(cross.size());
@ -979,6 +1054,7 @@ namespace {
}
}
// Step 6:
for (size_t i = 0; i < cross.size(); ++i) {
#if defined(CARVE_DEBUG)
std::cerr << "### i=" << i << " working on edge: " << cross[i].edge_idx[0] << " - " << cross[i].edge_idx[1] << std::endl;
@ -1060,7 +1136,8 @@ namespace {
#endif
}
if (!noncross.size() && !loops.size()) {
if (!noncross.size()) {
// If there are no non-crossing paths then we're done.
populateListFromVector(divided_base_loop, face_loops_out);
return true;
}
@ -1113,16 +1190,6 @@ namespace {
}
}
// for each loop, just test with any point.
for (size_t j = 0; j < loops.size(); ++j) {
test = face->project(loops[j].front()->v);
if (proj_aabb[i].intersects(test) &&
carve::geom2d::pointInPoly(proj[i], test).iclass != carve::POINT_OUT) {
inc.push_back(&loops[j]);
}
}
#if defined(CARVE_DEBUG)
std::cerr << "### divided base loop:" << i << " inc.size()=" << inc.size() << std::endl;
std::cerr << "### inc = [";
@ -1172,15 +1239,18 @@ namespace {
void composeEdgesIntoPaths(const carve::csg::V2Set &edges,
const std::vector<carve::mesh::MeshSet<3>::vertex_t *> &extra_endpoints,
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &paths,
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &cuts,
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &loops) {
using namespace carve::csg;
detail::VVSMap vertex_graph;
detail::VSet endpoints;
detail::VSet cut_endpoints;
std::vector<carve::mesh::MeshSet<3>::vertex_t *> path;
typedef std::vector<carve::mesh::MeshSet<3>::vertex_t *> vvec_t;
vvec_t path;
std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > temp;
std::list<vvec_t> path_list, cut_list, loop_list;
// build graph from edges.
for (V2Set::const_iterator i = edges.begin(); i != edges.end(); ++i) {
@ -1199,6 +1269,9 @@ namespace {
std::cerr << "### endpoint: " << (*i).first << std::endl;
#endif
endpoints.insert((*i).first);
if ((*i).second.size() == 1) {
cut_endpoints.insert((*i).first);
}
}
}
@ -1209,6 +1282,7 @@ namespace {
std::cerr << "### extra endpoint: " << extra_endpoints[i] << std::endl;
#endif
endpoints.insert(extra_endpoints[i]);
cut_endpoints.erase(extra_endpoints[i]);
}
}
@ -1252,11 +1326,19 @@ namespace {
}
CARVE_ASSERT(endpoints.find(path.back()) != endpoints.end());
temp.push_back(path);
bool is_cut =
cut_endpoints.find(path.front()) != cut_endpoints.end() &&
cut_endpoints.find(path.back()) != cut_endpoints.end();
if (is_cut) {
cut_list.push_back(vvec_t()); path.swap(cut_list.back());
} else {
path_list.push_back(vvec_t()); path.swap(path_list.back());
}
}
populateVectorFromList(temp, paths);
temp.clear();
populateVectorFromList(path_list, paths);
populateVectorFromList(cut_list, cuts);
// now only loops should remain in the graph.
while (vertex_graph.size()) {
@ -1291,72 +1373,14 @@ namespace {
if (v == path[0]) break;
}
temp.push_back(path);
loop_list.push_back(vvec_t()); path.swap(loop_list.back());
}
populateVectorFromList(temp, loops);
populateVectorFromList(loop_list, loops);
}
#if defined(CARVE_DEBUG_WRITE_PLY_DATA)
void dumpFacesAndHoles(const std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &face_loops,
const std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > &hole_loops) {
std::map<carve::mesh::MeshSet<3>::vertex_t *, size_t> v_included;
for (std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> >::const_iterator
i = face_loops.begin(); i != face_loops.end(); ++i) {
for (size_t j = 0; j < (*i).size(); ++j) {
if (v_included.find((*i)[j]) == v_included.end()) {
size_t &p = v_included[(*i)[j]];
p = v_included.size() - 1;
}
}
}
for (std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> >::const_iterator
i = hole_loops.begin(); i != hole_loops.end(); ++i) {
for (size_t j = 0; j < (*i).size(); ++j) {
if (v_included.find((*i)[j]) == v_included.end()) {
size_t &p = v_included[(*i)[j]];
p = v_included.size() - 1;
}
}
}
carve::line::PolylineSet fh;
fh.vertices.resize(v_included.size());
for (std::map<carve::mesh::MeshSet<3>::vertex_t *, size_t>::const_iterator
i = v_included.begin(); i != v_included.end(); ++i) {
fh.vertices[(*i).second].v = (*i).first->v;
}
{
std::vector<size_t> connected;
for (std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> >::const_iterator
i = face_loops.begin(); i != face_loops.end(); ++i) {
connected.clear();
for (size_t j = 0; j < (*i).size(); ++j) {
connected.push_back(v_included[(*i)[j]]);
}
fh.addPolyline(true, connected.begin(), connected.end());
}
for (std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> >::const_iterator
i = hole_loops.begin(); i != hole_loops.end(); ++i) {
connected.clear();
for (size_t j = 0; j < (*i).size(); ++j) {
connected.push_back(v_included[(*i)[j]]);
}
fh.addPolyline(true, connected.begin(), connected.end());
}
}
std::string out("/tmp/hole_merge.ply");
::writePLY(out, &fh, true);
}
#endif
template<typename T>
std::string ptrstr(const T *ptr) {
std::ostringstream s;
@ -1416,7 +1440,7 @@ namespace {
std::vector<carve::mesh::MeshSet<3>::vertex_t *> base_loop;
std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > hole_loops;
assembleBaseLoop(face, data, base_loop);
bool face_edge_intersected = assembleBaseLoop(face, data, base_loop);
detail::FV2SMap::const_iterator fse_iter = data.face_split_edges.find(face);
@ -1452,7 +1476,8 @@ namespace {
if (face_edges.find(std::make_pair(v1, v2)) == face_edges.end() &&
face_edges.find(std::make_pair(v2, v1)) == face_edges.end()) {
// If the edge isn't part of the face perimeter, add it to
// split_edges.
split_edges.insert(ordered_edge(v1, v2));
}
}
@ -1517,9 +1542,13 @@ namespace {
return;
}
// Consider handling cases where one end of the edge touches the
// perimeter, and where neither end does.
}
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > paths;
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > cuts;
std::vector<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > loops;
// Take the split edges and compose them into a set of paths and
@ -1528,67 +1557,73 @@ namespace {
// of the face. Paths are made up of all the other edge segments,
// and start and end at the face perimeter, or where they meet
// another path (sometimes both cases will be true).
composeEdgesIntoPaths(split_edges, base_loop, paths, loops);
composeEdgesIntoPaths(split_edges, base_loop, paths, cuts, loops);
#if defined(CARVE_DEBUG)
std::cerr << "### paths.size(): " << paths.size() << std::endl;
std::cerr << "### cuts.size(): " << cuts.size() << std::endl;
std::cerr << "### loops.size(): " << loops.size() << std::endl;
#endif
if (!paths.size()) {
// Loops found by composeEdgesIntoPaths() can't touch the
// boundary, or each other, so we can deal with the no paths
// case simply. The hole loops are the loops produced by
// composeEdgesIntoPaths() oriented so that their signed area
// wrt. the face is negative. The face loops are the base loop
// plus the hole loops, reversed.
// No complex paths.
face_loops.push_back(base_loop);
for (size_t i = 0; i < loops.size(); ++i) {
hole_loops.push_back(std::vector<carve::mesh::MeshSet<3>::vertex_t *>());
hole_loops.back().reserve(loops[i].size()-1);
std::copy(loops[i].begin(), loops[i].end()-1, std::back_inserter(hole_loops.back()));
face_loops.push_back(std::vector<carve::mesh::MeshSet<3>::vertex_t *>());
face_loops.back().reserve(loops[i].size()-1);
std::copy(loops[i].rbegin()+1, loops[i].rend(), std::back_inserter(face_loops.back()));
std::vector<carve::geom2d::P2> projected;
projected.reserve(face_loops.back().size());
for (size_t i = 0; i < face_loops.back().size(); ++i) {
projected.push_back(face->project(face_loops.back()[i]->v));
}
if (carve::geom2d::signedArea(projected) > 0.0) {
std::swap(face_loops.back(), hole_loops.back());
}
}
// if there are holes, then they need to be merged with faces.
if (hole_loops.size()) {
mergeFacesAndHoles(face, face_loops, hole_loops, hooks);
}
} else {
if (!processCrossingEdges(face, vertex_intersections, hooks, base_loop, paths, loops, face_loops)) {
if (processCrossingEdges(face, vertex_intersections, hooks, base_loop, paths, face_loops)) {
// Worked.
} else {
// complex case - fall back to old edge tracing code.
#if defined(CARVE_DEBUG)
std::cerr << "### processCrossingEdges failed. Falling back to edge tracing code" << std::endl;
#endif
for (V2Set::const_iterator i = split_edges.begin(); i != split_edges.end(); ++i) {
face_edges.insert(std::make_pair((*i).first, (*i).second));
face_edges.insert(std::make_pair((*i).second, (*i).first));
for (size_t i = 0; i < paths.size(); ++i) {
for (size_t j = 0; j < paths[i].size() - 1; ++j) {
face_edges.insert(std::make_pair(paths[i][j], paths[i][j+1]));
face_edges.insert(std::make_pair(paths[i][j+1], paths[i][j]));
}
}
splitFace(face, face_edges, face_loops, hole_loops, vertex_intersections);
if (hole_loops.size()) {
mergeFacesAndHoles(face, face_loops, hole_loops, hooks);
}
}
}
// Now merge cuts and loops into face loops.
// every cut creates a hole.
for (size_t i = 0; i < cuts.size(); ++i) {
hole_loops.push_back(std::vector<carve::mesh::MeshSet<3>::vertex_t *>());
hole_loops.back().reserve(2 * cuts[i].size() - 2);
std::copy(cuts[i].begin(), cuts[i].end(), std::back_inserter(hole_loops.back()));
if (cuts[i].size() > 2) {
std::copy(cuts[i].rbegin() + 1, cuts[i].rend() - 1, std::back_inserter(hole_loops.back()));
}
}
// every loop creates a hole and a corresponding face.
for (size_t i = 0; i < loops.size(); ++i) {
hole_loops.push_back(std::vector<carve::mesh::MeshSet<3>::vertex_t *>());
hole_loops.back().reserve(loops[i].size()-1);
std::copy(loops[i].begin(), loops[i].end()-1, std::back_inserter(hole_loops.back()));
face_loops.push_back(std::vector<carve::mesh::MeshSet<3>::vertex_t *>());
face_loops.back().reserve(loops[i].size()-1);
std::copy(loops[i].rbegin()+1, loops[i].rend(), std::back_inserter(face_loops.back()));
std::vector<carve::geom2d::P2> projected;
projected.reserve(face_loops.back().size());
for (size_t i = 0; i < face_loops.back().size(); ++i) {
projected.push_back(face->project(face_loops.back()[i]->v));
}
if (carve::geom2d::signedArea(projected) > 0.0) {
std::swap(face_loops.back(), hole_loops.back());
}
}
// if there are holes, then they need to be merged with faces.
if (hole_loops.size()) {
mergeFacesAndHoles(face, face_loops, hole_loops, hooks);
}
}
}

@ -501,10 +501,21 @@ bool carve::triangulate::detail::vertex_info::isClipable() const {
size_t carve::triangulate::detail::removeDegeneracies(vertex_info *&begin, std::vector<carve::triangulate::tri_idx> &result) {
vertex_info *v = begin;
vertex_info *v;
vertex_info *n;
size_t count = 0;
size_t remain = 0;
v = begin;
do {
v = v->next;
++remain;
} while (v != begin);
v = begin;
do {
if (remain < 4) break;
bool remove = false;
if (v->p == v->next->p) {
remove = true;
@ -533,11 +544,11 @@ size_t carve::triangulate::detail::removeDegeneracies(vertex_info *&begin, std::
if (n == begin) begin = n->next;
n->remove();
count++;
remain--;
delete n;
continue;
} else {
v = v->next;
}
v = v->next;
} while (v != begin);
return count;
}
@ -615,7 +626,7 @@ bool carve::triangulate::detail::doTriangulate(vertex_info *begin, std::vector<c
std::cerr << "remain = " << remain << std::endl;
#endif
while (vq.size()) {
while (remain > 3 && vq.size()) {
vertex_info *v = vq.pop();
if (!v->isClipable()) {
v->failed = true;
@ -639,10 +650,11 @@ bool carve::triangulate::detail::doTriangulate(vertex_info *begin, std::vector<c
#endif
v->remove();
remain--;
if (v == begin) begin = v->next;
delete v;
if (--remain == 3) break;
vq.updateVertex(n);
vq.updateVertex(p);
@ -676,27 +688,7 @@ bool carve::triangulate::detail::doTriangulate(vertex_info *begin, std::vector<c
std::cerr << "doTriangulate complete; remain=" << remain << std::endl;
#endif
bool ret = true;
if (remain > 3) {
std::vector<carve::geom2d::P2> temp;
temp.reserve(remain);
vertex_info *v = begin;
do {
temp.push_back(v->p);
v = v->next;
} while (v != begin);
if (carve::geom2d::signedArea(temp) == 0) {
// XXX: this test will fail in cases where the boundary is
// twisted so that a negative area balances a positive area.
#if defined(CARVE_DEBUG)
std::cerr << "skeleton remains. complete." << std::endl;
#endif
goto done;
}
#if defined(CARVE_DEBUG)
std::cerr << "before removeDegeneracies: remain=" << remain << std::endl;
#endif
@ -704,18 +696,16 @@ bool carve::triangulate::detail::doTriangulate(vertex_info *begin, std::vector<c
#if defined(CARVE_DEBUG)
std::cerr << "after removeDegeneracies: remain=" << remain << std::endl;
#endif
if (remain > 3) {
return splitAndResume(begin, result);
}
}
if (remain > 3) {
return splitAndResume(begin, result);
} else if (remain == 3) {
if (remain == 3) {
result.push_back(carve::triangulate::tri_idx(begin->idx, begin->next->idx, begin->next->next->idx));
ret = true;
} else {
ret = true;
}
done:
vertex_info *d = begin;
do {
vertex_info *n = d->next;
@ -723,7 +713,7 @@ bool carve::triangulate::detail::doTriangulate(vertex_info *begin, std::vector<c
d = n;
} while (d != begin);
return ret;
return true;
}

@ -40,6 +40,7 @@
#include <iostream>
using namespace carve::mesh;
using namespace carve::geom;
typedef unsigned int uint;
#define MAX(x,y) ((x)>(y)?(x):(y))
@ -65,71 +66,183 @@ static int isFacePlanar(CSG_IFace &face, std::vector<carve::geom3d::Vector> &ver
return 1;
}
static MeshSet<3> *Carve_meshSetFromMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes)
static void Carve_copyMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes, std::vector<MeshSet<3>::mesh_t*> &new_meshes)
{
std::vector<MeshSet<3>::mesh_t*> new_meshes;
std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin();
for(; it!=meshes.end(); it++) {
MeshSet<3>::mesh_t *mesh = *it;
MeshSet<3>::mesh_t *new_mesh = new MeshSet<3>::mesh_t(mesh->faces);
new_meshes.push_back(new_mesh);
}
}
static MeshSet<3> *Carve_meshSetFromMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes)
{
std::vector<MeshSet<3>::mesh_t*> new_meshes;
Carve_copyMeshes(meshes, new_meshes);
return new MeshSet<3>(new_meshes);
}
static void Carve_getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes,
std::vector<MeshSet<3>::aabb_t> &precomputedAABB,
MeshSet<3>::aabb_t &otherAABB,
static MeshSet<3> *Carve_meshSetFromTwoMeshes(std::vector<MeshSet<3>::mesh_t*> &left_meshes,
std::vector<MeshSet<3>::mesh_t*> &right_meshes)
{
std::vector<MeshSet<3>::mesh_t*> new_meshes;
Carve_copyMeshes(left_meshes, new_meshes);
Carve_copyMeshes(right_meshes, new_meshes);
return new MeshSet<3>(new_meshes);
}
static bool Carve_checkEdgeFaceIntersections_do(carve::csg::Intersections &intersections,
MeshSet<3>::face_t *face_a, MeshSet<3>::edge_t *edge_b)
{
if(intersections.intersects(edge_b, face_a))
return true;
carve::mesh::MeshSet<3>::vertex_t::vector_t _p;
if(face_a->simpleLineSegmentIntersection(carve::geom3d::LineSegment(edge_b->v1()->v, edge_b->v2()->v), _p))
return true;
return false;
}
static bool Carve_checkEdgeFaceIntersections(carve::csg::Intersections &intersections,
MeshSet<3>::face_t *face_a, MeshSet<3>::face_t *face_b)
{
MeshSet<3>::edge_t *edge_b;
edge_b = face_b->edge;
do {
if(Carve_checkEdgeFaceIntersections_do(intersections, face_a, edge_b))
return true;
edge_b = edge_b->next;
} while (edge_b != face_b->edge);
return false;
}
static inline bool Carve_facesAreCoplanar(const MeshSet<3>::face_t *a, const MeshSet<3>::face_t *b)
{
carve::geom3d::Ray temp;
// XXX: Find a better definition. This may be a source of problems
// if floating point inaccuracies cause an incorrect answer.
return !carve::geom3d::planeIntersection(a->plane, b->plane, temp);
}
static bool Carve_checkMeshSetInterseciton_do(carve::csg::Intersections &intersections,
const RTreeNode<3, Face<3> *> *a_node,
const RTreeNode<3, Face<3> *> *b_node,
bool descend_a = true)
{
if(!a_node->bbox.intersects(b_node->bbox))
return false;
if(a_node->child && (descend_a || !b_node->child)) {
for(RTreeNode<3, Face<3> *> *node = a_node->child; node; node = node->sibling) {
if(Carve_checkMeshSetInterseciton_do(intersections, node, b_node, false))
return true;
}
}
else if(b_node->child) {
for(RTreeNode<3, Face<3> *> *node = b_node->child; node; node = node->sibling) {
if(Carve_checkMeshSetInterseciton_do(intersections, a_node, node, true))
return true;
}
}
else {
for(size_t i = 0; i < a_node->data.size(); ++i) {
MeshSet<3>::face_t *fa = a_node->data[i];
aabb<3> aabb_a = fa->getAABB();
if(aabb_a.maxAxisSeparation(b_node->bbox) > carve::EPSILON) continue;
for(size_t j = 0; j < b_node->data.size(); ++j) {
MeshSet<3>::face_t *fb = b_node->data[j];
aabb<3> aabb_b = fb->getAABB();
if(aabb_b.maxAxisSeparation(aabb_a) > carve::EPSILON) continue;
std::pair<double, double> a_ra = fa->rangeInDirection(fa->plane.N, fa->edge->vert->v);
std::pair<double, double> b_ra = fb->rangeInDirection(fa->plane.N, fa->edge->vert->v);
if(carve::rangeSeparation(a_ra, b_ra) > carve::EPSILON) continue;
std::pair<double, double> a_rb = fa->rangeInDirection(fb->plane.N, fb->edge->vert->v);
std::pair<double, double> b_rb = fb->rangeInDirection(fb->plane.N, fb->edge->vert->v);
if(carve::rangeSeparation(a_rb, b_rb) > carve::EPSILON) continue;
if(!Carve_facesAreCoplanar(fa, fb)) {
if(Carve_checkEdgeFaceIntersections(intersections, fa, fb)) {
return true;
}
}
}
}
}
return false;
}
static bool Carve_checkMeshSetInterseciton(RTreeNode<3, Face<3> *> *rtree_a, RTreeNode<3, Face<3> *> *rtree_b)
{
carve::csg::Intersections intersections;
return Carve_checkMeshSetInterseciton_do(intersections, rtree_a, rtree_b);
}
static void Carve_getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> &meshes, MeshSet<3>::aabb_t &otherAABB,
std::vector<MeshSet<3>::mesh_t*> &operandMeshes)
{
std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin();
std::vector<MeshSet<3>::aabb_t>::iterator aabb_it = precomputedAABB.begin();
std::vector<MeshSet<3>::aabb_t> usedAABB;
std::vector< RTreeNode<3, Face<3> *> *> meshRTree;
while(it != meshes.end()) {
MeshSet<3>::mesh_t *mesh = *it;
MeshSet<3>::aabb_t aabb = mesh->getAABB();
bool isIntersect = false;
std::vector<MeshSet<3>::aabb_t>::iterator used_it = usedAABB.begin();
for(; used_it!=usedAABB.end(); used_it++) {
MeshSet<3>::aabb_t usedAABB = *used_it;
RTreeNode<3, Face<3> *> *rtree = RTreeNode<3, Face<3> *>::construct_STR(mesh->faces.begin(), mesh->faces.end(), 4, 4);
if(usedAABB.intersects(aabb) && usedAABB.intersects(otherAABB)) {
isIntersect = true;
break;
std::vector<MeshSet<3>::mesh_t*>::iterator operand_it = operandMeshes.begin();
std::vector<RTreeNode<3, Face<3> *> *>::iterator tree_it = meshRTree.begin();
for(; operand_it!=operandMeshes.end(); operand_it++, tree_it++) {
RTreeNode<3, Face<3> *> *operandRTree = *tree_it;
if(operandRTree->bbox.intersects(otherAABB)) {
if(Carve_checkMeshSetInterseciton(rtree, operandRTree)) {
isIntersect = true;
break;
}
}
}
if(!isIntersect) {
operandMeshes.push_back(mesh);
usedAABB.push_back(aabb);
meshRTree.push_back(rtree);
it = meshes.erase(it);
aabb_it = precomputedAABB.erase(aabb_it);
}
else {
it++;
aabb_it++;
}
}
std::vector<RTreeNode<3, Face<3> *> *>::iterator tree_it = meshRTree.begin();
for(; tree_it != meshRTree.end(); tree_it++) {
delete *tree_it;
}
}
static MeshSet<3> *Carve_getIntersectedOperand(std::vector<MeshSet<3>::mesh_t*> &meshes,
std::vector<MeshSet<3>::aabb_t> &precomputedAABB,
MeshSet<3>::aabb_t &otherAABB)
static MeshSet<3> *Carve_getIntersectedOperand(std::vector<MeshSet<3>::mesh_t*> &meshes, MeshSet<3>::aabb_t &otherAABB)
{
std::vector<MeshSet<3>::mesh_t*> operandMeshes;
Carve_getIntersectedOperandMeshes(meshes, precomputedAABB, otherAABB, operandMeshes);
Carve_getIntersectedOperandMeshes(meshes, otherAABB, operandMeshes);
return Carve_meshSetFromMeshes(operandMeshes);
}
static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
std::vector<MeshSet<3>::aabb_t> &precomputedAABB,
MeshSet<3>::aabb_t &otherAABB,
carve::interpolate::FaceAttr<uint> &oface_num)
{
@ -144,10 +257,10 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
std::vector<MeshSet<3>::mesh_t*> orig_meshes =
std::vector<MeshSet<3>::mesh_t*>(poly->meshes.begin(), poly->meshes.end());
MeshSet<3> *left = Carve_getIntersectedOperand(orig_meshes, precomputedAABB, otherAABB);
MeshSet<3> *left = Carve_getIntersectedOperand(orig_meshes, otherAABB);
while(orig_meshes.size()) {
MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, precomputedAABB, otherAABB);
MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, otherAABB);
try {
if(left->meshes.size()==0) {
@ -167,7 +280,12 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
catch(carve::exception e) {
std::cerr << "CSG failed, exception " << e.str() << std::endl;
MeshSet<3> *result = Carve_meshSetFromTwoMeshes(left->meshes, right->meshes);
delete left;
delete right;
left = result;
}
catch(...) {
delete left;
@ -180,38 +298,16 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
return left;
}
static MeshSet<3>::aabb_t Carve_computeAABB(MeshSet<3> *poly,
std::vector<MeshSet<3>::aabb_t> &precomputedAABB)
{
MeshSet<3>::aabb_t overallAABB;
std::vector<MeshSet<3>::mesh_t*>::iterator it = poly->meshes.begin();
for(; it!=poly->meshes.end(); it++) {
MeshSet<3>::aabb_t aabb;
MeshSet<3>::mesh_t *mesh = *it;
aabb = mesh->getAABB();
precomputedAABB.push_back(aabb);
overallAABB.unionAABB(aabb);
}
return overallAABB;
}
static void Carve_prepareOperands(MeshSet<3> **left_r, MeshSet<3> **right_r,
carve::interpolate::FaceAttr<uint> &oface_num)
static void Carve_unionIntersections(MeshSet<3> **left_r, MeshSet<3> **right_r,
carve::interpolate::FaceAttr<uint> &oface_num)
{
MeshSet<3> *left, *right;
std::vector<MeshSet<3>::aabb_t> left_precomputedAABB;
std::vector<MeshSet<3>::aabb_t> right_precomputedAABB;
MeshSet<3>::aabb_t leftAABB = (*left_r)->getAABB();
MeshSet<3>::aabb_t rightAABB = (*right_r)->getAABB();
MeshSet<3>::aabb_t leftAABB = Carve_computeAABB(*left_r, left_precomputedAABB);
MeshSet<3>::aabb_t rightAABB = Carve_computeAABB(*right_r, right_precomputedAABB);
left = Carve_unionIntersectingMeshes(*left_r, left_precomputedAABB, rightAABB, oface_num);
right = Carve_unionIntersectingMeshes(*right_r, right_precomputedAABB, leftAABB, oface_num);
left = Carve_unionIntersectingMeshes(*left_r, rightAABB, oface_num);
right = Carve_unionIntersectingMeshes(*right_r, leftAABB, oface_num);
if(left != *left_r)
delete *left_r;
@ -233,9 +329,9 @@ static MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor &face_it,
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]));
vertices.push_back(VECTOR(vertex.position[0],
vertex.position[1],
vertex.position[2]));
vertex_it.Step(vertex_it.it);
}
@ -522,19 +618,6 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType,
left = Carve_addMesh(obAFaces, obAVertices, oface_num, num_origfaces );
right = Carve_addMesh(obBFaces, obBVertices, oface_num, num_origfaces );
Carve_prepareOperands(&left, &right, oface_num);
if(left->meshes.size() == 0 || right->meshes.size()==0) {
// normally sohuldn't happen (zero-faces objects are handled by modifier itself), but
// unioning intersecting meshes which doesn't have consistent normals might lead to
// empty result which wouldn't work here
delete left;
delete right;
return BOP_ERROR;
}
min.x = max.x = left->vertex_storage[0].v.x;
min.y = max.y = left->vertex_storage[0].v.y;
min.z = max.z = left->vertex_storage[0].v.z;
@ -562,6 +645,23 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType,
left->transform(fwd_r);
right->transform(fwd_r);
// prepare operands for actual boolean operation. it's needed because operands might consist of
// several intersecting meshes and in case if another operands intersect an edge loop of intersecting that
// meshes tesselation of operation result can't be done properly. the only way to make such situations
// working is to union intersecting meshes of the same operand
Carve_unionIntersections(&left, &right, oface_num);
if(left->meshes.size() == 0 || right->meshes.size()==0) {
// normally sohuldn't happen (zero-faces objects are handled by modifier itself), but
// unioning intersecting meshes which doesn't have consistent normals might lead to
// empty result which wouldn't work here
delete left;
delete right;
return BOP_ERROR;
}
csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT);
oface_num.installHooks(csg);

@ -116,7 +116,8 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
if(ls.shader & SHADER_CAST_SHADOW) {
/* setup ray */
ray->P = ray_offset(sd->P, sd->Ng);
bool transmit = (dot(sd->Ng, ls.D) < 0.0f);
ray->P = ray_offset(sd->P, (transmit)? -sd->Ng: sd->Ng);
if(ls.t == FLT_MAX) {
/* distant light */

@ -220,9 +220,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
path_radiance_init(&L, kernel_data.film.use_light_pass);
#if defined(__EMISSION__) || defined(__BACKGROUND__)
float ray_pdf = 0.0f;
#endif
PathState state;
int rng_offset = PRNG_BASE_NUM;
@ -344,9 +342,8 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
path_radiance_bsdf_bounce(&L, &throughput, &bsdf_eval, bsdf_pdf, state.bounce, label);
/* set labels */
#if defined(__EMISSION__) || defined(__BACKGROUND__)
ray_pdf = bsdf_pdf;
#endif
if(!(label & LABEL_TRANSPARENT))
ray_pdf = bsdf_pdf;
/* update path state */
path_state_next(kg, &state, label);

@ -300,7 +300,7 @@ __device_inline void _shader_bsdf_multi_eval(const ShaderData *sd, const float3
}
}
*pdf = sum_pdf/sum_sample_weight;
*pdf = (sum_sample_weight > 0.0f)? sum_pdf/sum_sample_weight: 0.0f;
}
#endif

@ -65,8 +65,8 @@ class MEM_CacheLimiter;
#ifndef __MEM_cache_limiter_c_api_h_included__
extern "C" {
extern void MEM_CacheLimiter_set_maximum(intptr_t m);
extern intptr_t MEM_CacheLimiter_get_maximum();
extern void MEM_CacheLimiter_set_maximum(size_t m);
extern size_t MEM_CacheLimiter_get_maximum();
};
#endif
@ -125,7 +125,7 @@ class MEM_CacheLimiter {
public:
typedef typename std::list<MEM_CacheLimiterHandle<T> *,
MEM_Allocator<MEM_CacheLimiterHandle<T> *> >::iterator iterator;
typedef intptr_t (*MEM_CacheLimiter_DataSize_Func) (void *data);
typedef size_t (*MEM_CacheLimiter_DataSize_Func) (void *data);
MEM_CacheLimiter(MEM_CacheLimiter_DataSize_Func getDataSize_)
: getDataSize(getDataSize_) {
}
@ -146,8 +146,8 @@ public:
delete handle;
}
void enforce_limits() {
intptr_t max = MEM_CacheLimiter_get_maximum();
intptr_t mem_in_use, cur_size;
size_t max = MEM_CacheLimiter_get_maximum();
size_t mem_in_use, cur_size;
if (max == 0) {
return;
@ -188,8 +188,8 @@ public:
handle->me = it;
}
private:
intptr_t total_size() {
intptr_t size = 0;
size_t total_size() {
size_t size = 0;
for (iterator it = queue.begin(); it != queue.end(); it++) {
size+= getDataSize((*it)->get()->get_data());
}

@ -42,10 +42,10 @@ typedef struct MEM_CacheLimiterHandle_s MEM_CacheLimiterHandleC;
typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
/* function used to measure stored data element size */
typedef intptr_t(*MEM_CacheLimiter_DataSize_Func) (void*);
typedef size_t(*MEM_CacheLimiter_DataSize_Func) (void*);
#ifndef MEM_CACHELIMITER_H
extern void MEM_CacheLimiter_set_maximum(int m);
extern void MEM_CacheLimiter_set_maximum(size_t m);
extern int MEM_CacheLimiter_get_maximum(void);
#endif // MEM_CACHELIMITER_H
/**

@ -29,18 +29,18 @@
#include "MEM_CacheLimiter.h"
#include "MEM_CacheLimiterC-Api.h"
static intptr_t & get_max()
static size_t & get_max()
{
static intptr_t m = 32*1024*1024;
static size_t m = 32*1024*1024;
return m;
}
void MEM_CacheLimiter_set_maximum(intptr_t m)
void MEM_CacheLimiter_set_maximum(size_t m)
{
get_max() = m;
}
intptr_t MEM_CacheLimiter_get_maximum()
size_t MEM_CacheLimiter_get_maximum()
{
return get_max();
}

@ -835,7 +835,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
return {'FINISHED'}
class CLIP_OT_track_settings_as_default(Operator):
"""Copy trackign settings from active track to default settings"""
"""Copy tracking settings from active track to default settings"""
bl_idname = "clip.track_settings_as_default"
bl_label = "Track Settings As Default"

@ -489,8 +489,7 @@ class ShapeTransfer(Operator):
return (obj and obj.mode != 'EDIT')
def execute(self, context):
C = bpy.context
ob_act = C.active_object
ob_act = context.active_object
objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
if 1: # swap from/to, means we cant copy to many at once.
@ -585,11 +584,6 @@ class MakeDupliFace(Operator):
bl_idname = "object.make_dupli_face"
bl_label = "Make Dupli-Face"
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj and obj.type == 'MESH')
def _main(self, context):
from mathutils import Vector
@ -601,22 +595,22 @@ class MakeDupliFace(Operator):
Vector((-offset, +offset, 0.0)),
)
def matrix_to_quat(matrix):
def matrix_to_quad(matrix):
# scale = matrix.median_scale
trans = matrix.to_translation()
rot = matrix.to_3x3() # also contains scale
return [(rot * b) + trans for b in base_tri]
scene = bpy.context.scene
scene = context.scene
linked = {}
for obj in bpy.context.selected_objects:
for obj in context.selected_objects:
data = obj.data
if data:
linked.setdefault(data, []).append(obj)
for data, objects in linked.items():
face_verts = [axis for obj in objects
for v in matrix_to_quat(obj.matrix_world)
for v in matrix_to_quad(obj.matrix_world)
for axis in v]
faces = list(range(len(face_verts) // 3))

@ -226,10 +226,10 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
row.alignment = 'RIGHT'
sub = row.row(align=True)
sub.label() # XXX, for alignment only
subsub = sub.row(align=True)
subsub.active = enable_edit_value
subsub.prop(ob, "show_only_shape_key", text="")
subsub.prop(kb, "mute", text="")
sub.prop(ob, "use_shape_key_edit_mode", text="")
sub = row.row()

@ -92,7 +92,7 @@ class IMAGE_MT_select(Menu):
layout = self.layout
layout.operator("uv.select_border").pinned = False
layout.operator("uv.select_border").pinned = True
layout.operator("uv.select_border", text="Border Select Pinned").pinned = True
layout.separator()

@ -61,7 +61,7 @@ void animviz_calc_motionpaths(struct Scene *scene, ListBase *targets);
void free_path(struct Path *path);
void calc_curvepath(struct Object *ob);
int interval_test(int min, int max, int p1, int cycl);
int where_on_path(struct Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius, float *weight);
int where_on_path(struct Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius, float *weight);
/* ---------------------------------------------------- */
/* Dupli-Geometry */

@ -109,6 +109,8 @@ void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], flo
void armature_loc_pose_to_bone(struct bPoseChannel *pchan, float *inloc, float *outloc);
void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]);
void armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
void pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat);
void pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat);
void pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]);

@ -59,7 +59,7 @@ void curve_deform_verts(struct Scene *scene, struct Object *cuOb, struct Object
struct DerivedMesh *dm, float (*vertexCos)[3],
int numVerts, const char *vgroup, short defaxis);
void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object *target,
float *orco, float *vec, float mat[][3], int no_rot_axis);
float orco[3], float vec[3], float mat[][3], int no_rot_axis);
void lattice_deform_verts(struct Object *laOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],

@ -586,11 +586,14 @@ int interval_test(int min, int max, int p1, int cycl)
}
/* calculate the deformation implied by the curve path at a given parametric position, and returns whether this operation succeeded
* - *vec needs FOUR items!
* - ctime is normalized range <0-1>
/* calculate the deformation implied by the curve path at a given parametric position,
* and returns whether this operation succeeded.
*
* note: ctime is normalized range <0-1>
*
* returns OK: 1/0
*/
int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius, float *weight) /* returns OK */
int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius, float *weight)
{
Curve *cu;
Nurb *nu;

@ -1318,6 +1318,23 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc)
copy_v3_v3(outloc, nLocMat[3]);
}
void armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[][4], float outmat[][4])
{
bPoseChannel work_pchan = *pchan;
/* recalculate pose matrix with only parent transformations,
* bone loc/sca/rot is ignored, scene and frame are not used. */
where_is_pose_bone(NULL, ob, &work_pchan, 0.0f, FALSE);
/* find the matrix, need to remove the bone transforms first so this is
* calculated as a matrix to set rather then a difference ontop of whats
* already there. */
unit_m4(outmat);
pchan_apply_mat4(&work_pchan, outmat, FALSE);
armature_mat_pose_to_bone(&work_pchan, inmat, outmat);
}
/* same as object_mat3_to_rot() */
void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat)
{

@ -303,6 +303,12 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
copy_m4_m4(tempmat, mat);
mult_m4_m4m4(mat, imat, tempmat);
/* override with local location */
if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat);
copy_v3_v3(mat[3], tempmat[3]);
}
}
}
/* pose to local with parent */
@ -508,13 +514,17 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
normalize_v3(normal);
copy_v3_v3(plane, tmat[1]);
copy_v3_v3(tmat[2], normal);
cross_v3_v3v3(tmat[0], normal, plane);
cross_v3_v3v3(tmat[1], tmat[2], tmat[0]);
copy_m4_m3(mat, tmat);
cross_v3_v3v3(mat[0], normal, plane);
if(len_v3(mat[0]) < 1e-3) {
copy_v3_v3(plane, tmat[0]);
cross_v3_v3v3(mat[0], normal, plane);
}
copy_v3_v3(mat[2], normal);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
normalize_m4(mat);
/* apply the average coordinate as the new location */
mul_v3_m4v3(mat[3], ob->obmat, vec);

@ -381,7 +381,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
{
C->wm.window= win;
C->wm.screen= (win)? win->screen: NULL;
C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
if(C->wm.screen)
C->data.scene= C->wm.screen->scene;
C->wm.area= NULL;
C->wm.region= NULL;
}
@ -389,7 +390,8 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
void CTX_wm_screen_set(bContext *C, bScreen *screen)
{
C->wm.screen= screen;
C->data.scene= (C->wm.screen)? C->wm.screen->scene: NULL;
if(C->wm.screen)
C->data.scene= C->wm.screen->scene;
C->wm.area= NULL;
C->wm.region= NULL;
}

@ -539,6 +539,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
break;
case OB_CURVE:
case OB_FONT:
{
Curve *cu= ob->data;
@ -550,15 +551,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
node2 = dag_get_node(dag, cu->taperobj);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
}
}
break;
case OB_FONT:
{
Curve *cu= ob->data;
if(cu->textoncurve) {
node2 = dag_get_node(dag, cu->textoncurve);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
if(ob->type == OB_FONT) {
if(cu->textoncurve) {
node2 = dag_get_node(dag, cu->textoncurve);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
}
}
break;

@ -462,32 +462,25 @@ void end_latt_deform(Object *ob)
so we store in latmat transform from path coord inside object
*/
typedef struct {
float dmin[3], dmax[3], dscale, dloc[3];
float dmin[3], dmax[3];
float curvespace[4][4], objectspace[4][4], objectspace3[3][3];
int no_rot_axis;
} CurveDeform;
static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd, int dloc)
static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd)
{
invert_m4_m4(ob->imat, ob->obmat);
mult_m4_m4m4(cd->objectspace, ob->imat, par->obmat);
invert_m4_m4(cd->curvespace, cd->objectspace);
copy_m3_m4(cd->objectspace3, cd->objectspace);
// offset vector for 'no smear'
if(dloc) {
invert_m4_m4(par->imat, par->obmat);
mul_v3_m4v3(cd->dloc, par->imat, ob->obmat[3]);
}
else {
cd->dloc[0]=cd->dloc[1]=cd->dloc[2]= 0.0f;
}
cd->no_rot_axis= 0;
}
/* this makes sure we can extend for non-cyclic. *vec needs 4 items! */
static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir, float *quat, float *radius) /* returns OK */
/* this makes sure we can extend for non-cyclic.
*
* returns OK: 1/0
*/
static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir[3], float quat[4], float *radius)
{
Curve *cu= ob->data;
BevList *bl;
@ -532,20 +525,18 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir,
return 0;
}
/* for each point, rotate & translate to curve */
/* use path, since it has constant distances */
/* co: local coord, result local too */
/* returns quaternion for rotation, using cd->no_rot_axis */
/* axis is using another define!!! */
static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, CurveDeform *cd, float *quatp)
/* for each point, rotate & translate to curve */
/* use path, since it has constant distances */
/* co: local coord, result local too */
/* returns quaternion for rotation, using cd->no_rot_axis */
/* axis is using another define!!! */
static int calc_curve_deform(Scene *scene, Object *par, float co[3],
const short axis, CurveDeform *cd, float quat_r[4])
{
Curve *cu= par->data;
float fac, loc[4], dir[3], new_quat[4], radius;
short /*upflag, */ index;
index= axis-1;
if(index>2)
index -= 3; /* negative */
short index;
const int is_neg_axis = (axis > 2);
/* to be sure, mostly after file load */
if(cu->path==NULL) {
@ -554,52 +545,24 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
}
/* options */
if(ELEM3(axis, OB_NEGX+1, OB_NEGY+1, OB_NEGZ+1)) { /* OB_NEG# 0-5, MOD_CURVE_POS# 1-6 */
if (is_neg_axis) {
index = axis - 3;
if(cu->flag & CU_STRETCH)
fac= (-co[index]-cd->dmax[index])/(cd->dmax[index] - cd->dmin[index]);
else
fac= (cd->dloc[index])/(cu->path->totdist) - (co[index]-cd->dmax[index])/(cu->path->totdist);
fac= - (co[index]-cd->dmax[index])/(cu->path->totdist);
}
else {
index = axis;
if(cu->flag & CU_STRETCH)
fac= (co[index]-cd->dmin[index])/(cd->dmax[index] - cd->dmin[index]);
else
fac= (cd->dloc[index])/(cu->path->totdist) + (co[index]-cd->dmin[index])/(cu->path->totdist);
fac= + (co[index]-cd->dmin[index])/(cu->path->totdist);
}
#if 0 // XXX old animation system
/* we want the ipo to work on the default 100 frame range, because there's no
actual time involved in path position */
// huh? by WHY!!!!???? - Aligorith
if(cu->ipo) {
fac*= 100.0f;
if(calc_ipo_spec(cu->ipo, CU_SPEED, &fac)==0)
fac/= 100.0;
}
#endif // XXX old animation system
if( where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) { /* returns OK */
float quat[4], cent[3];
#if 0 // XXX - 2.4x Z-Up, Now use bevel tilt.
if(cd->no_rot_axis) /* set by caller */
dir[cd->no_rot_axis-1]= 0.0f;
/* -1 for compatibility with old track defines */
vec_to_quat( quat,dir, axis-1, upflag);
/* the tilt */
if(loc[3]!=0.0) {
normalize_v3(dir);
q[0]= (float)cos(0.5*loc[3]);
fac= (float)sin(0.5*loc[3]);
q[1]= -fac*dir[0];
q[2]= -fac*dir[1];
q[3]= -fac*dir[2];
mul_qt_qtqt(quat, q, quat);
}
#endif
if(cd->no_rot_axis) { /* set by caller */
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
@ -634,9 +597,9 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
/* zero the axis which is not used,
* the big block of text above now applies to these 3 lines */
quat_apply_track(quat, axis-1, (axis==1 || axis==3) ? 1:0); /* up flag is a dummy, set so no rotation is done */
vec_apply_track(cent, axis-1);
cent[axis < 4 ? axis-1 : axis-4]= 0.0f;
quat_apply_track(quat, axis, (axis == 0 || axis == 2) ? 1:0); /* up flag is a dummy, set so no rotation is done */
vec_apply_track(cent, axis);
cent[index]= 0.0f;
/* scale if enabled */
@ -650,8 +613,8 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
/* translation */
add_v3_v3v3(co, cent, loc);
if(quatp)
copy_qt_qt(quatp, quat);
if(quat_r)
copy_qt_qt(quat_r, quat);
return 1;
}
@ -666,6 +629,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
int a, flag;
CurveDeform cd;
int use_vgroups;
const int is_neg_axis = (defaxis > 2);
if(cuOb->type != OB_CURVE)
return;
@ -674,10 +638,10 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
flag = cu->flag;
cu->flag |= (CU_PATH|CU_FOLLOW); // needed for path & bevlist
init_curve_deform(cuOb, target, &cd, (cu->flag & CU_STRETCH)==0);
init_curve_deform(cuOb, target, &cd);
/* dummy bounds, keep if CU_DEFORM_BOUNDS_OFF is set */
if(defaxis < 3) {
if(is_neg_axis == FALSE) {
cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= 0.0f;
cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 1.0f;
}
@ -711,10 +675,6 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
if(cu->flag & CU_DEFORM_BOUNDS_OFF) {
/* dummy bounds */
cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= 0.0f;
cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 1.0f;
dvert = me->dvert;
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
@ -749,6 +709,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
weight= defvert_find_weight(dvert, index);
if(weight > 0.0f) {
/* already in 'cd.curvespace', prev for loop */
copy_v3_v3(vec, vertexCos[a]);
calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
interp_v3_v3v3(vertexCos[a], vertexCos[a], vec, weight);
@ -776,6 +737,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
}
for(a = 0; a < numVerts; a++) {
/* already in 'cd.curvespace', prev for loop */
calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
mul_m4_v3(cd.objectspace, vertexCos[a]);
}
@ -787,7 +749,8 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
/* input vec and orco = local coord in armature space */
/* orco is original not-animated or deformed reference point */
/* result written in vec and mat */
void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco, float *vec, float mat[][3], int no_rot_axis)
void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
float orco[3], float vec[3], float mat[][3], int no_rot_axis)
{
CurveDeform cd;
float quat[4];
@ -797,7 +760,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco
return;
}
init_curve_deform(cuOb, target, &cd, 0); /* 0 no dloc */
init_curve_deform(cuOb, target, &cd);
cd.no_rot_axis= no_rot_axis; /* option to only rotate for XY, for example */
copy_v3_v3(cd.dmin, orco);
@ -805,7 +768,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco
mul_m4_v3(cd.curvespace, vec);
if(calc_curve_deform(scene, cuOb, vec, target->trackflag+1, &cd, quat)) {
if(calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) {
float qmat[3][3];
quat_to_mat3( qmat,quat);
@ -885,7 +848,7 @@ int object_deform_mball(Object *ob, ListBase *dispbase)
static BPoint *latt_bp(Lattice *lt, int u, int v, int w)
{
return lt->def+ u + v*lt->pntsu + w*lt->pntsu*lt->pntsv;
return &lt->def[LT_INDEX(lt, u, v, w)];
}
void outside_lattice(Lattice *lt)

@ -194,10 +194,12 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
- dir: subdir to search
- filename: set this filename
- filesize: filesize for the file
*/
* - dir: subdir to search
* - filename: set this filename
* - filesize: filesize for the file
*
* return found: 1/0.
*/
#define MAX_RECUR 16
static int findFileRecursive(char *filename_new,
const char *dirname,
@ -211,11 +213,14 @@ static int findFileRecursive(char *filename_new,
struct stat status;
char path[FILE_MAX];
int size;
int found = FALSE;
filename_new[0] = '\0';
dir= opendir(dirname);
if (dir==NULL)
return 0;
return found;
if (*filesize == -1)
*filesize= 0; /* dir opened fine */
@ -237,19 +242,20 @@ static int findFileRecursive(char *filename_new,
if ((size > 0) && (size > *filesize)) { /* find the biggest file */
*filesize= size;
BLI_strncpy(filename_new, path, FILE_MAX);
found = TRUE;
}
}
}
else if (S_ISDIR(status.st_mode)) { /* is subdir */
if (*recur_depth <= MAX_RECUR) {
(*recur_depth)++;
findFileRecursive(filename_new, path, filename, filesize, recur_depth);
found |= findFileRecursive(filename_new, path, filename, filesize, recur_depth);
(*recur_depth)--;
}
}
}
closedir(dir);
return 1;
return found;
}
typedef struct BPathFind_Data
@ -266,19 +272,26 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
int filesize= -1;
int recur_depth= 0;
int found;
findFileRecursive(filename_new,
data->searchdir, BLI_path_basename((char *)path_src),
&filesize, &recur_depth);
found = findFileRecursive(filename_new,
data->searchdir, BLI_path_basename((char *)path_src),
&filesize, &recur_depth);
if (filesize == -1) { /* could not open dir */
BKE_reportf(data->reports, RPT_WARNING,
"Could open directory \"%s\"",
BLI_path_basename(data->searchdir));
return FALSE;
}
else if (found == FALSE) {
BKE_reportf(data->reports, RPT_WARNING,
"Could not find \"%s\" in \"%s\"",
BLI_path_basename((char *)path_src), data->searchdir);
return FALSE;
}
else {
strcpy(path_dst, filename_new);
BLI_strncpy(path_dst, filename_new, FILE_MAX);
return TRUE;
}
}

@ -55,7 +55,8 @@ struct View3D;
struct ViewContext;
struct wmWindow;
struct MVert;
struct wmOperatorType;
struct wmOperator;
/* for derivedmesh drawing callbacks, for view3d_select, .... */
typedef struct ViewContext {
@ -212,6 +213,7 @@ void project_short_noclip(struct ARegion *ar, const float vec[3], short adr[2]);
void project_int(struct ARegion *ar, const float vec[3], int adr[2]);
void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]);
void apply_project_float(float persmat[4][4], int winx, int winy, const float vec[], float adr[2]);
void project_float(struct ARegion *ar, const float vec[3], float adr[2]);
void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
@ -305,4 +307,9 @@ struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
void ED_view3D_background_image_clear(struct View3D *v3d);
/* view matrix properties utilities */
void ED_view3d_operator_properties_viewmat(struct wmOperatorType *ot);
void ED_view3d_operator_properties_viewmat_set(struct bContext *C, struct wmOperator *op);
void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx, int *winy, float persmat[4][4]);
#endif /* ED_VIEW3D_H */

@ -1529,38 +1529,40 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
width= rect.xmax-rect.xmin+1;
height = rect.ymax-rect.ymin;
zoomx= (float)width / (scopes->track_preview->x-2*margin);
zoomy= (float)height / (scopes->track_preview->y-2*margin);
if(width > 0 && height > 0) {
zoomx= (float)width / (scopes->track_preview->x-2*margin);
zoomy= (float)height / (scopes->track_preview->y-2*margin);
off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
glaDrawPixelsSafe(rect.xmin, rect.ymin+1, drawibuf->x, drawibuf->y,
drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
IMB_freeImBuf(drawibuf);
glaDrawPixelsSafe(rect.xmin, rect.ymin+1, drawibuf->x, drawibuf->y,
drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
IMB_freeImBuf(drawibuf);
/* draw cross for pizel position */
glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
/* draw cross for pizel position */
glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
for(a= 0; a< 2; a++) {
if(a==1) {
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
UI_ThemeColor(TH_SEL_MARKER);
for(a= 0; a< 2; a++) {
if(a==1) {
glLineStipple(3, 0xaaaa);
glEnable(GL_LINE_STIPPLE);
UI_ThemeColor(TH_SEL_MARKER);
}
else {
UI_ThemeColor(TH_MARKER_OUTLINE);
}
glBegin(GL_LINES);
glVertex2f(-10.0f, 0.0f);
glVertex2f(10.0f, 0.0f);
glVertex2f(0.0f, -10.0f);
glVertex2f(0.0f, 10.0f);
glEnd();
}
else {
UI_ThemeColor(TH_MARKER_OUTLINE);
}
glBegin(GL_LINES);
glVertex2f(-10.0f, 0.0f);
glVertex2f(10.0f, 0.0f);
glVertex2f(0.0f, -10.0f);
glVertex2f(0.0f, 10.0f);
glEnd();
}
glDisable(GL_LINE_STIPPLE);

@ -1541,6 +1541,8 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
if(ELEM(but->type, BLOCK, PULLDOWN))
block->xofs = -2; /* for proper alignment */
block->aspect = but->block->aspect;
ui_block_position(window, butregion, but, block);
}
else {

@ -2150,7 +2150,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
Object *ob= (Object*)activeptr->data;
Key *key= (Key*)itemptr->id.data;
split= uiLayoutSplit(sub, 0.75f, 0);
split= uiLayoutSplit(sub, 0.66f, 0);
uiItemL(split, name, icon);
@ -2158,10 +2158,13 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
row= uiLayoutRow(split, 1);
if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
uiItemR(row, itemptr, "mute", 0, "", 0);
if(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH))
if( (key->flag & KEYBLOCK_MUTE) ||
(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
{
uiLayoutSetActive(row, 0);
//uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
}
uiBlockSetEmboss(block, UI_EMBOSS);
}
else if(itemptr->type == &RNA_VertexGroup) {

@ -548,7 +548,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
int numVerts;
float (*vertexCos)[3];
if (mti->type==eModifierTypeType_Constructive) {
if (ELEM(mti->type, eModifierTypeType_Constructive, eModifierTypeType_Nonconstructive)) {
BKE_report(reports, RPT_ERROR, "Cannot apply constructive modifiers on curve");
return 0;
}

@ -1096,8 +1096,14 @@ static void file_expand_directory(bContext *C)
BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr);
}
#ifdef WIN32
if (sfile->params->dir[0] == '\0') {
else if (sfile->params->dir[0] == '\0')
#ifndef WIN32
{
sfile->params->dir[0] = '/';
sfile->params->dir[1] = '\0';
}
#else
{
get_default_root(sfile->params->dir);
}
/* change "C:" --> "C:\", [#28102] */

@ -855,14 +855,13 @@ static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
SpaceNode *snode = CTX_wm_space_node(C);
bNode *gnode;
gnode = nodeGetActive(snode->edittree);
if (!gnode)
return OPERATOR_CANCELLED;
/* XXX callback? */
if(gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
uiPupMenuOkee(C, op->type->idname, "Make group local?");
return OPERATOR_CANCELLED;
if (snode->nodetree==snode->edittree) {
gnode = nodeGetActive(snode->edittree);
if(gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
uiPupMenuOkee(C, op->type->idname, "Make group local?");
return OPERATOR_CANCELLED;
}
}
return node_group_edit_exec(C, op);

@ -553,7 +553,10 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
else if (seq->type == SEQ_SOUND) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
if(seq->sound)
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
else
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
}
else if (seq->type == SEQ_MOVIE) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);

@ -4110,7 +4110,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
ParticleDrawData *pdd = psys->pdd;
Material *ma;
float vel[3], imat[4][4];
float timestep, pixsize=1.0, pa_size, r_tilt, r_length;
float timestep, pixsize_scale, pa_size, r_tilt, r_length;
float pa_time, pa_birthtime, pa_dietime, pa_health, intensity;
float cfra;
float ma_col[3]= {0.0f, 0.0f, 0.0f};
@ -4217,12 +4217,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
case PART_DRAW_CROSS:
case PART_DRAW_AXIS:
/* lets calculate the scale: */
pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]);
if(part->draw_size==0.0)
pixsize *= 2.0f;
if (part->draw_size == 0.0)
pixsize_scale = 2.0f;
else
pixsize*=part->draw_size;
pixsize_scale = part->draw_size;
if(draw_as==PART_DRAW_AXIS)
create_cdata = 1;
@ -4410,6 +4409,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
ct+=dt;
for(i=0; i < trail_count; i++, ct += dt) {
float pixsize;
if(part->draw & PART_ABS_PATH_TIME) {
if(ct < pa_birthtime || ct > pa_dietime)
continue;
@ -4443,6 +4444,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
bb.time = ct;
}
pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, psys->pdd);
totpoint++;
@ -4453,6 +4456,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
{
state.time=cfra;
if(psys_get_particle_state(&sim,a,&state,0)){
float pixsize;
if(psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
@ -4476,6 +4481,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
bb.time = pa_time;
}
pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, pdd);
totpoint++;

@ -68,6 +68,9 @@
#include "BL_System.h"
#endif
#include "RNA_access.h"
#include "RNA_define.h"
#include "view3d_intern.h" // own include
/* use this call when executing an operator,
@ -945,23 +948,29 @@ void project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
}
}
void project_float(ARegion *ar, const float vec[3], float adr[2])
void apply_project_float(float persmat[4][4], int winx, int winy, const float vec[3], float adr[2])
{
RegionView3D *rv3d= ar->regiondata;
float vec4[4];
copy_v3_v3(vec4, vec);
vec4[3]= 1.0;
adr[0]= IS_CLIPPED;
mul_m4_v4(rv3d->persmat, vec4);
mul_m4_v4(persmat, vec4);
if(vec4[3] > (float)BL_NEAR_CLIP) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
adr[0] = (float)(winx/2.0f)+(winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(winy/2.0f)+(winy/2.0f)*vec4[1]/vec4[3];
}
}
void project_float(ARegion *ar, const float vec[3], float adr[2])
{
RegionView3D *rv3d= ar->regiondata;
apply_project_float(rv3d->persmat, ar->winx, ar->winy, vec, adr);
}
void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
{
RegionView3D *rv3d= ar->regiondata;
@ -1852,3 +1861,42 @@ float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
rv3d->persmat[2][3]*co[2])
) * rv3d->pixsize;
}
/* view matrix properties utilities */
void ED_view3d_operator_properties_viewmat(wmOperatorType *ot)
{
PropertyRNA *prop;
prop = RNA_def_int(ot->srna, "region_width", 0, 0, INT_MAX, "Region Width", "", 0, INT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_int(ot->srna, "region_height", 0, 0, INT_MAX, "Region height", "", 0, INT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_float_matrix(ot->srna, "perspective_matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Perspective Matrix", 0.0f, 0.0f);
RNA_def_property_flag(prop, PROP_HIDDEN);
}
void ED_view3d_operator_properties_viewmat_set(bContext *C, wmOperator *op)
{
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
if(!RNA_struct_property_is_set(op->ptr, "region_width"))
RNA_int_set(op->ptr, "region_width", ar->winx);
if(!RNA_struct_property_is_set(op->ptr, "region_height"))
RNA_int_set(op->ptr, "region_height", ar->winy);
if(!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
RNA_float_set_array(op->ptr, "perspective_matrix", (float *)rv3d->persmat);
}
void ED_view3d_operator_properties_viewmat_get(wmOperator *op, int *winx, int *winy, float persmat[4][4])
{
*winx = RNA_int_get(op->ptr, "region_width");
*winy = RNA_int_get(op->ptr, "region_height");
RNA_float_get_array(op->ptr, "perspective_matrix", (float *)persmat);
}

@ -5696,10 +5696,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
if(!clip || !BKE_movieclip_has_frame(clip, &sc->user)) {
t->total = 0;
t->total = 0;
if(!clip || !BKE_movieclip_has_frame(clip, &sc->user))
return;
if(!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
return;
}
if(ar->regiontype == RGN_TYPE_PREVIEW) {
/* transformation was called from graph editor */

@ -1230,6 +1230,11 @@ void mtex_bump_tap3( vec3 texco, sampler2D ima, float hScale,
void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
out float dBs, out float dBt )
{
float Hl;
float Hr;
float Hd;
float Hu;
vec2 TexDx = dFdx(texco.xy);
vec2 TexDy = dFdy(texco.xy);
@ -1238,10 +1243,10 @@ void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
vec2 STd = texco.xy - 0.5 * TexDy ;
vec2 STu = texco.xy + 0.5 * TexDy ;
float Hl = texture2D(ima, STl).x;
float Hr = texture2D(ima, STr).x;
float Hd = texture2D(ima, STd).x;
float Hu = texture2D(ima, STu).x;
rgbtobw(texture2D(ima, STl), Hl);
rgbtobw(texture2D(ima, STr), Hr);
rgbtobw(texture2D(ima, STd), Hd);
rgbtobw(texture2D(ima, STu), Hu);
vec2 dHdxy = vec2(Hr - Hl, Hu - Hd);
float fBlend = clamp(1.0-textureQueryLOD(ima, texco.xy).x, 0.0, 1.0);
@ -1255,8 +1260,6 @@ void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
ivec2 iTexLoc = ivec2(floor(fTexLoc));
vec2 t = clamp(fTexLoc - iTexLoc, 0.0, 1.0); // sat just to be pedantic
ivec2 iTexLocMod = iTexLoc + ivec2(-1, -1);
/*******************************************************************************************
* This block will replace the one below when one channel textures are properly supported. *
*******************************************************************************************
@ -1264,17 +1267,19 @@ void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
vec4 vSamplesUR = textureGather(ima, (iTexLoc+ivec2(1,-1) + vec2(0.5,0.5))/vDim );
vec4 vSamplesLL = textureGather(ima, (iTexLoc+ivec2(-1,1) + vec2(0.5,0.5))/vDim );
vec4 vSamplesLR = textureGather(ima, (iTexLoc+ivec2(1,1) + vec2(0.5,0.5))/vDim );
mat4 H = mat4(vSamplesUL.w, vSamplesUL.x, vSamplesLL.w, vSamplesLL.x,
vSamplesUL.z, vSamplesUL.y, vSamplesLL.z, vSamplesLL.y,
vSamplesUR.w, vSamplesUR.x, vSamplesLR.w, vSamplesLR.x,
vSamplesUR.z, vSamplesUR.y, vSamplesLR.z, vSamplesLR.y);
*/
ivec2 iTexLocMod = iTexLoc + ivec2(-1, -1);
mat4 H;
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
mtex_rgbtoint(texelFetch(ima, (iTexLocMod + ivec2(i,j)), 0), H[i][j]);
rgbtobw(texelFetch(ima, (iTexLocMod + ivec2(i,j)), 0), H[i][j]);
}
}

File diff suppressed because it is too large Load Diff

@ -147,10 +147,10 @@ static void IMB_moviecache_destructor(void *p)
}
/* approximate size of ImBuf in memory */
static intptr_t IMB_get_size_in_memory(ImBuf *ibuf)
static size_t IMB_get_size_in_memory(ImBuf *ibuf)
{
int a;
intptr_t size= 0, channel_size= 0;
size_t size= 0, channel_size= 0;
size+= sizeof(ImBuf);
@ -176,9 +176,9 @@ static intptr_t IMB_get_size_in_memory(ImBuf *ibuf)
return size;
}
static intptr_t get_item_size (void *p)
static size_t get_item_size (void *p)
{
intptr_t size= sizeof(MovieCacheItem);
size_t size= sizeof(MovieCacheItem);
MovieCacheItem *item= (MovieCacheItem *) p;
if(item->ibuf)

@ -293,8 +293,8 @@ static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float
/* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
if (ELEM3(acon->type, 0, 1, 2)) {
*min= -90.f;
*max= 90.f;
*min= -180.0f;
*max= 180.0f;
} else {
*min= -1000.f;
*max= 1000.f;
@ -1032,7 +1032,7 @@ static void rna_def_constraint_action(BlenderRNA *brna)
{00, "ROTATION_X", 0, "X Rotation", ""},
{01, "ROTATION_Y", 0, "Y Rotation", ""},
{02, "ROTATION_Z", 0, "Z Rotation", ""},
{10, "SCALE_X", 0, "Z Scale", ""},
{10, "SCALE_X", 0, "X Scale", ""},
{11, "SCALE_Y", 0, "Y Scale", ""},
{12, "SCALE_Z", 0, "Z Scale", ""},
{0, NULL, 0, NULL, NULL}};

@ -559,7 +559,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
RNA_def_property_ui_text(prop, "Mute", "Mute this shape key");
RNA_def_property_ui_icon(prop, ICON_MUTE_IPO_OFF, 1);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
RNA_def_property_update(prop, 0, "rna_Key_update_data");
prop= RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);

@ -93,10 +93,14 @@ static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *p
Material *ma= ptr->id.data;
DAG_id_tag_update(&ma->id, 0);
if(scene->gm.matmode == GAME_MAT_GLSL)
WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
else
WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
if (scene) { /* can be NULL, see [#30025] */
if (scene->gm.matmode == GAME_MAT_GLSL) {
WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
}
else {
WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
}
}
}
static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)

@ -613,18 +613,10 @@ static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
{
bPoseChannel *pchan= (bPoseChannel*)ptr->data;
Object *ob= (Object*)ptr->id.data;
float umat[4][4]= MAT4_UNITY;
float tmat[4][4];
/* recalculate pose matrix with only parent transformations,
* bone loc/sca/rot is ignored, scene and frame are not used. */
where_is_pose_bone(NULL, ob, pchan, 0.0f, FALSE);
armature_mat_pose_to_bone_ex(ob, pchan, (float (*)[4])values, tmat);
/* find the matrix, need to remove the bone transforms first so this is
* calculated as a matrix to set rather then a difference ontop of whats
* already there. */
pchan_apply_mat4(pchan, umat, FALSE);
armature_mat_pose_to_bone(pchan, (float (*)[4])values, tmat);
pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */
}

@ -377,10 +377,18 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P
CCLDeviceInfo *devices = CCL_compute_device_list(opencl);
int a;
for(a = 0; devices[a].name; a++) {
tmp.value = devices[a].value;
tmp.identifier = devices[a].identifier;
tmp.name = devices[a].name;
if(devices) {
for(a = 0; devices[a].name; a++) {
tmp.value = devices[a].value;
tmp.identifier = devices[a].identifier;
tmp.name = devices[a].name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
}
else {
tmp.value = 0;
tmp.name = "CPU";
tmp.identifier = "CPU";
RNA_enum_item_add(&item, &totitem, &tmp);
}
}

@ -47,6 +47,8 @@
#include "MOD_boolean_util.h"
#include "MOD_util.h"
#include "PIL_time.h"
static void copyData(ModifierData *md, ModifierData *target)
{
BooleanModifierData *bmd = (BooleanModifierData*) md;
@ -140,8 +142,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
DM_ensure_tessface(derivedData); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
// TIMEIT_START(NewBooleanDerivedMesh)
result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
1 + bmd->operation);
// TIMEIT_END(NewBooleanDerivedMesh)
}
/* if new mesh returned, return it; otherwise there was

@ -119,8 +119,10 @@ static void deformVerts(ModifierData *md, Object *ob,
{
CurveModifierData *cmd = (CurveModifierData*) md;
/* silly that defaxis and curve_deform_verts are off by 1
* but leave for now to save having to call do_versions */
curve_deform_verts(md->scene, cmd->object, ob, derivedData, vertexCos, numVerts,
cmd->name, cmd->defaxis);
cmd->name, cmd->defaxis-1);
}
static void deformVertsEM(

@ -660,6 +660,13 @@ static void force_hidden_passes(bNode *node, int passflag)
for(sock= node->outputs.first; sock; sock= sock->next)
sock->flag &= ~SOCK_UNAVAIL;
if(!(passflag & SCE_PASS_COMBINED)) {
sock= BLI_findlink(&node->outputs, RRES_OUT_IMAGE);
sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_ALPHA);
sock->flag |= SOCK_UNAVAIL;
}
sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
if(!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL);
@ -741,16 +748,16 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
if(rl)
force_hidden_passes(node, rl->passflag);
else
force_hidden_passes(node, 0);
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
}
else if(ima->type!=IMA_TYPE_MULTILAYER) { /* if ->rr not yet read we keep inputs */
force_hidden_passes(node, RRES_OUT_Z);
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
}
else
force_hidden_passes(node, 0);
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
}
else
force_hidden_passes(node, 0);
force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
}
}

@ -1562,7 +1562,7 @@ static PyObject *Matrix_str(MatrixObject *self)
int maxsize[MATRIX_MAX_DIM];
int row, col;
char dummy_buf[1];
char dummy_buf[64];
if (BaseMath_ReadCallback(self) == -1)
return NULL;
@ -1584,7 +1584,7 @@ static PyObject *Matrix_str(MatrixObject *self)
for (col = 0; col < self->num_col; col++) {
BLI_dynstr_appendf(ds, col ? ", %*.4f" : "%*.4f", maxsize[col], MATRIX_ITEM(self, row, col));
}
BLI_dynstr_append(ds, row + 1 != self->num_row ? ")\n " : ")");
BLI_dynstr_append(ds, row + 1 != self->num_row ? ")\n (" : ")");
}
BLI_dynstr_append(ds, ">");

@ -1030,9 +1030,9 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
/* preprocess, textures were not done, don't use shi->amb for that reason */
void ambient_occlusion(ShadeInput *shi)
{
if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f)
if(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)
sample_occ(&R, shi);
else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f)
else if(R.r.mode & R_RAYTRACE)
ray_ao(shi, shi->ao, shi->env);
else
shi->ao[0]= shi->ao[1]= shi->ao[2]= 1.0f;

@ -277,7 +277,7 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
static void wm_init_userdef(bContext *C)
{
UI_init_userdef();
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
sound_init(CTX_data_main(C));
/* needed so loading a file from the command line respects user-pref [#26156] */

@ -1457,15 +1457,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_LOCAL, KX_ConstraintActuator::KX_ACT_CONSTRAINT_LOCAL);
KX_MACRO_addTypesToDict(d, KX_CONSTRAINTACT_DOROTFH, KX_ConstraintActuator::KX_ACT_CONSTRAINT_DOROTFH);
/* 4. Ipo actuator, simple part */
KX_MACRO_addTypesToDict(d, KX_IPOACT_PLAY, KX_IpoActuator::KX_ACT_IPO_PLAY);
KX_MACRO_addTypesToDict(d, KX_IPOACT_PINGPONG, KX_IpoActuator::KX_ACT_IPO_PINGPONG);
KX_MACRO_addTypesToDict(d, KX_IPOACT_FLIPPER, KX_IpoActuator::KX_ACT_IPO_FLIPPER);
KX_MACRO_addTypesToDict(d, KX_IPOACT_LOOPSTOP, KX_IpoActuator::KX_ACT_IPO_LOOPSTOP);
KX_MACRO_addTypesToDict(d, KX_IPOACT_LOOPEND, KX_IpoActuator::KX_ACT_IPO_LOOPEND);
KX_MACRO_addTypesToDict(d, KX_IPOACT_FROM_PROP,KX_IpoActuator::KX_ACT_IPO_FROM_PROP);
/* 5. Random distribution types */
/* 4. Random distribution types */
KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_CONST, SCA_RandomActuator::KX_RANDOMACT_BOOL_CONST);
KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_UNIFORM, SCA_RandomActuator::KX_RANDOMACT_BOOL_UNIFORM);
KX_MACRO_addTypesToDict(d, KX_RANDOMACT_BOOL_BERNOUILLI, SCA_RandomActuator::KX_RANDOMACT_BOOL_BERNOUILLI);
@ -1477,7 +1469,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_NORMAL, SCA_RandomActuator::KX_RANDOMACT_FLOAT_NORMAL);
KX_MACRO_addTypesToDict(d, KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL, SCA_RandomActuator::KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL);
/* 6. Sound actuator */
/* 5. Sound actuator */
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYSTOP, KX_SoundActuator::KX_SOUNDACT_PLAYSTOP);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_PLAYEND, KX_SoundActuator::KX_SOUNDACT_PLAYEND);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPSTOP, KX_SoundActuator::KX_SOUNDACT_LOOPSTOP);
@ -1485,7 +1477,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL);
KX_MACRO_addTypesToDict(d, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP, KX_SoundActuator::KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP);
/* 7. Action actuator */
/* 6. Action actuator */
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PLAY, ACT_ACTION_PLAY);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PINGPONG, ACT_ACTION_PINGPONG);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_FLIPPER, ACT_ACTION_FLIPPER);
@ -1493,7 +1485,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPEND, ACT_ACTION_LOOP_END);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PROPERTY, ACT_ACTION_FROM_PROP);
/*8. GL_BlendFunc */
/* 7. GL_BlendFunc */
KX_MACRO_addTypesToDict(d, BL_ZERO, GL_ZERO);
KX_MACRO_addTypesToDict(d, BL_ONE, GL_ONE);
KX_MACRO_addTypesToDict(d, BL_SRC_COLOR, GL_SRC_COLOR);
@ -1507,7 +1499,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, BL_SRC_ALPHA_SATURATE, GL_SRC_ALPHA_SATURATE);
/* 9. UniformTypes */
/* 8. UniformTypes */
KX_MACRO_addTypesToDict(d, SHD_TANGENT, BL_Shader::SHD_TANGENT);
KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX, BL_Shader::MODELVIEWMATRIX);
KX_MACRO_addTypesToDict(d, MODELVIEWMATRIX_TRANSPOSE, BL_Shader::MODELVIEWMATRIX_TRANSPOSE);
@ -1524,7 +1516,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
KX_MACRO_addTypesToDict(d, CAM_POS, BL_Shader::CAM_POS);
KX_MACRO_addTypesToDict(d, CONSTANT_TIMER, BL_Shader::CONSTANT_TIMER);
/* 10 state actuator */
/* 9. state actuator */
KX_MACRO_addTypesToDict(d, KX_STATE1, (1<<0));
KX_MACRO_addTypesToDict(d, KX_STATE2, (1<<1));
KX_MACRO_addTypesToDict(d, KX_STATE3, (1<<2));