Commit Graph

13 Commits

Author SHA1 Message Date
51efe7de27 Improved context handling. Previously FRS_initialize() was used for both
initializing Freestyle and specifying contexts, making the API a bit messy.
Now FRS_initialize() is only for initialization, and contexts are specified
by new FRS_set_context() function just before starting rendering.
2009-11-10 00:03:31 +00:00
d56a0fd72d Fixed PythonInterpreter::interpretFile() so as to just use add_text()
instead of add_empty_text() plus file I/O code of its own.
2009-10-26 23:17:48 +00:00
Maxime Curioni
dc81204c91 TK's patch to correct the PythonInterpereter 2009-10-15 03:32:53 +00:00
Maxime Curioni
002ac28643 Migration of Freestyle to Blender 2.5 codebase (continued):
- proper Freestyle initialization, with support for undo/redo
- re-added FreestyleStyleConfig data structure
- Freestyle Python interpreter updated

This commit should compile without errors. More work is necessary to complete the migration:
- add Freestyle in the UI
- set up RNA support
2009-09-28 03:56:31 +00:00
008a6cc1ec Fixed a bug in PythonInterpreter::interpretFile() that a temporary
text object storing a Python script was not properly freed when an
error occurred during the execution of the script.
2009-08-23 16:03:12 +00:00
Maxime Curioni
8b3e4bc069 when Freestyle would execute style modules, a copy of the Python script would end up in the text editor and pollute the text editor file list. This is corrected: executed scripts do not leave trails behind. 2008-12-10 18:36:56 +00:00
Maxime Curioni
89e8fa216f The GL-based renderer was removed. Freestyle now uses Blender's internal renderer to raster strokes.
The render generated from Freestyle's data is currently stored in the original scene's render structure ( as 'freestyle_render'): when the render database is generated, the scene's geometrical data is first imported into Freestyle and strokes are calculated. The generated strokes are used to create a Blender scene, rendered independently. The render result is used in the rendering loop.

The final rendering is performed the same way edge rendering is, in a function ('freestyle_enhance_add') operating on each individual render part. Freestyle strokes are only included if the toggle button "Freestyle" (in the 'Output' panel) is active and if the "Freestyle" render layer is also selected. Freestyle's panel appears when the toggle button 'Freestyle' is active.

IMPORTANT: as of now, rendering ONLY works when OSA is disabled and when Xparts = Yparts = 1. If these settings are not set, a bogus image will be created.

To make the render happen, many modifications had to be made:
- the Canvas::Draw and Operators::create methods no longer render strokes. They only generate shading and locational information. 
- a BlenderStrokeRenderer class was added to turn Freestyle's strokes into a Blender scene. Basically, the scene consists of strokes in their projected image 2D coordinates and an orthographic camera centered in the middle of the corresponding canvas. The scene is rendered using vertex colors, in shadeless mode (therefore, no lamp is needed). BlenderStrokeRenderer uses the old GLTextureManager to load textures (as required by the StrokeRenderer class), even though stroke textures are probably not supported (not tested). After the scene is rendered, it is safely and automatically discarded.
- AppCanvas' code was greatly reduced to the bare minimum. The former AppCanvas would use an OpenGL-based back buffer and z buffer to determine the scene's color and depth information. In the future, this data will be determined from the corresponding render passes. Currently, the integration is not achieved so all style modules using depth/color information are sure to fail.
- before, Freestyle needed an OpenGL context to determine the camera's information and to compute the view map. As of now, the modelview and projection matrices are fully determined using data provided by Blender. This means both perspective and orthographic projections are supported. The AppGLWidget will very soon be removed completely.
2008-12-01 21:30:44 +00:00
Nathan Letwory
449f210c46 * Make sure freestyle branch compiles with SCons/msvc9 on Windows. This was joint operation with mxcurioni :) 2008-09-09 18:03:44 +00:00
Maxime Curioni
21c4797896 soc-2008-mxcurioni: Freestyle execution now works flawlessly (Python runtime loads appropriate modules, using SWIG wrapper), but does not render anything yet (render window OpenGL context not used yet). Currently, the SWIG wrapper library needs to be manually compiled (see SWIG section in source/blender/freestyle/SConscript for details). I am missing some knowledge on scons to create it automatically from the SConscript. Once I find that information, I'll make it automatic and for different platforms.
I also corrected a simple GLStrokeRenderer bug for texture loading (not in original Freestyle code). Apparently, IMB_loadiffname doesn't recognize the paper's texture depth so a work-around will have to be found.
2008-05-27 14:13:16 +00:00
Maxime Curioni
4245f81605 soc-2008-mxcurioni: PythonInterpreter now properly handles its initialization (in accordance with original Freestyle code). This is achieved by creating a temporary Text structure, adding the required import and appending the necessary Python path. The text is executed using the BPY_txt_do_python_Text command.
When Freestyle is run within Blender, it should not crash; the Python interpreter should report an ImportError on _Freestyle (the SWIG wrapper).
2008-05-27 03:29:43 +00:00
Maxime Curioni
373d42dbea soc-2008-mxcurioni: PythonInterpreter works, using Blender's Python functions. The drawing still does not produce anything because the SWIG module wrapper is missing 2008-05-26 19:52:55 +00:00
Maxime Curioni
fc8cd192a3 soc-2008-mxcurioni: Freestyle compiles but crashes at runtime because of the Python environment.
I analyzed the crash with gdb and PyImport_AddModule ("__main__") in Python/import.c:320 seems responsible for the crash: apparently, "__main__" is not found and causes the error "No such file or directory".

I have to figure out what's wrong with the current configuration, especially whether Freestyle's PythonInterpreter can be used as is. I am going to see whether it's just quicker to use Blender's functions.
2008-05-26 16:19:30 +00:00
Maxime Curioni
64e4a3ec9a soc-2008-mxcurioni: merged changes to revision 14747, cosmetic changes for source/blender/freestyle 2008-05-08 19:16:40 +00:00