2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_CURVE_H__
|
|
|
|
#define __BKE_CURVE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_curve.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
2011-09-14 00:37:27 +00:00
|
|
|
|
|
|
|
struct BezTriple;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Curve;
|
2011-09-14 00:37:27 +00:00
|
|
|
struct EditNurb;
|
Fix T50745: Shape key editing on bezier objects broken with Rendered Viewport Shading
So... Curve+shapekey was even more broken than it looked, this report was
actually a nice crasher (immediate crash in an ASAN build when trying to
edit a curve shapekey with some viewport rendering enabled).
There were actually two different issues here.
I) The less critical: rB6f1493f68fe was not fully fixing issues from
T50614. More specifically, if you updated obdata from editnurb
*without* freeing editnurb afterwards, you had a 'restored' (to
original curve) editnurb, without the edited shapekey modifications
anymore. This was fixed by tweaking again `calc_shapeKeys()` behavior in
`ED_curve_editnurb_load()`.
II) The crasher: in `ED_curve_editnurb_make()`, the call to
`init_editNurb_keyIndex()` was directly storing pointers of obdata
nurbs. Since those get freed every time `ED_curve_editnurb_load()` is
executed, it easily ended up being pointers to freed memory. This was
fixed by copying those data, which implied more complex handling code
for editnurbs->keyindex, and some reshuffling of a few functions to
avoid duplicating things between editor's editcurve.c and BKE's curve.c
Note that the separation of functions between editors and BKE area for
curve could use a serious update, it's currently messy to say the least.
Then again, that area is due to rework since a long time now... :/
Finally, aligned 'for_render' curve evaluation to mesh one - now
editing a shapekey will show in rendered viewports, if it does have some
weight (exactly as with shapekeys of meshes).
2017-02-22 21:20:50 +01:00
|
|
|
struct GHash;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct ListBase;
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Main;
|
2011-09-14 00:37:27 +00:00
|
|
|
struct Nurb;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Object;
|
2009-01-04 14:14:06 +00:00
|
|
|
struct Scene;
|
2013-08-19 09:25:24 +00:00
|
|
|
struct Path;
|
2014-03-11 17:12:18 +11:00
|
|
|
struct TextBox;
|
|
|
|
struct rctf;
|
2013-08-19 09:25:24 +00:00
|
|
|
|
|
|
|
typedef struct CurveCache {
|
|
|
|
ListBase disp;
|
|
|
|
ListBase bev;
|
2014-10-21 14:44:08 +02:00
|
|
|
ListBase deformed_nurbs;
|
2013-08-19 09:25:24 +00:00
|
|
|
struct Path *path;
|
|
|
|
} CurveCache;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Fix T50745: Shape key editing on bezier objects broken with Rendered Viewport Shading
So... Curve+shapekey was even more broken than it looked, this report was
actually a nice crasher (immediate crash in an ASAN build when trying to
edit a curve shapekey with some viewport rendering enabled).
There were actually two different issues here.
I) The less critical: rB6f1493f68fe was not fully fixing issues from
T50614. More specifically, if you updated obdata from editnurb
*without* freeing editnurb afterwards, you had a 'restored' (to
original curve) editnurb, without the edited shapekey modifications
anymore. This was fixed by tweaking again `calc_shapeKeys()` behavior in
`ED_curve_editnurb_load()`.
II) The crasher: in `ED_curve_editnurb_make()`, the call to
`init_editNurb_keyIndex()` was directly storing pointers of obdata
nurbs. Since those get freed every time `ED_curve_editnurb_load()` is
executed, it easily ended up being pointers to freed memory. This was
fixed by copying those data, which implied more complex handling code
for editnurbs->keyindex, and some reshuffling of a few functions to
avoid duplicating things between editor's editcurve.c and BKE's curve.c
Note that the separation of functions between editors and BKE area for
curve could use a serious update, it's currently messy to say the least.
Then again, that area is due to rework since a long time now... :/
Finally, aligned 'for_render' curve evaluation to mesh one - now
editing a shapekey will show in rendered viewports, if it does have some
weight (exactly as with shapekeys of meshes).
2017-02-22 21:20:50 +01:00
|
|
|
/* Definitions needed for shape keys */
|
|
|
|
typedef struct CVKeyIndex {
|
|
|
|
void *orig_cv;
|
|
|
|
int key_index, nu_index, pt_index, vertex_index;
|
|
|
|
bool switched;
|
|
|
|
} CVKeyIndex;
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
#define KNOTSU(nu) ( (nu)->orderu + (nu)->pntsu + (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu - 1) : 0) )
|
|
|
|
#define KNOTSV(nu) ( (nu)->orderv + (nu)->pntsv + (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv - 1) : 0) )
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2008-09-23 06:26:48 +00:00
|
|
|
/* Non cyclic nurbs have 1 less segment */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu - 1)
|
|
|
|
#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv - 1)
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D) == 0) ? 0 : 1)
|
|
|
|
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1 != 0.0f || (cu)->ext2 != 0.0f) ? 1 : 0)
|
2009-04-20 15:06:46 +00:00
|
|
|
|
2013-12-23 12:12:40 +11:00
|
|
|
/* not 3d and not unfilled */
|
|
|
|
#define CU_DO_2DFILL(cu) ((((cu)->flag & CU_3D) == 0) && (((cu)->flag & (CU_FRONT | CU_BACK)) != 0))
|
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
/* ** Curve ** */
|
|
|
|
void BKE_curve_free(struct Curve *cu);
|
|
|
|
void BKE_curve_editfont_free(struct Curve *cu);
|
First step to handle missing libs/datablocks when reading a file.
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-20 14:44:57 +02:00
|
|
|
void BKE_curve_init(struct Curve *cu);
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type);
|
Refactor ID copying (and to some extent, ID freeing).
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-08-07 16:39:55 +02:00
|
|
|
void BKE_curve_copy_data(struct Main *bmain, struct Curve *cu_dst, const struct Curve *cu_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Curve *BKE_curve_copy(struct Main *bmain, const struct Curve *cu);
|
2016-07-20 19:49:45 +02:00
|
|
|
void BKE_curve_make_local(struct Main *bmain, struct Curve *cu, const bool lib_local);
|
2012-04-28 16:49:00 +00:00
|
|
|
short BKE_curve_type_get(struct Curve *cu);
|
|
|
|
void BKE_curve_type_test(struct Object *ob);
|
|
|
|
void BKE_curve_curve_dimension_update(struct Curve *cu);
|
2013-08-19 09:58:28 +00:00
|
|
|
|
2013-08-21 07:40:19 +00:00
|
|
|
void BKE_curve_boundbox_calc(struct Curve *cu, float r_loc[3], float r_size[3]);
|
2013-08-19 09:58:28 +00:00
|
|
|
struct BoundBox *BKE_curve_boundbox_get(struct Object *ob);
|
2012-05-05 21:28:12 +00:00
|
|
|
void BKE_curve_texspace_calc(struct Curve *cu);
|
2013-08-19 09:58:28 +00:00
|
|
|
void BKE_curve_texspace_get(struct Curve *cu, float r_loc[3], float r_rot[3], float r_size[3]);
|
2009-04-20 15:06:46 +00:00
|
|
|
|
Move curve's boundbox and texspace calculation out of modifier stack
There were several issues with how bounding box and texture space
are calculated:
- This was done at the same time as applying modifiers, meaning if
several objects are sharing the same curve datablock, bounding
box and texture space will be calculated multiple times.
Further, allocating bounding box wasn't safe for threading.
- Bounding box and texture space were evaluated after pre-tessellation
modifiers are applied. This means Curve-level data is actually
depends on object data, and it's really bad because different
objects could have different modifiers and this leads to
conflicts (curve's data depends on object evaluation order)
and doesn't behave in a predictable way.
This commit moves bounding box and texture space evaluation from
modifier stack to own utility functions, just like it's was done
for meshes.
This makes curve objects update thread-safe, but gives some
limitations as well. Namely, with such approach it's not so
clear how to preserve the same behavior of texture space:
before this change texture space and bounding box would match
beveled curve as accurate as possible.
Old behavior was nice for quick texturing -- in most cases you
didn't need to modify texture space at all. But texture space
was depending on render/preview settings which could easily lead
to situations, when final result would be far different from
preview one.
Now we're using CV points coordinates and their radius to approximate
the bounding box. This doesn't give the same exact texture space,
but it helps a lot keeping texture space in a nice predictable way.
We could make approximation smarter in the future, but fir now
added operator to match texture space to fully tessellated curve
called "Match Texture Space".
Review link:
https://codereview.appspot.com/15410043/
Brief description:
http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2013/Results#Curve_Texture_Space
2013-10-20 14:41:33 +02:00
|
|
|
bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max[3]);
|
2013-03-09 05:35:49 +00:00
|
|
|
bool BKE_curve_center_median(struct Curve *cu, float cent[3]);
|
|
|
|
bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]);
|
2017-08-11 22:16:44 +10:00
|
|
|
void BKE_curve_transform_ex(struct Curve *cu, float mat[4][4], const bool do_keys, const bool do_props, const float unit_scale);
|
|
|
|
void BKE_curve_transform(struct Curve *cu, float mat[4][4], const bool do_keys, const bool do_props);
|
2014-02-03 18:55:59 +11:00
|
|
|
void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys);
|
2013-08-14 11:29:58 +00:00
|
|
|
void BKE_curve_material_index_remove(struct Curve *cu, int index);
|
|
|
|
void BKE_curve_material_index_clear(struct Curve *cu);
|
2014-07-17 17:12:12 +02:00
|
|
|
int BKE_curve_material_index_validate(struct Curve *cu);
|
2015-04-30 08:07:15 +10:00
|
|
|
void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
2014-01-27 15:18:40 +11:00
|
|
|
ListBase *BKE_curve_nurbs_get(struct Curve *cu);
|
|
|
|
|
2015-07-09 13:14:09 +10:00
|
|
|
int BKE_curve_nurb_vert_index_get(const struct Nurb *nu, const void *vert);
|
|
|
|
void BKE_curve_nurb_active_set(struct Curve *cu, const struct Nurb *nu);
|
2014-01-27 15:18:40 +11:00
|
|
|
struct Nurb *BKE_curve_nurb_active_get(struct Curve *cu);
|
|
|
|
void *BKE_curve_vert_active_get(struct Curve *cu);
|
2015-07-09 13:14:09 +10:00
|
|
|
void BKE_curve_nurb_vert_active_set(struct Curve *cu, const struct Nurb *nu, const void *vert);
|
2014-01-27 15:18:40 +11:00
|
|
|
bool BKE_curve_nurb_vert_active_get(struct Curve *cu, struct Nurb **r_nu, void **r_vert);
|
|
|
|
void BKE_curve_nurb_vert_active_validate(struct Curve *cu);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
2014-03-16 03:24:05 +11:00
|
|
|
float (*BKE_curve_nurbs_vertexCos_get(struct ListBase *lb, int *r_numVerts))[3];
|
2013-08-19 09:29:51 +00:00
|
|
|
void BK_curve_nurbs_vertexCos_apply(struct ListBase *lb, float (*vertexCos)[3]);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
2013-08-19 09:29:51 +00:00
|
|
|
float (*BKE_curve_nurbs_keyVertexCos_get(struct ListBase *lb, float *key))[3];
|
|
|
|
void BKE_curve_nurbs_keyVertexTilts_apply(struct ListBase *lb, float *key);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
Fix T50745: Shape key editing on bezier objects broken with Rendered Viewport Shading
So... Curve+shapekey was even more broken than it looked, this report was
actually a nice crasher (immediate crash in an ASAN build when trying to
edit a curve shapekey with some viewport rendering enabled).
There were actually two different issues here.
I) The less critical: rB6f1493f68fe was not fully fixing issues from
T50614. More specifically, if you updated obdata from editnurb
*without* freeing editnurb afterwards, you had a 'restored' (to
original curve) editnurb, without the edited shapekey modifications
anymore. This was fixed by tweaking again `calc_shapeKeys()` behavior in
`ED_curve_editnurb_load()`.
II) The crasher: in `ED_curve_editnurb_make()`, the call to
`init_editNurb_keyIndex()` was directly storing pointers of obdata
nurbs. Since those get freed every time `ED_curve_editnurb_load()` is
executed, it easily ended up being pointers to freed memory. This was
fixed by copying those data, which implied more complex handling code
for editnurbs->keyindex, and some reshuffling of a few functions to
avoid duplicating things between editor's editcurve.c and BKE's curve.c
Note that the separation of functions between editors and BKE area for
curve could use a serious update, it's currently messy to say the least.
Then again, that area is due to rework since a long time now... :/
Finally, aligned 'for_render' curve evaluation to mesh one - now
editing a shapekey will show in rendered viewports, if it does have some
weight (exactly as with shapekeys of meshes).
2017-02-22 21:20:50 +01:00
|
|
|
void BKE_curve_editNurb_keyIndex_delCV(struct GHash *keyindex, const void *cv);
|
|
|
|
void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex);
|
2012-04-28 16:49:00 +00:00
|
|
|
void BKE_curve_editNurb_free(struct Curve *cu);
|
|
|
|
struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
|
|
|
|
|
2013-05-13 07:13:28 +00:00
|
|
|
float *BKE_curve_make_orco(struct Scene *scene, struct Object *ob, int *r_numVerts);
|
2012-04-28 16:49:00 +00:00
|
|
|
float *BKE_curve_surf_make_orco(struct Object *ob);
|
|
|
|
|
2014-08-18 17:35:51 +06:00
|
|
|
void BKE_curve_bevelList_free(struct ListBase *bev);
|
2013-08-19 09:36:40 +00:00
|
|
|
void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render);
|
2014-03-20 22:56:28 +11:00
|
|
|
void BKE_curve_bevel_make(struct Scene *scene, struct Object *ob, struct ListBase *disp,
|
|
|
|
const bool for_render, const bool use_render_resolution);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
|
|
|
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
|
2015-05-07 18:10:34 +02:00
|
|
|
void BKE_curve_forward_diff_tangent_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
2014-03-11 17:12:18 +11:00
|
|
|
void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *tb, struct rctf *r_rect);
|
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
/* ** Nurbs ** */
|
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
bool BKE_nurbList_index_get_co(struct ListBase *editnurb, const int index, float r_co[3]);
|
2012-09-16 08:25:31 +00:00
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
int BKE_nurbList_verts_count(struct ListBase *nurb);
|
|
|
|
int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb);
|
|
|
|
|
|
|
|
void BKE_nurbList_free(struct ListBase *lb);
|
2017-06-14 22:36:30 +02:00
|
|
|
void BKE_nurbList_duplicate(struct ListBase *lb1, const struct ListBase *lb2);
|
2014-03-30 14:04:24 +11:00
|
|
|
void BKE_nurbList_handles_set(struct ListBase *editnurb, const char code);
|
2013-12-14 02:32:48 +11:00
|
|
|
void BKE_nurbList_handles_recalculate(struct ListBase *editnurb, const bool calc_length, const char flag);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
|
|
|
void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag);
|
2013-09-16 00:03:33 +00:00
|
|
|
void BKE_nurbList_flag_set(ListBase *editnurb, short flag);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
|
|
|
void BKE_nurb_free(struct Nurb *nu);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Nurb *BKE_nurb_duplicate(const struct Nurb *nu);
|
2013-10-17 19:57:14 +00:00
|
|
|
struct Nurb *BKE_nurb_copy(struct Nurb *src, int pntsu, int pntsv);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
|
|
|
void BKE_nurb_test2D(struct Nurb *nu);
|
Move curve's boundbox and texspace calculation out of modifier stack
There were several issues with how bounding box and texture space
are calculated:
- This was done at the same time as applying modifiers, meaning if
several objects are sharing the same curve datablock, bounding
box and texture space will be calculated multiple times.
Further, allocating bounding box wasn't safe for threading.
- Bounding box and texture space were evaluated after pre-tessellation
modifiers are applied. This means Curve-level data is actually
depends on object data, and it's really bad because different
objects could have different modifiers and this leads to
conflicts (curve's data depends on object evaluation order)
and doesn't behave in a predictable way.
This commit moves bounding box and texture space evaluation from
modifier stack to own utility functions, just like it's was done
for meshes.
This makes curve objects update thread-safe, but gives some
limitations as well. Namely, with such approach it's not so
clear how to preserve the same behavior of texture space:
before this change texture space and bounding box would match
beveled curve as accurate as possible.
Old behavior was nice for quick texturing -- in most cases you
didn't need to modify texture space at all. But texture space
was depending on render/preview settings which could easily lead
to situations, when final result would be far different from
preview one.
Now we're using CV points coordinates and their radius to approximate
the bounding box. This doesn't give the same exact texture space,
but it helps a lot keeping texture space in a nice predictable way.
We could make approximation smarter in the future, but fir now
added operator to match texture space to fully tessellated curve
called "Match Texture Space".
Review link:
https://codereview.appspot.com/15410043/
Brief description:
http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2013/Results#Curve_Texture_Space
2013-10-20 14:41:33 +02:00
|
|
|
void BKE_nurb_minmax(struct Nurb *nu, bool use_radius, float min[3], float max[3]);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
|
|
|
void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
|
|
|
|
void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
|
|
|
|
|
2016-07-03 23:20:53 +10:00
|
|
|
unsigned int BKE_curve_calc_coords_axis_len(
|
|
|
|
const unsigned int bezt_array_len, const unsigned int resolu,
|
|
|
|
const bool is_cyclic, const bool use_cyclic_duplicate_endpoint);
|
|
|
|
void BKE_curve_calc_coords_axis(
|
|
|
|
const struct BezTriple *bezt_array, const unsigned int bezt_array_len, const unsigned int resolu,
|
|
|
|
const bool is_cyclic, const bool use_cyclic_duplicate_endpoint,
|
|
|
|
/* array params */
|
|
|
|
const unsigned int axis, const unsigned int stride,
|
|
|
|
float *r_points);
|
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
void BKE_nurb_knot_calc_u(struct Nurb *nu);
|
|
|
|
void BKE_nurb_knot_calc_v(struct Nurb *nu);
|
2009-10-22 09:31:07 +00:00
|
|
|
|
2008-05-26 09:50:46 +00:00
|
|
|
/* nurb checks if they can be drawn, also clamp order func */
|
2013-03-09 05:35:49 +00:00
|
|
|
bool BKE_nurb_check_valid_u(struct Nurb *nu);
|
|
|
|
bool BKE_nurb_check_valid_v(struct Nurb *nu);
|
2014-04-08 07:28:14 +10:00
|
|
|
bool BKE_nurb_check_valid_uv(struct Nurb *nu);
|
2008-05-26 09:50:46 +00:00
|
|
|
|
2013-03-09 05:35:49 +00:00
|
|
|
bool BKE_nurb_order_clamp_u(struct Nurb *nu);
|
|
|
|
bool BKE_nurb_order_clamp_v(struct Nurb *nu);
|
2008-05-26 09:50:46 +00:00
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
void BKE_nurb_direction_switch(struct Nurb *nu);
|
2013-03-20 15:01:15 +00:00
|
|
|
bool BKE_nurb_type_convert(struct Nurb *nu, const short type, const bool use_handles);
|
2010-07-25 11:57:36 +00:00
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
void BKE_nurb_points_add(struct Nurb *nu, int number);
|
|
|
|
void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number);
|
|
|
|
|
2015-07-09 13:14:09 +10:00
|
|
|
int BKE_nurb_index_from_uv(struct Nurb *nu, int u, int v);
|
|
|
|
void BKE_nurb_index_to_uv(struct Nurb *nu, int index, int *r_u, int *r_v);
|
|
|
|
|
2013-07-24 13:56:36 +00:00
|
|
|
struct BezTriple *BKE_nurb_bezt_get_next(struct Nurb *nu, struct BezTriple *bezt);
|
|
|
|
struct BezTriple *BKE_nurb_bezt_get_prev(struct Nurb *nu, struct BezTriple *bezt);
|
|
|
|
struct BPoint *BKE_nurb_bpoint_get_next(struct Nurb *nu, struct BPoint *bp);
|
|
|
|
struct BPoint *BKE_nurb_bpoint_get_prev(struct Nurb *nu, struct BPoint *bp);
|
|
|
|
|
|
|
|
void BKE_nurb_bezt_calc_normal(struct Nurb *nu, struct BezTriple *bezt, float r_normal[3]);
|
|
|
|
void BKE_nurb_bezt_calc_plane(struct Nurb *nu, struct BezTriple *bezt, float r_plane[3]);
|
|
|
|
|
2015-07-09 02:56:04 +10:00
|
|
|
void BKE_nurb_bpoint_calc_normal(struct Nurb *nu, struct BPoint *bp, float r_normal[3]);
|
2017-07-10 14:37:20 +10:00
|
|
|
void BKE_nurb_bpoint_calc_plane(struct Nurb *nu, struct BPoint *bp, float r_plane[3]);
|
2015-07-09 02:56:04 +10:00
|
|
|
|
2014-03-01 12:57:15 +11:00
|
|
|
void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next,
|
|
|
|
const bool is_fcurve);
|
2013-08-29 02:32:51 +00:00
|
|
|
void BKE_nurb_handle_calc_simple(struct Nurb *nu, struct BezTriple *bezt);
|
2015-01-26 20:55:41 +11:00
|
|
|
void BKE_nurb_handle_calc_simple_auto(struct Nurb *nu, struct BezTriple *bezt);
|
2002-10-30 02:07:20 +00:00
|
|
|
|
2012-04-28 16:49:00 +00:00
|
|
|
void BKE_nurb_handles_calc(struct Nurb *nu);
|
|
|
|
void BKE_nurb_handles_autocalc(struct Nurb *nu, int flag);
|
2013-10-01 08:18:43 +00:00
|
|
|
void BKE_nurb_bezt_handle_test(struct BezTriple *bezt, const bool use_handle);
|
|
|
|
void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles);
|
2012-04-28 16:49:00 +00:00
|
|
|
|
2015-05-12 13:57:11 +05:00
|
|
|
/* **** Depsgraph evaluation **** */
|
|
|
|
|
|
|
|
struct EvaluationContext;
|
|
|
|
|
|
|
|
void BKE_curve_eval_geometry(struct EvaluationContext *eval_ctx,
|
|
|
|
struct Curve *curve);
|
|
|
|
|
2017-10-30 22:36:51 +11:00
|
|
|
/* curve_decimate.c */
|
|
|
|
unsigned int BKE_curve_decimate_bezt_array(
|
|
|
|
struct BezTriple *bezt_array, const unsigned int bezt_array_len, const unsigned int resolu, const bool is_cyclic,
|
|
|
|
const char flag_test, const char flag_set,
|
|
|
|
const float error_sq_max, const unsigned int error_target_len);
|
|
|
|
|
|
|
|
void BKE_curve_decimate_nurb(
|
|
|
|
struct Nurb *nu, const unsigned int resolu,
|
|
|
|
const float error_sq_max, const unsigned int error_target_len);
|
|
|
|
|
2013-03-09 05:35:49 +00:00
|
|
|
#endif /* __BKE_CURVE_H__ */
|