diff --git a/CMakeLists.txt b/CMakeLists.txt index d973c7c9465..114cdf40e2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1498,7 +1498,7 @@ endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(WITH_IK_ITASC) - message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.") + message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC, this feature will be missing.") set(WITH_IK_ITASC OFF) endif() endif() diff --git a/SConstruct b/SConstruct index 22075b720da..9a1f9234d06 100644 --- a/SConstruct +++ b/SConstruct @@ -274,7 +274,7 @@ if 'blenderlite' in B.targets: # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX if env['OURPLATFORM']=='darwin': - print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'][:9] + " --" + print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --" print "Available " + env['MACOSX_SDK_CHECK'] if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']: print B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk" diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake index 7e1b00d0923..3f7cca333cc 100644 --- a/build_files/cmake/Modules/FindGLEW.cmake +++ b/build_files/cmake/Modules/FindGLEW.cmake @@ -18,7 +18,7 @@ IF (WIN32) PATHS $ENV{PROGRAMFILES}/GLEW/lib ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib DOC "The GLEW library (64-bit)" ) ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") @@ -27,7 +27,7 @@ IF (WIN32) PATHS $ENV{PROGRAMFILES}/GLEW/lib ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin - ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib + ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib DOC "The GLEW library" ) ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64") diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 78a19a1e81d..e9c7fb2aca8 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -34,7 +34,7 @@ elif cmd_res[:2]=='11': MAC_CUR_VER='10.7' cmd = 'xcodebuild -version' cmd_xcode=commands.getoutput(cmd) -XCODE_CUR_VER=cmd_xcode +XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version cmd = 'xcodebuild -showsdks' cmd_sdk=commands.getoutput(cmd) MACOSX_SDK_CHECK=cmd_sdk diff --git a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp index 126529e9779..3922c864eba 100644 --- a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp +++ b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp @@ -70,7 +70,7 @@ static bool circumCircle(const float* p1, const float* p2, const float* p3, const float cp = vcross2(p1, p2, p3); if (fabsf(cp) > EPS) - { + { const float p1Sq = vdot2(p1,p1); const float p2Sq = vdot2(p2,p2); const float p3Sq = vdot2(p3,p3); @@ -78,7 +78,7 @@ static bool circumCircle(const float* p1, const float* p2, const float* p3, c[2] = (p1Sq*(p3[0]-p2[0]) + p2Sq*(p1[0]-p3[0]) + p3Sq*(p2[0]-p1[0])) / (2*cp); r = vdist2(c, p1); return true; - } + } c[0] = p1[0]; c[2] = p1[2]; diff --git a/intern/boolop/intern/BOP_BSPNode.cpp b/intern/boolop/intern/BOP_BSPNode.cpp index 7d9071b3132..3588e80c28e 100644 --- a/intern/boolop/intern/BOP_BSPNode.cpp +++ b/intern/boolop/intern/BOP_BSPNode.cpp @@ -89,10 +89,10 @@ unsigned int BOP_BSPNode::addFace(const BOP_BSPPoints& pts, else { m_outChild = new BOP_BSPNode(plane); newDeep = 2; - } + } } else { // face lies in both half-spaces: split it BOP_BSPPoints inside, outside; - MT_Point3 lpoint= pts[pts.size()-1]; + MT_Point3 lpoint= pts[pts.size()-1]; BOP_TAG ltag = testPoint(lpoint); BOP_TAG tstate = ltag; diff --git a/intern/boolop/intern/BOP_Face2Face.cpp b/intern/boolop/intern/BOP_Face2Face.cpp index de9fa7b8508..f88a271bfdb 100644 --- a/intern/boolop/intern/BOP_Face2Face.cpp +++ b/intern/boolop/intern/BOP_Face2Face.cpp @@ -538,10 +538,10 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo for(i=0;igetEdge(face,BOP_Segment::getEdge(s.m_cfg1)); - BOP_triangulateD(mesh, faces, face, s.m_v1, s.m_v2, - BOP_Segment::getEdge(s.m_cfg1)); + BOP_triangulateD(mesh, faces, face, s.m_v1, s.m_v2, + BOP_Segment::getEdge(s.m_cfg1)); BOP_Face *opposite = BOP_getOppositeFace(mesh,faces,face,edge); if (opposite != NULL) { - unsigned int e; - opposite->getEdgeIndex(edge->getVertex1(), edge->getVertex2(),e); - BOP_triangulateD(mesh, faces, opposite, s.m_v1, s.m_v2, e); + unsigned int e; + opposite->getEdgeIndex(edge->getVertex1(), edge->getVertex2(),e); + BOP_triangulateD(mesh, faces, opposite, s.m_v1, s.m_v2, e); } - } + } else { // EDGE(v1) != EDGE(v2) BOP_Edge *edge1 = mesh->getEdge(face,BOP_Segment::getEdge(s.m_cfg1)); BOP_Edge *edge2 = mesh->getEdge(face,BOP_Segment::getEdge(s.m_cfg2)); diff --git a/intern/boolop/intern/BOP_Merge2.h b/intern/boolop/intern/BOP_Merge2.h index 1e26a2576be..71ec0702a0b 100644 --- a/intern/boolop/intern/BOP_Merge2.h +++ b/intern/boolop/intern/BOP_Merge2.h @@ -78,7 +78,7 @@ class BOP_Merge2 { BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N ); BOP_Face *find4Neighbor(BOP_Face *faceI, BOP_Face *faceJ, BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N, - BOP_Face **faceL, BOP_Index &O); + BOP_Face **faceL, BOP_Index &O); BOP_Face3 *collapse(BOP_Face4 *faceC, BOP_Index X); void mergeFaces(BOP_Face *A, BOP_Face *B, BOP_Index X, BOP_Index I, BOP_Index N, BOP_Index P, BOP_Faces &newFaces ); diff --git a/intern/boolop/intern/BOP_Mesh.cpp b/intern/boolop/intern/BOP_Mesh.cpp index e35b5437f68..673caa3e921 100644 --- a/intern/boolop/intern/BOP_Mesh.cpp +++ b/intern/boolop/intern/BOP_Mesh.cpp @@ -252,8 +252,8 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face) BOP_Index index2 = face->getVertex(1); BOP_Index index3 = face->getVertex(2); - m_faces.push_back((BOP_Face *)face); - + m_faces.push_back((BOP_Face *)face); + BOP_Index edge; if (!getIndexEdge(index1,index2,edge)) { @@ -261,7 +261,7 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face) getVertex(index1)->addEdge(edge); getVertex(index2)->addEdge(edge); } - + getEdge(edge)->addFace(indexface); if (!getIndexEdge(index2,index3,edge)) { @@ -269,7 +269,7 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face) getVertex(index2)->addEdge(edge); getVertex(index3)->addEdge(edge); } - + getEdge(edge)->addFace(indexface); if (!getIndexEdge(index3,index1,edge)) { @@ -277,13 +277,13 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face) getVertex(index3)->addEdge(edge); getVertex(index1)->addEdge(edge); } - + getEdge(edge)->addFace(indexface); if ((index1 == index2) || (index1 == index3) || (index2 == index3)) face->setTAG(BROKEN); - return indexface; + return indexface; } /** @@ -452,7 +452,7 @@ bool BOP_Mesh::getIndexEdge(BOP_Index v1, BOP_Index v2, BOP_Index &e) #ifdef HASH_PRINTF_DEBUG printf ("found edge (%d %d)\n",v1,v2); #endif - e = edge->index; + e = edge->index; #ifdef BOP_NEW_MERGE if( m_edges[e]->getUsed() == false ) { m_edges[e]->setUsed(true); diff --git a/intern/boolop/intern/BOP_Mesh.h b/intern/boolop/intern/BOP_Mesh.h index 381557ec58b..9c1b4ad04ea 100644 --- a/intern/boolop/intern/BOP_Mesh.h +++ b/intern/boolop/intern/BOP_Mesh.h @@ -100,7 +100,7 @@ public: BOP_Index replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex); #ifdef HASH void rehashVertex(BOP_Index oldIndex, BOP_Index newIndex, - BOP_Index otherIndex); + BOP_Index otherIndex); #endif bool isClosedMesh(); diff --git a/intern/bsp/intern/BSP_MeshPrimitives.h b/intern/bsp/intern/BSP_MeshPrimitives.h index 018677327f4..f4d04d8863e 100644 --- a/intern/bsp/intern/BSP_MeshPrimitives.h +++ b/intern/bsp/intern/BSP_MeshPrimitives.h @@ -189,7 +189,7 @@ public : BSP_FaceInd new_f ); - BSP_VertexInd + BSP_VertexInd OpVertex( BSP_VertexInd vi ) const; diff --git a/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h b/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h index ca4ab106664..793fb47f73b 100644 --- a/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h +++ b/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h @@ -84,9 +84,9 @@ public : f.m_verts[1] = verts[i-1]; f.m_verts[2] = verts[i]; - m_faces.push_back(f); + m_faces.push_back(f); - BuildNormal(m_faces.back()); + BuildNormal(m_faces.back()); } } diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h index 3cdb70bb4df..591216a77b9 100644 --- a/intern/cycles/device/device_network.h +++ b/intern/cycles/device/device_network.h @@ -109,7 +109,7 @@ typedef struct RPCReceive { : socket(socket_), archive_stream(NULL), archive(NULL) { /* read head with fixed size */ - vector header(8); + vector header(8); size_t len = boost::asio::read(socket, boost::asio::buffer(header)); /* verify if we got something */ @@ -170,7 +170,7 @@ public: : listen_socket(io_service), collect_servers(false) { /* setup listen socket */ - listen_endpoint.address(boost::asio::ip::address_v4::any()); + listen_endpoint.address(boost::asio::ip::address_v4::any()); listen_endpoint.port(DISCOVER_PORT); listen_socket.open(listen_endpoint.protocol()); @@ -178,7 +178,7 @@ public: boost::asio::socket_base::reuse_address option(true); listen_socket.set_option(option); - listen_socket.bind(listen_endpoint); + listen_socket.bind(listen_endpoint); /* setup receive callback */ async_receive(); diff --git a/intern/cycles/kernel/osl/nodes/node_texture.h b/intern/cycles/kernel/osl/nodes/node_texture.h index 8adb0e8aeb5..e0ec8038ee4 100644 --- a/intern/cycles/kernel/osl/nodes/node_texture.h +++ b/intern/cycles/kernel/osl/nodes/node_texture.h @@ -190,7 +190,7 @@ float noise_wave(string wave, float a) float result = 0.0; if(wave == "Sine") { - result = 0.5 + 0.5*sin(a); + result = 0.5 + 0.5*sin(a); } else if(wave == "Saw") { float b = 2*M_PI; diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index e5003074822..85a01e54e5c 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -66,7 +66,7 @@ public: void *renderstate, void *val); bool has_userdata(ustring name, TypeDesc type, void *renderstate); - void *get_pointcloud_attr_query(ustring *attr_names, + void *get_pointcloud_attr_query(ustring *attr_names, TypeDesc *attr_types, int nattrs); int pointcloud(ustring filename, const OSL::Vec3 ¢er, float radius, int max_points, void *attr_query, void **attr_outdata); diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h index 82797018d74..448132bff46 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -191,7 +191,7 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard) __device float noise_wave(NodeWaveType wave, float a) { if(wave == NODE_WAVE_SINE) { - return 0.5f + 0.5f*sin(a); + return 0.5f + 0.5f*sin(a); } else if(wave == NODE_WAVE_SAW) { float b = 2.0f*M_PI_F; diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 61840829900..da078f925a9 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -644,6 +644,10 @@ class WM_OT_context_modal_mouse(Operator): data_path_iter = data_path_iter data_path_item = data_path_item + header_text = StringProperty( + name="Header Text", + description="Text to display in header during scale", + ) input_scale = FloatProperty( description="Scale the mouse movement by this value before applying the delta", @@ -703,14 +707,19 @@ class WM_OT_context_modal_mouse(Operator): if event_type == 'MOUSEMOVE': delta = event.mouse_x - self.initial_x self._values_delta(delta) + if self.header_text: + for item, value_orig in self._values.items(): + context.area.header_text_set(self.header_text % eval("item.%s" % self.data_path_item)) elif 'LEFTMOUSE' == event_type: item = next(iter(self._values.keys())) self._values_clear() + context.area.header_text_set() return operator_value_undo_return(item) elif event_type in {'RIGHTMOUSE', 'ESC'}: self._values_restore() + context.area.header_text_set() return {'CANCELLED'} return {'RUNNING_MODAL'} diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 1144cbf188d..1d8e47ab850 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -88,7 +88,7 @@ class VIEW3D_HT_header(Header): row = layout.row(align=True) row.prop(toolsettings, "use_snap", text="") row.prop(toolsettings, "snap_element", text="", icon_only=True) - if snap_element != 'INCREMENT': + if snap_element not in ('INCREMENT', 'VOLUME'): row.prop(toolsettings, "snap_target", text="") if obj: if obj.mode == 'OBJECT': @@ -791,11 +791,17 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.lens" props.input_scale = 0.1 + if obj.data.lens_unit == 'MILLIMETERS': + props.header_text = "Camera Lens Angle: %.1fmm" + else: + props.header_text = "Camera Lens Angle: %.1f\u00B0" + else: props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.ortho_scale" props.input_scale = 0.01 + props.header_text = "Camera Lens Scale: %.3f" if not obj.data.dof_object: #layout.label(text="Test Has DOF obj"); @@ -803,6 +809,7 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.dof_distance" props.input_scale = 0.02 + props.header_text = "DOF Distance: %.3f" if obj.type in {'CURVE', 'FONT'}: layout.operator_context = 'INVOKE_REGION_WIN' @@ -811,11 +818,13 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.extrude" props.input_scale = 0.01 + props.header_text = "Extrude Size: %.3f" props = layout.operator("wm.context_modal_mouse", text="Width Size") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.offset" props.input_scale = 0.01 + props.header_text = "Width Size: %.3f" if obj.type == 'EMPTY': layout.operator_context = 'INVOKE_REGION_WIN' @@ -824,6 +833,7 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_iter = "selected_editable_objects" props.data_path_item = "empty_draw_size" props.input_scale = 0.01 + props.header_text = "Empty Draw Size: %.3f" if obj.type == 'LAMP': layout.operator_context = 'INVOKE_REGION_WIN' @@ -831,12 +841,14 @@ class VIEW3D_MT_object_specials(Menu): props = layout.operator("wm.context_modal_mouse", text="Energy") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.energy" + props.header_text = "Lamp Energy: %.3f" if obj.data.type in {'SPOT', 'AREA', 'POINT'}: props = layout.operator("wm.context_modal_mouse", text="Falloff Distance") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.distance" props.input_scale = 0.1 + props.header_text = "Lamp Falloff Distance: %.1f" if obj.data.type == 'SPOT': layout.separator() @@ -844,21 +856,25 @@ class VIEW3D_MT_object_specials(Menu): props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.spot_size" props.input_scale = 0.01 + props.header_text = "Spot Size: %.2f" props = layout.operator("wm.context_modal_mouse", text="Spot Blend") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.spot_blend" props.input_scale = -0.01 + props.header_text = "Spot Blend: %.2f" props = layout.operator("wm.context_modal_mouse", text="Clip Start") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.shadow_buffer_clip_start" props.input_scale = 0.05 + props.header_text = "Clip Start: %.2f" props = layout.operator("wm.context_modal_mouse", text="Clip End") props.data_path_iter = "selected_editable_objects" props.data_path_item = "data.shadow_buffer_clip_end" props.input_scale = 0.05 + props.header_text = "Clip End: %.2f" layout.separator() diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index c1d6165d37e..b61074d9a94 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2081,7 +2081,7 @@ static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces) if (!faces_from_tessfaces) DM_DupPolys(source, dm); - else + else CDDM_tessfaces_to_faces(dm); cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 0761b8f14c7..f45899ff365 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -808,8 +808,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if(linedata2[i]>1) linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1); for (i=0; i<=slen; i++) { - for (j=i; (mem[j]) && (mem[j]!='\n') && - (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (jxof+= ct->charnr*linedata[ct->linenr]; // } diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index d9fe0138784..3bcb262fac8 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -146,7 +146,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen) return; } - /* - Note: This code comes from python, here's the corrusponding comment. - */ + /* - Note: This code comes from python, here's the corresponding comment. - */ /* This over-allocates proportional to the list size, making room * for additional growth. The over-allocation is mild, but is * enough to give linear-time amortized behavior over a long @@ -220,7 +220,7 @@ void IDP_ResizeArray(IDProperty *prop, int newlen) return; } - /* - Note: This code comes from python, here's the corrusponding comment. - */ + /* - Note: This code comes from python, here's the corresponding comment. - */ /* This over-allocates proportional to the list size, making room * for additional growth. The over-allocation is mild, but is * enough to give linear-time amortized behavior over a long diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 03d4ca0a922..ca22d917b50 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -875,27 +875,6 @@ static int vergedgesort(const void *v1, const void *v2) } -/* TODO: remove after bmesh merge */ -#if 0 - -static void mfaces_strip_loose(MFace *mface, int *totface) -{ - int a,b; - - for (a=b=0; a<*totface; a++) { - if (mface[a].v3) { - if (a!=b) { - memcpy(&mface[b],&mface[a],sizeof(mface[b])); - } - b++; - } - } - - *totface= b; -} - -#endif - /* Create edges based on known verts and faces */ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *allloop, MPoly *allpoly, int UNUSED(totvert), int totface, int UNUSED(totloop), int totpoly, @@ -1706,8 +1685,9 @@ void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, for (i=0; irender_flag&MCLIP_PROXY_RENDER_UNDISTORT) { int width, height; - float aspy= 1.0f/clip->tracking.camera.pixel_aspect;; + float aspy= 1.0f/clip->tracking.camera.pixel_aspect; BKE_movieclip_get_size(clip, user, &width, &height); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 33f20642ca6..e48495bcc44 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2386,10 +2386,12 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist) pfr->density += q*q; pfr->near_density += q*q*q; } + /* * Find the Courant number for an SPH particle (used for adaptive time step). */ -static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr) { +static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr) +{ ParticleData *pa, *npa; int i; float flow[3], offset[3], dist; @@ -2533,7 +2535,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa sphdata->pass++; } -static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata) { +static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata) +{ ParticleTarget *pt; int i; @@ -2556,13 +2559,17 @@ static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata) { sphdata->force_cb = sph_force_cb; sphdata->density_cb = sph_density_accum_cb; } -static void sph_solver_finalise(SPHData *sphdata) { + +static void sph_solver_finalise(SPHData *sphdata) +{ if (sphdata->eh) { BLI_edgehash_free(sphdata->eh, NULL); sphdata->eh = NULL; } } -static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata){ + +static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata) +{ ParticleSettings *part = sim->psys->part; // float timestep = psys_get_timestep(sim); // UNUSED float pa_mass = part->mass * (part->flag & PART_SIZEMASS ? pa->size : 1.f); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 60c4c08795c..c3f6bbff2f2 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -81,29 +81,38 @@ static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm); /// -static void *arena_alloc(CCGAllocatorHDL a, int numBytes) { +static void *arena_alloc(CCGAllocatorHDL a, int numBytes) +{ return BLI_memarena_alloc(a, numBytes); } -static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) { + +static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) +{ void *p2 = BLI_memarena_alloc(a, newSize); if (ptr) { memcpy(p2, ptr, oldSize); } return p2; } -static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) { + +static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) +{ + /* do nothing */ } -static void arena_release(CCGAllocatorHDL a) { + +static void arena_release(CCGAllocatorHDL a) +{ BLI_memarena_free(a); } typedef enum { CCG_USE_AGING = 1, CCG_USE_ARENA = 2, - CCG_CALC_NORMALS = 4, + CCG_CALC_NORMALS = 4 } CCGFlags; -static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags flags) { +static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags flags) +{ CCGMeshIFC ifc; CCGSubSurf *ccgSS; int useAging = !!(flags & CCG_USE_AGING); @@ -159,7 +168,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl return ccgSS; } -static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { +static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) +{ CCGVert *v0 = ccgSubSurf_getEdgeVert0(e); CCGVert *v1 = ccgSubSurf_getEdgeVert1(e); int v0idx = *((int*) ccgSubSurf_getVertUserData(ss, v0)); @@ -174,7 +184,9 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { return edgeBase + x-1; } } -static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize) { + +static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize) +{ int faceBase = *((int*) ccgSubSurf_getFaceUserData(ss, f)); int numVerts = ccgSubSurf_getFaceNumVerts(f); @@ -211,7 +223,8 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg } } -static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mp, struct MLoop *ml, int fi, CCGVertHDL *fverts) { +static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mp, struct MLoop *ml, int fi, CCGVertHDL *fverts) +{ UvMapVert *v, *nv; int j, nverts= mp->totloop; @@ -227,7 +240,8 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mp, struct MLoop } } -static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MLoopUV *mloopuv) { +static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MLoopUV *mloopuv) +{ MPoly *mpoly = dm->getPolyArray(dm); MLoop *mloop = dm->getLoopArray(dm); MVert *mvert = dm->getVertArray(dm); @@ -587,19 +601,23 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, /***/ -static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) { +static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) +{ return ((int*) ccgSubSurf_getVertUserData(ss, v))[1]; } -static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) { +static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) +{ return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1]; } -static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) { +static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) +{ return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1]; } -static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { +static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGVertIterator *vi = ccgSubSurf_getVertIterator(ss); @@ -643,22 +661,30 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { ccgEdgeIterator_free(ei); ccgVertIterator_free(vi); } -static int ccgDM_getNumVerts(DerivedMesh *dm) { + +static int ccgDM_getNumVerts(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; return ccgSubSurf_getNumFinalVerts(ccgdm->ss); } -static int ccgDM_getNumEdges(DerivedMesh *dm) { + +static int ccgDM_getNumEdges(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; return ccgSubSurf_getNumFinalEdges(ccgdm->ss); } -static int ccgDM_getNumTessFaces(DerivedMesh *dm) { + +static int ccgDM_getNumTessFaces(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; return ccgSubSurf_getNumFinalFaces(ccgdm->ss); } -static int ccgDM_getNumLoops(DerivedMesh *dm) { + +static int ccgDM_getNumLoops(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; /* All subsurf faces are quads */ @@ -1216,7 +1242,8 @@ static void ccgDM_copyFinalPolyArray(DerivedMesh *dm, MPoly *mface) } } -static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { +static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int edgeSize = ccgSubSurf_getEdgeSize(ss); @@ -1299,7 +1326,9 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { MEM_freeN(edgeMap2); MEM_freeN(faceMap2); } -static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) { + +static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGVertIterator *vi = ccgSubSurf_getVertIterator(ccgdm->ss); @@ -1314,7 +1343,9 @@ static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData ccgVertIterator_free(vi); } -static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData) { + +static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); @@ -1334,7 +1365,8 @@ static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData ccgEdgeIterator_free(ei); } -static void ccgDM_drawVerts(DerivedMesh *dm) { +static void ccgDM_drawVerts(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int edgeSize = ccgSubSurf_getEdgeSize(ss); @@ -1394,7 +1426,8 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm) } } -static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) { +static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss); @@ -1463,7 +1496,9 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw } } } -static void ccgDM_drawLooseEdges(DerivedMesh *dm) { + +static void ccgDM_drawLooseEdges(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int totedge = ccgSubSurf_getNumEdges(ss); @@ -1499,7 +1534,8 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d) } /* Only used by non-editmesh types */ -static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) { +static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int gridSize = ccgSubSurf_getGridSize(ss); @@ -1733,12 +1769,14 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, #undef PASSATTRIB } -static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) { +static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) +{ dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } /* Only used by non-editmesh types */ -static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) { +static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; GPUVertexAttribs gattribs; @@ -1883,7 +1921,8 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void * } -static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) { +static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; int gridSize = ccgSubSurf_getGridSize(ss); @@ -2271,7 +2310,9 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, } } } -static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) { + +static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); @@ -2301,7 +2342,9 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u ccgEdgeIterator_free(ei); } -static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData) { + +static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); @@ -2332,7 +2375,9 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v ccgEdgeIterator_free(ei); } -static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData) { + +static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); @@ -2352,7 +2397,8 @@ static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *us ccgFaceIterator_free(fi); } -static void ccgDM_release(DerivedMesh *dm) { +static void ccgDM_release(DerivedMesh *dm) +{ CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; if (DM_release(dm)) { diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 7e04e0ae566..2fd1a506004 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -35,8 +35,8 @@ #include "BLI_math.h" -#ifndef BLI_MATH_BASE_INLINE_H -#define BLI_MATH_BASE_INLINE_H +#ifndef __MATH_BASE_INLINE_C__ +#define __MATH_BASE_INLINE_C__ /* A few small defines. Keep'em local! */ #define SMALL_NUMBER 1.e-8f @@ -156,5 +156,4 @@ MINLINE float signf(float f) } -#endif /* BLI_MATH_BASE_INLINE_H */ - +#endif /* __MATH_BASE_INLINE_C__ */ diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index cd1c0470ae2..f497470fa4c 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -31,8 +31,8 @@ #include "BLI_math_color.h" #include "BLI_utildefines.h" -#ifndef BLI_MATH_COLOR_INLINE_H -#define BLI_MATH_COLOR_INLINE_H +#ifndef __MATH_COLOR_INLINE_C__ +#define __MATH_COLOR_INLINE_C__ /******************************** Color Space ********************************/ @@ -193,5 +193,4 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned srgb_to_linearrgb_predivide_v4(linear, fsrgb); } -#endif /* BLI_MATH_COLOR_INLINE_H */ - +#endif /* __MATH_COLOR_INLINE_C__ */ diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 832ef5d15b6..9031d52cf4c 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -30,8 +30,8 @@ #include "BLI_math.h" -#ifndef BLI_MATH_GEOM_INLINE_H -#define BLI_MATH_GEOM_INLINE_H +#ifndef __MATH_GEOM_INLINE_C__ +#define __MATH_GEOM_INLINE_C__ /****************************** Spherical Harmonics **************************/ @@ -75,7 +75,7 @@ MINLINE float dot_shsh(float a[9], float b[9]) MINLINE float diffuse_shv3(float sh[9], const float v[3]) { /* See formula (13) in: - "An Efficient Representation for Irradiance Environment Maps" */ + * "An Efficient Representation for Irradiance Environment Maps" */ static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f; static const float c4 = 0.886227f, c5 = 0.247708f; float x, y, z, sum; @@ -97,7 +97,7 @@ MINLINE float diffuse_shv3(float sh[9], const float v[3]) MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f) { /* See formula (3) in: - "An Efficient Representation for Irradiance Environment Maps" */ + * "An Efficient Representation for Irradiance Environment Maps" */ float sh[9], x, y, z; x= v[0]; @@ -128,7 +128,7 @@ MINLINE float eval_shv3(float sh[9], const float v[3]) return dot_shsh(tmp, sh); } -MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f) +MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f) { float tmp[9]; @@ -137,5 +137,4 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f) add_sh_shsh(r, r, tmp); } -#endif /* BLI_MATH_GEOM_INLINE_H */ - +#endif /* __MATH_GEOM_INLINE_C__ */ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 9c5d8f3261f..854494763af 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -30,8 +30,8 @@ #include "BLI_math.h" -#ifndef BLI_MATH_VECTOR_INLINE_H -#define BLI_MATH_VECTOR_INLINE_H +#ifndef __MATH_VECTOR_INLINE_C__ +#define __MATH_VECTOR_INLINE_C__ /********************************** Init *************************************/ @@ -627,5 +627,4 @@ MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const flo ((l2[0]-pt[0]) * (l1[1]-pt[1])); } -#endif /* BLI_MATH_VECTOR_INLINE_H */ - +#endif /* __MATH_VECTOR_INLINE_C__ */ diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index 48f653f4759..f7dacef88d3 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -90,6 +90,7 @@ set(SRC intern/bmesh_mods.c intern/bmesh_newcore.c intern/bmesh_opdefines.c + intern/bmesh_operator_api_inline.c intern/bmesh_operators.c intern/bmesh_operators_private.h intern/bmesh_polygon.c diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index b95fe55b3b5..c973abdee6b 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -374,6 +374,7 @@ void bmesh_end_edit(BMesh *bm, int flag); #include "bmesh_iterators.h" #include "bmesh_walkers.h" #include "intern/bmesh_inline.c" +#include "intern/bmesh_operator_api_inline.c" #ifdef __cplusplus } diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h index 79c89392015..80f2856b066 100644 --- a/source/blender/bmesh/bmesh_operator_api.h +++ b/source/blender/bmesh/bmesh_operator_api.h @@ -73,6 +73,7 @@ extern "C" { * semantically similar to the iterator api in bmesh_iterators.h). */ +struct BMesh; struct GHashIterator; /* slot type arrays are terminated by the last member @@ -182,15 +183,10 @@ void BMO_op_finish(struct BMesh *bm, struct BMOperator *op); #define BMO_elem_flag_test(bm, element, oflag) ((element)->oflags[bm->stackdepth-1].f & (oflag)) #define BMO_elem_flag_enable(bm, element, oflag) ((element)->oflags[bm->stackdepth-1].f |= (oflag)) #define BMO_elem_flag_disable(bm, element, oflag) ((element)->oflags[bm->stackdepth-1].f &= ~(oflag)) +#define BMO_elem_flag_set(bm, element, oflag, val)((val) ? BMO_elem_flag_enable(bm, element, oflag) : \ + BMO_elem_flag_disable(bm, element, oflag)) #define BMO_elem_flag_toggle(bm, element, oflag) ((element)->oflags[bm->stackdepth-1].f ^= (oflag)) -/* profiling showed a significant amount of time spent in BMO_elem_flag_test */ -#if 0 -void BMO_elem_flag_enable(struct BMesh *bm, void *element, const short oflag); -void BMO_elem_flag_disable(struct BMesh *bm, void *element, const short oflag); -int BMO_elem_flag_test(struct BMesh *bm, void *element, const short oflag); -#endif - /* count the number of elements with a specific flag. * type can be a bitmask of BM_FACE, BM_EDGE, or BM_FACE. */ int BMO_mesh_flag_count(struct BMesh *bm, const short oflag, const char htype); @@ -225,7 +221,7 @@ int BMO_mesh_flag_count(struct BMesh *bm, const short oflag, const char htype); * %e - pass in a single element. * %v - pointer to a float vector of length 3. * %m[3/4] - matrix, 3/4 refers to the matrix size, 3 or 4. the - * corrusponding argument must be a pointer to + * corresponding argument must be a pointer to * a float matrix. * %s - copy a slot from another op, instead of mapping to one * argument, it maps to two, a pointer to an operator and @@ -339,44 +335,11 @@ int BMO_slot_map_count(struct BMesh *bm, struct BMOperator *op, const char *slot */ int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag); -/* inserts a key/value mapping into a mapping slot. note that it copies the - * value, it doesn't store a reference to it. */ - -#if 0 - -BM_INLINE void BMO_slot_map_insert(BMesh *bm, BMOperator *op, const char *slotname, - void *element, void *data, int len); - -/* inserts a key/float mapping pair into a mapping slot. */ -BM_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname, - void *element, float val); - -/* returns 1 if the specified pointer is in the map. */ -BM_INLINE int BMO_slot_map_contains(BMesh *bm, BMOperator *op, const char *slotname, void *element); - -/* returns a point to the value of a specific key. */ -BM_INLINE void *BMO_slot_map_data_get(BMesh *bm, BMOperator *op, const char *slotname, void *element); - -/* returns the float part of a key/float pair. */ -BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname, void *element); - -#endif - /* flags all elements in a mapping. note that the mapping must only have * bmesh elements in it.*/ void BMO_slot_map_to_flag(struct BMesh *bm, struct BMOperator *op, const char *slotname, const short oflag); -/* pointer versoins of BMO_slot_map_float_get and BMO_slot_map_float_insert. - * - * do NOT use these for non-operator-api-allocated memory! instead - * use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */ - -#if 0 -BM_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slotname, void *key, void *val); -BM_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname, void *key); -#endif - /* this part of the API is used to iterate over element buffer or * mapping slots. * @@ -453,104 +416,6 @@ typedef struct BMOElemMapping { extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES]; -BM_INLINE void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, - void *element, void *data, int len) -{ - BMOElemMapping *mapping; - BMOpSlot *slot = BMO_slot_get(op, slotname); - - /*sanity check*/ - if (slot->slottype != BMO_OP_SLOT_MAPPING) { - return; - } - - mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len); - - mapping->element = (BMHeader*) element; - mapping->len = len; - memcpy(mapping + 1, data, len); - - if (!slot->data.ghash) { - slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, - BLI_ghashutil_ptrcmp, "bmesh op"); - } - - BLI_ghash_insert(slot->data.ghash, element, mapping); -} - -BM_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname, - void *element, int val) -{ - BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(int)); -} - -BM_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname, - void *element, float val) -{ - BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(float)); -} - -BM_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slotname, - void *element, void *val) -{ - BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(void*)); -} - -BM_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element) -{ - BMOpSlot *slot = BMO_slot_get(op, slotname); - - /*sanity check*/ - if (slot->slottype != BMO_OP_SLOT_MAPPING) return 0; - if (!slot->data.ghash) return 0; - - return BLI_ghash_haskey(slot->data.ghash, element); -} - -BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, - void *element) -{ - BMOElemMapping *mapping; - BMOpSlot *slot = BMO_slot_get(op, slotname); - - /*sanity check*/ - if (slot->slottype != BMO_OP_SLOT_MAPPING) return NULL; - if (!slot->data.ghash) return NULL; - - mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element); - - if (!mapping) return NULL; - - return mapping + 1; -} - -BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname, - void *element) -{ - float *val = (float*) BMO_slot_map_data_get(bm, op, slotname, element); - if (val) return *val; - - return 0.0f; -} - -BM_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname, - void *element) -{ - int *val = (int*) BMO_slot_map_data_get(bm, op, slotname, element); - if (val) return *val; - - return 0; -} - -BM_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname, - void *element) -{ - void **val = (void**) BMO_slot_map_data_get(bm, op, slotname, element); - if (val) return *val; - - return NULL; -} - #ifdef __cplusplus } #endif diff --git a/source/blender/bmesh/bmesh_walkers.h b/source/blender/bmesh/bmesh_walkers.h index a9515dbd3e7..d926ab6d066 100644 --- a/source/blender/bmesh/bmesh_walkers.h +++ b/source/blender/bmesh/bmesh_walkers.h @@ -91,7 +91,8 @@ BMFace *f; BMW_init(&walker, bm, BMW_ISLAND, SOME_OP_FLAG); f = BMW_begin(&walker, some_start_face); -for (; f; f=BMW_step(&walker)) { +for (; f; f=BMW_step(&walker)) +{ //do something with f } BMW_end(&walker); diff --git a/source/blender/bmesh/intern/bmesh_inline.c b/source/blender/bmesh/intern/bmesh_inline.c index 4433aaa0fc6..b855c4b865a 100644 --- a/source/blender/bmesh/intern/bmesh_inline.c +++ b/source/blender/bmesh/intern/bmesh_inline.c @@ -46,6 +46,12 @@ BM_INLINE void BM_elem_flag_disable(void *element, const char hflag) ((BMHeader *)element)->hflag &= ~hflag; } +BM_INLINE void BM_elem_flag_set(void *element, const char hflag, const int val) +{ + if (val) BM_elem_flag_enable(element, hflag); + else BM_elem_flag_disable(element, hflag); +} + BM_INLINE void BM_elem_flag_toggle(void *element, const char hflag) { ((BMHeader *)element)->hflag ^= hflag; diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 8a8ccb5efb1..21ecc245707 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -115,12 +115,7 @@ void BM_mesh_select_mode_flush(BMesh *bm) ok = FALSE; } - if (ok) { - BM_elem_flag_enable(f, BM_ELEM_SELECT); - } - else { - BM_elem_flag_disable(f, BM_ELEM_SELECT); - } + BM_elem_flag_set(f, BM_ELEM_SELECT, ok); } } else if (bm->selectmode & SCE_SELECT_EDGE) { @@ -139,12 +134,7 @@ void BM_mesh_select_mode_flush(BMesh *bm) ok = FALSE; } - if (ok) { - BM_elem_flag_enable(f, BM_ELEM_SELECT); - } - else { - BM_elem_flag_disable(f, BM_ELEM_SELECT); - } + BM_elem_flag_set(f, BM_ELEM_SELECT, ok); } } @@ -802,9 +792,6 @@ void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag) /***************** Mesh Hiding stuff *********** */ -#define BM_ELEM_HIDE_SET(ele, hide) \ - (hide) ? BM_elem_flag_enable(ele, BM_ELEM_HIDDEN) : BM_elem_flag_disable(ele, BM_ELEM_HIDDEN); - static void vert_flush_hide_set(BMesh *bm, BMVert *v) { BMIter iter; @@ -815,7 +802,7 @@ static void vert_flush_hide_set(BMesh *bm, BMVert *v) hide = hide && BM_elem_flag_test(e, BM_ELEM_HIDDEN); } - BM_ELEM_HIDE_SET(v, hide); + BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide); } static void edge_flush_hide(BMesh *bm, BMEdge *e) @@ -828,7 +815,7 @@ static void edge_flush_hide(BMesh *bm, BMEdge *e) hide = hide && BM_elem_flag_test(f, BM_ELEM_HIDDEN); } - BM_ELEM_HIDE_SET(e, hide); + BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); } void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide) @@ -838,13 +825,13 @@ void BM_vert_hide_set(BMesh *bm, BMVert *v, int hide) BMEdge *e; BMFace *f; - BM_ELEM_HIDE_SET(v, hide); + BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide); BM_ITER(e, &iter, bm, BM_EDGES_OF_VERT, v) { - BM_ELEM_HIDE_SET(e, hide); + BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); BM_ITER(f, &fiter, bm, BM_FACES_OF_EDGE, e) { - BM_ELEM_HIDE_SET(f, hide); + BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); } } } @@ -857,10 +844,10 @@ void BM_edge_hide_set(BMesh *bm, BMEdge *e, int hide) /* edge hiding: faces around the edge */ BM_ITER(f, &iter, bm, BM_FACES_OF_EDGE, e) { - BM_ELEM_HIDE_SET(f, hide); + BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); } - BM_ELEM_HIDE_SET(e, hide); + BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide); /* hide vertices if necassary */ vert_flush_hide_set(bm, e->v1); @@ -872,7 +859,7 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide) BMIter iter; BMLoop *l; - BM_ELEM_HIDE_SET(f, hide); + BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide); BM_ITER(l, &iter, bm, BM_LOOPS_OF_FACE, f) { edge_flush_hide(bm, l->e); @@ -883,9 +870,6 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide) } } -#undef BM_ELEM_HIDE_SET - - void BM_elem_hide_set(BMesh *bm, void *element, int hide) { BMHeader *h = element; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 9621e593f3a..b5132312d3c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -355,9 +355,7 @@ static void bmesh_rationalize_normals(BMesh *bm, int undo) bmesh_righthandfaces_exec(bm, &bmop); BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { - if (BMO_elem_flag_test(bm, f, FACE_FLIP)) - BM_elem_flag_enable(f, BM_ELEM_TAG); - else BM_elem_flag_disable(f, BM_ELEM_TAG); + BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP)); } BMO_pop(bm); diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 72910d7f993..19aa37ca22b 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -498,7 +498,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, con BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv) { - /* nice example implimentation but we want loops to have their customdata + /* nice example implementation but we want loops to have their customdata * accounted for */ #if 0 BMEdge *ne = NULL; diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.c b/source/blender/bmesh/intern/bmesh_operator_api_inline.c new file mode 100644 index 00000000000..8e32f2710e2 --- /dev/null +++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.c @@ -0,0 +1,141 @@ +/* + * ***** 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. + * + * Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/intern/bmesh_operator_api_inline.c + * \ingroup bmesh + * + * BMesh inline operator functions. + */ + +#ifndef __BMESH_OPERATOR_API_INLINE_C__ +#define __BMESH_OPERATOR_API_INLINE_C__ + +#include "bmesh.h" + +/* inserts a key/value mapping into a mapping slot. note that it copies the + * value, it doesn't store a reference to it. */ + +BM_INLINE void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, + void *element, void *data, int len) +{ + BMOElemMapping *mapping; + BMOpSlot *slot = BMO_slot_get(op, slotname); + + /*sanity check*/ + if (slot->slottype != BMO_OP_SLOT_MAPPING) { + return; + } + + mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len); + + mapping->element = (BMHeader*) element; + mapping->len = len; + memcpy(mapping + 1, data, len); + + if (!slot->data.ghash) { + slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, + BLI_ghashutil_ptrcmp, "bmesh op"); + } + + BLI_ghash_insert(slot->data.ghash, element, mapping); +} + +BM_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname, + void *element, int val) +{ + BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(int)); +} + +BM_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname, + void *element, float val) +{ + BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(float)); +} + + +/* pointer versoins of BMO_slot_map_float_get and BMO_slot_map_float_insert. + * + * do NOT use these for non-operator-api-allocated memory! instead + * use BMO_slot_map_data_get and BMO_slot_map_insert, which copies the data. */ + +BM_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *slotname, + void *element, void *val) +{ + BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(void*)); +} + +BM_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element) +{ + BMOpSlot *slot = BMO_slot_get(op, slotname); + + /*sanity check*/ + if (slot->slottype != BMO_OP_SLOT_MAPPING) return 0; + if (!slot->data.ghash) return 0; + + return BLI_ghash_haskey(slot->data.ghash, element); +} + +BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, + void *element) +{ + BMOElemMapping *mapping; + BMOpSlot *slot = BMO_slot_get(op, slotname); + + /*sanity check*/ + if (slot->slottype != BMO_OP_SLOT_MAPPING) return NULL; + if (!slot->data.ghash) return NULL; + + mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element); + + if (!mapping) return NULL; + + return mapping + 1; +} + +BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname, + void *element) +{ + float *val = (float*) BMO_slot_map_data_get(bm, op, slotname, element); + if (val) return *val; + + return 0.0f; +} + +BM_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname, + void *element) +{ + int *val = (int*) BMO_slot_map_data_get(bm, op, slotname, element); + if (val) return *val; + + return 0; +} + +BM_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname, + void *element) +{ + void **val = (void**) BMO_slot_map_data_get(bm, op, slotname, element); + if (val) return *val; + + return NULL; +} + +#endif /* __BMESH_OPERATOR_API_INLINE_C__ */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 79d229aec1b..19b13a00f6d 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -861,13 +861,13 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL); - copy_v3_v3(f->no, l_iter->f->no); - if (!f) { + if (UNLIKELY(!f)) { fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__); break; } + copy_v3_v3(f->no, l_iter->f->no); BMO_elem_flag_enable(bm, newl->e, newedge_oflag); BMO_elem_flag_enable(bm, f, newface_oflag); diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 06f90d04bd3..a8c4cd71845 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -101,7 +101,26 @@ BMLoop *BM_face_other_loop(BMEdge *e, BMFace *f, BMVert *v) int BM_vert_in_face(BMFace *f, BMVert *v) { - return bmesh_radial_find_first_faceloop(BM_FACE_FIRST_LOOP(f), v) != NULL; + BMLoop *l_iter, *l_first; + +#ifdef USE_BMESH_HOLES + BMLoopList *lst; + for (lst = f->loops.first; lst; lst = lst->next) +#endif + { +#ifdef USE_BMESH_HOLES + l_iter = l_first = lst->first; +#else + l_iter = l_first = f->l_first; +#endif + do { + if (l_iter->v == v) { + return TRUE; + } + } while ((l_iter = l_iter->next) != l_first); + } + + return FALSE; } /* @@ -121,7 +140,9 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len) int i, count = 0; - for (i = 0; i < len; i++) BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP); + for (i = 0; i < len; i++) { + BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP); + } #ifdef USE_BMESH_HOLES for (lst = f->loops.first; lst; lst = lst->next) @@ -551,7 +572,7 @@ float BM_edge_face_angle(BMesh *UNUSED(bm), BMEdge *e) return angle_normalized_v3v3(l1->f->no, l2->f->no); } else { - return (float)M_PI / 2.0f; /* acos(0.0) */ + return DEG2RADF(90.0f); } } @@ -581,7 +602,7 @@ float BM_vert_edge_angle(BMesh *UNUSED(bm), BMVert *v) return M_PI - angle_v3v3v3(v1->co, v->co, v2->co); } else { - return (float)M_PI / 2.0f; /* acos(0.0) */ + return DEG2RADF(90.0f); } } diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index dcb7ce6c06a..35c3146fcb9 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -51,7 +51,8 @@ int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e) return FALSE; } -BMVert *bmesh_edge_getothervert(BMEdge *e, BMVert *v) { +BMVert *bmesh_edge_getothervert(BMEdge *e, BMVert *v) +{ if (e->v1 == v) { return e->v2; } diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 2beed279f4b..ad15b703041 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -167,16 +167,20 @@ static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BM BMIter liter; BMLoop *l; - BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v1) { - if (l->prev->v == v2) { - *l1 = l; - *l2 = l->prev; - return; - } - else if (l->next->v == v2) { - *l1 = l; - *l2 = l->next; - return; + if ((v1->e && v1->e->l) && + (v2->e && v2->e->l)) + { + BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v1) { + if (l->prev->v == v2) { + *l1 = l; + *l2 = l->prev; + return; + } + else if (l->next->v == v2) { + *l1 = l; + *l2 = l->next; + return; + } } } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 6ba0c91fb4d..610790393f1 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1407,6 +1407,8 @@ void bmesh_contextual_create_exec(BMesh *bm, BMOperator *op) printf("cannot find nice quad from concave set of vertices\n"); } - if (f) BMO_elem_flag_enable(bm, f, ELE_OUT); + if (f) { + BMO_elem_flag_enable(bm, f, ELE_OUT); + } } } diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 2ee70bb4644..ddef478a4aa 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -88,12 +88,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) BMVert *v; BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { - if (BM_vert_edge_count(v) == 2) { - BMO_elem_flag_disable(bm, v, VERT_MARK); - } - else { - BMO_elem_flag_enable(bm, v, VERT_MARK); - } + BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2)); } } @@ -251,12 +246,7 @@ void dissolveedges_exec(BMesh *bm, BMOperator *op) if (use_verts) { BM_ITER(v, &viter, bm, BM_VERTS_OF_MESH, NULL) { - if (BM_vert_edge_count(v) == 2) { - BMO_elem_flag_disable(bm, v, VERT_MARK); - } - else { - BMO_elem_flag_enable(bm, v, VERT_MARK); - } + BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2)); } } diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index d7626673e43..09b0e2042f4 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -407,7 +407,9 @@ void splitop_exec(BMesh *bm, BMOperator *op) break; } } - if (!found) BMO_elem_flag_enable(bm, e, SPLIT_INPUT); + if (!found) { + BMO_elem_flag_enable(bm, e, SPLIT_INPUT); + } } for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) { @@ -419,8 +421,9 @@ void splitop_exec(BMesh *bm, BMOperator *op) break; } } - if (!found) BMO_elem_flag_enable(bm, v, SPLIT_INPUT); - + if (!found) { + BMO_elem_flag_enable(bm, v, SPLIT_INPUT); + } } } diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 2c6a0e0de6a..b194428deba 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -215,7 +215,9 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) } } - if (!found && (rlen > 1)) BMO_elem_flag_enable(bm, e, EXT_DEL); + if (!found && (rlen > 1)) { + BMO_elem_flag_enable(bm, e, EXT_DEL); + } } } @@ -243,8 +245,9 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op) } BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { - if (BMO_elem_flag_test(bm, f, EXT_INPUT)) + if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { BMO_elem_flag_enable(bm, f, EXT_DEL); + } } if (delorig) { diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 3f102661d30..5ece4b60c4e 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -125,7 +125,7 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols) l1 = e->l; l3 = e->l->radial_next; - /* match up loops on each side of an edge corrusponding to each ver */ + /* match up loops on each side of an edge corresponding to each ver */ if (l1->v == l3->v) { l2 = l1->next; l4 = l2->next; diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index ce46ae7493d..2f47104476b 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -687,7 +687,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) float (*ofs)[3] = NULL; /* go through and find any shapekey customdata layers - * that might not have corrusponding KeyBlocks, and add them if + * that might not have corresponding KeyBlocks, and add them if * necassary */ j = 0; for (i = 0; i < bm->vdata.totlayer; i++) { diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index e674a3f2856..9cf17490d58 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -248,7 +248,7 @@ void bmesh_create_grid_exec(BMesh *bm, BMOperator *op) eve = BM_vert_create(bm, vec, NULL); BMO_elem_flag_enable(bm, eve, VERT_MARK); - if (a) { + if (a != 0) { e = BM_edge_create(bm, preveve, eve, NULL, TRUE); BMO_elem_flag_enable(bm, e, EDGE_ORIG); } diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index 2eb1cf7db3e..bd528faa43e 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -124,10 +124,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) if (!v) v = e->v1; if (!v2) v2 = e->v2; - if (v == v2) + if (v == v2) { BMO_elem_flag_enable(bm, e, EDGE_COL); - else if (!BM_edge_exists(v, v2)) + } + else if (!BM_edge_exists(v, v2)) { BM_edge_create(bm, v, v2, e, TRUE); + } BMO_elem_flag_enable(bm, e, ELE_DEL); } diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index a14af618411..b4ec3d740d4 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -89,8 +89,9 @@ void bmesh_beautify_fill_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", EDGE_MARK, BM_EDGE); BMO_ITER(f, &siter, bm, op, "faces", BM_FACE) { - if (f->len == 3) + if (f->len == 3) { BMO_elem_flag_enable(bm, f, FACE_MARK); + } } while (!stop) { diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 68123ee7412..f57e91b05c0 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -170,8 +170,9 @@ static void bmesh_regionextend_extend(BMesh *bm, BMOperator *op, int usefaces) BMO_ITER(f, &siter, bm, op, "geom", BM_FACE) { BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { BM_ITER(f2, &fiter, bm, BM_FACES_OF_EDGE, l->e) { - if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) + if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) { BMO_elem_flag_enable(bm, f2, SEL_FLAG); + } } } } @@ -595,21 +596,21 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op) for (i = 0; i < num_total; i++) { fm = f_ext[i].f; if (!BMO_elem_flag_test(bm, fm, FACE_MARK) && !BM_elem_flag_test(fm, BM_ELEM_HIDDEN)) { - int cont = 1; - for (idx = 0; idx < num_sels && cont == 1; idx++) { + int cont = TRUE; + for (idx = 0; idx < num_sels && cont == TRUE; idx++) { fs = f_ext[indices[idx]].f; switch (type) { case SIMFACE_MATERIAL: if (fm->mat_nr == fs->mat_nr) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } break; case SIMFACE_IMAGE: if (f_ext[i].t == f_ext[indices[idx]].t) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } break; @@ -617,7 +618,7 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op) angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* if the angle between the normals -> 0 */ if (angle / 180.0f <= thresh) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } break; @@ -626,7 +627,7 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op) if (angle / 180.0f <= thresh) { /* and dot product difference -> 0 */ if (fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } } break; @@ -634,14 +635,14 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op) case SIMFACE_AREA: if (fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } break; case SIMFACE_PERIMETER: if (fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh) { BMO_elem_flag_enable(bm, fm, FACE_MARK); - cont = 0; + cont = FALSE; } break; @@ -776,14 +777,14 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) for (i = 0; i < num_total; i++) { e = e_ext[i].e; if (!BMO_elem_flag_test(bm, e, EDGE_MARK) && !BM_elem_flag_test(e, BM_ELEM_HIDDEN)) { - int cont = 1; - for (idx = 0; idx < num_sels && cont == 1; idx++) { + int cont = TRUE; + for (idx = 0; idx < num_sels && cont == TRUE; idx++) { es = e_ext[indices[idx]].e; switch (type) { case SIMEDGE_LENGTH: if (fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } break; @@ -796,14 +797,14 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) if (angle / 90.0f <= thresh) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } break; case SIMEDGE_FACE: if (e_ext[i].faces == e_ext[indices[idx]].faces) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } break; @@ -812,12 +813,12 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) if (e_ext[indices[idx]].faces == 2) { if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } } } else { - cont = 0; + cont = FALSE; } break; @@ -830,7 +831,7 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) if (c1 && c2 && fabsf(*c1 - *c2) <= thresh) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } } break; @@ -838,14 +839,14 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op) case SIMEDGE_SEAM: if (BM_elem_flag_test(e, BM_ELEM_SEAM) == BM_elem_flag_test(es, BM_ELEM_SEAM)) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } break; case SIMEDGE_SHARP: if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == BM_elem_flag_test(es, BM_ELEM_SMOOTH)) { BMO_elem_flag_enable(bm, e, EDGE_MARK); - cont = 0; + cont = FALSE; } break; @@ -939,22 +940,22 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op) for (i = 0; i < num_total; i++) { v = v_ext[i].v; if (!BMO_elem_flag_test(bm, v, VERT_MARK) && !BM_elem_flag_test(v, BM_ELEM_HIDDEN)) { - int cont = 1; - for (idx = 0; idx < num_sels && cont == 1; idx++) { + int cont = TRUE; + for (idx = 0; idx < num_sels && cont == TRUE; idx++) { vs = v_ext[indices[idx]].v; switch (type) { case SIMVERT_NORMAL: /* compare the angle between the normals */ if (RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh) { BMO_elem_flag_enable(bm, v, VERT_MARK); - cont = 0; + cont = FALSE; } break; case SIMVERT_FACE: /* number of adjacent faces */ if (v_ext[i].num_faces == v_ext[indices[idx]].num_faces) { BMO_elem_flag_enable(bm, v, VERT_MARK); - cont = 0; + cont = FALSE; } break; @@ -965,7 +966,7 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op) for (v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++) { if (v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr) { BMO_elem_flag_enable(bm, v, VERT_MARK); - cont = 0; + cont = FALSE; break; } } diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 23e4ad7e289..134b7f9eb0c 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -731,7 +731,10 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, { BME_TransData *vtd; - if (BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) return; + if (BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) { + return; + } + BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL); if ((vtd = BME_get_transdata(td, v))) { if (options & BME_BEVEL_EMIN) { @@ -767,18 +770,23 @@ static void bevel_init_verts(BMesh *bm, int options, BME_TransData_Head *td) BMIter iter; float weight; BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) { - weight = 0.0; + weight = 0.0f; if (!BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) { /* modifiers should not use selection */ if (options & BME_BEVEL_SELECT) { - if(BM_elem_flag_test(v, BM_ELEM_SELECT)) weight = 1.0; + if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { + weight = 1.0f; + } } /* bevel weight NYI */ - else if(options & BME_BEVEL_WEIGHT) + else if (options & BME_BEVEL_WEIGHT) { weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT); - else - weight = 1.0; - if(weight > 0.0) { + } + else { + weight = 1.0f; + } + + if (weight > 0.0f) { BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL); BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, weight, -1, NULL); } @@ -804,6 +812,7 @@ static void bevel_init_edges(BMesh *bm, int options, BME_TransData_Head *td) else { weight = 1.0; } + if(weight > 0.0) { BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_BEVEL); @@ -836,15 +845,18 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); if(v->e) { BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); - if (!BM_vert_is_manifold(bm, v)) + if (!BM_vert_is_manifold(bm, v)) { BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); + } + /* test wire ver */ len = BM_vert_edge_count(v); if (len == 2 && BM_vert_is_wire(bm, v)) BMO_elem_flag_disable(bm, v, BME_BEVEL_NONMAN); } - else + else { BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); + } } BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { @@ -854,13 +866,22 @@ static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_ind BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN); BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); } - if(BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); + if(BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) { + BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); + } } - BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) + BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG); - if(options & BME_BEVEL_VERT) bevel_init_verts(bm, options, td); - else bevel_init_edges(bm, options, td); + } + + if(options & BME_BEVEL_VERT) { + bevel_init_verts(bm, options, td); + } + else { + bevel_init_edges(bm, options, td); + } + return bm; } diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index fbfd916ba14..2af1df90f51 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -460,12 +460,14 @@ void GeometryExporter::create_normals(std::vector &nor, std::vectorar); - draw_triangulated(mcords, tot); + draw_triangulated(mcords, tot); glBegin(GL_LINE_LOOP); /* for zero sized masks, lines */ for (a = 0; a < tot; a++) { @@ -1164,31 +1164,28 @@ static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val BM_elem_select_set(em->bm, e, val); break; case EDGE_MODE_TAG_SEAM: - if (val) {BM_elem_flag_enable(e, BM_ELEM_SEAM);} - else {BM_elem_flag_disable(e, BM_ELEM_SEAM);} + BM_elem_flag_set(e, BM_ELEM_SEAM, val); break; case EDGE_MODE_TAG_SHARP: - if (val) {BM_elem_flag_enable(e, BM_ELEM_SEAM);} - else {BM_elem_flag_disable(e, BM_ELEM_SEAM);} + BM_elem_flag_set(e, BM_ELEM_SMOOTH, !val); break; case EDGE_MODE_TAG_FREESTYLE: - if (val) {BM_elem_flag_enable(e, BM_ELEM_FREESTYLE);} - else {BM_elem_flag_disable(e, BM_ELEM_FREESTYLE);} + BM_elem_flag_set(e, BM_ELEM_FREESTYLE, val); break; case EDGE_MODE_TAG_CREASE: { float *crease = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_CREASE); - if (val) {*crease = 1.0f;} - else {*crease = 0.0f;} + if (val) *crease = 1.0f; + else *crease = 0.0f; break; } case EDGE_MODE_TAG_BEVEL: { float *bweight = CustomData_bmesh_get(&em->bm->edata, e->head.data, CD_BWEIGHT); - if (val) {*bweight = 1.0f;} - else {*bweight = 0.0f;} + if (val) *bweight = 1.0f; + else *bweight = 0.0f; break; } } @@ -1797,9 +1794,10 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event return OPERATOR_CANCELLED; if (limit) { + /* hflag no-seam --> bmo-tag */ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (!BM_elem_flag_test(e, BM_ELEM_SEAM)) BMO_elem_flag_enable(bm, e, BM_ELEM_SELECT); - else BMO_elem_flag_disable(bm, e, BM_ELEM_SELECT); /* is this needed ? */ + /* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */ + BMO_elem_flag_set(bm, e, BM_ELEM_SELECT, !BM_elem_flag_test(e, BM_ELEM_SEAM)); } } @@ -1879,18 +1877,14 @@ static int select_linked_exec(bContext *C, wmOperator *op) BMFace *efa; BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { - if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { - BM_elem_flag_enable(efa, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(efa, BM_ELEM_TAG); - } + BM_elem_flag_set(efa, BM_ELEM_TAG, (BM_elem_flag_test(efa, BM_ELEM_SELECT) && + !BM_elem_flag_test(efa, BM_ELEM_HIDDEN))); } if (limit) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (!BM_elem_flag_test(e, BM_ELEM_SEAM)) BMO_elem_flag_enable(bm, e, BM_ELEM_SELECT); - else BMO_elem_flag_disable(bm, e, BM_ELEM_SELECT); /* is this needed ? */ + /* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */ + BMO_elem_flag_set(bm, e, BM_ELEM_SELECT, !BM_elem_flag_test(e, BM_ELEM_SEAM)); } } @@ -2055,6 +2049,7 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h BMO_push(bm, NULL); BM_ITER(h, &iter, bm, itertype, NULL) { if (BM_elem_flag_test(h, BM_ELEM_SELECT)) { + /* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */ BMO_elem_flag_enable(bm, (BMElemF *)h, BM_ELEM_SELECT); } } @@ -2731,7 +2726,7 @@ static int loop_to_region(bContext *C, wmOperator *op) int a, b; /* find the set of regions with smallest number of total faces */ - a = loop_find_regions(em, selbigger); + a = loop_find_regions(em, selbigger); b = loop_find_regions(em, !selbigger); if ((a <= b) ^ selbigger) { diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 2941505fd8e..2fa87d6f492 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -1500,15 +1500,11 @@ void EDBM_reveal_mesh(BMEditMesh *em) BMHeader *ele; int i; - /* Use index field to remember what was hidden before all is revealed. */ + /* Use tag flag to remember what was hidden before all is revealed. + * BM_ELEM_HIDDEN --> BM_ELEM_TAG */ for (i = 0; i < 3; i++) { BM_ITER(ele, &iter, em->bm, iter_types[i], NULL) { - if (BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) { - BM_elem_flag_enable(ele, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(ele, BM_ELEM_TAG); - } + BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN)); } } @@ -1759,10 +1755,7 @@ static void mesh_set_smooth_faces(BMEditMesh *em, short smooth) BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - if (smooth) - BM_elem_flag_enable(efa, BM_ELEM_SMOOTH); - else - BM_elem_flag_disable(efa, BM_ELEM_SMOOTH); + BM_elem_flag_set(efa, BM_ELEM_SMOOTH, smooth); } } } @@ -2365,13 +2358,9 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat); + /* BM_ELEM_SELECT --> BM_ELEM_TAG */ BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { - BM_elem_flag_enable(e, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(e, BM_ELEM_TAG); - } + BM_elem_flag_set(e, BM_ELEM_TAG, BM_elem_flag_test(e, BM_ELEM_SELECT)); } /* handle case of one vert selected. identify @@ -2507,12 +2496,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) BMO_slot_buffer_hflag_enable(bm, &bmop, side?"edgeout2":"edgeout1", BM_ELEM_SELECT, BM_EDGE, TRUE); BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { - BM_elem_flag_enable(e, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(e, BM_ELEM_TAG); - } + BM_elem_flag_set(e, BM_ELEM_TAG, BM_elem_flag_test(e, BM_ELEM_SELECT)); } /* constrict edge selection again */ @@ -3102,7 +3086,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op) if (bm->totvertsel < 2) { //error("No edges are selected to operate on"); - return OPERATOR_CANCELLED;; + return OPERATOR_CANCELLED; } /* get the cut curve */ diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 65a34e2d1b3..58b5154cdff 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -113,7 +113,7 @@ void paintface_flush_flags(Object *ob) if ((index_array = CustomData_get_layer(&dm->faceData, CD_POLYINDEX))) { polys = dm->getPolyArray(dm); - faces = dm->getTessFaceArray(dm);; + faces = dm->getTessFaceArray(dm); totface = dm->getNumTessFaces(dm); /* loop over tessfaces */ diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c index 1b8e90ffce7..e08db8b6e46 100755 --- a/source/blender/editors/mesh/knifetool.c +++ b/source/blender/editors/mesh/knifetool.c @@ -180,7 +180,8 @@ static void knife_project_v3(knifetool_opdata *kcd, const float co[3], float sco ED_view3d_project_float(kcd->ar, co, sco, kcd->projmat); } -static ListBase *knife_empty_list(knifetool_opdata *kcd) { +static ListBase *knife_empty_list(knifetool_opdata *kcd) +{ ListBase *lst; lst = BLI_memarena_alloc(kcd->arena, sizeof(ListBase)); @@ -188,7 +189,8 @@ static ListBase *knife_empty_list(knifetool_opdata *kcd) { return lst; } -static void knife_append_list(knifetool_opdata *kcd, ListBase *lst, void *elem) { +static void knife_append_list(knifetool_opdata *kcd, ListBase *lst, void *elem) +{ Ref *ref; ref = BLI_mempool_calloc(kcd->refs); @@ -580,29 +582,29 @@ static void knife_cut_through(knifetool_opdata *kcd) if (firstv) { /* For each face incident to firstv, * find the first following linehit (if any) sharing that face and connect */ - for (r = firstfaces.first; r; r = r->next ) { - f = r->ref; - found = 0; - for (j = 0, lh2 = kcd->linehits; j < kcd->totlinehit; j++, lh2++) { - kfe2 = lh2->kfe; - for (r2 = kfe2->faces.first; r2; r2 = r2->next) { - if (r2->ref == f) { - v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]); - knife_add_single_cut_through(kcd, firstv, v2, f); - found = 1; - break; - } - } - } - if (!found && lastv) { + for (r = firstfaces.first; r; r = r->next ) { + f = r->ref; + found = 0; + for (j = 0, lh2 = kcd->linehits; j < kcd->totlinehit; j++, lh2++) { + kfe2 = lh2->kfe; + for (r2 = kfe2->faces.first; r2; r2 = r2->next) { + if (r2->ref == f) { + v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]); + knife_add_single_cut_through(kcd, firstv, v2, f); + found = 1; + break; + } + } + } + if (!found && lastv) { for (r2 = lastfaces.first; r2; r2 = r2->next) { if (r2->ref == f) { knife_add_single_cut_through(kcd, firstv, lastv, f); break; } } - } - } + } + } } for (i = 0, lh = kcd->linehits; i < kcd->totlinehit; i++, lh++) { diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index c35bf8988b7..2be66ca5310 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -371,10 +371,10 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me) CustomDataLayer *cdlp, *cdlu; int index; - index= CustomData_get_active_layer_index(pdata, CD_MTEXPOLY); + index= CustomData_get_active_layer_index(pdata, CD_MTEXPOLY); cdlp= (index == -1)? NULL: &pdata->layers[index]; - index= CustomData_get_active_layer_index(ldata, CD_MLOOPUV); + index= CustomData_get_active_layer_index(ldata, CD_MLOOPUV); cdlu= (index == -1)? NULL: &ldata->layers[index]; if (!cdlp || !cdlu) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index d01b9805800..af9b30997d4 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -149,15 +149,6 @@ void MESH_OT_select_next_loop(struct wmOperatorType *ot); extern struct EnumPropertyItem *corner_type_items; -#if 0 /* REMOVE AFTER BMESH MERGE */ - -void join_triangles(EditMesh *em); -int removedoublesflag(EditMesh *em, short flag, short automerge, float limit); /* return amount */ -void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beautify, int numcuts, int corner_pattern, int seltype); -int EdgeSlide(EditMesh *em, struct wmOperator *op, short immediate, float imperc); - -#endif - void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_subdivide(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 6825edb0822..1626a074c42 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1748,7 +1748,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op)) ob_iter->gameflag = ob->gameflag; ob_iter->gameflag2 = ob->gameflag2; ob_iter->inertia = ob->inertia; - ob_iter->formfactor = ob->formfactor;; + ob_iter->formfactor = ob->formfactor; ob_iter->damping = ob->damping; ob_iter->rdamping = ob->rdamping; ob_iter->min_vel = ob->min_vel; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index f902c88d5f0..9bdb151d55d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -156,7 +156,9 @@ typedef struct Temp_UvData{ -void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float mouse_coord[2], float alpha, float radius, float aspectRatio) { +void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float mouse_coord[2], + float alpha, float radius, float aspectRatio) +{ Temp_UVData *tmp_uvdata; float diff[2]; int i; @@ -433,7 +435,8 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op) op->customdata = NULL; } -static int get_uv_element_offset_from_face(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, int doIslands) { +static int get_uv_element_offset_from_face(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, int doIslands) +{ UvElement *element = ED_get_uv_element(map, efa, l); if (!element || (doIslands && element->island != island_index)) { return -1; @@ -442,14 +445,16 @@ static int get_uv_element_offset_from_face(UvElementMap *map, BMFace *efa, BMLoo } -static unsigned int uv_edge_hash(const void *key) { +static unsigned int uv_edge_hash(const void *key) +{ UvEdge *edge = (UvEdge *)key; return BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) + BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1)); } -static int uv_edge_compare(const void *a, const void *b) { +static int uv_edge_compare(const void *a, const void *b) +{ UvEdge *edge1 = (UvEdge *)a; UvEdge *edge2 = (UvEdge *)b; diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 6a9c2755330..fc48516b378 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1143,8 +1143,8 @@ static int select_groped_exec(bContext *C, wmOperator *op) if(ok) { track->flag|= SELECT; - if(sc->flag&SC_SHOW_MARKER_PATTERN) track->pat_flag|= SELECT;; - if(sc->flag&SC_SHOW_MARKER_SEARCH) track->search_flag|= SELECT;; + if(sc->flag&SC_SHOW_MARKER_PATTERN) track->pat_flag|= SELECT; + if(sc->flag&SC_SHOW_MARKER_SEARCH) track->search_flag|= SELECT; } track= track->next; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 513df524872..e368d8c10b7 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -698,7 +698,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl) /* LOCATION */ ddm->getVertCo(ddm, mp_vi[0], v1); ddm->getVertCo(ddm, mp_vi[1], v2); - ddm->getVertCo(ddm, mp_vi[2], v3);; + ddm->getVertCo(ddm, mp_vi[2], v3); if (mp->totloop >= 4) { ddm->getVertCo(ddm, mp_vi[3], v4); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 90c62df724a..8ca0852e7aa 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3033,6 +3033,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, glFrontFace(GL_CCW); glDisable(GL_LIGHTING); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); } // Setup for drawing wire over, disable zbuffer @@ -3391,6 +3392,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glFrontFace(GL_CCW); glDisable(GL_LIGHTING); + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + if (base->flag & SELECT) { UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT); } @@ -3830,7 +3833,6 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); if (!glsl) { - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); glEnable(GL_LIGHTING); dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material); glDisable(GL_LIGHTING); @@ -3892,7 +3894,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -3930,7 +3931,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -3955,7 +3955,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); drawDispListsolid(lb, ob, 0); GPU_end_object_materials(); } @@ -4157,8 +4156,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv { Object *ob=base->object; ParticleEditSettings *pset = PE_settings(scene); - ParticleSettings *part; - ParticleData *pars, *pa; + ParticleSettings *part = psys->part; + ParticleData *pars = psys->particles; + ParticleData *pa; ParticleKey state, *states=NULL; ParticleBillboardData bb; ParticleSimulationData sim= {NULL}; @@ -4176,12 +4176,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv unsigned char tcol[4]= {0, 0, 0, 255}; /* 1. */ - if (psys==NULL) - return; - - part=psys->part; - pars=psys->particles; - if (part==NULL || !psys_check_enabled(ob, psys)) return; @@ -7360,7 +7354,6 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r glDisable(GL_COLOR_MATERIAL); } - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW); glEnable(GL_LIGHTING); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 2993dbeee22..c8c62d63e36 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -580,7 +580,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->pan_view= FALSE; break; - /* impliment WASD keys */ + /* implement WASD keys */ case FLY_MODAL_DIR_FORWARD: if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */ else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 0226ccc4938..d2b37c0f3b7 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -121,8 +121,8 @@ typedef struct TransCon { typedef struct TransDataExtension { float drot[3]; /* Initial object drot */ - // float drotAngle; /* Initial object drotAngle, TODO: not yet implimented */ - // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implimented */ + // float drotAngle; /* Initial object drotAngle, TODO: not yet implemented */ + // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implemented */ float dquat[4]; /* Initial object dquat */ float dscale[3]; /* Initial object dscale */ float *rot; /* Rotation of the data to transform (Faculative) */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 7737978c4ea..67adac9bea2 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2053,12 +2053,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) // transform now requires awareness for select mode, so we tag the f1 flags in verts if(selectmode & SCE_SELECT_VERTEX) { BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) { - if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - BM_elem_flag_enable(eve, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(eve, BM_ELEM_TAG); - } + BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT)); } } else if(selectmode & SCE_SELECT_EDGE) { @@ -4406,8 +4401,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) td->ext->irotAngle= ob->rotAngle; copy_v3_v3(td->ext->irotAxis, ob->rotAxis); - // td->ext->drotAngle= ob->drotAngle; // XXX, not implimented - // copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implimented + // td->ext->drotAngle= ob->drotAngle; // XXX, not implemented + // copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implemented } else { td->ext->rot= NULL; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 92912018812..3deb4636200 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -293,7 +293,8 @@ int uvedit_face_visible_nolocal(Scene *scene, BMFace *efa) return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)==0 && BM_elem_flag_test(efa, BM_ELEM_SELECT)); } -int uvedit_face_visible(Scene *scene, Image *ima, BMFace *efa, MTexPoly *tf) { +int uvedit_face_visible(Scene *scene, Image *ima, BMFace *efa, MTexPoly *tf) +{ ToolSettings *ts= scene->toolsettings; if(ts->uv_flag & UV_SHOW_SAME_IMAGE) @@ -1436,12 +1437,8 @@ static void weld_align_uv(bContext *C, int tool) /* flush vertex tags to edges */ BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) { - if (BM_elem_flag_test(eed->v1, BM_ELEM_TAG) && BM_elem_flag_test(eed->v2, BM_ELEM_TAG)) { - BM_elem_flag_enable(eed, BM_ELEM_TAG); - } - else { - BM_elem_flag_disable(eed, BM_ELEM_TAG); - } + BM_elem_flag_set(eed, BM_ELEM_TAG, (BM_elem_flag_test(eed->v1, BM_ELEM_TAG) && + BM_elem_flag_test(eed->v2, BM_ELEM_TAG))); } /* find a vertex with only one tagged edge */ @@ -2017,7 +2014,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) #endif - DAG_id_tag_update(obedit->data, 0); + DAG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); BLI_array_free(hitv); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index c3c19b683e1..5211e64f6fb 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -241,7 +241,8 @@ static void stitch_update_header(StitchState *stitch_state, bContext *C) } } -static int getNumOfIslandUvs(UvElementMap *elementMap, int island){ +static int getNumOfIslandUvs(UvElementMap *elementMap, int island) +{ if(island == elementMap->totalIslands-1){ return elementMap->totalUVs - elementMap->islandIndices[island]; }else{ @@ -249,7 +250,8 @@ static int getNumOfIslandUvs(UvElementMap *elementMap, int island){ } } -static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]){ +static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]) +{ float uv_rotation_result[2]; uv[0] -= medianPoint[0]; @@ -262,7 +264,8 @@ static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]){ uv[1] = uv_rotation_result[1] + medianPoint[1]; } -static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){ +static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) +{ float limit; int do_limit; @@ -293,7 +296,8 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it } -static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){ +static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state) +{ if((state->snap_islands && element->island == element_iter->island) || (!state->midpoints && element->island == element_iter->island)) return 0; @@ -303,7 +307,8 @@ static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *elem /* calculate snapping for islands */ -static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition *preview_position, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final){ +static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition *preview_position, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final) +{ int i; UvElement *element; @@ -471,7 +476,8 @@ static void stitch_state_delete(StitchState *stitch_state) /* checks for remote uvs that may be stitched with a certain uv, flags them if stitchable. */ -static void determine_uv_stitchability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data){ +static void determine_uv_stitchability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data) +{ int vert_index; UvElement *element_iter; BMLoop *l; @@ -697,7 +703,7 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final) if(i < numoftris){ /* using next since the first uv is already accounted for */ BMLoop *lnext = l->next; - MLoopUV *luvnext = CustomData_bmesh_get(&state->em->bm->ldata, lnext->next->head.data, CD_MLOOPUV);; + MLoopUV *luvnext = CustomData_bmesh_get(&state->em->bm->ldata, lnext->next->head.data, CD_MLOOPUV); luv = CustomData_bmesh_get(&state->em->bm->ldata, lnext->head.data, CD_MLOOPUV); memcpy(preview->static_tris + buffer_index, fuv->uv, 2*sizeof(float)); @@ -876,14 +882,16 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final) } /* Stitch hash initialisation functions */ -static unsigned int uv_edge_hash(const void *key){ +static unsigned int uv_edge_hash(const void *key) +{ UvEdge *edge = (UvEdge *)key; return BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) + BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1)); } -static int uv_edge_compare(const void *a, const void *b){ +static int uv_edge_compare(const void *a, const void *b) +{ UvEdge *edge1 = (UvEdge *)a; UvEdge *edge2 = (UvEdge *)b; @@ -1275,7 +1283,8 @@ static int stitch_exec(bContext *C, wmOperator *op) } } -static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState *stitch_state){ +static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState *stitch_state) +{ /* add uv under mouse to processed uv's */ float co[2]; NearestHit hit; diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index a3e3eb19a5b..002563ada4b 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -179,6 +179,10 @@ void GPU_extensions_init(void) GG.npotdisabled = 1; } + /* make sure double side isn't used by defautl and only getting enabled in places where it's + * really needed to prevent different unexpected behaviors like with intel gme965 card (sergey) */ + glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0); + GG.os = GPU_OS_UNIX; #ifdef _WIN32 GG.os = GPU_OS_WIN; diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c index 6c330fb3dae..123d0b42979 100644 --- a/source/blender/imbuf/intern/cineon/logImageLib.c +++ b/source/blender/imbuf/intern/cineon/logImageLib.c @@ -44,13 +44,15 @@ #define DEFAULT_WHITE_POINT 685 void -logImageSetVerbose(int verbosity) { +logImageSetVerbose(int verbosity) +{ cineonSetVerbose(verbosity); dpxSetVerbose(verbosity); } LogImageFile* -logImageOpen(const char* filename, int cineon) { +logImageOpen(const char* filename, int cineon) +{ if (cineon) { return cineonOpen(filename); } else { @@ -60,7 +62,8 @@ logImageOpen(const char* filename, int cineon) { } LogImageFile* -logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon) { +logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon) +{ if (cineon) { return cineonOpenFromMem(buffer, size); } else { @@ -70,7 +73,8 @@ logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon) { } LogImageFile* -logImageCreate(const char* filename, int cineon, int width, int height, int depth) { +logImageCreate(const char* filename, int cineon, int width, int height, int depth) +{ if (cineon) { return cineonCreate(filename, width, height, depth); } else { @@ -80,7 +84,8 @@ logImageCreate(const char* filename, int cineon, int width, int height, int dept } int -logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* depth) { +logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* depth) +{ *width = logImage->width; *height = logImage->height; *depth = logImage->depth; @@ -88,7 +93,8 @@ logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* dept } int -logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) { +logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) +{ params->gamma = DEFAULT_GAMMA; params->blackPoint = DEFAULT_BLACK_POINT; params->whitePoint = DEFAULT_WHITE_POINT; @@ -97,7 +103,8 @@ logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) { } int -logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params) { +logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params) +{ params->gamma = logImage->params.gamma; params->blackPoint = logImage->params.blackPoint; params->whitePoint = logImage->params.whitePoint; @@ -106,7 +113,8 @@ logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionPa } int -logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params) { +logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params) +{ if ((params->gamma >= MIN_GAMMA) && (params->gamma <= MAX_GAMMA) && (params->blackPoint >= 0) && @@ -123,22 +131,26 @@ logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionPa } int -logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y) { +logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y) +{ return logImage->getRow(logImage, row, y); } int -logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y) { +logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y) +{ return logImage->setRow(logImage, row, y); } void -logImageClose(LogImageFile* logImage) { +logImageClose(LogImageFile* logImage) +{ logImage->close(logImage); } void -logImageDump(const char* filename) { +logImageDump(const char* filename) +{ U32 magic; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index d9ec3bf60c6..45f58ee9d17 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -743,7 +743,8 @@ void IMB_color_to_bw(ImBuf *ibuf) } } -void IMB_buffer_float_clamp(float *buf, int width, int height){ +void IMB_buffer_float_clamp(float *buf, int width, int height) +{ int i, total = width*height*4; for(i = 0; i < total; i++){ buf[i] = MIN2(1.0, buf[i]); diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 7d3662c7ffb..83307cc2fc6 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -136,7 +136,7 @@ typedef struct Object { /* materials */ struct Material **mat; /* material slots */ - char *matbits; /* a boolean field, with each byte 1 if corrusponding material is linked to object */ + char *matbits; /* a boolean field, with each byte 1 if corresponding material is linked to object */ int totcol; /* copy of mesh or curve or meta */ int actcol; /* currently selected material in the UI */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5ad698d7071..772f28450ed 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1029,7 +1029,7 @@ typedef struct UnitSettings { /* Display/Editing unit options for each scene */ float scale_length; /* maybe have other unit conversions? */ char system; /* imperial, metric etc */ - char system_rotation; /* not implimented as a propper unit system yet */ + char system_rotation; /* not implemented as a propper unit system yet */ short flag; } UnitSettings; diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 52dc364e590..8257b850010 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -566,10 +566,12 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview) ListBase threads; ThreadData thdata; int totnode, curnode, rendering= 1, n; - bNodeTreeExec *exec= ntree->execdata; - + bNodeTreeExec *exec; + if(ntree==NULL) return; - + + exec = ntree->execdata; + if(do_preview) ntreeInitPreview(ntree, 0, 0); diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index 61d30a5ec4a..7b2e682e968 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -42,7 +42,8 @@ static bNodeSocketTemplate cmp_node_doubleedgemask_out[]= { { -1, 0, "" } // output socket array terminator }; -static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -189,7 +190,8 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int rsize[2]=gsz; } -static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -375,7 +377,8 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in rsize[2]=gsz; } -static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -514,7 +517,8 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim rsize[2]=gsz; } -static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) +{ int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -692,7 +696,8 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li rsize[2]=gsz; } -static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) +{ int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -750,7 +755,8 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l rsize[2]=in_gsz; } -static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) +{ int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -812,7 +818,8 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i rsize[2]=in_gsz; } -static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz){ +static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) +{ int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance @@ -920,7 +927,8 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne } -static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset){ +static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) +{ int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter int fsz; // size of the frame @@ -1048,7 +1056,8 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g } -static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { +static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) +{ float *imask; // imask = pointer to inner mask pixel buffer float *omask; // omask = pointer to outer mask pixel buffer @@ -1172,7 +1181,8 @@ static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, b } } -void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype) { +void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype) +{ static bNodeType ntype; // allocate a node type data structure node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS); diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index aeccdc6ebbc..6d6bb0db0f6 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -708,6 +708,9 @@ PyDoc_STRVAR(bpy_bmvert_calc_edge_angle_doc, ".. method:: calc_edge_angle()\n" "\n" " Return the angle between 2 connected edges.\n" +"\n" +" :return: The angle between both edges in radians.\n" +" :rtype: float\n" ); static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self) { @@ -809,6 +812,43 @@ static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self) /* Face * ---- */ +PyDoc_STRVAR(bpy_bmface_copy_from_face_interp_doc, +".. method:: copy_from_face_interp(face)\n" +"\n" +" Interpolate the customdata from another face onto this one (faces should overlap).\n" +"\n" +" :arg face: The face to interpolate data from.\n" +" :type face: :class:`BMFace`\n" +); +static PyObject *bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *args) +{ + BPy_BMFace *py_face = NULL; + + BPY_BM_CHECK_OBJ(self); + + if (!PyArg_ParseTuple(args, "O!:BMFace.copy_from_face_interp", + &BPy_BMFace_Type, &py_face)) + { + return NULL; + } + else { + BMesh *bm = self->bm; + + BPY_BM_CHECK_OBJ(py_face); + + if (py_face->bm != bm) { + PyErr_SetString(PyExc_ValueError, + "BMFace.copy_from_face_interp(face): face is from another mesh"); + return NULL; + } + + BM_face_interp_from_face(bm, self->f, py_face->f); + + Py_RETURN_NONE; + } +} + + PyDoc_STRVAR(bpy_bmface_copy_doc, ".. method:: copy(verts=True, edges=True)\n" "\n" @@ -922,6 +962,50 @@ static PyObject *bpy_bmface_normal_update(BPy_BMFace *self) /* Loop * ---- */ +PyDoc_STRVAR(bpy_bmloop_copy_from_face_interp_doc, +".. method:: copy_from_face_interp(face, vert=True, multires=True)\n" +"\n" +" Interpolate the customdata from a face onto this loop (the loops vert should overlap the face).\n" +"\n" +" :arg face: The face to interpolate data from.\n" +" :type face: :class:`BMFace`\n" +" :arg vert: When enabled, interpolate the loops vertex data.\n" +" :type vert: boolean\n" +" :arg multires: When enabled, interpolate the loops multires data.\n" +" :type multires: boolean\n" +); +static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args) +{ + BPy_BMFace *py_face = NULL; + int do_vertex = TRUE; + int do_multires = TRUE; + + BPY_BM_CHECK_OBJ(self); + + if (!PyArg_ParseTuple(args, "O!|ii:BMLoop.copy_from_face_interp", + &BPy_BMFace_Type, &py_face, + &do_vertex, &do_multires)) + { + return NULL; + } + else { + BMesh *bm = self->bm; + + BPY_BM_CHECK_OBJ(py_face); + + if (py_face->bm != bm) { + PyErr_SetString(PyExc_ValueError, + "BMLoop.copy_from_face_interp(face): face is from another mesh"); + return NULL; + } + + BM_loop_interp_from_face(bm, self->l, py_face->f, do_vertex, do_multires); + + Py_RETURN_NONE; + } +} + + PyDoc_STRVAR(bpy_bmloop_calc_face_angle_doc, ".. method:: calc_face_angle()\n" "\n" @@ -950,7 +1034,8 @@ static PyObject *bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args) if (!PyArg_ParseTuple(args, "|OO!:verts.new", py_co, - &BPy_BMVert_Type, &py_vert_example)) { + &BPy_BMVert_Type, &py_vert_example)) + { return NULL; } else { @@ -1053,7 +1138,8 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args) if (!PyArg_ParseTuple(args, "O|O!:faces.new", &vert_seq, - &BPy_BMFace_Type, &py_face_example)) { + &BPy_BMFace_Type, &py_face_example)) + { return NULL; } else { @@ -1185,7 +1271,7 @@ static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value) BPY_BM_CHECK_OBJ(value); if (value->bm != bm) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_ValueError, "faces.remove(vert): vertex is from another mesh"); return NULL; } @@ -1193,7 +1279,7 @@ static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value) BM_vert_kill(bm, value->v); bpy_bm_generic_invalidate((BPy_BMGeneric *)value); - Py_RETURN_NONE;; + Py_RETURN_NONE; } } @@ -1210,7 +1296,7 @@ static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value) BPY_BM_CHECK_OBJ(value); if (value->bm != bm) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_ValueError, "faces.remove(vert): vertex is from another mesh"); return NULL; } @@ -1218,7 +1304,7 @@ static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value) BM_edge_kill(bm, value->e); bpy_bm_generic_invalidate((BPy_BMGeneric *)value); - Py_RETURN_NONE;; + Py_RETURN_NONE; } } @@ -1235,7 +1321,7 @@ static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value) BPY_BM_CHECK_OBJ(value); if (value->bm != bm) { - PyErr_SetString(PyExc_TypeError, + PyErr_SetString(PyExc_ValueError, "faces.remove(vert): vertex is from another mesh"); return NULL; } @@ -1243,7 +1329,7 @@ static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value) BM_face_kill(bm, value->f); bpy_bm_generic_invalidate((BPy_BMGeneric *)value); - Py_RETURN_NONE;; + Py_RETURN_NONE; } } @@ -1471,7 +1557,9 @@ static struct PyMethodDef bpy_bmedge_methods[] = { static struct PyMethodDef bpy_bmface_methods[] = { {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc}, + {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc}, + {"copy_from_face_interp", (PyCFunction)bpy_bmface_copy_from_face_interp, METH_O, bpy_bmface_copy_from_face_interp_doc}, {"copy", (PyCFunction)bpy_bmface_copy, METH_VARARGS|METH_KEYWORDS, bpy_bmface_copy_doc}, @@ -1486,6 +1574,7 @@ static struct PyMethodDef bpy_bmface_methods[] = { static struct PyMethodDef bpy_bmloop_methods[] = { {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc}, + {"copy_from_face_interp", (PyCFunction)bpy_bmloop_copy_from_face_interp, METH_O, bpy_bmloop_copy_from_face_interp_doc}, {"calc_angle", (PyCFunction)bpy_bmloop_calc_face_angle, METH_NOARGS, bpy_bmloop_calc_face_angle_doc}, {NULL, NULL, 0, NULL} diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c index 7dbf57ab260..19832b67962 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.c +++ b/source/blender/python/bmesh/bmesh_py_utils.c @@ -327,7 +327,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args) BMFace *f_new = NULL; BMLoop *l_new = NULL; - if (!PyArg_ParseTuple(args, "O!O!|O!:face_split", + if (!PyArg_ParseTuple(args, "O!O!O!|O!:face_split", &BPy_BMFace_Type, &py_face, &BPy_BMVert_Type, &py_vert_a, &BPy_BMVert_Type, &py_vert_b, @@ -362,7 +362,7 @@ static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args) bm = py_face->bm; f_new = BM_face_split(bm, py_face->f, - py_vert_a->v, py_vert_a->v, + py_vert_a->v, py_vert_b->v, &l_new, py_edge_example ? py_edge_example->e : NULL); if (f_new && l_new) { diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 3802bd80b9e..e63e0146330 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -228,7 +228,7 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) /* similar to PyErr_Format(), * - * implimentation - we cant actually preprend the existing exception, + * implementation - we cant actually preprend the existing exception, * because it could have _any_ argiments given to it, so instead we get its * __str__ output and raise our own exception including it. */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 8fdf061a0e3..23718df1c66 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6857,7 +6857,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param #if 1 /* Skip the code below and call init directly on the allocated 'py_srna' * otherwise __init__() always needs to take a second self argument, see pyrna_struct_new(). - * Although this is annoying to have to impliment a part of pythons typeobject.c:type_call(). + * Although this is annoying to have to implement a part of pythons typeobject.c:type_call(). */ if (py_class->tp_init) { #ifdef USE_PEDANTIC_WRITE diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index fc9ea877da6..47e93492e7a 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -796,7 +796,7 @@ static PyObject *M_Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) return NULL; cellNoiseV(vec[0], vec[1], vec[2], r_vec); - return Vector_CreatePyObject(NULL, 3, Py_NEW, NULL);; + return Vector_CreatePyObject(NULL, 3, Py_NEW, NULL); } static PyMethodDef M_Noise_methods[] = { diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index f709572d0bb..db47952e45f 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -132,7 +132,8 @@ int quicktime_get_num_videocodecs() return qtVideoCodecCount; } -QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) { +QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) +{ if ((indexValue>=0) && (indexValue < qtVideoCodecCount)) return &qtVideoCodecList[indexValue]; else @@ -176,7 +177,8 @@ int quicktime_get_num_audiocodecs() return qtAudioCodecCount; } -QuicktimeCodecTypeDesc* quicktime_get_audiocodecType_desc(int indexValue) { +QuicktimeCodecTypeDesc* quicktime_get_audiocodecType_desc(int indexValue) +{ if ((indexValue>=0) && (indexValue < qtAudioCodecCount)) return &qtAudioCodecList[indexValue]; else diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 71cf87517f5..251d37e920e 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -153,7 +153,8 @@ int quicktime_get_num_videocodecs() return qtVideoCodecCount; } -QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) { +QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) +{ if ((indexValue>=0) && (indexValue < qtVideoCodecCount)) return &qtVideoCodecList[indexValue]; else diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 1d4edb45242..b06d85f2356 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -175,7 +175,8 @@ void BL_ActionActuator::ResetStartTime(float curtime) //SetLocalTime(curtime); } -CValue* BL_ActionActuator::GetReplica() { +CValue* BL_ActionActuator::GetReplica() +{ BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName()); replica->ProcessReplica(); return replica; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 3eb00a35904..8fb87025fe8 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2140,7 +2140,8 @@ KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used } -KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){ +KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist) +{ for (int j=0;jGetCount();j++) { diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp index 343cf023417..37960e5c2f7 100644 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp +++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp @@ -41,12 +41,14 @@ extern "C" { #include "BKE_fcurve.h" } -float BL_ScalarInterpolator::GetValue(float currentTime) const { +float BL_ScalarInterpolator::GetValue(float currentTime) const +{ // XXX 2.4x IPO_GetFloatValue(m_blender_adt, m_channel, currentTime); return evaluate_fcurve(m_fcu, currentTime); } -BL_InterpolatorList::BL_InterpolatorList(bAction *action) { +BL_InterpolatorList::BL_InterpolatorList(bAction *action) +{ if(action==NULL) return; @@ -59,7 +61,8 @@ BL_InterpolatorList::BL_InterpolatorList(bAction *action) { } } -BL_InterpolatorList::~BL_InterpolatorList() { +BL_InterpolatorList::~BL_InterpolatorList() +{ BL_InterpolatorList::iterator i; for (i = begin(); !(i == end()); ++i) { delete *i; diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index cf0aed181bb..c03c97311c7 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -308,7 +308,8 @@ const STR_String & CIntValue::GetText() -CValue* CIntValue::GetReplica() { +CValue* CIntValue::GetReplica() +{ CIntValue* replica = new CIntValue(*this); replica->ProcessReplica(); replica->m_pstrRep = NULL; diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index cdd87235fd2..4e048b1a875 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -71,7 +71,8 @@ const STR_String & CListValue::GetText() -CValue* CListValue::GetReplica() { +CValue* CListValue::GetReplica() +{ CListValue* replica = new CListValue(*this); replica->ProcessReplica(); @@ -214,7 +215,7 @@ CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val) //assert(false); // todo: implement me! static int error_printed = 0; if (error_printed==0) { - fprintf(stderr, "CValueList::Calc not yet implimented\n"); + fprintf(stderr, "CValueList::Calc not yet implemented\n"); error_printed = 1; } return NULL; @@ -227,7 +228,7 @@ CValue* CListValue::CalcFinal(VALUE_DATA_TYPE dtype, //assert(false); // todo: implement me! static int error_printed = 0; if (error_printed==0) { - fprintf(stderr, "CValueList::CalcFinal not yet implimented\n"); + fprintf(stderr, "CValueList::CalcFinal not yet implemented\n"); error_printed = 1; } return NULL; diff --git a/source/gameengine/Expressions/Operator1Expr.cpp b/source/gameengine/Expressions/Operator1Expr.cpp index 4e93ee0cb09..98228dfbe7d 100644 --- a/source/gameengine/Expressions/Operator1Expr.cpp +++ b/source/gameengine/Expressions/Operator1Expr.cpp @@ -103,7 +103,8 @@ bool COperator1Expr::NeedsRecalculated() return m_lhs->NeedsRecalculated(); } -CExpression* COperator1Expr::CheckLink(std::vector& brokenlinks) { +CExpression* COperator1Expr::CheckLink(std::vector& brokenlinks) +{ CExpression* newlhs = m_lhs->CheckLink(brokenlinks); diff --git a/source/gameengine/Expressions/Operator2Expr.cpp b/source/gameengine/Expressions/Operator2Expr.cpp index 11a509e59d0..f11d0670d15 100644 --- a/source/gameengine/Expressions/Operator2Expr.cpp +++ b/source/gameengine/Expressions/Operator2Expr.cpp @@ -197,7 +197,8 @@ bool COperator2Expr::NeedsRecalculated() -CExpression* COperator2Expr::CheckLink(std::vector& brokenlinks) { +CExpression* COperator2Expr::CheckLink(std::vector& brokenlinks) +{ // if both children are 'dead', return NULL // if only one child is alive, return that child // if both childresn are alive, return this diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp index 96cc5b48338..07a2743b19f 100644 --- a/source/gameengine/Expressions/VectorValue.cpp +++ b/source/gameengine/Expressions/VectorValue.cpp @@ -47,7 +47,8 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype) m_vec[KX_Z] = m_transformedvec[KX_Z] = z; } -CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) { +CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) +{ SetCustomFlag1(false);//FancyOutput=false; @@ -64,7 +65,8 @@ CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctyp SetName(name); } -CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype) { +CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype) +{ SetCustomFlag1(false);//FancyOutput=false; @@ -201,7 +203,8 @@ const STR_String & CVectorValue::GetText() return gstrVectorStr; } -CValue* CVectorValue::GetReplica() { +CValue* CVectorValue::GetReplica() +{ CVectorValue* replica = new CVectorValue(*this); replica->ProcessReplica(); return replica; diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index 6aee6bd19e7..3612115f90e 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -303,7 +303,8 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = { const char SCA_JoystickSensor::GetButtonActiveList_doc[] = "getButtonActiveList\n" "\tReturns a list containing the indices of the button currently pressed.\n"; -PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) { +PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) +{ SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); PyObject *ls = PyList_New(0); PyObject *value; @@ -325,7 +326,8 @@ PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) { const char SCA_JoystickSensor::GetButtonStatus_doc[] = "getButtonStatus(buttonIndex)\n" "\tReturns a bool of the current pressed state of the specified button.\n"; -PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) { +PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) +{ SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex); int index; diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 544b1da76af..5413638391f 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -183,7 +183,8 @@ isValid( SCA_PropertyActuator:: -GetReplica() { +GetReplica() +{ SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this); diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp index a12619aa925..eca678f4e89 100644 --- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp @@ -54,14 +54,16 @@ #define TEMPERING_SHIFT_T(y) (y << 15) #define TEMPERING_SHIFT_L(y) (y >> 18) -SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed) { +SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed) +{ // int mti = N + 1; /*unused*/ m_seed = seed; m_refcount = 1; SetStartVector(); } -SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() { +SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() +{ /* intentionally empty */ } diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp index f548eaee38a..a39c8ede6c1 100644 --- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp +++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp @@ -72,7 +72,8 @@ KX_NetworkMessageSensor::~KX_NetworkMessageSensor() { } -CValue* KX_NetworkMessageSensor::GetReplica() { +CValue* KX_NetworkMessageSensor::GetReplica() +{ // This is the standard sensor implementation of GetReplica // There may be more network message sensor specific stuff to do here. CValue* replica = new KX_NetworkMessageSensor(*this); diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 519ff97a2a2..3739ad0d712 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -104,7 +104,8 @@ KX_FontObject::~KX_FontObject() //it's handled in KX_Scene::NewRemoveObject } -CValue* KX_FontObject::GetReplica() { +CValue* KX_FontObject::GetReplica() +{ KX_FontObject* replica = new KX_FontObject(*this); replica->ProcessReplica(); return replica; @@ -116,7 +117,8 @@ void KX_FontObject::ProcessReplica() KX_GetActiveScene()->AddFont(this); } -int GetFontId (VFont *font) { +int GetFontId (VFont *font) +{ PackedFile *packedfile=NULL; int fontid = -1; diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp index 4e0e04beca4..d2468d0317d 100644 --- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp @@ -34,7 +34,8 @@ #include "MT_Matrix3x3.h" #include "KX_IScalarInterpolator.h" -void KX_OrientationInterpolator::Execute(float currentTime) const { +void KX_OrientationInterpolator::Execute(float currentTime) const +{ MT_Vector3 eul(m_ipos[0]->GetValue(currentTime), m_ipos[1]->GetValue(currentTime), m_ipos[2]->GetValue(currentTime)); diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp index be70ee8ced5..1e217ecf616 100644 --- a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp @@ -34,7 +34,8 @@ #include "MT_Point3.h" #include "KX_IScalarInterpolator.h" -void KX_PositionInterpolator::Execute(float currentTime) const { +void KX_PositionInterpolator::Execute(float currentTime) const +{ m_target.setValue(m_ipos[0]->GetValue(currentTime), m_ipos[1]->GetValue(currentTime), m_ipos[2]->GetValue(currentTime)); diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp index 2b0f112a63f..e234a9621b8 100644 --- a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp @@ -33,6 +33,7 @@ #include "KX_ScalarInterpolator.h" #include "KX_IScalarInterpolator.h" -void KX_ScalarInterpolator::Execute(float currentTime) const { +void KX_ScalarInterpolator::Execute(float currentTime) const +{ *m_target = m_ipo->GetValue(currentTime); } diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp index 51c2a87d14d..dd40cbd22fd 100644 --- a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp +++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp @@ -34,7 +34,8 @@ #include "MT_Vector3.h" #include "KX_IScalarInterpolator.h" -void KX_ScalingInterpolator::Execute(float currentTime) const { +void KX_ScalingInterpolator::Execute(float currentTime) const +{ m_target.setValue(m_ipos[0]->GetValue(currentTime), m_ipos[1]->GetValue(currentTime), m_ipos[2]->GetValue(currentTime)); diff --git a/source/gameengine/Network/NG_NetworkScene.cpp b/source/gameengine/Network/NG_NetworkScene.cpp index 4c5206ea2f1..3dbfb53d03d 100644 --- a/source/gameengine/Network/NG_NetworkScene.cpp +++ b/source/gameengine/Network/NG_NetworkScene.cpp @@ -144,7 +144,8 @@ void NG_NetworkScene::RemoveAllObjects() /** * get a single network object given its name */ -NG_NetworkObject* NG_NetworkScene::FindNetworkObject(const STR_String& objname) { +NG_NetworkObject* NG_NetworkScene::FindNetworkObject(const STR_String& objname) +{ NG_NetworkObject *nwobj = NULL; if (! m_networkdevice->IsOnline()) return nwobj;