Commit Graph

92 Commits

Author SHA1 Message Date
b640700597 Cleanup: style 2015-04-30 08:18:23 +10:00
4288ab16e5 Add material slot reorder buttons 2015-04-28 07:30:04 +10:00
b1d758ae6b Cleanup: redundant struct declarations 2015-03-29 03:56:39 +11:00
027361c898 Fix T41834: Ctrl+LMB, Extrude Curves 2+ splines
Extrude and Ctrl+LMB now support multiple selected vertices.
Also maintain active vertices.

D964 by Tyler Sliwkanich with own modifications
2015-01-26 21:08:43 +11:00
23e14259d2 Code cleanup: synchronize const qualifiers between declaration and definition 2014-10-31 16:17:02 +01:00
bae0f904ee Fix T42257: Curve vertex parent not working with animation
Vertex parent was using original non-modified nurbs list, simply because
it didn't have something else to operate with.

Now we've got deformed by pre-tessellation modifiers nurbs in the curve
cache which might be used y the vertex parent.
2014-10-21 14:44:08 +02:00
e8f3fa99de Support more object types scene-scale (on creation)
- lamp
- camera
- font
- empty & effector

Also fix inconsistency with apply transform
(modified shape-keys for meshes but not curve/lattice)
2014-09-01 21:01:11 +10:00
6c7467e0da Fix T41085: Blender crashes when using "spline" or "segments" for bevel curve factor.
Root of the issue goes to the fact that bevel list calculation might drop some points
if they're at the same position. This made spline length calculation goes wrong.

Now the length of the bevel segments is stored in the bevel list, so values are
always reliable.

Initial patch by Lukas Treyer with some tweaks from me.
2014-08-18 17:38:20 +06:00
1097a3f70d Add helper to validate (and fix) material indices of meshes' polygons, curves' splines and texts' letters.
Useful especially for importer addons.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D650
2014-07-17 17:16:07 +02:00
c61eb64f06 Fix T39635: Crash convening curve to mesh 2014-04-08 07:41:38 +10:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
0782187979 Code cleanup: BKE_nurbList_handles_set used some strange logic 2014-03-30 15:04:20 +11:00
27e86ed832 Code cleanup: use bools 2014-03-20 22:56:28 +11:00
2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
4cfd14644b 3D Text: textbox selection while in editmode
D395 from Henrik Aarnio with some improvements.
2014-03-11 17:16:08 +11:00
f29dadc5ea Code cleanup: comment unused code in calchandleNurb_intern
Also remove outdated comments.
2014-03-01 12:58:52 +11:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
Kevin Mackay
fbc7ab30ff Curves: save active point to file
Changed curve active point from pointer to index. Allows curve active point to be saved to file and retained between modes for free. Also some small optimisations by removing pointer look up code.

- Made active point access functions into BKE API calls.
- Fixes operators where curve de-selection resulted in unsel-active point.
- Split curve delete into 2 functions
2014-01-27 15:21:04 +11:00
0a61116e54 Fix for converting unfilled 3d text into a mesh 2013-12-23 12:12:40 +11:00
c456cd94b2 Curve Handle Recalculate (Ctrl+N)
T37799 Patch from Simon Repp
with added option to recalculate handle lengths.
2013-12-14 02:53:19 +11:00
3a370ec6ec 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-12-11 16:32:41 +06:00
Kevin Mackay
4230b8f9c4 Patch [#37115] Surface split and separate operators
Added surface support to recent curve split operator, completing quick hack todo
Updated nurbs separate operator to make use of new split logic, completing tools todo
Added 'Delete segment' option to surfaces and improved surface duplication, used for split/separate
2013-10-17 19:57:14 +00:00
f1f7648d4c fix for error setting vector handles to free when both vector handles were selected but not the mid-point.
only one of the handles would be changed to the HD_FREE.

effected curves and fcurves.
2013-10-01 08:18:43 +00:00
e8ade192ff move editcurve add functions into their own source file editcurve_add.c 2013-09-16 00:03:33 +00:00
95fcf02500 patch [#36336] Split operator for curves and surfaces
by Kevin Mackay (yakca)

The operator follows roughly the same behaviour as the split operator for a mesh (Ykey).
2013-08-29 02:32:51 +00:00
785a67f396 Partial revert of recenr cu->disp merge commit
That ended up in tricky code trying to mimic depsgraph
branch behavior API-wise preserving texspace and bound
box calculation compatible with previous releases.

So for now bring cu->disp back to the trunk but keep
texpsace and boundbox APIs the same as in the branch.

This keeps texpsapce and boundbox behavior fully compatible
with previous releases and still makes API the same as
for meshes.
2013-08-21 07:40:19 +00:00
f030758515 Tag object-data level boundbox as invalid rather than freeing it
Object update used to free object-data level bounding box to trigger
it's re-calculation in the future. Such a freeing performed from
object update isn't thread-safe because mesh could be shared between
multiple objects.

Rather than freeing bounding box, tag it's as invalid, this is safe
from threading point of view and also prevents unnecessary memory
re-allocation.

Object-level bounding box is still reallocating, but think we could
change this easily in the future as well.

--
svn merge -r58154:58156 -r59258:59259 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:58:28 +00:00
7ef3f98de1 Made curves almost thread-safe
Now modifier stack wouldn't modify original curve's nurbs
and will operate on a copy of nurbs.

This makes it possible to process curve object update with
shared curve datablocks from multiple threads. There's no
big overhead for creating a copy of nurbs comparing to old
behavior which was allocating original vertex array and
apply coordinates on curve after all modifier are applied.

The only remained issue with curves is curve's bounding box
and texture space. It's not thread-safe, but it wouldn't
lead to crashes -- it just could lead to either memory
leak or wrong texture coordinates due to difference in
modifiers stacks of objects which shares the same curve.

--
svn merge -r57959:57961 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:36:40 +00:00
345fff872b Remove unused argument from utility curve functions
So far it was harmless, but with upcoming changes having this
argument could be confusing from logic point of view

--
svn merge -r57958:57959 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:29:51 +00:00
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
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
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
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
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
7961147a59 code cleanup: was using var named 'in' for output. 2013-03-09 11:55:12 +00:00
221a383366 use 'bool' for BLI_/BKE_ functions. 2013-03-09 05:35:49 +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
da9394f596 code cleanup: define sizes of vectors for function args and use C style comments 2012-10-15 09:11:17 +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
9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
c91cee2bb9 code cleanup: naming - BKE_mesh_* 2012-05-05 21:28:12 +00:00
f88cfd9168 Code and style cleanup in own modules in BKE and also mball module
- Make sure functions are named in way BKE_<object>_<action> (same way as RNA callbacks)
- Make functions which are used by mball.c only static and remove their prototypes
  from public header file.

Further cleanup is coming.
2012-04-28 16:49:00 +00:00
c21c58f44c style cleanup, also remove unused externs. 2012-03-11 19:09:01 +00:00
2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
b99f6e3d08 Fix #29005: Bezier/Surface Datablock switching bug?
This commit updates curve datablock to respect curve dimension flag
when setting datablock for curve.

Not ideal but this makes behavior quite expected, avoids big changes in
curves core stuff which depends on object type and prevents restrictions
on changing data datablock which works in general cases.
2011-11-03 16:16:19 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
1741269d30 resolve bad level calls from blenkenel/ into editors/ & remove editors from the include path from CMake & SCons.
* ED_curve_editnurbs --> curve_editnurbs
* ED_sculpt_modifiers_changed --> object_sculpt_modifiers_changed
2011-09-14 00:37:27 +00:00
c74bb09584 fix for material slot removal (r38879)
- The object ID was being passed to the data_delete_material_index_id() from object_remove_material_slot(), rather then the object data. (so the material slot fix wouldnt run in that case).
- add support for fixing text object materials too.
2011-07-31 12:43:41 +00:00
ca38366732 particles & vector-font: floats were being implicitly promoted to
doubles, adjust to use floats.
2011-03-28 11:21:39 +00:00