Commit Graph

713 Commits

Author SHA1 Message Date
Bastien Montagne 7bae9ee6b6 Mesh validate: add an option to not clean temp/cache CDLayers.
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-02-05 14:03:01 +01:00
Tamito Kajiyama 0305b208eb Fix for Freestyle view map caching not properly updated upon changes of render resolution and scale.
Problem reports independently by Light BWK and Folkert de Vries, thanks.
2015-02-02 10:00:12 +09:00
Bastien Montagne fca515838e Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).
Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)'
and 'strcmp(foo, bar) == 0' in several places...
2015-01-26 16:59:24 +01:00
Campbell Barton 967f93d1c1 Fix error in freestyle api 2015-01-20 20:00:31 +11:00
Campbell Barton 704494e8cd Fix own error in freestyle api 2015-01-19 11:31:23 +11:00
Tamito Kajiyama c9e5d9226b Fix T43090: Cycles + Freestyle + border render = black render.
The reported problem was due to a special case where there are no strokes
to be rendered.  Since rendering an empty scene is a waste of time, the issue
was addressed here by skipping the stroke rendering process entirely.
2015-01-18 00:39:03 +09:00
Campbell Barton b09563ca8c Cleanup: fixes for building with recent clang 2015-01-14 05:11:20 +11:00
Campbell Barton 9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
Campbell Barton b240b8e231 Freestyle: reserve array sizes before filling
also use PyList_GET_ITEM when list size is known.
2015-01-04 21:23:26 +11:00
Campbell Barton de6b546e15 Fix 8 memory leaks from bad PyList_Append use 2015-01-04 20:35:16 +11:00
Campbell Barton 8106a6b75d mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped,
add new function for creating wrapped objects.

also fixes unlikely memory leak if the data-array can't be allocated.
2015-01-04 17:43:57 +11:00
Tamito Kajiyama d8b00a3bf5 Freestyle: memory consumption optimization in stroke rendering.
Previously individual strokes were represented by distinct mesh objects
no matter how many vertices and materials each stroke has, although
the vertex and material counts can be quite small depending on the input
scene data.  Now stroke meshes are packed into a minimum number of
mesh objects, so as to reduce the overheads of Blender object creation.
2015-01-03 21:54:56 +09:00
Tamito Kajiyama f06335e12f Fix for view map cache not flushed by updates of edge detection options.
This fix should be considered for inclusion in the 2.73 release, since
it concerns a new feature of Freestyle introduced in 2.73.
2015-01-03 15:40:07 +09:00
Tamito Kajiyama 3fea13ed6c Freestyle: Fix for view map caching not flashed properly in view port rendering. 2014-11-26 23:26:20 +09:00
Bastien Montagne 216989686b Fix freestyle compile.
Do not know why this shows up now, probably a recent tweak in BLI_utildefines.h or so...
2014-11-23 20:49:34 +01:00
Campbell Barton 43fa4baa6c Refactor: BLI_path_util (part 2)
Use BKE_appdir/tempdir naming prefix for functions extracted from BLI_path_util
2014-11-23 18:55:52 +01:00
Campbell Barton 6308c16675 Refactor: BLI_path_util (split out app directory access)
This module is intended for path manipulation functions
but had utility functions added to access various directories.
2014-11-23 18:42:18 +01:00
Campbell Barton 133f79e449 Cleanup: warnings, typos 2014-10-29 14:15:21 +01:00
Campbell Barton 25b7455eea Cleanup: de-duplicate engine-id's 2014-10-28 12:49:04 +01:00
Tamito Kajiyama a3e3ac03ff Fix T42351: Freestyle will not render edges selected by Edge Type: Material Boundary, if the materials are different, but look identical. 2014-10-23 22:01:45 +09:00
Tamito Kajiyama c2d6de8e20 Freestyle: Fix for memory leaks in StrokeVertexIterator.
The issues identified here are regression from 2.71, so the present code
revision is appropriate for backporting if 2.72a is planned.
2014-10-10 18:57:36 +09:00
Tamito Kajiyama 5fdbb793ff Freestyle: Fix for StrokeVertexIterator.__next__() ignoring the first and only element.
A StrokeVertexIterator ignores the first element when it is the only element.
Such an iterator can be created by the .incremented() method from an iterator
over two stroke vertices.

This problem is a regression from 2.71.  The present fix is appropriate to backport
if Blender 2.72a is planned.

Problem report by Kazuhiro Murakawa through personal communications, thanks!
2014-10-10 18:57:35 +09:00
Tamito Kajiyama fe9394741b Freestyle: silence a GCC warning (-Wunused-function). 2014-10-09 01:31:08 +09:00
Tamito Kajiyama 14df7de916 D801: Freestyle: remove old and unused stroke shaders
This patch removes several stroke shaders written in C++ that are unused
and don't serve a real purpose any more.  The removed shaders are:

  - BPy_ColorVariationPatternShader
  - BPy_StrokeTextureShader
  - BPy_TextureAssignerShader
  - BPy_ThicknessVariationPatternShader
  - BPy_fstreamShader
  - BPy_streamShader

and a few more that weren't even exposed to the Python API.

Some minor edits were made by the reviewer.

Differential Revision: https://developer.blender.org/D801

Reviewed by: kjym3
2014-10-09 01:31:07 +09:00
Campbell Barton 50af4d208d Cleanup: spelling, ws 2014-10-03 08:21:14 +02:00
Sergey Sharybin e99919f713 Freestyle: For until c++11 is accepted only static members could b initialized in-lined 2014-10-02 19:24:16 +06:00
Bastien Montagne 69356b0b9b Fix freestyle/bplayer build (usual stub stuff). 2014-10-02 12:47:05 +02:00
Tamito Kajiyama c47682d6ab Freestyle: Fix for destructive view map modifications during chaining operations.
The view map is mostly treated as a read-only data structure by line stylization
operations (i.e., selection, chaining, splitting, sorting and stroke creation).  The
only exception is the chaining operation in some cases where insertion of extra
FEdge objects is necessary to ensure the continuity of underlying FEdges from
which a chain is constructed.

The present revision addresses the removal of extra FEdges so to keep the view
map clean and suitable for reuse in subsequent render frames.
2014-10-02 17:52:16 +09:00
Tamito Kajiyama c946a450ed Freestyle: Finer memory statistics with CXX_GUARDEDALLOC. 2014-10-02 17:52:14 +09:00
Tamito Kajiyama dd9c53b312 Freestyle: View map caching.
New render layer option named "View map cache" is added to reuse a
previously computed view map for subsequent rendering.  The cache is
automatically updated when the mesh geometry of the input 3D scene has
been changed.

This functionality offers a major performance boost for Freestyle
animation rendering when camera-space mesh geometry is static, as well
as for repeated still renders with updates of line stylization options.

Although the "View map cache" toggle is a render layer option, the cache
memory is shared by all render layers and scenes.  This means that if
Freestyle is used for two or more render layers (possibly in different
scenes through the compositor), then the cached view map for one render
layer is replaced by a new view map for another render layer and hence
no performance gain is expected.
2014-10-02 17:52:13 +09:00
Tamito Kajiyama 99ef213dcb Freestyle: minor docstring revision of Operators.reset(). 2014-09-28 11:17:32 +09:00
Tamito Kajiyama c900cd3bd8 Freestyle: Expose the Operators.reset() function to Python.
The Operators.reset function is exposed to the Freestyle Python API, which makes
it possible to combine multiple style modules into one file.

Differential revision: https://developer.blender.org/D802

Author: flokkievids (Folkert de Vries)

Reviewed by: kjym3 (Tamito Kajiyama)
2014-09-28 11:17:31 +09:00
Tamito Kajiyama d342f46682 D713: correct error /w braces (freestyle)
Differential revision: https://developer.blender.org/D713

Author: campbellbarton (Campbell Barton)
2014-09-23 22:35:15 +09:00
Tamito Kajiyama 64ade99ecc Freestyle: Python API documentation updates.
Fixed dead references of API identifiers (e.g., freestyle.types.Interface0D)
due to relocations of the identifiers into submodules.  Also made various minor
revisions of mark-ups and typos.
2014-09-19 13:41:47 +09:00
Tamito Kajiyama f87ca5f1c3 Fix for missing Freestyle sections in the Blender Python API documentation.
Freestyle sections of the API docs were empty due to Freestyle module reorganization
in commit rB6498b96ce7081db039354228213d72e8c70bd3aa.

Module __all__ property was added to submodules so as to properly exclude irrelevant
documentation elements such as mathutils.Vector.
2014-09-18 15:48:15 +09:00
Tamito Kajiyama 507af00855 Freestyle: Fix for missing quality control on line rendering in Cycles.
Freestyle was using the default Cycles rendering settings (e.g., the number
of samples) and users could not change them.  Now all render parameters
(except for film_transparent) are inherited for Freestyle stroke rendering.

Problem report by Danny Grimm on Facebook, thanks!
2014-09-11 13:41:14 +09:00
Tamito Kajiyama f6b4b12961 Better fix for T41464: Material Boundary bug in Freestyle.
The problem addressed here is that there was no mean to check if an iterator
points the last of the elements being iterated over.  Such checking is necessary
to reliably dereference the iterator (i.e., calling the operator*() method of the
underlying C++ iterator object).

Now Interface0DIterator and StrokeVertexIterator have an .at_last property
to check if an iterator points the last element.  Using this new API feature,
the present commit partly reverts the previous commit rBeb8964fb7f19 to
better address T41464.

Differential revision: https://developer.blender.org/D752

Author: flokkievids (Folkert de Vries)

Reviewed by: kjym3 (Tamito Kajiyama)
2014-09-02 21:24:41 +09:00
Tamito Kajiyama eb8964fb7f Fix T41464: Material Boundary bug in Freestyle.
The reported issue was caused by an old bug combined with another bug
introduced by recent Freestyle Python API updates.

The old bug was that a mutable reference to CurvePoint was treated as if
it were immutable.  Iteration over CurvePoint objects is implemented by
the C++ CurvePointIterator class, whose dereference method
CurvePointIterator::operator*() returns a reference to a mutable data
member (probably originally intended for better performance).  Hence the
returned reference may vary upon iteration over different CurvePoints.
This implementation detail was overlooked and the returned reference was
treated as immutable (which is the case in fact for other Interface0D
subclasses except for CurvePoint).  This bug was surprisingly old as it
existed before the beginning of Freestyle integration into Blender.

The other bug was in the MaterialBoundaryUP0D predicate class that was
not properly handling the end of iteration.  It is noted that when the
iter() and next() built-in functions are applied to Interface0DIterator,
it is no longer possible to reliably check the end of iteration by the
.is_end property of the iterator.  Namely, the .is_end property works as
expected only when iteration is carried out in combination with the
conventional .increment() and .decrement() methods of the iterator.  For
this reason the commit rBb408d8af31c9 was partly reverted to recover the
previous definition of MaterialBoundaryUP0D.
2014-08-20 10:37:41 +09:00
Campbell Barton bba80ed7af Cleanup 2014-08-17 12:18:40 +10:00
Campbell Barton 7c9b8aa6cc Fix possible uninitialized var use 2014-08-13 10:38:08 +10:00
Campbell Barton 7df4fc5eaf Spelling 2014-08-13 09:34:37 +10:00
Tamito Kajiyama b65a022892 Freestyle: Removed the stored bContext from the Controller class.
The stored context object was used for creation of shade nodes.  A closer look at the
node system showed that the context is not actually used when shader nodes are
added to a shader node tree.  Relying on this fact, now a NULL pointer is passed to
nodeAddStaticNode() instead of the stored bContext pointer.
2014-08-12 10:10:55 +09:00
Tamito Kajiyama 75e03e93be Freestyle: removed dead code in BlenderStrokeRenderer. 2014-08-12 10:10:51 +09:00
Tamito Kajiyama b606520791 Freestyle: Removed debugging code (use G.main instead of Freestyle-local struct Main). 2014-08-12 10:10:49 +09:00
Tamito Kajiyama f7d3f2b228 Fix for vertex colors not working properly.
Looks like the issue was caused by a UV map name starting with a lower case
letter (e.g., "color").  Capitalizing the name fixed the problem.  Also adjusted
the creation of custom data layers to optimize things a bit.
2014-08-12 10:10:48 +09:00
Tamito Kajiyama 829e25c922 Fix for wrong link in the line style shader nodes due to a typo. 2014-08-12 10:10:47 +09:00
Tamito Kajiyama 7dd605e361 Fix for SCENE_OT_freestyle_stroke_material_create not respecting "use_nodes" line style prop. 2014-08-12 10:10:46 +09:00
Tamito Kajiyama 7852fc8bcd Freestyle: Proper support for alpha transparency in line style shader nodes for Cycles. 2014-08-12 10:10:45 +09:00
Tamito Kajiyama 2843aa1501 Freestyle: Fix for error handling in SCENE_OT_freestyle_stroke_material_create. 2014-08-12 10:10:44 +09:00
Tamito Kajiyama cc33d73185 Freestyle: Fix for an increasing reference count of images in copied Image Texture shader nodes. 2014-08-12 10:10:43 +09:00