set(WITH_HEADLESS ON)
endif()
- if(WITH_OPENIMAGEIO)
- set(WITH_BOOST ON)
- endif()
-
+# auto enable openimageio and boost for cycles
+if(WITH_CYCLES)
+ set(WITH_OPENIMAGEIO ON)
+ set(WITH_BOOST ON)
+endif()
+
TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
# don't store paths to libs for portable distrobution
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_INPUT_NDOF)
++ info_cfg_option(WITH_CYCLES)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
set(WITH_BULLET OFF CACHE FORCE BOOL)
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
++set(WITH_CYCLES OFF CACHE FORCE BOOL)
set(WITH_FFTW3 OFF CACHE FORCE BOOL)
+ set(WITH_LIBMV OFF CACHE FORCE BOOL)
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
--- /dev/null
- import libcycles_blender as lib
+#
+# Copyright 2011, Blender Foundation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+import bpy
+
+def init():
- lib.init(path, user_path)
++ import bcycles
+ import os.path
+
+ path = os.path.dirname(__file__)
+ user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
+
- import libcycles_blender as lib
++ bcycles.init(path, user_path)
+
+def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0):
- engine.session = lib.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
++ import bcycles
+
+ data = data.as_pointer()
+ scene = scene.as_pointer()
+ if region:
+ region = region.as_pointer()
+ if v3d:
+ v3d = v3d.as_pointer()
+ if rv3d:
+ rv3d = rv3d.as_pointer()
+
- import libcycles_blender as lib
- lib.free(engine.session)
++ engine.session = bcycles.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
+
+def free(engine):
+ if "session" in dir(engine):
+ if engine.session:
- import libcycles_blender as lib
- lib.render(engine.session)
++ import bcycles
++ bcycles.free(engine.session)
+ del engine.session
+
+def render(engine):
- import libcycles_blender as lib
- lib.sync(engine.session)
++ import bcycles
++ bcycles.render(engine.session)
+
+def update(engine, data, scene):
- import libcycles_blender as lib
++ import bcycles
++ bcycles.sync(engine.session)
+
+def draw(engine, region, v3d, rv3d):
- lib.draw(engine.session, v3d, rv3d)
++ import bcycles
+ v3d = v3d.as_pointer()
+ rv3d = rv3d.as_pointer()
+
+ # draw render image
- import libcycles_blender as lib
- return lib.available_devices()
++ bcycles.draw(engine.session, v3d, rv3d)
+
+def available_devices():
- import libcycles_blender as lib
- return lib.with_osl()
++ import bcycles
++ return bcycles.available_devices()
+
+def with_osl():
++ import bcycles
++ return bcycles.with_osl()
+
--- /dev/null
- "libcycles_blender",
- "Blender RNA to render exporter",
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <Python.h>
+
+#include "blender_sync.h"
+#include "blender_session.h"
+
+#include "util_opengl.h"
+#include "util_path.h"
+
+CCL_NAMESPACE_BEGIN
+
+static PyObject *init_func(PyObject *self, PyObject *args)
+{
+ const char *path, *user_path;
+
+ if(!PyArg_ParseTuple(args, "ss", &path, &user_path))
+ return NULL;
+
+ path_init(path, user_path);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *create_func(PyObject *self, PyObject *args)
+{
+ PyObject *pyengine, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
+
+ if(!PyArg_ParseTuple(args, "OOOOOO", &pyengine, &pydata, &pyscene, &pyregion, &pyv3d, &pyrv3d))
+ return NULL;
+
+ /* RNA */
+ PointerRNA engineptr;
+ RNA_pointer_create(NULL, &RNA_RenderEngine, (void*)PyLong_AsVoidPtr(pyengine), &engineptr);
+ BL::RenderEngine engine(engineptr);
+
+ PointerRNA dataptr;
+ RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr);
+ BL::BlendData data(dataptr);
+
+ PointerRNA sceneptr;
+ RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
+ BL::Scene scene(sceneptr);
+
+ PointerRNA regionptr;
+ RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyregion), ®ionptr);
+ BL::Region region(regionptr);
+
+ PointerRNA v3dptr;
+ RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyv3d), &v3dptr);
+ BL::SpaceView3D v3d(v3dptr);
+
+ PointerRNA rv3dptr;
+ RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyrv3d), &rv3dptr);
+ BL::RegionView3D rv3d(rv3dptr);
+
+ /* create session */
+ BlenderSession *session;
+
+ if(rv3d) {
+ /* interactive session */
+ int width = region.width();
+ int height = region.height();
+
+ session = new BlenderSession(engine, data, scene, v3d, rv3d, width, height);
+ }
+ else {
+ /* offline session */
+ session = new BlenderSession(engine, data, scene);
+ }
+
+ return PyLong_FromVoidPtr(session);
+}
+
+static PyObject *free_func(PyObject *self, PyObject *args)
+{
+ PyObject *pysession;
+
+ if(!PyArg_ParseTuple(args, "O", &pysession))
+ return NULL;
+
+ delete (BlenderSession*)PyLong_AsVoidPtr(pysession);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *render_func(PyObject *self, PyObject *args)
+{
+ PyObject *pysession;
+
+ if(!PyArg_ParseTuple(args, "O", &pysession))
+ return NULL;
+
+ Py_BEGIN_ALLOW_THREADS
+
+ BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+ session->render();
+
+ Py_END_ALLOW_THREADS
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *draw_func(PyObject *self, PyObject *args)
+{
+ PyObject *pysession, *pyv3d, *pyrv3d;
+
+ if(!PyArg_ParseTuple(args, "OOO", &pysession, &pyv3d, &pyrv3d))
+ return NULL;
+
+ BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+
+ if(PyLong_AsVoidPtr(pyrv3d)) {
+ /* 3d view drawing */
+ int viewport[4];
+ glGetIntegerv(GL_VIEWPORT, viewport);
+
+ session->draw(viewport[2], viewport[3]);
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *sync_func(PyObject *self, PyObject *args)
+{
+ PyObject *pysession;
+
+ if(!PyArg_ParseTuple(args, "O", &pysession))
+ return NULL;
+
+ BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+ session->synchronize();
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *available_devices_func(PyObject *self, PyObject *args)
+{
+ vector<DeviceType> types = Device::available_types();
+
+ PyObject *ret = PyTuple_New(types.size());
+
+ for(size_t i = 0; i < types.size(); i++) {
+ string name = Device::string_from_type(types[i]);
+ PyTuple_SetItem(ret, i, PyUnicode_FromString(name.c_str()));
+ }
+
+ return ret;
+}
+
+static PyObject *with_osl_func(PyObject *self, PyObject *args)
+{
+#ifdef WITH_OSL
+ PyObject *ret = Py_True;
+#else
+ PyObject *ret = Py_False;
+#endif
+
+ return Py_INCREF(ret), ret;
+}
+
+static PyMethodDef methods[] = {
+ {"init", init_func, METH_VARARGS, ""},
+ {"create", create_func, METH_VARARGS, ""},
+ {"free", free_func, METH_VARARGS, ""},
+ {"render", render_func, METH_VARARGS, ""},
+ {"draw", draw_func, METH_VARARGS, ""},
+ {"sync", sync_func, METH_VARARGS, ""},
+ {"available_devices", available_devices_func, METH_NOARGS, ""},
+ {"with_osl", with_osl_func, METH_NOARGS, ""},
+ {NULL, NULL, 0, NULL},
+};
+
+static struct PyModuleDef module = {
+ PyModuleDef_HEAD_INIT,
++ "bcycles",
++ "Blender cycles render integration",
+ -1,
+ methods,
+ NULL, NULL, NULL, NULL
+};
+
+CCL_NAMESPACE_END
+
+extern "C" PyObject *CYCLES_initPython();
+
+PyObject *CYCLES_initPython()
+{
+ return PyModule_Create(&ccl::module);
+}
+
cam->sensor_y = DEFAULT_SENSOR_HEIGHT;
}
}
+ }
- {
- bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER);
++ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 2)) {
++ bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER);
+
- if(ntreetype && ntreetype->foreach_nodetree)
- ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260);
- }
++ if(ntreetype && ntreetype->foreach_nodetree)
++ ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260);
+ }
+
/* put compatibility code here until next subversion bump */
{
{
static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
+ PointerRNA mappingptr = RNA_pointer_get(ptr, "mapping");
uiLayout *row;
- uiItemL(layout, "Translation:", ICON_NONE);
+ uiItemL(layout, "Location:", ICON_NONE);
row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "location", 0, "", ICON_NONE);
+ uiItemR(row, &mappingptr, "location", 0, "", ICON_NONE);
uiItemL(layout, "Rotation:", ICON_NONE);
row= uiLayoutRow(layout, 1);
uiItemL(layout, "Scale:", ICON_NONE);
row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "scale", 0, "", ICON_NONE);
+ uiItemR(row, &mappingptr, "scale", 0, "", ICON_NONE);
- #if 0
row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "use_min", 0, "Min", ICON_NONE);
- uiItemR(row, ptr, "min", 0, "", ICON_NONE);
+ uiItemR(row, &mappingptr, "use_min", 0, "Min", ICON_NONE);
+ uiItemR(row, &mappingptr, "min", 0, "", ICON_NONE);
row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "use_max", 0, "Max", ICON_NONE);
- uiItemR(row, ptr, "max", 0, "", ICON_NONE);
-
+ uiItemR(row, &mappingptr, "use_max", 0, "Max", ICON_NONE);
+ uiItemR(row, &mappingptr, "max", 0, "", ICON_NONE);
- #endif
}
static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
}
}
- /*static void node_layout_prop(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname)
- {
- if(C && CTX_wm_space_node(C)) {
- uiItemR(layout, ptr, propname, 0, NULL, ICON_NONE);
- }
- else {
- uiLayout *split = uiLayoutSplit(layout, 0.35f, 0);
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
-
- uiItemL(uiLayoutColumn(split, 0), RNA_property_ui_name(prop), ICON_NONE);
- uiItemR(uiLayoutColumn(split, 0), ptr, propname, 0, "", ICON_NONE);
- }
- }*/
-
+static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "attribute_name", 0, "Name", ICON_NONE);
+}
+
+static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ //uiItemR(layout, ptr, "image", 0, "", ICON_NONE);
+ uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
+ uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
+}
+
+static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "sun_direction", 0, "", ICON_NONE);
+ uiItemR(layout, ptr, "turbidity", 0, NULL, ICON_NONE);
+}
+
+static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "gradient_type", 0, "", ICON_NONE);
+}
+
+static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "turbulence_depth", 0, NULL, ICON_NONE);
+}
+
+static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "wave_type", 0, "", ICON_NONE);
+}
+
+static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "musgrave_type", 0, "", ICON_NONE);
+}
+
+static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "coloring", 0, "", ICON_NONE);
+}
+
+static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE);
+}
+
static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
Main *bmain= CTX_data_main(C);
}
- static void node_shader_default_mapping(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+ static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
- node->storage= add_mapping();
+ node->storage= add_tex_mapping();
}
static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
static bNodeType ntype;
node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
- node_type_compatibility(&ntype, NODE_OLD_SHADING);
+ node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out);
node_type_size(&ntype, 240, 160, 320);
- node_type_init(&ntype, node_shader_default_mapping);
+ node_type_init(&ntype, node_shader_init_mapping);
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_mapping);
node_type_gpu(&ntype, gpu_shader_mapping);
{(char *)"blf", BPyInit_blf},
#ifdef WITH_AUDASPACE
{(char *)"aud", AUD_initPython},
- {(char *)"libcycles_blender", CYCLES_initPython},
+#endif
+#ifdef WITH_CYCLES
++ {(char *)"bcycles", CYCLES_initPython},
#endif
{(char *)"gpu", GPU_initPython},
{NULL, NULL}
bf_blenfont
bf_intern_audaspace
bf_intern_mikktspace
- extern_recastnavigation
- bf_editor_util # --- BAD LEVEL CALL HERE --- XXX, this should be removed before release!
+ bf_intern_cycles
+ cycles_render
+ cycles_bvh
+ cycles_device
+ cycles_kernel
+ cycles_util
+ cycles_subd
)
if(WITH_LIBMV)