Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-03-01Refactor: Merge non-functional-change part of 'edit normals' 2017 GSoC.Bastien Montagne
This merges changes in internals, runtime-only of existing custom normals code, which make sense as of themselves, and will make diff of soc branch easier/lighter to review. In the details, it mostly changes two things: * Now, smooth fans (aka MLoopNorSpaceArray) can store either loop indices, or pointers to BMLoop themselves. This makes sense since in BMesh, it's relatively easy to get index from a BMElement, but nearly impracticable to go the other way around. * First change enforces another, now we cannot rely anymore on `loops` being NULL in MLoopNorSpace to detect single-loop fans, so we instead store that info in a new flag. Again, these are expected to be totally non-functional changes.
2018-02-22Fix (unreported) meshes changing shading when creating empty clnors data.Bastien Montagne
When you were using autosmooth to generate some custom normals, and created empty custom loop normal data, you would go back to an 'all smooth' shading, cancelling some sharp edges generated by the mesh's smooth threshold. Now we will first tag such edges as sharp, such that shading remains the same. This is not crucial in current master, but it is for clnors editing gsoc branch!
2018-02-20Cleanup: split normals: use different varnames for angle and its cosine.Bastien Montagne
Using same name for two different things is not the best idea ever...
2017-08-21Fix T52434: Restore mesh center of mass calculationCampbell Barton
The new method while improved for solid objects doesn't work for non-manifold meshes, keep both.
2017-08-07Refactor ID copying (and to some extent, ID freeing).Bastien Montagne
This will allow much finer controll over how we copy data-blocks, from full copy in Main database, to "lighter" ones (out of Main, inside an already allocated datablock, etc.). This commit also transfers a llot of what was previously handled by per-ID-type custom code to generic ID handling code in BKE_library. Hopefully will avoid in future inconsistencies and missing bits we had all over the codebase in the past. It also adds missing copying handling for a few types, most notably Scene (which where using a fully customized handling previously). Note that the type of allocation used during copying (regular in Main, allocated but outside of Main, or not allocated by ID handling code at all) is stored in ID's, which allows to handle them correctly when freeing. This needs to be taken care of with caution when doing 'weird' unusual things with ID copying and/or allocation! As a final note, while rather noisy, this commit will hopefully not break too much existing branches, old 'API' has been kept for the main part, as a wrapper around new code. Cleaning it up will happen later. Design task : T51804 Phab Diff: D2714
2017-06-21Fix T51856: `BKE_mesh_new_from_object()` would often generate default 'Mesh' ↵Bastien Montagne
named datablock. This is annoying especially for exporters who do use mesh name, since it broke any relation with actual Mesh naming in original Blend file. Unfortunately, we cannot avoid the extra .xxx digits. ;)
2017-06-14Make whole ID copying code use const source pointer.Bastien Montagne
Noisy change, but safe, and better do it sooner than later if we are to rework copying code. Also, previous commit shows this *is* useful to catch some mistakes.
2017-02-22Cycles: Fix shading with autosmooth and custom normalsSergey Sharybin
New logic of split_faces was leaving mesh in a proper state from Blender's point of view, but Cycles wanted loop normals to be "flushed" to vertex normals. Now we do such a flush from Cycles side again, so we don't leave bad meshes behind. Thanks Bastien for assistance here!
2017-02-22Refactor Mesh split_faces() code to use loop normal spaces.Bastien Montagne
Finding which loop should share its vertex with which others is not easy with regular Mesh data (mostly due to lack of advanced topology info, as opposed with BMesh case). Custom loop normals computing already does that - and can return 'loop normal spaces', which among other things contain definitions of 'smooth fans' of loops around vertices. Using those makes it easy to find vertices (and then edges) that needs splitting. This commit also adds support of non-autosmooth meshes, where we want to split out flat faces from smooth ones.
2016-07-21Refactor/deduplicate even more make_local code (and fix part of T48907).Bastien Montagne
Turns out most BKE_foo_make_local datablock-specific functions are actually doing exactly the same thing, only two currently need special additional operations (object and brush ones). So added a BKE_id_make_local_generic instead of copying same code over and over. Also, changed a bit how make_local works in case we are localizing a whole library. We need to do the 'remap' step (from old linked ID to new local one) in the second loop, otherwise we miss some dependencies. This fixes main part of T48907.
2016-07-14Add option to id_make_local to force localization of datablock, even if not ↵Bastien Montagne
used locally. Will be used by link/append code.
2016-07-10Cleanup/Refactor: pass Main pointer to all ID copy functions.Bastien Montagne
Also allows us to get rid of a few _copy_ex() versions...
2016-07-08Refactor/enhance BKE_mesh_make_local().Bastien Montagne
Now using modern features from libquery/libremap areas. Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6). Note: this enlightened broken case of proxy objects regarding make_local (and also whole remapping, in fact). Will be fixed in near future.
2016-07-01BMesh: make toolflags optionalCampbell Barton
Saves 8 bytes per vert/edge/face. Gives overall ~20-25% memory saving for dyntopo sculpting and modifiers that use BMesh.
2016-06-22ID-Remap - Step one: core work (cleanup and rework of generic ID datablock ↵Bastien Montagne
handling). This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock was pretty much impossible, except for a few special cases. Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite a few ID usages were missed or wrongly handled that way). One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling by using library_query utils to allow generic handling of those, which is now the case (now, generic ID links handling is only "knwon" from readfile.c and library_query.c). This commit also adds backends to allow live replacement and deletion of datablocks in Blender (so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one, or NULL one in case of unlinking). This will allow nice new features, like ability to easily reload or relocate libraries, real immediate deletion of datablocks in blender, replacement of one datablock by another, etc. Some of those are for next commits. A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core. Though it was tested rather deeply, being totally impossible to check all possible ID usage cases, it's likely there are some remaining issues and bugs in new code... Please report them! ;) Review task: D2027 (https://developer.blender.org/D2027). Reviewed by campbellbarton, thanks a bunch.
2016-06-07Fix (unreported) EditNormal modifier: broken 'flip poly' feature.Bastien Montagne
Newly computed custom normals were forgotten during poly flipping, leading to wrong custom normals being assigned to wrong loop... Dead simple, but was tough to track down this one!
2016-04-29Fix T48290: Hook fails after deleting geometryCampbell Barton
Now CD_SHAPEKEY_INDEX customdata is stored in edit-mode when hooks and vertex parents are used. This also fixes a bug where undo would loose key-index data. Move to structs for BM_mesh_bm_to/from_me to avoid passing many argument, which mostly aren't used.
2016-04-26Support multiple tangents for BI render & viewportAlexander Romanov
Normal Map node support for GLSL mode and the internal render (multiple tangents support). The Normal Map node is a useful node which is present in the Cycles render. It makes it possible to use normal mapping without additional material node in a node tree. This patch implements Normal Map node for GLSL mode and the internal render. Previously only the active UV layer was used to calculate tangents.
2016-03-14Support mdisps for Mesh.flip_normals()Campbell Barton
2016-03-14Cleanup: move MDisps flipping to own functionCampbell Barton
2016-02-28BKE_mesh: add polygon flipping tools.Bastien Montagne
Those new functions invert the winding of polygons, effectively inverting their normals. A helper was also added to allow swapping two items in customdata layers. Being able to invert normals outside of BMesh area is very important in several places, like IO scripts or customnormals modifiers... Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D1814
2015-10-20First step to handle missing libs/datablocks when reading a file.Bastien Montagne
Idea is, instead of ignoring completely missing linked datablocks, to create void placeholders for them. That way, you can work on your file, save it, and find again your missing data once lib becomes available again. Or you can edit missing lib's path (in Outliner), save and reload the file, and you are done. Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon. Future plans are also to be able to relocate missing libs and reload them at runtime. Code notes: - Placeholder ID is just a regular datablock of same type as expected linked one, with 'default' data, and a LIB_MISSING bitflag set. - To allow creation of such datablocks, creation of datablocks in BKE was split in two step: + Allocation of memory itself. + Setting of all internal data to default values. See also the design task (T43351). Reviewed by @campbellbarton, thanks a bunch! Differential Revision: https://developer.blender.org/D1394
2015-10-12Add functions to compute normals (verts, polys and loops ones) for a given ↵Bastien Montagne
shapekey. Title says pretty much everything, we now have BKE and RNA funcs to get vertex, poly and loop normals of a given shapekey. This will be used e.g. in FBX exporter (shapekeys need normal data too). Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D1510
2015-09-04Fix T46015: normals_split_custom_set_from_vertices doesn't work with zero ↵Bastien Montagne
vectors This was simply broken for vertex case (indexing loop normals with vert indices...). Turns out to be rather verbose to replace on-the-fly zero normals by default ones correctly, and do not want to make a full copy of the given custom normals array, so now this one is editied in place (replacing zero vectors by correct default normals). Don't think this could be a serious issue anyway.
2015-08-12Displace Modifier: add an option to displace along (averaged) custom ↵Bastien Montagne
normals, instead of vertex normals. User suggestion/request from 'boby'.
2015-07-30Move tangents and baking to looptris:Antony Riakiotakis
Notes: * Code in rendering and in game engine will still convert tangents to a tessface representation. Added code that takes care of tangent layer only, might be removed when BGE and rendering goes full mlooptri mode. * Baking should work discovered some dead code while I was working on the patch, also tangents are broken when baking from multires (also in master), but those are separate issues that can be fixed later. This should fix T45491 as well
2015-07-19Cleanup: styleCampbell Barton
Also 'com' as abbreviation for center-of-mass is a bit confusing, rename to 'center'.
2015-07-19Convert rigidbody conversion to looptri.Antony Riakiotakis
Patch D1417 by Martin Felke, with minor edits thanks!
2015-07-16Add tessellation data to DerivedMesh (LoopTri)Campbell Barton
This stores loop indices into the loop array giving easier acess to data such as vertex-colors and UV's, removing the need to store an MFace duplicate of custom-data. This doesn't yet move all internal code from MFace to LoopTri just yet. Only applies to: - opengl drawing - sculpting (pbvh) - vertex/weight paint Thanks to @psy-fi for review, fixes and improvements to drawing!
2015-07-10Cleanup: use const for mesh functionsCampbell Barton
2015-05-20doxygen: corrections/updatesCampbell Barton
Also add depsgraph & physics
2015-05-12Depsgraph: Add evaluation callbacks for granular nodes updateSergey Sharybin
This commit only adds callbacks which then later be used with major dependency graph commit, keeping the upcoming commit more clean to follow. Should be no functional changes so far still.
2015-04-28Add material slot reorder buttonsGaia Clary
2015-04-19Sculpt: smooth brush, exclude self from averageCampbell Barton
Was including the vertices own location when accumulating.
2015-03-31Corrective Smooth Modifier (aka delta-mush)Campbell Barton
This modifier can be used to correct bad deformations, Original patch D1183 by @sazerac, with own modifications
2015-03-28Cleanup: redundant struct declarationsCampbell Barton
2015-03-20Fix T43786: Cycles bake disregards Auto Smooth (vertex per-face normals)Sergey Sharybin
Added an utility function which performs vertex split based on the loop normal so now backing API matches to what's happening in Cycles and BI in terms of autosplit. Reviewers: dfelinto, campbellbarton Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D1174
2015-02-05Add Custom Loop Normals.Bastien Montagne
This is the core code for it, tools (datatransfer and modifier) will come in next commits). RNA api is already there, though. See the code for details, but basically, we define, for each 'smooth fan' (which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal), a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store custom normal as two angular factors inside that space. This allows to have custom normals 'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer. Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals, and be converted back into storage format at the end. Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can be rather heavy with high poly meshes. Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05Mesh validate: add an option to not clean temp/cache CDLayers.Bastien Montagne
This is mandatory for incoming custom normal imports from io scripts, because often geometry here is corrupted, so we need to call mesh.validate() to clean it up. Issue is, we cannot set custom normals before geometry is clean, so we need to store temporary plain loop normals in a CD_NORMAL layer, validate, and then set custom normals. So we need a way to prevent 'temp' lnors to be freed by validate.
2015-01-19Make use/computation of lnors consistant.Bastien Montagne
Issue was, when requesting (building) lnors for a mesh that has autosmooth disabled, one would expect to simply get vnors as lnors. Until now, it wasn't the case, which was bad e.g. for normal projections of loops in recent remap code (projecting along split loop normals when you would expect projection along vertex normals...). Also, removed the 'angle' parameter from RNA's `mesh.calc_normals_split`. This should *always* use mesh settings (both autosmooth and smoothresh), otherwise once again we'd get inconsistencies in some cases. Will update fbx and obj addons too.
2014-09-01Support more object types scene-scale (on creation)Campbell Barton
- lamp - camera - font - empty & effector Also fix inconsistency with apply transform (modified shape-keys for meshes but not curve/lattice)
2014-07-17Add helper to validate (and fix) material indices of meshes' polygons, ↵Bastien Montagne
curves' splines and texts' letters. Useful especially for importer addons. Reviewers: campbellbarton Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D650
2014-07-11Fix T41019: Calculate Mass does not calculate actual volume.Lukas Tönne
This was a ToDo item, for mesh-based rigid body shapes (trimesh, convex) the operator was simply using the bounding box volume, which can grossly overestimate the volume and mass. Calculating the actual volume of a mesh is not so difficult after all, see e.g. http://research.microsoft.com/en-us/um/people/chazhang/publications/icip01_ChaZhang.pdf This patch also allows calculating the center-of-mass in the same way. This is currently unused, because the rigid body system assumes the CoM to be the same as the geometric object center. This is fine most of the time, adding such user settings for "center-of-mass offset" would also add quite a bit of complexity in user space, but it could be necessary at some point. A number of other physical properties could be calculated using the same principle, e.g. the moment of inertia.
2014-05-03Bake API - bpy.ops.object.bake()Dalai Felinto
New operator that can calls a bake function to the current render engine when available. This commit provides no feature for the users, but allows external engines to be accessed by the operator and be integrated with the baking api. The API itself is simple. Blender sends a populated array of BakePixels to the renderer, and gets back an array of floats with the result. The Blender Internal (and multires) system is still running independent, but we eventually will pipe it through the API as well. Cycles baking will come next as a separated commit Python Operator: ---------------- The operator can be called with some arguments, or a user interface can be created for it. In that case the arguments can be ommited and the interface can expose the settings from bpy.context.scene.render.bake bpy.ops.object.bake(type='COMBINED', filepath="", width=512, height=512, margin=16, use_selected_to_active=False, cage_extrusion=0, cage="", normal_space='TANGENT', normal_r='POS_X', normal_g='POS_Y', normal_b='POS_Z', save_mode='INTERNAL', use_clear=False, use_split_materials=False, use_automatic_name=False) Note: external save mode is currently disabled. Supported Features: ------------------ * Margin - Baked result is extended this many pixels beyond the border of each UV "island," to soften seams in the texture. * Selected to Active - bake shading on the surface of selected object to the active object. The rays are cast from the lowpoly object inwards towards the highpoly object. If the highpoly object is not entirely involved by the lowpoly object, you can tweak the rays start point with Cage Extrusion. For even more control of the cage you can use a Cage object. * Cage Extrusion - distance to use for the inward ray cast when using selected to active * Custom Cage - object to use as cage (instead of the lowpoly object). * Normal swizzle - change the axis that gets mapped to RGB * Normal space - save as tangent or object normal spaces Supported Passes: ----------------- Any pass that is supported by Blender renderlayer system. Though it's up to the external engine to provide a valid enum with its supported passes. Normal passes get a special treatment since we post-process them to converted and "swizzled" Development Notes for External Engines: --------------------------------------- (read them in bake_api.c) * For a complete implementation example look at the Cycles Bake commit (next). Review: D421 Reviewed by: Campbell Barton, Brecht van Lommel, Sergey Sharybin, Thomas Dinge Normal map pipeline "consulting" by Andy Davies (metalliandy) Original design by Brecht van Lommel. The entire commit history can be found on the branch: bake-cycles
2014-04-15Math Lib: avoid having to pass a pre-calculated normal tot area_poly_v3Campbell Barton
add normal_poly_v3
2014-04-13Split Normals I (1/5): basis for split normals (nearly nothing user-visible ↵Bastien Montagne
here): * Add a new calcLoopNormals function to DerivedMesh struct, and implement it for CDDM and CCGDM (subsurf). EditDerivedBMesh (edit mode DM) only gets a dummy one in this commit. * Add a tessellated version of CD_LOOPNORMAL layer (CD_TESSLOOPNORMAL), with relevant code to handle it (tessellation, rna access, etc.). * Change auto_smooth options of Mesh (angle now in radian internaly, and toggle is now used to enable/disable split normals in DM creation process). Note BI render code is not touched here, hence its behavior regarding this option is now incoherent, will be addressed in a separate commit. Reviewers: campbellbarton CC: brecht Differential Revision: https://developer.blender.org/D365
2014-03-16Code cleanup: modifier_skin_customdata_ensure was a bad level callCampbell Barton
2014-03-15Code cleanup: use r_ prefix for return argsCampbell Barton
2014-01-22Fix T38316: Half of a Face is Missing on Newly Created Cubes or Cylinders.Bastien Montagne
Own bug from rBc691551249f3. Now at least I understand why `test_index_face()` is needed for tessellated quads! Added a bunch of comments to explain the issue, as it's far from an obvious one... We loose some performances, but it's still much quicker than org code.
2014-01-21Code Cleanup: reduce sign conversionCampbell Barton