Commit Graph

543 Commits

Author SHA1 Message Date
527ddb0a5b Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now data which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.

Actually, this commit also contains wrapping runtime curve
members into own structure

This allows easier assignment on file loading, keeps curve-
specific runtime data grouped and saves couple of bytes in
Object for non-curve types.

--
svn merge -r57938:57939 ^/branches/soc-2013-depsgraph_mt
svn merge -r57957:57958^/branches/soc-2013-depsgraph_mt
2013-08-19 09:25:24 +00:00
503b7d5b9a add materials.clear() method, matching other python list method. 2013-08-14 11:29:58 +00:00
4982f200fa move alloca define into its own header since its not related to BLI_array 2013-07-28 10:38:25 +00:00
02468b290a code cleanup: use MEM_mallocN rather then MEM_callocN when the array is
overwritten immediately after.
2013-07-19 10:41:16 +00:00
e68618a5f2 Fix memory leak in BKE_mesh_vert_poly_map_create. 2013-07-16 00:34:03 +00:00
abe84a4f43 Fix #36139: cycles not taking texture spacing settings into account for
generated coordinates on text objects.
2013-07-15 11:11:36 +00:00
878608d1cf fix regression [#36141] Crash with skin and remesh modifier in edit mode. 2013-07-14 23:27:47 +00:00
6d9de6a72b fix [#35975] "Select Linked" = "Select All" in Weight Paint mode?
looks like this was broken since bmesh merge.
2013-07-03 09:53:06 +00:00
e64ae3ad7c fix [#35914] Blender crashes when trying to use vertex selection masking on a copy directly after using SHIFT+d 2013-06-30 22:04:03 +00:00
23d3c64b59 fixed Blender crash, but unclear when this situation can happen 2013-06-29 08:38:17 +00:00
603258d763 fix for zero length normalize before scanfill for meshes and other minor changes. 2013-06-27 04:32:44 +00:00
a7858767f4 fix [#35858] Weight Paint: Hiding faces isnt flushing the flag to the vertices. 2013-06-26 02:47:56 +00:00
afb200f217 calculate polygon normals for BKE_mesh_recalc_tessellation() inline rather then using scanfills function. 2013-06-24 18:13:33 +00:00
f35264706a Construct orco UV layer for curve when applying constructive modifier
Also construct orco uv layer when converting curve to a mesh.

This makes it possible to preserve automatically generated coordinates
("use uv for mapping" option) when using constructive modifiers or
converting curve to the mesh.

With cycles nothing special is needed to preserve texture mapping
after such operations, in blender internal you'll need to change
texture mapping from Generated to UV.

This feature is useful on it's own and also would help in potential
switch 3d viewport to always use DM to draw objects, which would
help making drawing more thread-safe.
2013-06-20 13:27:48 +00:00
c15802f7d3 display active vertex in weight paint mode. also correct NULL free. 2013-06-15 11:02:36 +00:00
a8beff3c5e added basic utility functions for working with mselect (selected mesh elements) 2013-06-15 09:42:58 +00:00
05ad8c2dc9 expose smooth group calculation to python as Mesh.calc_smooth_groups() 2013-06-14 09:59:09 +00:00
1fe21f29ec utility function for calculating smooth groups from sharp edges: BKE_mesh_calc_smoothgroups 2013-06-14 08:28:27 +00:00
cd33e7f1b4 utility function BKE_mesh_edge_poly_map_create(), currently unused. 2013-06-14 07:15:38 +00:00
f7a06295b9 code cleanup: reduce pointer indirection for mesh-map creation functions. 2013-06-14 06:34:37 +00:00
0435560b24 code cleanup: make_edges_mdata() reduce some sign conversion, pointer indirection. 2013-06-14 06:15:30 +00:00
31e667c10e solidify: dont add poly-normal layer to the derived mesh, since this is no longer a convention. 2013-06-12 09:35:02 +00:00
dfad9b0c09 fix [#35555] Collada: export destroys mesh in some cases
add arguments to calculate normals when converting to bmesh:
  BM_mesh_bm_from_me, DM_to_bmesh

This gives some speedup to undo (which didnt need to re-calculate vertex normals), and array modifier which doesnt need to calculate face normals at all
2013-06-02 23:20:49 +00:00
d7f51f83f6 remove CD_MASK_NORMAL from CD_MASK_DERIVEDMESH, bmesh merge included this but its not needed.
Now add asserts to make sure this layer is only added once the modifier stack has been calculated.
this saves normal layer being calculated whenver vertex normals need updating.
2013-05-30 18:09:19 +00:00
ef4db04da8 code cleanup: lots of calls to BKE_mesh_calc_normals_mapping were not using the mapping functionality.
replace ED_mesh_calc_normals with BKE_mesh_calc_normals().
2013-05-28 14:23:07 +00:00
0559630c7e fix for missing normalize with recent optimizations. 2013-05-28 12:00:36 +00:00
dfdb2eb9a8 fix own error in r56649, caused normal calculation to fail, reported as [#35448], also quiet float/double warning. 2013-05-24 06:50:15 +00:00
4392fc6f1d Optimize BKE_mesh_calc_normals(), gives approx 25% speedup.
- no need to allocate polygon normal array.
- no need to use BLI_array_ functions (realloc's).
- reduce some of the looping.
2013-05-10 10:07:01 +00:00
76b1e8bc09 code clenup: rename BKE_mesh_poly_calc_angles -> BKE_mesh_calc_poly_angles 2013-05-08 12:56:51 +00:00
89c8de1f48 add matrix multiply for projection that outputs 2d values. 2013-05-08 12:55:36 +00:00
6b1b20ef0d code cleanup: BKE_mesh_nurbs_displist_to_mdata(), use const bool for
'conv_polys'
2013-05-08 12:53:52 +00:00
62087935ec Fix #35209: cycles generated texture coordinates did not stick to deforming meshes. 2013-05-05 05:56:41 +00:00
2b640a2519 fix for own commit r56204, wasnt checking edges exist before adding. 2013-04-27 01:16:38 +00:00
319036f2d5 fix [#35026] Curve build modifier 2013-04-22 12:00:37 +00:00
4df0c46f83 Make freestyle use local Main for temporary objects
This means main database is no longer pollutes with
temporary scene and objects needed for freestyle
render.

Actually, there're few of separated temporary mains
now. Ideally it's better to use single one, but it's
not so much trivial to pass it to all classes. Not
so big deal actually.

Required some changes to blender kernel, to make it
possible to add object to a given main, also to
check on mesh materials for objects in given main.
This is all straightforward changes.

As an additional, solved issue with main database
being infinitely polluted with text blocks created
by create_lineset_handler function.

This fixes:
- #35003: Freestyle crashes if user expands objects in FRS1_Scene
- #35012: ctrl+f12 rendering crashes when using Freestyle
2013-04-18 08:58:21 +00:00
37e73aa368 code cleanup: use BKE naming conventions for functions in BKE_editmesh.h and BKE_editmesh_bvh.h 2013-04-16 05:59:48 +00:00
6da961775f code cleanup: rename BKE_tessmesh -> BKE_editmesh, rename EditDerivedBMesh.tc -> em. ('tc' is odd name which isn't used elsewhere). 2013-04-13 20:31:52 +00:00
9244cbef14 surpport converting boundary edges to curves with BKE_mesh_to_curve(). alt+c convert. 2013-04-08 00:25:44 +00:00
64d161de87 style cleanup:
also rename mesh_getVertexCos() --> BKE_mesh_vertexCos_get() to match curve function.
2013-03-26 07:29:01 +00:00
e7c15beaf6 code cleanup: use booleans for mesh and selection code. 2013-03-19 23:17:44 +00:00
3dababa7ec code cleanup: name mesh functions more consistently, also use bools for mesh args. 2013-03-17 19:55:10 +00:00
7ec47aa864 code cleanup: shadowing 2013-03-16 14:33:32 +00:00
a0351fd97e object converting curve/mball to a mesh would give invalid selection state (edges selected but nothing else).
add arg to BKE_mesh_calc_edges() so selecting newly created edges is optional.
2013-03-16 01:19:03 +00:00
0807c976f4 code cleanup: rename BKE_mesh_to_curve_ex --> BKE_mesh_to_curve_nurblist,
also correct odd indentation.
2013-03-15 10:48:48 +00:00
7626101dc9 split up BKE_mesh_to_curve() into 2 functions, adding BKE_mesh_to_curve_ex() which doesn't do object type conversion. 2013-03-14 18:44:32 +00:00
a0dbd88311 converting a mesh to a curve was unnecessarily using tessface's.
use mpolys instead and simplify checks for wire edges.

Also rename BKE_mesh_from_curve() --> BKE_mesh_to_curve() since this function converts a mesh into a curve.
2013-03-14 18:35:21 +00:00
1810913f81 fix for bmesh regression similar to last revision r54920. only effected loading old blend files without edge data. 2013-02-28 04:18:01 +00:00
10305de3ac Fix "Origin to Center of Mass" not working well with ngons
Now we do simple triangulation and calculate signed area of triangles to
account for concave polygons.

This only works correct for planar polygons but gives better results
overall.
2013-02-14 17:35:46 +00:00
296444e1dc style cleanup: some warnigs & spelling. 2013-02-06 14:02:19 +00:00
fdfa5910b5 Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances:

- Normal Map node requires tesselated faces to compute tangent space
- All temporary meshes needed for Cycles export were adding to G.main
- Undo pushes would temporary set meshes tessfaces to NULL
- Moving node will cause undo push and tree re-evaluate fr preview

All this leads to threading conflict between preview render and undo
system.

Solved it in  way that all temporary meshes are adding to that exact
Main which was passed to Cycles via BlendData. This required couple
of mechanic changes like adding extra parameter to *_add() functions
and adding some *_ex() functions to make it possible RNA adds objects
to Main passed to new() RNA function.

This was tricky to pass Main to RNA function and IMO that's not so
nice to pass main to function, so ended up with such decision:

- Object.to_mesh() will add temp mesh to G.main
- Added Main.meshes.new_from_object() which does the same as to_mesh,
  but adds temporary mesh to specified Main.

So now all temporary meshes needed for preview render would be added
to preview_main which does not conflict with undo pushes.

Viewport render shall not be an issue because object sync happens from
main thread in this case.

It could be some issues with final render, but that's not so much
likely to happen, so shall be fine.

Thanks to Brecht for review!
2013-02-05 12:46:15 +00:00