Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMaxime Curioni <maxime.curioni@gmail.com>2008-07-31 15:20:30 +0400
committerMaxime Curioni <maxime.curioni@gmail.com>2008-07-31 15:20:30 +0400
commitf09f89d5dcbc5532eeda9f54f0e1163373491083 (patch)
tree9cf112e13a5e1728be82c199b5a32f5e7922de54 /source
parent3010f2b753f2397256861816504b8e7d697632db (diff)
soc-2008-mxcurioni: added a Freestyle panel to select a style at run-time, by specifying its pathname. By default, it is loaded with the contour.py path.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/scene.c1
-rw-r--r--source/blender/freestyle/FRS_freestyle.h3
-rw-r--r--source/blender/freestyle/intern/app_blender/api.cpp17
-rw-r--r--source/blender/include/butspace.h3
-rw-r--r--source/blender/src/SConscript2
-rw-r--r--source/blender/src/buttons_scene.c43
6 files changed, 62 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 2898dca767c..089a80a9fea 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -271,6 +271,7 @@ Scene *add_scene(char *name)
strcpy(sce->r.backbuf, "//backbuf");
strcpy(sce->r.pic, U.renderdir);
+
BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
sce->r.osa= 8;
diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h
index 060ccf6961a..20ff6b72231 100644
--- a/source/blender/freestyle/FRS_freestyle.h
+++ b/source/blender/freestyle/FRS_freestyle.h
@@ -5,6 +5,9 @@
extern "C" {
#endif
+ extern char style_module[255];
+
+ void FRS_initialize();
void FRS_prepare(Render* re);
void FRS_execute(Render* re, int render_in_layer);
diff --git a/source/blender/freestyle/intern/app_blender/api.cpp b/source/blender/freestyle/intern/app_blender/api.cpp
index 7f5135a2655..a6490324fbf 100644
--- a/source/blender/freestyle/intern/app_blender/api.cpp
+++ b/source/blender/freestyle/intern/app_blender/api.cpp
@@ -30,7 +30,8 @@ extern "C" {
static Controller *controller = NULL;
static AppGLWidget *view = NULL;
-
+ char style_module[255] = "";
+
void FRS_initialize(){
if( pathconfig == NULL )
@@ -42,8 +43,14 @@ extern "C" {
if( view == NULL )
view = new AppGLWidget;
- controller->Clear();
controller->setView(view);
+ controller->Clear();
+
+ if( strlen(style_module) == 0 ){
+ string path( pathconfig->getProjectDir() + Config::DIR_SEP + "style_modules_blender" + Config::DIR_SEP + "contour.py" );
+ strcpy( style_module, path.c_str() );
+ }
+
}
@@ -114,10 +121,8 @@ extern "C" {
}
// add style module
- string style_module = pathconfig->getProjectDir() +
- Config::DIR_SEP + "style_modules_blender" +
- Config::DIR_SEP + "contour.py";
- controller->InsertStyleModule( 0, const_cast<char *>(style_module.c_str()) );
+ cout << "Module: " << style_module << endl;
+ controller->InsertStyleModule( 0, style_module );
controller->toggleLayer(0, true);
// compute view map
diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h
index c0542e3f34c..68bc1fff774 100644
--- a/source/blender/include/butspace.h
+++ b/source/blender/include/butspace.h
@@ -318,6 +318,8 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_FS_PIC 1601
#define B_FS_BACKBUF 1602
+#define B_FS_FRS 1603
+
#define B_FS_FTYPE 1604 /* FTYPE is no more */
#define B_DORENDER 1605
#define B_DOANIM 1606
@@ -372,6 +374,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_SEQ_BUT_RELOAD_FILE 1696
#define B_SEQ_BUT_REBUILD_PROXY 1697
#define B_SEQ_SEL_PROXY_DIR 1698
+
/* *********************** */
#define B_ARMATUREBUTS 1800
#define B_POSE 1701
diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript
index 229cc87ef37..a7a960beac9 100644
--- a/source/blender/src/SConscript
+++ b/source/blender/src/SConscript
@@ -27,7 +27,7 @@ incs += ' #/intern/decimation/extern ../blenloader ../python'
incs += ' ../../kernel/gen_system #/intern/SoundSystem ../readstreamglue ../nodes'
incs += ' ../quicktime #/intern/elbeem/extern'
incs += ' #/intern/ghost #/intern/opennl/extern #/extern/glew/include'
-
+incs += ' ../freestyle'
incs += ' ' + env['BF_PYTHON_INC']
incs += ' ' + env['BF_SDL_INC']
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 8b35f90ea9d..6edf3ebf168 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -120,6 +120,8 @@ extern void makeffmpegstring(char* string);
#endif
+#include "FRS_freestyle.h"
+
/* here the calls for scene buttons
- render
- world
@@ -1362,6 +1364,15 @@ static void backbuf_pic(char *name)
BIF_undo_push("Change background picture");
}
+static void freestyle_module(char *name)
+{
+ strcpy(style_module, name);
+ allqueue(REDRAWBUTSSCENE, 0);
+ BIF_undo_push("Change style module");
+}
+
+
+
static void run_playanim(char *file)
{
extern char bprogname[]; /* usiblender.c */
@@ -1463,6 +1474,13 @@ void do_render_panels(unsigned short event)
activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
break;
+ case B_FS_FRS:
+ sa= closest_bigger_area();
+ areawinset(sa->win);
+ activate_fileselect(FILE_SPECIAL, "SELECT STYLE MODULE", style_module, freestyle_module);
+ break;
+
+
case B_PR_PAL:
G.scene->r.xsch= 720;
G.scene->r.ysch= 576;
@@ -3235,6 +3253,26 @@ static void render_panel_yafrayGlobal()
}
#endif /* disable yafray stuff */
+static void render_panel_freestyle()
+{
+ uiBlock *block;
+
+ if( strlen(style_module) == 0 )
+ FRS_initialize();
+
+ block= uiNewBlock(&curarea->uiblocks, "render_panel_freestyle", UI_EMBOSS, UI_HELV, curarea->win);
+ uiNewPanelTabbed("Render", "Render");
+ if(uiNewPanel(curarea, block, "Freestyle", "Render", 320, 0, 318, 204)==0) return;
+
+ // label to force a boundbox for buttons not to be centered
+ uiBlockBeginAlign(block);
+ uiDefIconBut(block, BUT, B_FS_FRS, ICON_FILESEL, 10, 190, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get style module");
+ uiDefBut(block, TEX,0,"", 31, 190, 279, 20, style_module, 0.0,79.0, 0, 0, "Style module path name");
+ uiBlockEndAlign(block);
+
+
+}
+
static void layer_copy_func(void *lay_v, void *lay_p)
{
unsigned int *lay= lay_p;
@@ -3453,6 +3491,11 @@ void render_panels()
}
#endif
+ if (G.scene->r.renderer==R_FREESTYLE) {
+ render_panel_freestyle();
+ }
+
+
}
/* --------------------------------------------- */