Commit Graph

696 Commits

Author SHA1 Message Date
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
Tamito Kajiyama
45af769020 Freestyle: Properly reconnect links from a UV Along Stroke node to a UV Map node. 2014-08-12 10:10:42 +09:00
Tamito Kajiyama
6f60ca3cd4 Freestyle: Caching of auto-generated materials from line style shader nodes. 2014-08-12 10:10:38 +09:00
Tamito Kajiyama
7b1234be1c Removed/disabled debugging code. 2014-08-12 10:10:37 +09:00
Tamito Kajiyama
34c133a488 Freestyle: an improved workflow of line style shading nodes.
Removed the previous changes for passing a line style through the Controller, and
revised the BlenderTextureShader to assign the shader node tree of a line style
(if specified) to strokes.  This way the assignment of shading nodes can be done
through both the Freestyle GUI and Python scripting.
2014-08-12 10:10:36 +09:00
Tamito Kajiyama
c38e80d632 WIP commit just for a record of a working snapshot of code revisions for node-based textured strokes. 2014-08-12 10:10:35 +09:00
Tamito Kajiyama
a2a2d4679a Made temporary changes to use G.main rather than Freestyle-local Main for debugging. 2014-08-12 10:10:34 +09:00
Tamito Kajiyama
622ef089f9 Freestyle: Fix for a crash during access to Scene properties from within Python. 2014-08-12 10:10:33 +09:00
Tamito Kajiyama
1ddb8e238e Freestyle: Keep a reference of the line style in Stroke rather than in StrokeRep. 2014-08-12 10:10:31 +09:00
Tamito Kajiyama
83360eccae Fix for renamed API functions in rB415af0b. 2014-08-12 10:10:29 +09:00
Tamito Kajiyama
701f0356df Freestyle: Removed a debug print in BlenderStrokeRenderer::GetStrokeShader(). 2014-08-12 10:10:28 +09:00
Tamito Kajiyama
722951eceb Freestyle: Added "blend_type" and "use_clamp" options to the Output Line Style shader node. 2014-08-12 10:10:27 +09:00
Tamito Kajiyama
7e9ac19b2c Freestyle: Fix for stroke_shader node default values copied from the Output Line Style node. 2014-08-12 10:10:24 +09:00
Tamito Kajiyama
4e11fcead0 Follow-up to rB647969f9b617: Renamed CTX_data_linestyle_from_scene() to BKE_get_linestyle_from_scene(). 2014-08-12 10:10:21 +09:00
Tamito Kajiyama
fc85446c50 Freestyle: Added preliminary support for textured strokes in Cycles.
Now the shader node tree of a line style ID datablock is used to define textures
as well as their mapping and influence.

TODO: Textures alpha channel mapping and influence.
TODO: Blend mode in the Output Line Style shader node.
2014-08-12 10:10:20 +09:00
Tamito Kajiyama
91c31efe01 Enabled USE_CYCLES_FOR_STROKE_RENDERING compile-time flag by default. 2014-08-12 10:10:15 +09:00
Tamito Kajiyama
1e513658de Always use the Blender Internal renderer for stroke rendering. 2014-08-12 10:10:12 +09:00
Tamito Kajiyama
d459d102b5 Added new operator "Create Freestyle Stroke Material" for testing. 2014-08-12 10:10:11 +09:00