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
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-11-10 03:03:31 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-11-10 03:03:31 +0300
commit51efe7de27119587c918a1e5cc429acca8ca672f (patch)
tree464c39158e29a8063517a6dce9f49cf690ecedfc /source/blender/freestyle
parentb65008dd6f113974bdf67082eea5ec10c93913b7 (diff)
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.
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/FRS_freestyle.h3
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.cpp11
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.h3
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp11
-rwxr-xr-xsource/blender/freestyle/intern/system/PythonInterpreter.h8
5 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h
index 73aae416819..1add5f97b38 100644
--- a/source/blender/freestyle/FRS_freestyle.h
+++ b/source/blender/freestyle/FRS_freestyle.h
@@ -16,7 +16,8 @@ extern "C" {
extern int freestyle_viewport[4];
// Rendering
- void FRS_initialize(bContext* C);
+ void FRS_initialize();
+ void FRS_set_context(bContext* C);
void FRS_add_Freestyle( struct Render* re);
void FRS_exit();
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 6b7f095c6ac..46f45f139fe 100755
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -71,7 +71,7 @@ extern "C" {
-Controller::Controller(bContext* C)
+Controller::Controller()
{
const string sep(Config::DIR_SEP.c_str());
@@ -108,7 +108,7 @@ Controller::Controller(bContext* C)
_Canvas = new AppCanvas;
- _inter = new PythonInterpreter(C);
+ _inter = new PythonInterpreter();
_EnableQI = true;
_ComputeRidges = true;
_ComputeSteerableViewMap = false;
@@ -175,6 +175,13 @@ void Controller::setView(AppView *iView)
_Canvas->setViewer(_pView);
}
+void Controller::setContext(bContext *C)
+{
+ PythonInterpreter* py_inter = dynamic_cast<PythonInterpreter*>(_inter);
+ assert(py_inter != 0);
+ py_inter->setContext(C);
+}
+
int Controller::LoadMesh(Render *re, SceneRenderLayer* srl)
{
diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h
index 99d85434811..4734462b7a5 100755
--- a/source/blender/freestyle/intern/application/Controller.h
+++ b/source/blender/freestyle/intern/application/Controller.h
@@ -66,10 +66,11 @@ extern "C" {
class Controller
{
public:
- Controller(bContext* C) ;
+ Controller() ;
~Controller() ;
void setView(AppView *iView);
+ void setContext(bContext *C);
//soc
void init_options();
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 8c5d7b0288a..0f2160d7bf6 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -45,13 +45,13 @@ extern "C" {
// Initialization
//=======================================================
- void FRS_initialize(bContext* C){
+ void FRS_initialize() {
if( freestyle_is_initialized )
return;
pathconfig = new Config::Path;
- controller = new Controller(C);
+ controller = new Controller();
view = new AppView;
controller->setView(view);
@@ -60,6 +60,11 @@ extern "C" {
freestyle_is_initialized = 1;
}
+ void FRS_set_context(bContext* C) {
+ cout << "FRS_set_context: context 0x" << C << " scene 0x" << CTX_data_scene(C) << endl;
+ controller->setContext(C);
+ }
+
void FRS_exit() {
delete pathconfig;
delete controller;
@@ -205,7 +210,7 @@ extern "C" {
displayed_layer_count(srl) > 0 )
{
cout << "\n----------------------------------------------------------" << endl;
- cout << "| "<< srl->name << endl;
+ cout << "| " << (re->scene->id.name+2) << "|" << srl->name << endl;
cout << "----------------------------------------------------------" << endl;
// prepare Freestyle:
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index e04e1d9b9d1..bf1a5064d3e 100755
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -51,9 +51,9 @@ class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter
{
public:
- PythonInterpreter(bContext* C) {
+ PythonInterpreter() {
_language = "Python";
- _context = C;
+ _context = 0;
//Py_Initialize();
}
@@ -61,6 +61,10 @@ class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter
//Py_Finalize();
}
+ void setContext(bContext *C) {
+ _context = C;
+ }
+
int interpretFile(const string& filename) {
initPath();