Commit Graph

878 Commits

Author SHA1 Message Date
899caeae49 Freestyle: Fix for a potential implementation error in the Python wrapper of the Nature class. 2014-03-13 21:00:59 +09:00
37cf28b341 Freestyle: avoid checking PyErr_Occurred and quiet warning 2014-03-13 11:54:59 +11:00
25ad7b44a0 Fix for prevoius commit: accidentally changed a ifndef to ifdef. 2014-03-09 00:30:50 +01:00
5559302369 Cleanup some useless/unneeded #ifdefs for MSVC2013. 2014-03-09 00:25:08 +01:00
26b1406f6e Freestyle: Fix for incorrect comparisons of Nature values with integer and boolean values.
The problem is that comparisons involving the constants Nature.POINT (for vertices) and
Nature.NO_FEATURE (for edges) were evaluated in a wrong way.  It is recalled that the
Nature class is a subclass of Python's built-in int type, and that these two constants are zero
when evaluated as numbers.  The issue was caused by the implementation of the constants
in an incompatible way for comparison with Python int (and boolean) values.  Specifically,
the zero of Python int is represented by an empty array of digits, whereas the zero-valued
Nature constants were represented by an array of size 1.  Python int comparison operators
first check the lengths of the arrays of two operands, and then start comparing the digits
only when the array length is the same.  For this reason, the two Nature constants were
not properly compared with int values (and thus with boolean values).  It is noted that the
zero-valued Nature constants may result from bitwise operations on other Nature constants
(e.g., Nature.SILHOUETTE & Nature.BORDER), so this issue must have affected many
existing style modules.

The problem was reported by Folkert de Vries (flokkievids) through personal communications.
Thanks a lot!
2014-03-05 21:56:38 +09:00
da5e6b98c9 Fix T38887: error in (still unused) freestyle math function implementation. 2014-02-28 18:15:24 +01:00
fdcdd5e52e Freestyle: Follow-up fix for the chaining operation bug in the previous commit.
Many thanks to flokkievids for identifying the inconsistency.
2014-02-13 09:56:56 +09:00
054094f582 Freestyle: Fix for chaining operators not concatenating edges with Freestyle edge marks and at material boundaries.
Problem report by Postoman on the BlenderArtists.org Freestyle thread, thanks a lot!
2014-02-12 18:17:21 +09:00
37026b12ec Code cleanup: use bool for static methods 2014-02-05 22:36:15 +11:00
1dc1d92dab Code cleanup: white space and cmake was broken on all platforms 2014-02-03 13:56:34 +11:00
a16998911b Freestyle: Fix for iterations over 0D elements in the reversed order.
The revision is concerned with Interface0DIterator and StrokeVertexIterator.
These iterators can be generated by Interface1D::vertices_end() and
Stroke::stroke_vertices_end(), respectively.  These methods return an
iterator poinitng the next index of the last 0D element (i.e., iterator's is_end
property is true).  When the iterators created in this way are used with
Python's iterator protocol (e.g., in a for-loop), iterations over 0D elements
are automatically performed in the reversed order.  This functionality was
broken after recent revisions concerning Freestyle iterators.

Also made minor code cleanup (white space).
2014-02-02 22:05:32 +09:00
41d778fa5d Docstring updates and code cleanup by flokkievids (Folkert de Vries). 2014-02-02 22:05:31 +09:00
bab88fee20 Code cleanup (mostly indentation and white space). 2014-02-02 22:05:30 +09:00
e9e2813fbe Fix for iterators' at_start flag left unset in C++ to Python conversion utility functions.
Also changed the type of the 'reversed' flag from int to bool.
2014-02-02 22:05:29 +09:00
b58beed604 Imported D222 Diff 2 (ID 781) by flokkievids (Folkert de Vries). 2014-02-02 22:05:28 +09:00
6498b96ce7 Reorganized the Freestyle Python API in a hierarchical package structure.
Both C- and Python-coded API components were rearranged into logical groups.
New Python modules are packaged as follows:

freestyle - Top-level package
freestyle.types - Classes for core data structues (e.g., view map)
freestyle.chainingiterators - Pre-defined chaining iterators
freestyle.functions - Pre-defined 0D and 1D functions
freestyle.predicates - Pre-defined 0D and 1D predicates
freestyle.shaders - Pre-defined stroke shaders
freestyle.utils - Utility functions

The Python modules are installed in scripts/freestyle/modules.  Pre-defined
styles are installed in scripts/freestyle/styles.

To-do: update styles according to the new Freestyle API package structure.
2014-01-28 23:33:57 +09:00
e79b244097 Fix collada and freestyle module compile errors after recent commit, forgot to
compile with those enabled.
2014-01-15 19:15:51 +01:00
ebbb6adf32 Fix for infinite freestyle re-render in the viewport
Was a regression since e618d8238e and was caused by the wrong
main being tagged for update.
2014-01-15 17:42:01 +06:00
e618d8238e Fix T38054: High CPU usage with many objects
This is a regression since threaded dependency graph landed to master.
Root of the issue goes to the loads of graph preparation being done
even if there's nothing to be updated.

The idea of this change is to use ID type recalc bits to determine
whether there're objects to be updated. Generally speaking, we now
check object and object data datablocks with DAG_id_type_tagged()
and if there's no such IDs tagged we skip the whole task pool creation
and so,

The only difficult aspect was that in some circumstances it was possible
that there are tagged objects but nothing in ID recalc bit fields.

There were several different circumstances when it was possible:

* When one assigns object->recalc flag directly DAG flush didn't
  set corresponding bits to ID recalc bits. Partially it is fixed
  by making it so flush will set bitfield, but also for object
  types there's no reason to assign recalc flag directly. Using
  generic DAG_id_type_tag works almost the same fast as direct
  assignment, ensures all the bitflags are set properly and for the
  long run it seems it's what we would actually want to.

* DAG_on_visible_update() didn't set recalc bits at all.

* Some areas were checking for object->recalc != 0, however it is was
  possible that object recalc flag contains PSYS_RECALC_CHILD which
  was never cleaned from there.

  No idea why would we need to assign such a flag when enabling
  scene simplification, this is to be investigated separately.

* It is possible that scene_update_post and frame_update_post handlers
  will modify objects. The issue is that DAG_ids_clear_recalc is called
  just after callbacks, which leaves objects with recalc flags but no
  corresponding bit in ID recalc bitfield. This leads to some kind of
  regression when using ID type tag fields to check whether there objects
  to be updated internally comparing threaded DAG with legacy one.

  For now let's have a workaround which will preserve tag for ID_OB
  if there're objects with OB_RECALC_ALL bits. This keeps behavior
  unchanged comparing with 2.69 release.
2014-01-13 15:57:51 +06:00
173f7a3d30 Fix compile on MSVC, we don't use "isfinite" anywhere else inside source/blender ;) 2013-12-17 21:36:45 +01:00
f1a989f9c3 Fix crash in freestyle vector parsing (hard to believe nobody noticed)
Vectors were being assigned as an array of classes in Vec2f_ptr_from_PyObject and similar functions,
rather then assigning a number to each axis.
2013-12-17 18:01:15 +11:00
61fb34a622 Fix for obscure freestyle crash when attempting to negate INT_MIN
This gives undefined behavior - in my case stays the same value and crashes.

Check for finite input resolves the issue.
2013-12-17 18:00:22 +11:00
b3ea4ec90c Py API: use direct access to list/tuple size when type is known 2013-12-17 16:40:06 +11:00
e2429d6492 Woo Hoo. First git commit.
Changes for VC2013

Now, I can build Blender with VC2013 with Cycles, Collada, OpenExr,OpenImageIO disabled. Also, you need VC2008 sp1 installed to make old libs compatible.
2013-11-29 15:13:12 -05:00
41e563594d Code Cleanup: int pointer comparison 2013-11-22 08:39:13 +11:00
c592ebf5df Freestyle: a follow-up fix of trunk revision 61233. When an iterator has reached
the end, any reference of the object pointed by it will now lead to a RuntimeError
instead of returning None, with the aim of forcing Python API users to check the
end of iteration rather than implicitly indicating the error condition.

Acknowledgement to flokkievids for API discussions in the BlenderArtists.org
Freestyle for Blender thread.
2013-11-16 22:11:28 +00:00
ef1bc03fce Fix #37092 and #37381: crashes in the .object() method of Freestyle iterators.
Now the method checks if the iterator is at the end, and returns None if that is the case.
2013-11-12 02:28:26 +00:00
8c5597eb49 Additional code improvements: avoid unnecessary Python object allocations in Freestyle. 2013-11-05 00:51:59 +00:00
9575521812 Minor code improvements: avoid unnecessary Python object allocations in Freestyle color blending. 2013-11-03 14:25:37 +00:00
2190e6de0e Fix for missing calls of BaseMath_ReadCallback() when accessing vector/color elements.
This bug was causing wrong color blending results in Freestyle color modifiers.
Problem report from Light BWK through personal communications, thanks!
2013-11-03 14:24:02 +00:00
beae4f498d code cleanup: spelling 2013-10-31 14:10:01 +00:00
7eff2285a3 Fix for Freestyle rendering errors with color blend modes SOFT_LIGHT and LINEAR_LIGHT. 2013-10-31 07:41:40 +00:00
804643793e Fix for occasional crashes due to numerical instability in Freestyle Perlin noise modifiers with a large 'octaves' value.
Problem report by Light BWK through personal communications, thanks a lot!
2013-10-24 11:41:39 +00:00
b6ea073af2 more fixes relating to [#36878], freestyle was only checking for NULL linestyles in some places. 2013-09-30 09:28:43 +00:00
aa8488421f style cleanup: whitespace & odd indentation 2013-09-21 10:46:58 +00:00
0e46f1b1f8 Fix [#36727] Curve Object Scaled to 0 + Freestyle = Crash
Division by zero...
2013-09-15 14:27:06 +00:00
8beb565c59 code cleanup: headers - doxy comments. 2013-09-12 03:02:50 +00:00
f6b37f34ec code cleanup:
- add missing headers from cmake (own omission)
- quiet rna_test.c unused define warnings.
- minor style edits
- spelling corrections and ignore all uppercase words with spell checking script.
2013-09-05 19:56:49 +00:00
4ece675781 Quiet annoying VC++ warning C4819: The file contains a character that cannot be represented in the current code page. 2013-08-24 17:36:45 +00:00
6caad3445e Add stdlib.h to solve compilation error caused by missing abort() prototype
Perhaps we'd better move this include to BLI_utildefines as we made with
with other includes needed for BLI_abort?
2013-08-24 17:15:59 +00:00
248e3d74a0 Fix for [#36374] Read unitialized memory in Freestyle.
A variable keeping a bounding box was referenced after it was flagged as empty.
2013-08-24 11:42:00 +00:00
47c23750e8 style cleanup: indent/whitespace 2013-08-19 01:48:44 +00:00
98c574e41a use 'greater/less then or equal to' operators rather then adding 1. 2013-08-11 05:40:35 +00:00
67ae5e8158 Fix for a formatting error in the docstring of SVertex.viewvertex(). 2013-08-07 21:49:11 +00:00
65e7039f8d Fix for docstrings of CurvePoint.first_svertex() and CurvePoint.second_svertex(). 2013-08-07 21:40:59 +00:00
5129112072 add c++/guardedalloc to more freestyle classes, also remove redundant 'public:' 2013-08-04 18:50:00 +00:00
65b932d9f1 Fix for docstring inconsistency in Stroke.stroke_vertices_end(). 2013-07-20 01:45:18 +00:00
33b65832d2 Fix for [#35482] 2.67 freestyle line visibility computation bug.
The reported line visibility issue was caused by a wrong calculation of a 2D
bounding box (so-called "proscenium face" in Freestyle) in the case of a
spherical grid data structure used for a perspective camera.  The problem was
resulting from the proscenium computation based on two corners (min and max)
of the 3D bounding box of imported mesh data.  Aware of the spherical coordinate
transformation involving non-linear (arctangent) functions, now the proscenium
is computed by taking in account all the eight corners of the 3D bounding box.

Also added minor code changes to facilitate future debugging.
2013-07-13 19:33:25 +00:00
55c79821b9 optimize interp_weights_poly_v2(), well tested, was calculating the area twice as much as was needed. 2013-07-12 00:18:27 +00:00
f514fae6d8 Fix for Bug #35695: Freestyle produces extra line across an object with pointed areas.
The cause of inconsistent edge connectivity in the view map (documented in the commit
log of revision 58006) was identified and fixed.  The problem was that when a ViewEdge
was split at a cusp vertex (ViewMapBuilder::computeCusps()), the ViewVertex at one end
of a newly created ViewEdge in ViewMap::InsertViewVertex() was not properly updated to
take account of edge connectivity changes.
2013-07-11 17:25:18 +00:00