Commit Graph

446 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
0312b18319 Get rid of a display list stored in Curve datablock
This display list was only used for texture space calculation,
and even there this display list was only used for bounding
box calculation.

Since we already do have bounding box in a curve datablock
there's no reason to duplicate non-modified display list
just to calculate bounding box later, let's just calculate
bounding box at the first point.

This makes code a little be more thread-safe but curves are
still not safe for threads at all because of bevel list and
path. That would be solved later.

--
svn merge -r57939:57940 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:13:15 +00:00
9e42f76bab Fix #36467: ends of curves - 2D differs to 3D
This is getting confused, why bevel is handled different
for 2D and 3D curves?

Anyway, made bevel work for 2D case nice again, but it's
probably nice to unify 2D and 3D cases.
2013-08-14 19:45:35 +00:00
503b7d5b9a add materials.clear() method, matching other python list method. 2013-08-14 11:29:58 +00:00
463ff86592 Fix #36461: ends of curves - twist still not good
Needed correct quat for first point as well.

Maybe it's time to refactor make_minimum_twist function a bit..
2013-08-13 15:27:49 +00:00
bc5dc88bda Fix #36420: ends of curves - caps & twist not good
Forgot to calculate directions of first/last points
for NURBS and POLY splines.
2013-08-12 09:00:48 +00:00
4941cafa09 Fix #36007: ends of curves do not fit
Made first/last tessellated curve have proper
direction and tilt. Before direction/tilt
from second/previous to last tessellated curve
segments.

Thanks Brecht for review and tests!
2013-08-07 18:22:15 +00:00
b6f58d0ea1 - add individual origin support for curves and improve the orientation calculations for curve handles,
- add support for using the active point's orientation.
- add support for creating new custom orientations from curves.
- fix error where only the last selected curve handle was taken into account for manipulator orientations.
2013-07-24 13:56:36 +00:00
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
d527c669f7 fix [#36176] Connected font Bevel moves inwards for some letter combinations
bevel wasn't taking into account overlapping text (bug goes back to 1.8).
2013-07-17 14:05:50 +00:00
cd6b27f2b5 remove return value from MEM_freeN, it wasn't used anywhere and was cast to a different function signature. (which evidently works but error prone). 2013-05-21 07:37:59 +00:00
6bd58ac967 fix [#35335] Crash when rendering a text object with a remesh modifier and a material texture 2013-05-13 07:13:28 +00:00
e369c2375b fix for tangent curve flipping only doing 2d angle tests. 2013-04-14 11:56:11 +00:00
5734d229a8 Fix #34867: cycles viewport render did not respect viewport visibility for
modifiers with text/curve/surface objects.

This is because the code here did not yet support the distinction between
generating the tesselated mesh at viewport/render resolution and generating a
separate displist/derivedmesh for render that is not stored in the object but
created and freed on the fly.
2013-04-05 00:33:59 +00:00
36d25daa09 style cleanup 2013-03-26 22:45:06 +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
d4af049fab add option to convert grease pencil into poly line directly.
Without this, bezier curves at 12 resolution are very high detail for many tasks when converted from freehand strokes.
so add the option to convert 1:1 grease pencil points to curve polygons.

also add use_handles option to curve conversion which is used when converting beziers to poly lines.
2013-03-20 15:01:15 +00:00
221a383366 use 'bool' for BLI_/BKE_ functions. 2013-03-09 05:35:49 +00:00
ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
c84e4da7dd code cleanup: move 2d bevel list into its own function. (as with 3d bevel) 2013-02-21 17:16:51 +00:00
441c7fb79a fix for crashes running some operators in background mode and some divide by zero errors. 2013-02-06 02:48:03 +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
73c7c10c6e Bug fix #33748
Old fixes, since 2009 and before! Related to Curve object editmode:

- normals are not being drawn for hidden curves anymore
- even worse: Blender also didn't hide the extrusions or bevels for hidden curves
- outside edit mode, it shows all (as for all other modes)
- (de)select-all now works when 1st (or any) handle was hidden.
2013-01-15 15:42:12 +00:00
c93e127e7a code cleanup: style and replace (float)sin, (float)cos with sinf, cosf 2013-01-12 14:28:23 +00:00
682df047a0 style cleanup 2013-01-08 02:06:16 +00:00
a6bee579e9 move pbvh into BKE, it used many BKE bad level includes.
now blenlib/BLI doesn't depend on any blenkern/BKE functions,
there are still some bad level includes but these are only to access G.background and the blender version define.
2012-12-15 15:59:25 +00:00
21a9fa9089 move bpath module from BLI to BKE, it was making many bad level calls into BKE. 2012-12-15 15:31:50 +00:00
634b22fc46 code cleanup: spelling labda -> lambda 2012-12-11 14:18:37 +00:00
973cb29d84 style cleanup: if's on the same line. 2012-11-18 02:41:55 +00:00
2bb174cfa4 style cleanup: indentation 2012-11-09 09:33:28 +00:00
09cf0fa6f3 Bugreport - Christian Krupa in irc:
Curves behaved totally bad suddenly. Caused by Campbell code cleanup, replacing
this:

	/* this is for float inaccuracy */
	if (t < knots[0])
		t = knots[0];
	else if (t > knots[opp2]) 
		t = knots[opp2];


with:

	t = (t < knots[0]) ? knots[0] : knots[opp2];

Tss!
2012-11-01 13:00:24 +00:00
00b8c2afa1 style cleanup 2012-10-31 10:09:06 +00:00
aeba4950c3 style cleanup 2012-10-27 10:42:28 +00:00
0e494b74c4 style cleanup 2012-10-26 04:14:10 +00:00
d599b643b7 style cleanup: bge, switch statements mostly.
also left bmesh decimator on in previous commit.
2012-10-21 07:58:38 +00:00
67e2768570 quiet some -Wshadow warnings 2012-10-12 14:35:10 +00:00
589ada7f0c code cleanup: correct spelling 2012-09-28 06:45:20 +00:00
b3d2ea28ce speedup for vertex parent lookups, were looping over array elements when it wasn't needed for lattice and curves, and in some cases meshes.
do dirrect array lookups instead where possible.
2012-09-16 08:25:31 +00:00
a3c4b0f47d make SWAP macros typesafe using CHECK_TYPE macro.
Its unlikely you want to do short -> int, int -> float etc, conversion during swapping (if its needed we could have a non type checking macro).

Double that the optimized assembler outbut using SWAP() remains unchanged from before.

This exposed quite a few places where redundant type conversion was going on.

Also remove curve.c's swapdata() and replace its use with swap_v3_v3()
2012-08-25 20:16:08 +00:00
699b23ecdb fix for type mismatch with SWAP() macro. 2012-08-25 19:43:15 +00:00
ed0489bb6e style cleanup: also spelling 2012-08-24 23:22:34 +00:00
f0951f58ca code cleanup: rename G.afbreek --> is_break, G.rendering --> is_rendering 2012-08-08 18:37:06 +00:00
62a73381a7 use fabsf when using floats. 2012-07-21 15:27:40 +00:00
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
f5f25b81e8 style cleanup:
also fix for building ghost test and fix double free in one of the tests
2012-06-17 09:58:26 +00:00
e1241030db yse BLI_math for the compositor in more places. 2012-06-12 20:04:55 +00:00
af3e348430 code cleanup: use TRUE/FALSE rather then 1/0 for better readability, also replace do prefix with do_ for bool vars. 2012-05-19 13:28:19 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
305d341ec2 code cleanup: use vector math function minmax_v3v3_v3() and other minor vector function edits. 2012-05-13 11:05:52 +00:00
145289ad95 code cleanup: minor improvements to float/vector usage. 2012-05-12 22:13:38 +00:00