The main contribution of this commit is the possibility to save Freestyle configuration information inside .blend files. It required an extensive refactoring of the previous interface code.

The code has been tested and does not crash on my machine. If you encounter issues, please let me know (and if possible, sending me an sample .blend file).

DETAILS:
- refactored code to notify Freestyle when adding/removing render layers  (FRS_freestyle_config.{h,cpp})
- corrected the freeing of style modules when files are read from / written to disk
- moved Freestyle configuration information into scene renderlayers, to allow loading / saving .blend files (DNA_scene_types.h DNA_freestyle_types.h FRS_freestyle.cpp)
- inserted temporary trick to prevent crashes when orthographic camera is used (SilhouetteGeomEngine.cpp), but outputting incorrect feature line calculations
This commit is contained in:
Maxime Curioni 2009-08-04 00:40:36 +00:00
parent ff110c17f7
commit bd92aea926
17 changed files with 173 additions and 140 deletions

View File

@ -11,6 +11,7 @@ incs += ' #/extern/bullet2/src'
incs += ' #/intern/bmfont'
incs += ' #/intern/opennl/extern'
incs += ' ../gpu #/extern/glew/include'
incs += ' ../freestyle'
incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_ZLIB_INC']

View File

@ -96,6 +96,8 @@
#include <sys/time.h>
#endif
#include "FRS_freestyle_config.h"
void free_avicodecdata(AviCodecData *acd)
{
if (acd) {
@ -162,6 +164,11 @@ void free_scene(Scene *sce)
sce->r.ffcodecdata.properties = NULL;
}
SceneRenderLayer *srl;
for(srl= sce->r.layers.first; srl; srl= srl->next) {
BLI_freelistN( &srl->freestyleConfig.modules);
}
BLI_freelistN(&sce->markers);
BLI_freelistN(&sce->transform_spaces);
BLI_freelistN(&sce->r.layers);
@ -195,7 +202,7 @@ Scene *add_scene(char *name)
sce->selectmode= SCE_SELECT_VERTEX;
sce->editbutsize= 0.1;
sce->autokey_mode= U.autokey_mode;
sce->r.mode= R_GAMMA;
sce->r.cfra= 1;
sce->r.sfra= 1;
@ -615,6 +622,8 @@ void scene_add_render_layer(Scene *sce)
srl->lay= (1<<20) -1;
srl->layflag= 0x7FFF; /* solid ztra halo edge strand */
srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
FRS_add_freestyle_config( srl );
}
/* Initialize 'permanent' sculpt data that is saved with file kept after

View File

@ -3682,6 +3682,11 @@ static void direct_link_scene(FileData *fd, Scene *sce)
link_list(fd, &(sce->transform_spaces));
link_list(fd, &(sce->r.layers));
SceneRenderLayer *srl;
for(srl= sce->r.layers.first; srl; srl= srl->next) {
link_list(fd, &(srl->freestyleConfig.modules));
}
sce->nodetree= newdataadr(fd, sce->nodetree);
if(sce->nodetree)
direct_link_nodetree(fd, sce->nodetree);
@ -8776,7 +8781,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
for(srl= sce->r.layers.first; srl; srl= srl->next) {
expand_doit(fd, mainvar, srl->mat_override);
expand_doit(fd, mainvar, srl->light_override);
expand_doit(fd, mainvar, srl->light_override);
}
}

View File

@ -1449,6 +1449,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
TimeMarker *marker;
TransformOrientation *ts;
SceneRenderLayer *srl;
FreestyleModuleConfig *fmc;
int a;
sce= scebase->first;
@ -1525,7 +1526,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
if(seq->type==SEQ_IMAGE)
writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
else if(seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
strip->done= 1;
}
@ -1562,8 +1563,13 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
for(ts = sce->transform_spaces.first; ts; ts = ts->next)
writestruct(wd, DATA, "TransformOrientation", 1, ts);
for(srl= sce->r.layers.first; srl; srl= srl->next)
for(srl= sce->r.layers.first; srl; srl= srl->next) {
writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
for(fmc= srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc);
}
}
if(sce->nodetree) {
writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);

View File

@ -29,7 +29,7 @@ FILE(GLOB_RECURSE SRC *.cpp)
SET(INC
../blenkernel ../blenloader ../blenlib ../imbuf ../makesdna ../python
../render/extern/include ../render/intern/include ../include ../src
../../../extern/glew/include ../../../intern/guardedalloc
../../../extern/glew/include ../../../intern/guardedalloc ../freestyle
${PYTHON_INC}
${PNG_INC}
)

View File

@ -8,13 +8,8 @@
extern "C" {
#endif
typedef struct StyleModuleConf {
struct StyleModuleConf *next, *prev;
char module_path[255];
short is_displayed;
} StyleModuleConf;
#include "DNA_listBase.h"
#include "DNA_scene_types.h"
extern short freestyle_is_initialized;
@ -22,8 +17,7 @@ extern "C" {
extern float freestyle_mv[4][4];
extern float freestyle_proj[4][4];
extern int freestyle_viewport[4];
extern short freestyle_current_layer_number;
extern char* freestyle_current_module_path;
extern SceneRenderLayer* freestyle_current_layer;
extern ListBase* freestyle_modules;
@ -32,13 +26,12 @@ extern "C" {
extern float* freestyle_dkr_epsilon;
// Rendering
void FRS_initialize();
void FRS_initialize( short select_layer );
void FRS_add_Freestyle(Render* re);
void FRS_exit();
// Panel configuration
void FRS_select_layer( SceneRenderLayer* srl );
void FRS_delete_layer( SceneRenderLayer* srl, short isDestructor );
void FRS_add_module();
void FRS_delete_module(void *module_index_ptr, void *unused);
void FRS_move_up_module(void *module_index_ptr, void *unused);

View File

@ -0,0 +1,17 @@
#ifndef FRS_FREESTYLE_CONFIG_H
#define FRS_FREESTYLE_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "DNA_scene_types.h"
void FRS_add_freestyle_config( SceneRenderLayer* srl );
void FRS_free_freestyle_config( SceneRenderLayer* srl );
#ifdef __cplusplus
}
#endif
#endif

View File

@ -15,19 +15,18 @@ extern "C" {
#include "MEM_guardedalloc.h"
#include "DNA_camera_types.h"
#include "DNA_listBase.h"
#include "DNA_scene_types.h"
#include "DNA_freestyle_types.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
#include "BIF_renderwin.h"
#include "BPY_extern.h"
#include "render_types.h"
#include "renderpipeline.h"
#include "pixelblending.h"
#include "../../FRS_freestyle.h"
#include "../../FRS_freestyle_config.h"
// Freestyle configuration
short freestyle_is_initialized = 0;
@ -42,7 +41,6 @@ extern "C" {
int freestyle_viewport[4];
// Panel configuration
short freestyle_current_layer_number = 0;
char* freestyle_current_module_path = NULL;
SceneRenderLayer* freestyle_current_layer = NULL;
@ -51,31 +49,13 @@ extern "C" {
float* freestyle_sphere_radius;
float* freestyle_dkr_epsilon;
class FreestylePanelConfigurationData {
public:
set<SceneRenderLayer*> layers;
map<SceneRenderLayer*, ListBase*> modules;
map<SceneRenderLayer*, int*> flags;
map<SceneRenderLayer*, float*> sphere_radius;
map<SceneRenderLayer*, float*> dkr_epsilon;
FreestylePanelConfigurationData() {}
~FreestylePanelConfigurationData() {
set<SceneRenderLayer*>::iterator it;
for( it=layers.begin(); it!=layers.end(); it++)
FRS_delete_layer( *it, 1 );
}
};
static FreestylePanelConfigurationData* panelConfig;
string default_module_path;
//=======================================================
// Initialization
//=======================================================
void FRS_initialize(){
void FRS_initialize( short select_layer ){
if( !freestyle_is_initialized ) {
@ -83,27 +63,21 @@ extern "C" {
controller = new Controller;
view = new AppView;
controller->setView(view);
} else {
delete panelConfig;
default_module_path = pathconfig->getProjectDir() + Config::DIR_SEP + "style_modules" + Config::DIR_SEP + "contour.py";
freestyle_is_initialized = 1;
}
panelConfig = new FreestylePanelConfigurationData;
default_module_path = pathconfig->getProjectDir() + Config::DIR_SEP + "style_modules" + Config::DIR_SEP + "contour.py";
FRS_select_layer( (SceneRenderLayer*) BLI_findlink(&G.scene->r.layers, G.scene->r.actlay) );
freestyle_is_initialized = 1;
if( select_layer )
FRS_select_layer( (SceneRenderLayer*) BLI_findlink(&G.scene->r.layers, G.scene->r.actlay) );
}
void FRS_exit() {
delete pathconfig;
delete controller;
delete view;
delete panelConfig;
}
//=======================================================
@ -130,26 +104,6 @@ extern "C" {
freestyle_viewpoint[1] = maincam_obj->obmat[3][1];
freestyle_viewpoint[2] = maincam_obj->obmat[3][2];
// freestyle_mv[0][0] = maincam_obj->obmat[0][0];
// freestyle_mv[0][1] = maincam_obj->obmat[1][0];
// freestyle_mv[0][2] = maincam_obj->obmat[2][0];
// freestyle_mv[0][3] = 0.0;
//
// freestyle_mv[1][0] = maincam_obj->obmat[0][1];
// freestyle_mv[1][1] = maincam_obj->obmat[1][1];
// freestyle_mv[1][2] = maincam_obj->obmat[2][1];
// freestyle_mv[1][3] = 0.0;
//
// freestyle_mv[2][0] = re->viewmat[2][0];
// freestyle_mv[2][1] = re->viewmat[2][1];
// freestyle_mv[2][2] = re->viewmat[2][2];
// freestyle_mv[2][3] = 0.0;
//
// freestyle_mv[3][0] = re->viewmat[3][0];
// freestyle_mv[3][1] = re->viewmat[3][1];
// freestyle_mv[3][2] = re->viewmat[3][2];
// freestyle_mv[3][3] = 1.0;
for( int i = 0; i < 4; i++ )
for( int j = 0; j < 4; j++ )
freestyle_mv[i][j] = re->viewmat[i][j];
@ -157,13 +111,11 @@ extern "C" {
for( int i = 0; i < 4; i++ )
for( int j = 0; j < 4; j++ )
freestyle_proj[i][j] = re->winmat[i][j];
//f(cam && (re->r.mode & R_ORTHO)) {
}
void prepare(Render* re, SceneRenderLayer* srl ) {
// clear canvas
controller->Clear();
@ -172,10 +124,14 @@ extern "C" {
return;
// add style modules
FreestyleConfig* config = &srl->freestyleConfig;
cout << "\n=== Rendering options ===" << endl;
cout << "Modules :"<< endl;
int layer_count = 0;
for( StyleModuleConf* module_conf = (StyleModuleConf *)panelConfig->modules[srl]->first; module_conf; module_conf = module_conf->next ) {
for( FreestyleModuleConfig* module_conf = (FreestyleModuleConfig *)config->modules.first; module_conf; module_conf = module_conf->next ) {
if( module_conf->is_displayed ) {
cout << " " << layer_count+1 << ": " << module_conf->module_path << endl;
controller->InsertStyleModule( layer_count, module_conf->module_path );
@ -186,10 +142,10 @@ extern "C" {
cout << endl;
// set parameters
controller->setSphereRadius(*panelConfig->sphere_radius[srl]);
controller->setComputeRidgesAndValleysFlag((*panelConfig->flags[srl] & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
controller->setComputeSuggestiveContoursFlag((*panelConfig->flags[srl] & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
controller->setSuggestiveContourKrDerivativeEpsilon(*panelConfig->dkr_epsilon[srl]);
controller->setSphereRadius( config->sphere_radius );
controller->setComputeRidgesAndValleysFlag( (config->flags & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
controller->setComputeSuggestiveContoursFlag( (config->flags & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
controller->setSuggestiveContourKrDerivativeEpsilon( config->dkr_epsilon ) ;
cout << "Sphere radius : " << controller->getSphereRadius() << endl;
cout << "Redges and valleys : " << (controller->getComputeRidgesAndValleysFlag() ? "enabled" : "disabled") << endl;
@ -236,11 +192,8 @@ extern "C" {
int displayed_layer_count( SceneRenderLayer* srl ) {
int count = 0;
if( panelConfig->layers.find(srl) == panelConfig->layers.end() )
return 0;
for( StyleModuleConf* module_conf = (StyleModuleConf *)panelConfig->modules[srl]->first; module_conf; module_conf = module_conf->next ) {
for( FreestyleModuleConfig* module_conf = (FreestyleModuleConfig *)srl->freestyleConfig.modules.first; module_conf; module_conf = module_conf->next ) {
if( module_conf->is_displayed )
count++;
}
@ -257,6 +210,7 @@ extern "C" {
cout << "# Freestyle" << endl;
cout << "#===============================================================" << endl;
FRS_initialize( 0 );
init_view(re);
init_camera(re);
@ -300,50 +254,37 @@ extern "C" {
// Freestyle Panel Configuration
//=======================================================
void FRS_select_layer( SceneRenderLayer* srl )
{
if( panelConfig->layers.find(srl) == panelConfig->layers.end() )
{
panelConfig->layers.insert(srl);
panelConfig->modules[srl] = new ListBase;
panelConfig->modules[srl]->first = panelConfig->modules[srl]->last = NULL;
panelConfig->flags[srl] = new int(0);
panelConfig->sphere_radius[srl] = new float(1.0);
panelConfig->dkr_epsilon[srl] = new float(0.001);
}
void FRS_add_freestyle_config( SceneRenderLayer* srl )
{
FreestyleConfig* config = &srl->freestyleConfig;
freestyle_modules = panelConfig->modules[srl];
freestyle_flags = panelConfig->flags[srl];
freestyle_sphere_radius = panelConfig->sphere_radius[srl];
freestyle_dkr_epsilon = panelConfig->dkr_epsilon[srl];
freestyle_current_layer = srl;
freestyle_current_layer_number = BLI_findindex(&G.scene->r.layers, freestyle_current_layer);
config->modules.first = config->modules.last = NULL;
config->flags = 0;
config->sphere_radius = 1.0;
config->dkr_epsilon = 0.001;
}
void FRS_free_freestyle_config( SceneRenderLayer* srl )
{
BLI_freelistN( &srl->freestyleConfig.modules );
}
void FRS_delete_layer( SceneRenderLayer* srl, short isDestructor )
{
BLI_freelistN( panelConfig->modules[srl] );
delete panelConfig->modules[srl];
void FRS_select_layer( SceneRenderLayer* srl )
{
FreestyleConfig* config = &srl->freestyleConfig;
delete panelConfig->flags[srl];
delete panelConfig->sphere_radius[srl];
delete panelConfig->dkr_epsilon[srl];
freestyle_modules = &config->modules;
freestyle_flags = &config->flags;
freestyle_sphere_radius = &config->sphere_radius;
freestyle_dkr_epsilon = &config->dkr_epsilon;
panelConfig->modules.erase(srl);
panelConfig->flags.erase(srl);
panelConfig->sphere_radius.erase(srl);
panelConfig->dkr_epsilon.erase(srl);
if( !isDestructor )
panelConfig->layers.erase(srl);
freestyle_current_layer = srl;
G.scene->freestyle_current_layer_number = BLI_findindex(&G.scene->r.layers, freestyle_current_layer);
}
void FRS_add_module()
{
StyleModuleConf* module_conf = (StyleModuleConf*) MEM_callocN( sizeof(StyleModuleConf), "style module configuration");
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) MEM_callocN( sizeof(FreestyleModuleConfig), "style module configuration");
BLI_addtail(freestyle_modules, (void*) module_conf);
strcpy( module_conf->module_path, default_module_path.c_str() );
@ -352,14 +293,14 @@ extern "C" {
void FRS_delete_module(void *module_index_ptr, void *unused)
{
StyleModuleConf* module_conf = (StyleModuleConf*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
BLI_freelinkN( freestyle_modules, module_conf);
}
void FRS_move_up_module(void *module_index_ptr, void *unused)
{
StyleModuleConf* module_conf = (StyleModuleConf*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
BLI_remlink(freestyle_modules, module_conf);
BLI_insertlink(freestyle_modules, module_conf->prev->prev, module_conf);
@ -367,7 +308,7 @@ extern "C" {
void FRS_move_down_module(void *module_index_ptr, void *unused)
{
StyleModuleConf* module_conf = (StyleModuleConf*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
BLI_remlink(freestyle_modules, module_conf);
BLI_insertlink(freestyle_modules, module_conf->next, module_conf);
@ -375,7 +316,7 @@ extern "C" {
void FRS_set_module_path(void *module_index_ptr, void *unused)
{
StyleModuleConf* module_conf = (StyleModuleConf*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
freestyle_current_module_path = module_conf->module_path;
}

View File

@ -619,11 +619,21 @@ namespace GeomUtils {
void fromRetinaToCamera(const Vec3r& p,
Vec3r& q,
real z,
real focal,
const real projection_matrix[4][4]) {
q[0] = (-p[0] * z) / projection_matrix[0][0];
q[1] = (-p[1] * z) / projection_matrix[1][1];
q[2] = z;
if( projection_matrix[3][3] == 0.0 ) // perspective
{
q[0] = (-p[0] * focal) / projection_matrix[0][0];
q[1] = (-p[1] * focal) / projection_matrix[1][1];
q[2] = focal;
}
else // orthogonal
{
q[0] = p[0] / projection_matrix[0][0];
q[1] = p[1] / projection_matrix[1][1];
q[2] = focal;
}
}
void fromCameraToWorld(const Vec3r& p,

View File

@ -52,7 +52,8 @@ real SilhouetteGeomEngine::_glModelViewMatrix[4][4] = {{1,0,0,0},
{0,0,0,1}};
real SilhouetteGeomEngine::_znear = 0.0;
real SilhouetteGeomEngine::_zfar = 100.0;
bool SilhouetteGeomEngine::_isOrthographicProjection = false;
SilhouetteGeomEngine * SilhouetteGeomEngine::_pInstance = 0;
void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const real iProjectionMatrix[4][4], const int iViewport[4], real iFocal)
@ -91,6 +92,8 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const
_viewport[i] = iViewport[i];
}
_Focal = iFocal;
_isOrthographicProjection = (iProjectionMatrix[3][3] != 0.0);
}
void SilhouetteGeomEngine::setFrustum(real iZNear, real iZFar)
@ -146,6 +149,10 @@ void SilhouetteGeomEngine::ProjectSilhouette(SVertex* ioVertex)
real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
{
if( _isOrthographicProjection )
return t;
// we need to compute for each parameter t the corresponding
// parameter T which gives the intersection in 3D.
//currentEdge = (*fe);

View File

@ -59,6 +59,7 @@ private:
static real _glProjectionMatrix[4][4]; // GL style (column major) projection matrix
static real _glModelViewMatrix[4][4]; // GL style (column major) model view matrix
static bool _isOrthographicProjection;
static SilhouetteGeomEngine *_pInstance;

View File

@ -0,0 +1,28 @@
#ifndef DNA_FREESTYLE_TYPES_H
#define DNA_FREESTYLE_TYPES_H
#include "DNA_listBase.h"
typedef struct FreestyleModuleConfig {
struct FreestyleModuleConfig *next, *prev;
char module_path[256];
short is_displayed;
short pad[3];
} FreestyleModuleConfig;
typedef struct FreestyleConfig {
ListBase modules;
int flags;
float sphere_radius;
float dkr_epsilon;
int pad;
} FreestyleConfig;
#endif

View File

@ -38,6 +38,7 @@ extern "C" {
#include "DNA_scriptlink_types.h"
#include "DNA_ID.h"
#include "DNA_scriptlink_types.h"
#include "DNA_freestyle_types.h"
struct Radio;
struct Object;
@ -47,6 +48,7 @@ struct Image;
struct Group;
struct bNodeTree;
typedef struct Base {
struct Base *next, *prev;
unsigned int lay, selcol;
@ -125,6 +127,9 @@ typedef struct SceneRenderLayer {
int passflag; /* pass_xor has to be after passflag */
int pass_xor;
struct FreestyleConfig freestyleConfig;
} SceneRenderLayer;
/* srl->layflag */
@ -448,7 +453,8 @@ typedef struct ToolSettings {
/* Alt+RMB option */
char edge_mode;
} ToolSettings;
} ToolSettings;
/* Used by all brushes to store their properties, which can be directly set
by the interface code. Note that not all properties are actually used by
@ -565,7 +571,11 @@ typedef struct Scene {
/* frame step. */
int frame_step;
int pad;
/* Freestyle */
short freestyle_current_layer_number;
short pad;
} Scene;

View File

@ -129,6 +129,7 @@ char *includefiles[] = {
"DNA_particle_types.h",
"DNA_cloth_types.h",
"DNA_gpencil_types.h",
"DNA_freestyle_types.h",
// if you add files here, please add them at the end
// of makesdna.c (this file) as well
@ -1151,4 +1152,5 @@ int main(int argc, char ** argv)
#include "DNA_particle_types.h"
#include "DNA_cloth_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_freestyle_types.h"
/* end of list */

View File

@ -72,7 +72,7 @@
#endif /* disable yafray */
#include "FRS_freestyle.h"
#include "FRS_freestyle_config.h"
/* internal */
#include "render_types.h"
@ -592,6 +592,7 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int
rl->lay= (1<<20) -1;
rl->layflag= 0x7FFF; /* solid ztra halo strand */
rl->passflag= SCE_PASS_COMBINED;
FRS_add_freestyle_config( srl );
re->r.actlay= 0;
}

View File

@ -122,6 +122,8 @@ extern void makeffmpegstring(char* string);
#endif
#include "FRS_freestyle.h"
#include "FRS_freestyle_config.h"
#include "DNA_freestyle_types.h"
/* here the calls for scene buttons
- render
@ -1744,7 +1746,7 @@ void do_render_panels(unsigned short event)
#endif
case B_FRS_SELECT_RENDER_LAYER:
FRS_select_layer( BLI_findlink(&G.scene->r.layers, freestyle_current_layer_number ) );
FRS_select_layer( BLI_findlink(&G.scene->r.layers, G.scene->freestyle_current_layer_number ) );
allqueue(REDRAWBUTSSCENE, 0);
break;
@ -3314,7 +3316,7 @@ static void render_panel_freestyle()
uiBut *bt;
int module_list_y;
StyleModuleConf* module_conf;
FreestyleModuleConfig* module_conf;
int module_number, last_module_number;
// block
@ -3331,7 +3333,7 @@ static void render_panel_freestyle()
}
uiDefBut(block, LABEL, 0, "Render Layer:", 10,210,100,20, NULL, 0, 0, 0, 0, "");
uiDefButS(block, MENU, B_FRS_SELECT_RENDER_LAYER, str, 110,210,200,20, &freestyle_current_layer_number, 0, 0, 0, 0, "Settings for current Render Layer");
uiDefButS(block, MENU, B_FRS_SELECT_RENDER_LAYER, str, 110,210,200,20, &G.scene->freestyle_current_layer_number, 0, 0, 0, 0, "Settings for current Render Layer");
MEM_freeN(str);
// label to force a boundbox for buttons not to be centered
@ -3398,16 +3400,16 @@ static void delete_scene_layer_func(void *srl_v, void *act_i)
intptr_t act= (intptr_t)act_i;
int deleted_layer = G.scene->r.actlay;
FRS_delete_layer( BLI_findlink(&G.scene->r.layers, deleted_layer), 0 );
FRS_free_freestyle_config( BLI_findlink(&G.scene->r.layers, deleted_layer) );
BLI_remlink(&G.scene->r.layers, srl_v);
MEM_freeN(srl_v);
G.scene->r.actlay = 0;
if( deleted_layer == freestyle_current_layer_number ) {
if( deleted_layer == G.scene->freestyle_current_layer_number ) {
FRS_select_layer( BLI_findlink(&G.scene->r.layers, G.scene->r.actlay) );
} else {
freestyle_current_layer_number = BLI_findindex(&G.scene->r.layers, freestyle_current_layer);
G.scene->freestyle_current_layer_number = BLI_findindex(&G.scene->r.layers, freestyle_current_layer);
}
if(G.scene->nodetree) {

View File

@ -605,7 +605,7 @@ void BIF_read_file(char *name)
if (retval!=0) G.relbase_valid = 1;
FRS_initialize();
FRS_initialize( 1 );
undo_editmode_clear();
undo_imagepaint_clear();
@ -681,7 +681,7 @@ int BIF_read_homefile(int from_memory)
init_userdef_file();
FRS_initialize();
FRS_initialize( 1 );
undo_editmode_clear();
undo_imagepaint_clear();