Cycles: svn merge -r41627:41650 ^/trunk/blender

This commit is contained in:
Brecht Van Lommel 2011-11-08 12:33:17 +00:00
commit 64ab414026
110 changed files with 833 additions and 1294 deletions

@ -15,6 +15,6 @@ from bpy.app.handlers import persistent
@persistent @persistent
def load_handler(dummy): def load_handler(dummy):
print("Load Handler:", bpy.data.filepath) print("Load Handler:", bpy.data.filepath)
bpy.app.handlers.load_post.append(load_handler) bpy.app.handlers.load_post.append(load_handler)

@ -6,7 +6,8 @@ This script shows the most simple example of adding a handler.
import bpy import bpy
def my_handler(scene):
print("Frame Change", scene.frame_current)
bpy.app.handlers.frame_change_pre.append(my_handler) def my_handler(scene):
print("Frame Change", scene.frame_current)
bpy.app.handlers.frame_change_pre.append(my_handler)

@ -25,8 +25,8 @@
set(INC set(INC
. .
../Eigen3 ../Eigen3
./third_party/ssba third_party/ssba
./third_party/ldl/Include third_party/ldl/Include
../colamd/Include ../colamd/Include
) )
@ -130,7 +130,7 @@ set(SRC
third_party/msinttypes/inttypes.h third_party/msinttypes/inttypes.h
) )
IF(WIN32) if(WIN32)
list(APPEND SRC list(APPEND SRC
third_party/glog/src/logging.cc third_party/glog/src/logging.cc
third_party/glog/src/raw_logging.cc third_party/glog/src/raw_logging.cc
@ -158,18 +158,23 @@ IF(WIN32)
) )
list(APPEND INC list(APPEND INC
./third_party/glog/src/windows third_party/glog/src/windows
./third_party/msinttypes
) )
IF(MSVC) if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
if(MSVC)
set(MSVC_OFLAGS O1 O2 Ox) set(MSVC_OFLAGS O1 O2 Ox)
foreach(FLAG ) foreach(FLAG )
string(REPLACE "" "Od" CMAKE_CXX_FLAGS_RELEASE "") string(REPLACE "" "Od" CMAKE_CXX_FLAGS_RELEASE "")
string(REPLACE "" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "") string(REPLACE "" "Od" CMAKE_C_FLAGS_RELWITHDEBINFO "")
endforeach() endforeach()
ENDIF(MSVC) endif()
ELSE(WIN32) else(WIN32)
list(APPEND SRC list(APPEND SRC
third_party/glog/src/utilities.cc third_party/glog/src/utilities.cc
third_party/glog/src/symbolize.cc third_party/glog/src/symbolize.cc
@ -201,9 +206,9 @@ ELSE(WIN32)
) )
list(APPEND INC list(APPEND INC
./third_party/glog/src third_party/glog/src
) )
ENDIF(WIN32) endif()
add_definitions(-DV3DLIB_ENABLE_SUITESPARSE -DGOOGLE_GLOG_DLL_DECL=) add_definitions(-DV3DLIB_ENABLE_SUITESPARSE -DGOOGLE_GLOG_DLL_DECL=)

@ -30,7 +30,9 @@ incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog ./third_party/msinttypes' incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc'] src += ['./third_party/glog/src/windows/port.cc']

@ -166,6 +166,16 @@ IF(WIN32)
third_party/glog/src/windows/config.h third_party/glog/src/windows/config.h
) )
list(APPEND INC
./third_party/glog/src/windows
)
IF(NOT MINGW)
list(APPEND INC
./third_party/msinttypes
)
ENDIF(MINGW)
list(APPEND INC list(APPEND INC
./third_party/glog/src/windows ./third_party/glog/src/windows
./third_party/msinttypes ./third_party/msinttypes
@ -219,7 +229,10 @@ incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog ./third_party/msinttypes' incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
${win_src} ${win_src}
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc'] src += ['./third_party/glog/src/windows/port.cc']

@ -32,6 +32,8 @@
namespace libmv { namespace libmv {
namespace euclidean_resection { namespace euclidean_resection {
typedef unsigned int uint;
bool EuclideanResection(const Mat2X &x_camera, bool EuclideanResection(const Mat2X &x_camera,
const Mat3X &X_world, const Mat3X &X_world,
Mat3 *R, Vec3 *t, Mat3 *R, Vec3 *t,

@ -1,3 +1,16 @@
diff --git a/src/libmv/multiview/euclidean_resection.cc b/src/libmv/multiview/euclidean_resection.cc
index 6d918a1..9286251 100644
--- a/src/libmv/multiview/euclidean_resection.cc
+++ b/src/libmv/multiview/euclidean_resection.cc
@@ -32,6 +32,8 @@
namespace libmv {
namespace euclidean_resection {
+typedef unsigned int uint;
+
bool EuclideanResection(const Mat2X &x_camera,
const Mat3X &X_world,
Mat3 *R, Vec3 *t,
diff --git a/src/libmv/numeric/numeric.h b/src/libmv/numeric/numeric.h diff --git a/src/libmv/numeric/numeric.h b/src/libmv/numeric/numeric.h
index f39d126..21e0f06 100644 index f39d126..21e0f06 100644
--- a/src/libmv/numeric/numeric.h --- a/src/libmv/numeric/numeric.h
@ -11,3 +24,148 @@ index f39d126..21e0f06 100644
inline long lround(double d) { inline long lround(double d) {
return (long)(d>0 ? d+0.5 : ceil(d-0.5)); return (long)(d>0 ? d+0.5 : ceil(d-0.5));
} }
diff --git a/src/third_party/glog/src/config.h b/src/third_party/glog/src/config.h
index ed8d56e..06ed686 100644
--- a/src/third_party/glog/src/config.h
+++ b/src/third_party/glog/src/config.h
@@ -4,6 +4,8 @@
/* Namespace for Google classes */
#ifdef __APPLE__
#include "config_mac.h"
+#elif __MINGW32__
+ #include "windows/config.h"
#elif __GNUC__
#include "config_linux.h"
#elif _MSC_VER
diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
index ee54f94..c4ae256 100644
--- a/src/third_party/glog/src/utilities.h
+++ b/src/third_party/glog/src/utilities.h
@@ -101,7 +101,9 @@
// correctly when GetStackTrace() is called with max_depth == 0.
// Some code may do that.
-#if defined(HAVE_LIB_UNWIND)
+#if __MINGW32__
+# undef STACKTRACE_H
+#elif defined(HAVE_LIB_UNWIND)
# define STACKTRACE_H "stacktrace_libunwind-inl.h"
#elif !defined(NO_FRAME_POINTER)
# if defined(__i386__) && __GNUC__ >= 2
diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
index 7a6df74..4257375 100755
--- a/src/third_party/glog/src/windows/glog/logging.h
+++ b/src/third_party/glog/src/windows/glog/logging.h
@@ -59,7 +59,7 @@
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
+# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
@@ -86,6 +86,15 @@
#include <gflags/gflags.h>
#endif
+#ifdef __MINGW32__
+# include <stdlib.h>
+# include <unistd.h>
+# include <stdint.h> // the normal place uint16_t is defined
+# include <sys/types.h> // the normal place u_int16_t is defined
+# include <inttypes.h> // a third place for uint16_t or u_int16_t
+# define _exit(x) exit(x)
+#endif
+
namespace google {
#if 0 // the C99 format
@@ -98,11 +107,16 @@ typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
-#elif 1 // the windows (vc7) format
+#elif defined(_MSC_VER)
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
+#elif defined(__MINGW32__)
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif
diff --git a/src/third_party/glog/src/windows/port.h b/src/third_party/glog/src/windows/port.h
index d093bf5..d507812 100755
--- a/src/third_party/glog/src/windows/port.h
+++ b/src/third_party/glog/src/windows/port.h
@@ -59,14 +59,16 @@
* used by both C and C++ code, so we put all the C++ together.
*/
-/* 4244: otherwise we get problems when substracting two size_t's to an int
- * 4251: it's complaining about a private struct I've chosen not to dllexport
- * 4355: we use this in a constructor, but we do it safely
- * 4715: for some reason VC++ stopped realizing you can't return after abort()
- * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
- * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
- */
-#pragma warning(disable:4244 4251 4355 4715 4800 4996)
+#if _MSC_VER
+ /* 4244: otherwise we get problems when substracting two size_t's to an int
+ * 4251: it's complaining about a private struct I've chosen not to dllexport
+ * 4355: we use this in a constructor, but we do it safely
+ * 4715: for some reason VC++ stopped realizing you can't return after abort()
+ * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
+ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
+ */
+# pragma warning(disable:4244 4251 4355 4715 4800 4996)
+#endif
/* file I/O */
#define PATH_MAX 1024
@@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
extern int safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
+#if !defined(__MINGW32__)
#define va_copy(dst, src) (dst) = (src)
+#endif
/* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank.
@@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
+#if __MINGW32__
+ struct tm *local_result;
+ local_result = localtime (timep);
+
+ if (local_result == NULL || result == NULL)
+ return NULL;
+
+ memcpy (result, local_result, sizeof (result));
+
+ return result;
+#else
localtime_s(result, timep);
return result;
+#endif
}
inline char* strerror_r(int errnum, char* buf, size_t buflen) {
+#if __MINGW32__
+ strncpy(buf, "Not implemented yet", buflen);
+ return buf;
+#else
strerror_s(buf, buflen, errnum);
return buf;
+#endif
}
#ifndef __cplusplus

@ -4,6 +4,8 @@
/* Namespace for Google classes */ /* Namespace for Google classes */
#ifdef __APPLE__ #ifdef __APPLE__
#include "config_mac.h" #include "config_mac.h"
#elif __MINGW32__
#include "windows/config.h"
#elif __GNUC__ #elif __GNUC__
#include "config_linux.h" #include "config_linux.h"
#elif _MSC_VER #elif _MSC_VER

@ -101,7 +101,9 @@
// correctly when GetStackTrace() is called with max_depth == 0. // correctly when GetStackTrace() is called with max_depth == 0.
// Some code may do that. // Some code may do that.
#if defined(HAVE_LIB_UNWIND) #if __MINGW32__
# undef STACKTRACE_H
#elif defined(HAVE_LIB_UNWIND)
# define STACKTRACE_H "stacktrace_libunwind-inl.h" # define STACKTRACE_H "stacktrace_libunwind-inl.h"
#elif !defined(NO_FRAME_POINTER) #elif !defined(NO_FRAME_POINTER)
# if defined(__i386__) && __GNUC__ >= 2 # if defined(__i386__) && __GNUC__ >= 2

@ -59,7 +59,7 @@
// Annoying stuff for windows -- makes sure clients can import these functions // Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL #ifndef GOOGLE_GLOG_DLL_DECL
# if defined(_WIN32) && !defined(__CYGWIN__) # if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport) # define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else # else
# define GOOGLE_GLOG_DLL_DECL # define GOOGLE_GLOG_DLL_DECL
@ -86,6 +86,15 @@
#include "third_party/gflags/gflags.h" #include "third_party/gflags/gflags.h"
#endif #endif
#ifdef __MINGW32__
# include <stdlib.h>
# include <unistd.h>
# include <stdint.h> // the normal place uint16_t is defined
# include <sys/types.h> // the normal place u_int16_t is defined
# include <inttypes.h> // a third place for uint16_t or u_int16_t
# define _exit(x) exit(x)
#endif
namespace google { namespace google {
#if 0 // the C99 format #if 0 // the C99 format
@ -98,11 +107,16 @@ typedef int32_t int32;
typedef u_int32_t uint32; typedef u_int32_t uint32;
typedef int64_t int64; typedef int64_t int64;
typedef u_int64_t uint64; typedef u_int64_t uint64;
#elif 1 // the windows (vc7) format #elif defined(_MSC_VER)
typedef __int32 int32; typedef __int32 int32;
typedef unsigned __int32 uint32; typedef unsigned __int32 uint32;
typedef __int64 int64; typedef __int64 int64;
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
#elif defined(__MINGW32__)
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#else #else
#error Do not know how to define a 32-bit integer quantity on your system #error Do not know how to define a 32-bit integer quantity on your system
#endif #endif

@ -59,14 +59,16 @@
* used by both C and C++ code, so we put all the C++ together. * used by both C and C++ code, so we put all the C++ together.
*/ */
/* 4244: otherwise we get problems when substracting two size_t's to an int #if _MSC_VER
* 4251: it's complaining about a private struct I've chosen not to dllexport /* 4244: otherwise we get problems when substracting two size_t's to an int
* 4355: we use this in a constructor, but we do it safely * 4251: it's complaining about a private struct I've chosen not to dllexport
* 4715: for some reason VC++ stopped realizing you can't return after abort() * 4355: we use this in a constructor, but we do it safely
* 4800: we know we're casting ints/char*'s to bools, and we're ok with that * 4715: for some reason VC++ stopped realizing you can't return after abort()
* 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror() * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
*/ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
#pragma warning(disable:4244 4251 4355 4715 4800 4996) */
# pragma warning(disable:4244 4251 4355 4715 4800 4996)
#endif
/* file I/O */ /* file I/O */
#define PATH_MAX 1024 #define PATH_MAX 1024
@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
extern int safe_vsnprintf(char *str, size_t size, extern int safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap); const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#if !defined(__MINGW32__)
#define va_copy(dst, src) (dst) = (src) #define va_copy(dst, src) (dst) = (src)
#endif
/* Windows doesn't support specifying the number of buckets as a /* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank. * hash_map constructor arg, so we leave this blank.
@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
inline struct tm* localtime_r(const time_t* timep, struct tm* result) { inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
#if __MINGW32__
struct tm *local_result;
local_result = localtime (timep);
if (local_result == NULL || result == NULL)
return NULL;
memcpy (result, local_result, sizeof (result));
return result;
#else
localtime_s(result, timep); localtime_s(result, timep);
return result; return result;
#endif
} }
inline char* strerror_r(int errnum, char* buf, size_t buflen) { inline char* strerror_r(int errnum, char* buf, size_t buflen) {
#if __MINGW32__
strncpy(buf, "Not implemented yet", buflen);
return buf;
#else
strerror_s(buf, buflen, errnum); strerror_s(buf, buflen, errnum);
return buf; return buf;
#endif
} }
#ifndef __cplusplus #ifndef __cplusplus

@ -118,7 +118,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
case BL::ShaderNode::type_COMBRGB: break; case BL::ShaderNode::type_COMBRGB: break;
case BL::ShaderNode::type_CURVE_RGB: break; case BL::ShaderNode::type_CURVE_RGB: break;
case BL::ShaderNode::type_CURVE_VEC: break; case BL::ShaderNode::type_CURVE_VEC: break;
case BL::ShaderNode::type_GEOM: break; case BL::ShaderNode::type_GEOMETRY: break;
case BL::ShaderNode::type_HUE_SAT: break; case BL::ShaderNode::type_HUE_SAT: break;
case BL::ShaderNode::type_INVERT: break; case BL::ShaderNode::type_INVERT: break;
case BL::ShaderNode::type_MATERIAL: break; case BL::ShaderNode::type_MATERIAL: break;
@ -218,10 +218,6 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
node = new HoldoutNode(); node = new HoldoutNode();
break; break;
} }
case BL::ShaderNode::type_BSDF_ANISOTROPIC: {
node = new WardBsdfNode();
break;
}
case BL::ShaderNode::type_BSDF_DIFFUSE: { case BL::ShaderNode::type_BSDF_DIFFUSE: {
node = new DiffuseBsdfNode(); node = new DiffuseBsdfNode();
break; break;
@ -285,7 +281,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
node = new TransparentVolumeNode(); node = new TransparentVolumeNode();
break; break;
} }
case BL::ShaderNode::type_GEOMETRY: { case BL::ShaderNode::type_NEW_GEOMETRY: {
node = new GeometryNode(); node = new GeometryNode();
break; break;
} }

@ -208,7 +208,7 @@ class BPyOpsSubModOp(object):
return "# %s\n%s" % (descr, as_string) return "# %s\n%s" % (descr, as_string)
def __str__(self): # used for print(...) def __str__(self): # used for print(...)
return "<function bpy.ops.%s.%s at 0x%x'>" % \ return ("<function bpy.ops.%s.%s at 0x%x'>" %
(self.module, self.func, id(self)) (self.module, self.func, id(self)))
ops_fake_module = BPyOps() ops_fake_module = BPyOps()

@ -25,9 +25,11 @@ from bpyml import TAG, ARGS, CHILDREN
_uilayout_rna = _bpy.types.UILayout.bl_rna _uilayout_rna = _bpy.types.UILayout.bl_rna
_uilayout_tags = ["ui"] + \ _uilayout_tags = (
_uilayout_rna.properties.keys() + \ ["ui"] +
_uilayout_rna.properties.keys() +
_uilayout_rna.functions.keys() _uilayout_rna.functions.keys()
)
# these need to be imported directly # these need to be imported directly
# >>> from bpyml_ui.locals import * # >>> from bpyml_ui.locals import *

@ -155,7 +155,8 @@ class CLIP_OT_delete_proxy(Operator):
self._rmproxy(d + '_undistorted') self._rmproxy(d + '_undistorted')
self._rmproxy(os.path.join(absproxy, 'proxy_' + str(x) + '.avi')) self._rmproxy(os.path.join(absproxy, 'proxy_' + str(x) + '.avi'))
tc = ('free_run.blen_tc', 'interp_free_run.blen_tc', \ tc = ('free_run.blen_tc',
'interp_free_run.blen_tc',
'record_run.blen_tc') 'record_run.blen_tc')
for x in tc: for x in tc:
@ -280,10 +281,10 @@ class CLIP_OT_constraint_to_fcurve(Operator):
efra = max(efra, track.markers[-1].frame) efra = max(efra, track.markers[-1].frame)
if sfra is None or efra is None: if sfra is None or efra is None:
return return
# Store object matrices # Store object matrices
for x in range(sfra, efra+1): for x in range(sfra, efra + 1):
scene.frame_set(x) scene.frame_set(x)
matrices.append(ob.matrix_world.copy()) matrices.append(ob.matrix_world.copy())
@ -291,7 +292,7 @@ class CLIP_OT_constraint_to_fcurve(Operator):
# Apply matrices on object and insert keyframes # Apply matrices on object and insert keyframes
i = 0 i = 0
for x in range(sfra, efra+1): for x in range(sfra, efra + 1):
scene.frame_set(x) scene.frame_set(x)
ob.matrix_world = matrices[i] ob.matrix_world = matrices[i]

@ -105,8 +105,7 @@ class QuickFur(Operator):
psys.settings.child_type = 'INTERPOLATED' psys.settings.child_type = 'INTERPOLATED'
obj.data.materials.append(mat) obj.data.materials.append(mat)
obj.particle_systems[-1].settings.material = \ psys.settings.material = len(obj.data.materials)
len(obj.data.materials)
return {'FINISHED'} return {'FINISHED'}

@ -212,8 +212,11 @@ def islandIntersectUvIsland(source, target, SourceOffset):
# Edge intersect test # Edge intersect test
for ed in edgeLoopsSource: for ed in edgeLoopsSource:
for seg in edgeLoopsTarget: for seg in edgeLoopsTarget:
i = geometry.intersect_line_line_2d(\ i = geometry.intersect_line_line_2d(seg[0],
seg[0], seg[1], SourceOffset+ed[0], SourceOffset+ed[1]) seg[1],
SourceOffset+ed[0],
SourceOffset+ed[1],
)
if i: if i:
return 1 # LINE INTERSECTION return 1 # LINE INTERSECTION
@ -773,15 +776,16 @@ def main_consts():
global ROTMAT_2D_POS_45D global ROTMAT_2D_POS_45D
global RotMatStepRotation global RotMatStepRotation
ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2) ROTMAT_2D_POS_90D = Matrix.Rotation(radians(90.0), 2)
ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2) ROTMAT_2D_POS_45D = Matrix.Rotation(radians(45.0), 2)
RotMatStepRotation = [] RotMatStepRotation = []
rot_angle = 22.5 #45.0/2 rot_angle = 22.5 #45.0/2
while rot_angle > 0.1: while rot_angle > 0.1:
RotMatStepRotation.append([\ RotMatStepRotation.append([
Matrix.Rotation( radians(rot_angle), 2),\ Matrix.Rotation(radians(+rot_angle), 2),
Matrix.Rotation( radians(-rot_angle), 2)]) Matrix.Rotation(radians(-rot_angle), 2),
])
rot_angle = rot_angle/2.0 rot_angle = rot_angle/2.0

@ -108,6 +108,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
col.prop(cam, "clip_start", text="Start") col.prop(cam, "clip_start", text="Start")
col.prop(cam, "clip_end", text="End") col.prop(cam, "clip_end", text="End")
class DATA_PT_camera(CameraButtonsPanel, Panel): class DATA_PT_camera(CameraButtonsPanel, Panel):
bl_label = "Camera" bl_label = "Camera"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@ -120,8 +121,8 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
row = layout.row(align=True) row = layout.row(align=True)
row.menu("CAMERA_MT_presets", text=bpy.types.CAMERA_MT_presets.bl_label) row.menu("CAMERA_MT_presets", text=bpy.types.CAMERA_MT_presets.bl_label)
row.operator("camera.preset_add", text="", icon="ZOOMIN") row.operator("camera.preset_add", text="", icon='ZOOMIN')
row.operator("camera.preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("camera.preset_add", text="", icon='ZOOMOUT').remove_active = True
layout.label(text="Sensor:") layout.label(text="Sensor:")
@ -137,6 +138,7 @@ class DATA_PT_camera(CameraButtonsPanel, Panel):
col = split.column(align=True) col = split.column(align=True)
col.prop(cam, "sensor_fit", text="") col.prop(cam, "sensor_fit", text="")
class DATA_PT_camera_dof(CameraButtonsPanel, Panel): class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
bl_label = "Depth of Field" bl_label = "Depth of Field"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@ -156,6 +158,7 @@ class DATA_PT_camera_dof(CameraButtonsPanel, Panel):
col.active = cam.dof_object is None col.active = cam.dof_object is None
col.prop(cam, "dof_distance", text="Distance") col.prop(cam, "dof_distance", text="Distance")
class DATA_PT_camera_display(CameraButtonsPanel, Panel): class DATA_PT_camera_display(CameraButtonsPanel, Panel):
bl_label = "Display" bl_label = "Display"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}

@ -134,8 +134,8 @@ class DATA_PT_sunsky(DataButtonsPanel, Panel):
row = layout.row(align=True) row = layout.row(align=True)
row.prop(lamp, "use_sky") row.prop(lamp, "use_sky")
row.menu("LAMP_MT_sunsky_presets", text=bpy.types.LAMP_MT_sunsky_presets.bl_label) row.menu("LAMP_MT_sunsky_presets", text=bpy.types.LAMP_MT_sunsky_presets.bl_label)
row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMIN") row.operator("lamp.sunsky_preset_add", text="", icon='ZOOMIN')
row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("lamp.sunsky_preset_add", text="", icon='ZOOMOUT').remove_active = True
row = layout.row() row = layout.row()
row.active = lamp.use_sky or lamp.use_atmosphere row.active = lamp.use_sky or lamp.use_atmosphere

@ -315,11 +315,9 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
split = layout.split() split = layout.split()
if dome_type == 'FISHEYE' or \ if dome_type in {'FISHEYE', 'TRUNCATED_REAR', 'TRUNCATED_FRONT'}:
dome_type == 'TRUNCATED_REAR' or \
dome_type == 'TRUNCATED_FRONT':
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True) col.prop(gs, "dome_angle", slider=True)
@ -336,6 +334,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
else: # cube map else: # cube map
col = split.column() col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True) col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col = split.column() col = split.column()

@ -124,7 +124,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, Panel):
split.template_ID(ob, "active_material", new="material.new") split.template_ID(ob, "active_material", new="material.new")
row = split.row() row = split.row()
if mat: if mat:
row.prop(mat, "use_nodes", icon="NODETREE", text="") row.prop(mat, "use_nodes", icon='NODETREE', text="")
if slot: if slot:
row.prop(slot, "link", text="") row.prop(slot, "link", text="")
@ -501,8 +501,8 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, Panel):
row = layout.row().split() row = layout.row().split()
sub = row.row(align=True).split(percentage=0.75) sub = row.row(align=True).split(percentage=0.75)
sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label) sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
sub.operator("material.sss_preset_add", text="", icon="ZOOMIN") sub.operator("material.sss_preset_add", text="", icon='ZOOMIN')
sub.operator("material.sss_preset_add", text="", icon="ZOOMOUT").remove_active = True sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_active = True
split = layout.split() split = layout.split()

@ -267,12 +267,12 @@ class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
ob = context.object ob = context.object
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.label(text="Tracking Axes:") col.label(text="Tracking Axes:")
col.prop(ob, "track_axis", text="Axis") col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis") col.prop(ob, "up_axis", text="Up Axis")
col = split.column() col = split.column()
col.prop(ob, "use_slow_parent") col.prop(ob, "use_slow_parent")
row = col.row() row = col.row()

@ -73,8 +73,8 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
col.label(text="Presets:") col.label(text="Presets:")
sub = col.row(align=True) sub = col.row(align=True)
sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label)
sub.operator("cloth.preset_add", text="", icon="ZOOMIN") sub.operator("cloth.preset_add", text="", icon='ZOOMIN')
sub.operator("cloth.preset_add", text="", icon="ZOOMOUT").remove_active = True sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True
col.label(text="Quality:") col.label(text="Quality:")
col.prop(cloth, "quality", text="Steps", slider=True) col.prop(cloth, "quality", text="Steps", slider=True)

@ -206,7 +206,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
col = split.column() col = split.column()
if scene.use_gravity: if scene.use_gravity:
col.label(text="Use Scene Gravity", icon="SCENE_DATA") col.label(text="Use Scene Gravity", icon='SCENE_DATA')
sub = col.column() sub = col.column()
sub.enabled = False sub.enabled = False
sub.prop(fluid, "gravity", text="") sub.prop(fluid, "gravity", text="")
@ -215,7 +215,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
col.prop(fluid, "gravity", text="") col.prop(fluid, "gravity", text="")
if scene.unit_settings.system != 'NONE': if scene.unit_settings.system != 'NONE':
col.label(text="Use Scene Size Units", icon="SCENE_DATA") col.label(text="Use Scene Size Units", icon='SCENE_DATA')
sub = col.column() sub = col.column()
sub.enabled = False sub.enabled = False
sub.prop(fluid, "simulation_scale", text="Metres") sub.prop(fluid, "simulation_scale", text="Metres")

@ -186,8 +186,8 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
row = layout.row(align=True) row = layout.row(align=True)
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label) row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
row.operator("render.preset_add", text="", icon="ZOOMIN") row.operator("render.preset_add", text="", icon='ZOOMIN')
row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("render.preset_add", text="", icon='ZOOMOUT').remove_active = True
split = layout.split() split = layout.split()

@ -312,10 +312,10 @@ class CLIP_PT_track(Panel):
row = layout.row(align=True) row = layout.row(align=True)
label = bpy.types.CLIP_MT_track_color_presets.bl_label label = bpy.types.CLIP_MT_track_color_presets.bl_label
row.menu('CLIP_MT_track_color_presets', text=label) row.menu('CLIP_MT_track_color_presets', text=label)
row.menu('CLIP_MT_track_color_specials', text="", icon="DOWNARROW_HLT") row.menu('CLIP_MT_track_color_specials', text="", icon='DOWNARROW_HLT')
row.operator("clip.track_color_preset_add", text="", icon="ZOOMIN") row.operator("clip.track_color_preset_add", text="", icon='ZOOMIN')
props = row.operator("clip.track_color_preset_add", props = row.operator("clip.track_color_preset_add",
text="", icon="ZOOMOUT") text="", icon='ZOOMOUT')
props.remove_active = True props.remove_active = True
row = layout.row() row = layout.row()
@ -349,8 +349,8 @@ class CLIP_PT_tracking_camera(Panel):
row = layout.row(align=True) row = layout.row(align=True)
label = bpy.types.CLIP_MT_camera_presets.bl_label label = bpy.types.CLIP_MT_camera_presets.bl_label
row.menu('CLIP_MT_camera_presets', text=label) row.menu('CLIP_MT_camera_presets', text=label)
row.operator("clip.camera_preset_add", text="", icon="ZOOMIN") row.operator("clip.camera_preset_add", text="", icon='ZOOMIN')
props = row.operator("clip.camera_preset_add", text="", icon="ZOOMOUT") props = row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT')
props.remove_active = True props.remove_active = True
row = layout.row(align=True) row = layout.row(align=True)
@ -441,11 +441,11 @@ class CLIP_PT_track_settings(Panel):
active = clip.tracking.tracks.active active = clip.tracking.tracks.active
if active: if active:
layout.prop(active, "tracker") layout.prop(active, "tracker")
if active.tracker == "KLT": if active.tracker == 'KLT':
layout.prop(active, "pyramid_levels") layout.prop(active, "pyramid_levels")
if active.tracker == "SAD": elif active.tracker == 'SAD':
layout.prop(active, "correlation_min") layout.prop(active, "correlation_min")
layout.prop(settings, "frames_adjust") layout.prop(settings, "frames_adjust")
layout.prop(settings, "speed") layout.prop(settings, "speed")
@ -489,7 +489,7 @@ class CLIP_PT_stabilization(Panel):
sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="") sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="")
sub.menu('CLIP_MT_stabilize_2d_specials', text="", sub.menu('CLIP_MT_stabilize_2d_specials', text="",
icon="DOWNARROW_HLT") icon='DOWNARROW_HLT')
layout.prop(stab, "influence_location") layout.prop(stab, "influence_location")
@ -757,8 +757,8 @@ class CLIP_MT_reconstruction(Menu):
layout.operator("clip.set_origin") layout.operator("clip.set_origin")
layout.operator("clip.set_floor") layout.operator("clip.set_floor")
layout.operator("clip.set_axis", text="Set X Asix").axis = "X" layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
layout.operator("clip.set_axis", text="Set Y Asix").axis = "Y" layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
layout.operator("clip.set_scale") layout.operator("clip.set_scale")

@ -61,7 +61,7 @@ class IMAGE_MT_view(Menu):
layout.separator() layout.separator()
ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]] ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
for a, b in ratios: for a, b in ratios:
layout.operator("image.view_zoom_ratio", text="Zoom" + " %d:%d" % (a, b)).ratio = a / b layout.operator("image.view_zoom_ratio", text="Zoom" + " %d:%d" % (a, b)).ratio = a / b
@ -746,12 +746,12 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
layout.template_curve_mapping(brush, "curve") layout.template_curve_mapping(brush, "curve")
row = layout.row(align=True) row = layout.row(align=True)
row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH' row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND' row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT' row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP' row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
if __name__ == "__main__": # only for live edit. if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__) bpy.utils.register_module(__name__)

@ -967,10 +967,10 @@ class USERPREF_PT_addons(Panel):
continue continue
# check if addon should be visible with current filters # check if addon should be visible with current filters
if (filter == "All") or \ if ((filter == "All") or
(filter == info["category"]) or \ (filter == info["category"]) or
(filter == "Enabled" and is_enabled) or \ (filter == "Enabled" and is_enabled) or
(filter == "Disabled" and not is_enabled): (filter == "Disabled" and not is_enabled)):
if search and search not in info["name"].lower(): if search and search not in info["name"].lower():
if info["author"]: if info["author"]:

@ -223,7 +223,7 @@ class InputKeyMapPanel:
col = layout.column() col = layout.column()
row = col.row() row = col.row()
row.label(text=km.name, icon="DOT") row.label(text=km.name, icon='DOT')
row.label() row.label()
row.label() row.label()
@ -265,13 +265,13 @@ class InputKeyMapPanel:
if not text: if not text:
text = "Blender (default)" text = "Blender (default)"
row.menu("USERPREF_MT_keyconfigs", text=text) row.menu("USERPREF_MT_keyconfigs", text=text)
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN") row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMIN')
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMOUT').remove_active = True
#~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active) #~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
#~ row.operator("wm.keyconfig_remove", text="", icon='X') #~ row.operator("wm.keyconfig_remove", text="", icon='X')
row.prop(context.space_data, "filter_text", icon="VIEWZOOM") row.prop(context.space_data, "filter_text", icon='VIEWZOOM')
col.separator() col.separator()

@ -1536,7 +1536,7 @@ class VIEW3D_MT_edit_mesh_select_mode(Menu):
class VIEW3D_MT_edit_mesh_extrude(Menu): class VIEW3D_MT_edit_mesh_extrude(Menu):
bl_label = "Extrude" bl_label = "Extrude"
_extrude_funcs = { \ _extrude_funcs = {
"VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
"EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
"FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),

@ -172,7 +172,7 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
bl_context = "mesh_edit" bl_context = "mesh_edit"
bl_label = "Mesh Options" bl_label = "Mesh Options"
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return context.active_object return context.active_object
@ -912,12 +912,12 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, Panel):
layout.template_curve_mapping(brush, "curve", brush=True) layout.template_curve_mapping(brush, "curve", brush=True)
row = layout.row(align=True) row = layout.row(align=True)
row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH' row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND' row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT' row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP' row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
class VIEW3D_PT_sculpt_options(PaintPanel, Panel): class VIEW3D_PT_sculpt_options(PaintPanel, Panel):

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines. * and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */ * Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260 #define BLENDER_VERSION 260
#define BLENDER_SUBVERSION 1 #define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 250 #define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0 #define BLENDER_MINSUBVERSION 0

@ -245,6 +245,7 @@ typedef struct bNodeType {
struct bNodeTreeExec; struct bNodeTreeExec;
typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree); typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
typedef struct bNodeTreeType typedef struct bNodeTreeType
{ {
int type; /* type identifier */ int type; /* type identifier */
@ -256,6 +257,7 @@ typedef struct bNodeTreeType
void (*free_cache)(struct bNodeTree *ntree); void (*free_cache)(struct bNodeTree *ntree);
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node); void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
void (*foreach_nodetree)(struct Main *main, void *calldata, bNodeTreeCallback func); /* iteration over all node trees */ void (*foreach_nodetree)(struct Main *main, void *calldata, bNodeTreeCallback func); /* iteration over all node trees */
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func); /* iteration over all node classes */
/* calls allowing threaded composite */ /* calls allowing threaded composite */
void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree); void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
@ -440,7 +442,7 @@ struct ShadeResult;
#define SH_NODE_RGBTOBW 105 #define SH_NODE_RGBTOBW 105
#define SH_NODE_TEXTURE 106 #define SH_NODE_TEXTURE 106
#define SH_NODE_NORMAL 107 #define SH_NODE_NORMAL 107
#define SH_NODE_GEOM 108 #define SH_NODE_GEOMETRY 108
#define SH_NODE_MAPPING 109 #define SH_NODE_MAPPING 109
#define SH_NODE_CURVE_VEC 110 #define SH_NODE_CURVE_VEC 110
#define SH_NODE_CURVE_RGB 111 #define SH_NODE_CURVE_RGB 111
@ -470,7 +472,7 @@ struct ShadeResult;
#define SH_NODE_BSDF_TRANSPARENT 138 #define SH_NODE_BSDF_TRANSPARENT 138
#define SH_NODE_BSDF_VELVET 139 #define SH_NODE_BSDF_VELVET 139
#define SH_NODE_EMISSION 140 #define SH_NODE_EMISSION 140
#define SH_NODE_GEOMETRY 141 #define SH_NODE_NEW_GEOMETRY 141
#define SH_NODE_LIGHT_PATH 142 #define SH_NODE_LIGHT_PATH 142
#define SH_NODE_TEX_IMAGE 143 #define SH_NODE_TEX_IMAGE 143
#define SH_NODE_TEX_SKY 145 #define SH_NODE_TEX_SKY 145

@ -370,7 +370,9 @@ if(WITH_GAMEENGINE)
endif() endif()
if(WITH_LIBMV) if(WITH_LIBMV)
list(APPEND INC ../../../extern/libmv) list(APPEND INC
../../../extern/libmv
)
add_definitions(-DWITH_LIBMV) add_definitions(-DWITH_LIBMV)
endif() endif()

@ -191,15 +191,13 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
{ {
struct ImBuf *ibuf; struct ImBuf *ibuf;
char name[FILE_MAX]; char name[FILE_MAX];
int loadflag /*, size */ /* UNUSED */, undistort; int loadflag, use_proxy= 0;
/* size= rendersize_to_number(user->render_size); */ use_proxy= (flag&MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
if(use_proxy) {
undistort= user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT; int undistort= user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT;
if((flag&MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL)
get_proxy_fname(clip, user->render_size, undistort, framenr, name); get_proxy_fname(clip, user->render_size, undistort, framenr, name);
else } else
get_sequence_fname(clip, framenr, name); get_sequence_fname(clip, framenr, name);
loadflag= IB_rect|IB_multilayer; loadflag= IB_rect|IB_multilayer;
@ -318,7 +316,7 @@ static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
if(clip->cache) { if(clip->cache) {
MovieClipImBufCacheKey key; MovieClipImBufCacheKey key;
key.framenr= user?user->framenr:clip->lastframe; key.framenr= user->framenr;
if(flag&MCLIP_USE_PROXY) { if(flag&MCLIP_USE_PROXY) {
key.proxy= rendersize_to_proxy(user, flag); key.proxy= rendersize_to_proxy(user, flag);
@ -346,7 +344,7 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
moviecache_hashcmp, moviecache_keydata); moviecache_hashcmp, moviecache_keydata);
} }
key.framenr= user?user->framenr:clip->lastframe; key.framenr= user->framenr;
if(flag&MCLIP_USE_PROXY) { if(flag&MCLIP_USE_PROXY) {
key.proxy= rendersize_to_proxy(user, flag); key.proxy= rendersize_to_proxy(user, flag);
@ -478,9 +476,6 @@ static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, in
static int need_undistorted_cache(MovieClipUser *user, int flag) static int need_undistorted_cache(MovieClipUser *user, int flag)
{ {
if (!user)
return 0;
/* only full undistorted render can be used as on-fly undistorting image */ /* only full undistorted render can be used as on-fly undistorting image */
if(flag&MCLIP_USE_PROXY) { if(flag&MCLIP_USE_PROXY) {
if(user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL || (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT)==0) if(user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL || (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT)==0)
@ -495,7 +490,7 @@ static ImBuf *get_undistorted_cache(MovieClip *clip, MovieClipUser *user)
{ {
MovieClipCache *cache= clip->cache; MovieClipCache *cache= clip->cache;
MovieTrackingCamera *camera= &clip->tracking.camera; MovieTrackingCamera *camera= &clip->tracking.camera;
int framenr= user?user->framenr:clip->lastframe; int framenr= user->framenr;
/* no cache or no cached undistorted image */ /* no cache or no cached undistorted image */
if(!clip->cache || !clip->cache->undistibuf) if(!clip->cache || !clip->cache->undistibuf)
@ -517,7 +512,7 @@ static ImBuf *get_undistorted_cache(MovieClip *clip, MovieClipUser *user)
return cache->undistibuf; return cache->undistibuf;
} }
static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *distoriton, ImBuf *ibuf) static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *distortion, ImBuf *ibuf)
{ {
ImBuf *undistibuf; ImBuf *undistibuf;
@ -525,12 +520,12 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
otherwise, undistorted proxy can be darker than it should */ otherwise, undistorted proxy can be darker than it should */
imb_freerectfloatImBuf(ibuf); imb_freerectfloatImBuf(ibuf);
if(distoriton) if(distortion)
undistibuf= BKE_tracking_distortion_exec(distoriton, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1); undistibuf= BKE_tracking_distortion_exec(distortion, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1);
else else
undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f); undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f);
if(undistibuf->userflags|= IB_RECT_INVALID) { if(undistibuf->userflags&IB_RECT_INVALID) {
ibuf->userflags&= ~IB_RECT_INVALID; ibuf->userflags&= ~IB_RECT_INVALID;
IMB_rect_from_float(undistibuf); IMB_rect_from_float(undistibuf);
} }
@ -547,7 +542,7 @@ static ImBuf *put_undistorted_cache(MovieClip *clip, MovieClipUser *user, ImBuf
copy_v2_v2(cache->principal, camera->principal); copy_v2_v2(cache->principal, camera->principal);
copy_v3_v3(&cache->k1, &camera->k1); copy_v3_v3(&cache->k1, &camera->k1);
cache->undist_framenr= user?user->framenr:clip->lastframe; cache->undist_framenr= user->framenr;
if(cache->undistibuf) if(cache->undistibuf)
IMB_freeImBuf(cache->undistibuf); IMB_freeImBuf(cache->undistibuf);
@ -568,7 +563,7 @@ static ImBuf *put_undistorted_cache(MovieClip *clip, MovieClipUser *user, ImBuf
ImBuf *BKE_movieclip_get_ibuf(MovieClip *clip, MovieClipUser *user) ImBuf *BKE_movieclip_get_ibuf(MovieClip *clip, MovieClipUser *user)
{ {
ImBuf *ibuf= NULL; ImBuf *ibuf= NULL;
int framenr= user?user->framenr:clip->lastframe; int framenr= user->framenr;
int cache_undistorted= 0; int cache_undistorted= 0;
/* cache isn't threadsafe itself and also loading of movies /* cache isn't threadsafe itself and also loading of movies
@ -586,11 +581,11 @@ ImBuf *BKE_movieclip_get_ibuf(MovieClip *clip, MovieClipUser *user)
ibuf= get_imbuf_cache(clip, user, clip->flag); ibuf= get_imbuf_cache(clip, user, clip->flag);
if(!ibuf) { if(!ibuf) {
int use_sequence= 1; int use_sequence= 0;
/* undistorted proxies for movies should be read as image sequence */ /* undistorted proxies for movies should be read as image sequence */
use_sequence&= user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT; use_sequence= (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) &&
use_sequence&= user->render_size!=MCLIP_PROXY_RENDER_SIZE_FULL; (user->render_size!=MCLIP_PROXY_RENDER_SIZE_FULL);
if(clip->source==MCLIP_SRC_SEQUENCE || use_sequence) if(clip->source==MCLIP_SRC_SEQUENCE || use_sequence)
ibuf= movieclip_load_sequence_file(clip, user, framenr, clip->flag); ibuf= movieclip_load_sequence_file(clip, user, framenr, clip->flag);
@ -622,7 +617,7 @@ ImBuf *BKE_movieclip_get_ibuf(MovieClip *clip, MovieClipUser *user)
ImBuf *BKE_movieclip_get_ibuf_flag(MovieClip *clip, MovieClipUser *user, int flag) ImBuf *BKE_movieclip_get_ibuf_flag(MovieClip *clip, MovieClipUser *user, int flag)
{ {
ImBuf *ibuf= NULL; ImBuf *ibuf= NULL;
int framenr= user?user->framenr:clip->lastframe; int framenr= user->framenr;
int cache_undistorted= 0; int cache_undistorted= 0;
/* cache isn't threadsafe itself and also loading of movies /* cache isn't threadsafe itself and also loading of movies
@ -668,7 +663,7 @@ ImBuf *BKE_movieclip_get_ibuf_flag(MovieClip *clip, MovieClipUser *user, int fla
ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle) ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle)
{ {
ImBuf *ibuf, *stableibuf= NULL; ImBuf *ibuf, *stableibuf= NULL;
int framenr= user?user->framenr:clip->lastframe; int framenr= user->framenr;
ibuf= BKE_movieclip_get_ibuf(clip, user); ibuf= BKE_movieclip_get_ibuf(clip, user);
@ -749,7 +744,7 @@ int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user)
void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, int *height) void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, int *height)
{ {
if(!user || user->framenr==clip->lastframe) { if(user->framenr==clip->lastframe) {
*width= clip->lastsize[0]; *width= clip->lastsize[0];
*height= clip->lastsize[1]; *height= clip->lastsize[1];
} else { } else {

@ -1907,20 +1907,18 @@ static void registerShaderNodes(ListBase *ntypelist)
register_node_type_sh_bsdf_diffuse(ntypelist); register_node_type_sh_bsdf_diffuse(ntypelist);
register_node_type_sh_bsdf_glossy(ntypelist); register_node_type_sh_bsdf_glossy(ntypelist);
register_node_type_sh_bsdf_glass(ntypelist); register_node_type_sh_bsdf_glass(ntypelist);
//register_node_type_sh_bsdf_anisotropic(ntypelist);
register_node_type_sh_bsdf_translucent(ntypelist); register_node_type_sh_bsdf_translucent(ntypelist);
register_node_type_sh_bsdf_transparent(ntypelist); register_node_type_sh_bsdf_transparent(ntypelist);
register_node_type_sh_bsdf_velvet(ntypelist); register_node_type_sh_bsdf_velvet(ntypelist);
register_node_type_sh_emission(ntypelist); register_node_type_sh_emission(ntypelist);
register_node_type_sh_holdout(ntypelist); register_node_type_sh_holdout(ntypelist);
register_node_type_sh_volume_transparent(ntypelist); //register_node_type_sh_volume_transparent(ntypelist);
register_node_type_sh_volume_isotropic(ntypelist); //register_node_type_sh_volume_isotropic(ntypelist);
register_node_type_sh_mix_shader(ntypelist); register_node_type_sh_mix_shader(ntypelist);
register_node_type_sh_add_shader(ntypelist); register_node_type_sh_add_shader(ntypelist);
register_node_type_sh_output_lamp(ntypelist); register_node_type_sh_output_lamp(ntypelist);
register_node_type_sh_output_material(ntypelist); register_node_type_sh_output_material(ntypelist);
//register_node_type_sh_output_texture(ntypelist);
register_node_type_sh_output_world(ntypelist); register_node_type_sh_output_world(ntypelist);
register_node_type_sh_tex_image(ntypelist); register_node_type_sh_tex_image(ntypelist);

@ -3176,7 +3176,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
mul_v3_fl(v1_tan, 1.0f - 0.01f * frict); mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
/* surface_velocity is opposite to cm velocity */ /* surface_velocity is opposite to cm velocity */
mul_v3_v3fl(vr_tan, v1_tan, -1.0f); negate_v3_v3(vr_tan, v1_tan);
/* get back to global coordinates */ /* get back to global coordinates */
add_v3_v3(v1_tan, vc_tan); add_v3_v3(v1_tan, vc_tan);

@ -2167,6 +2167,14 @@ static void ntree_tmp_cycles_version_patch(bNodeTree *ntree)
} }
} }
} }
else if(node->type == SH_NODE_MIX_RGB) {
bNodeSocket *sock = node->inputs.first;
sock=sock->next;
strcpy(sock->name, "Color1");
sock=sock->next;
strcpy(sock->name, "Color2");
}
else { else {
for(sock=node->inputs.first; sock; sock=sock->next) { for(sock=node->inputs.first; sock; sock=sock->next) {
if(strcmp(sock->name, "Closure1") == 0) if(strcmp(sock->name, "Closure1") == 0)

@ -3684,7 +3684,7 @@ void REEB_draw()
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX) if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{ {
interp_v3_v3v3(vec, arc->head->p, arc->tail->p, 0.5f); mid_v3_v3v3(vec, arc->head->p, arc->tail->p);
s += sprintf(s, "%i (%i-%i-%i) ", i, arc->symmetry_level, arc->symmetry_flag, arc->symmetry_group); s += sprintf(s, "%i (%i-%i-%i) ", i, arc->symmetry_level, arc->symmetry_flag, arc->symmetry_group);
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_WEIGHT) if (G.scene->toolsettings->skgen_options & SKGEN_DISP_WEIGHT)

@ -77,6 +77,10 @@ typedef struct uiLayout uiLayout;
/* Defines */ /* Defines */
/* names */
#define UI_MAX_DRAW_STR 400
#define UI_MAX_NAME_STR 128
/* uiBlock->dt */ /* uiBlock->dt */
#define UI_EMBOSS 0 /* use widget style for drawing */ #define UI_EMBOSS 0 /* use widget style for drawing */
#define UI_EMBOSSN 1 /* Nothing, only icon and/or text */ #define UI_EMBOSSN 1 /* Nothing, only icon and/or text */
@ -131,11 +135,11 @@ typedef struct uiLayout uiLayout;
#define UI_ICON_LEFT 128 #define UI_ICON_LEFT 128
#define UI_ICON_SUBMENU 256 #define UI_ICON_SUBMENU 256
#define UI_ICON_PREVIEW 512 #define UI_ICON_PREVIEW 512
/* control for button type block */
#define UI_MAKE_TOP 1024 #define UI_BUT_NODE_LINK 1024
#define UI_MAKE_DOWN 2048 #define UI_BUT_NODE_ACTIVE 2048
#define UI_MAKE_LEFT 4096 #define UI_FLAG_UNUSED 4096
#define UI_MAKE_RIGHT 8192 #define UI_FLAG_UNUSED2 8192
/* button align flag, for drawing groups together */ /* button align flag, for drawing groups together */
#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT|UI_BUT_ALIGN_DOWN) #define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT|UI_BUT_ALIGN_DOWN)
@ -159,8 +163,6 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_VEC_SIZE_LOCK (1<<30) /* used to flag if color hsv-circle should keep luminance */ #define UI_BUT_VEC_SIZE_LOCK (1<<30) /* used to flag if color hsv-circle should keep luminance */
#define UI_BUT_COLOR_CUBIC (1<<31) /* cubic saturation for the color wheel */ #define UI_BUT_COLOR_CUBIC (1<<31) /* cubic saturation for the color wheel */
#define UI_BUT_NODE_LINK (1<<30) /* node link drawing hint for pulldowns */
#define UI_BUT_NODE_ACTIVE (1<<31) /* node link drawing hint for pulldowns */
#define UI_PANEL_WIDTH 340 #define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160 #define UI_COMPACT_PANEL_WIDTH 160

@ -45,7 +45,6 @@ set(SRC
interface_icons.c interface_icons.c
interface_layout.c interface_layout.c
interface_ops.c interface_ops.c
interface_node.c
interface_panel.c interface_panel.c
interface_regions.c interface_regions.c
interface_style.c interface_style.c

@ -97,11 +97,6 @@ typedef enum {
} uiWidgetTypeEnum; } uiWidgetTypeEnum;
#define UI_MAX_DRAW_STR 400
#define UI_MAX_NAME_STR 128
/* panel limits */ /* panel limits */
#define UI_PANEL_MINX 100 #define UI_PANEL_MINX 100
#define UI_PANEL_MINY 70 #define UI_PANEL_MINY 70

@ -1533,15 +1533,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
if(ELEM(but->type, BLOCK, PULLDOWN)) if(ELEM(but->type, BLOCK, PULLDOWN))
block->xofs = -2; /* for proper alignment */ block->xofs = -2; /* for proper alignment */
/* only used for automatic toolbox, so can set the shift flag */
if(but->flag & UI_MAKE_TOP) {
block->direction= UI_TOP|UI_SHIFT_FLIPPED;
uiBlockFlipOrder(block);
}
if(but->flag & UI_MAKE_DOWN) block->direction= UI_DOWN|UI_SHIFT_FLIPPED;
if(but->flag & UI_MAKE_LEFT) block->direction |= UI_LEFT;
if(but->flag & UI_MAKE_RIGHT) block->direction |= UI_RIGHT;
ui_block_position(window, butregion, but, block); ui_block_position(window, butregion, but, block);
} }
else { else {

@ -2609,9 +2609,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBlockSetEmboss(block, UI_EMBOSS); uiBlockSetEmboss(block, UI_EMBOSS);
uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
/* XXX linking hack */
uiTemplateNodeView(NULL, NULL, NULL, NULL, NULL);
} }
/********************************* Keymap *************************************/ /********************************* Keymap *************************************/

@ -1183,7 +1183,6 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect); widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
} }
else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) { else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
/* node link hacking */
int tmp = rect->xmin; int tmp = rect->xmin;
rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1; rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect); widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
@ -2546,28 +2545,19 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
{ {
/* silly node link button hacks */ /* silly node link button hacks */
uiWidgetBase wtb; uiWidgetBase wtb;
unsigned char tmp[4]; uiWidgetColors wcol_backup= *wcol;
unsigned char tmp2[4];
widget_init(&wtb); widget_init(&wtb);
/* half rounded */ /* half rounded */
round_box_edges(&wtb, roundboxalign, rect, 4.0f); round_box_edges(&wtb, roundboxalign, rect, 4.0f);
memcpy(tmp, wcol->inner, sizeof(char)*4); wcol->inner[0] += 15; wcol->inner[1] += 15; wcol->inner[2] += 15;
memcpy(tmp2, wcol->outline, sizeof(char)*4); wcol->outline[0] += 15; wcol->outline[1] += 15; wcol->outline[2] += 15;
wcol->inner[0] += 15;
wcol->inner[1] += 15;
wcol->inner[2] += 15;
wcol->outline[0] += 15;
wcol->outline[1] += 15;
wcol->outline[2] += 15;
/* decoration */ /* decoration */
widgetbase_draw(&wtb, wcol); widgetbase_draw(&wtb, wcol);
*wcol= wcol_backup;
memcpy(wcol->inner, tmp, sizeof(char)*4);
memcpy(wcol->outline, tmp2, sizeof(char)*4);
} }
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))

@ -1537,7 +1537,7 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
} }
/* could fail if footage uses images with different sizes */ /* could fail if footage uses images with different sizes */
BKE_movieclip_get_size(clip, NULL, &width, &height); BKE_movieclip_get_size(clip, &sc->user, &width, &height);
error= BKE_tracking_solve_reconstruction(tracking, width, height); error= BKE_tracking_solve_reconstruction(tracking, width, height);
@ -1546,6 +1546,9 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
else else
BKE_reportf(op->reports, RPT_INFO, "Average reprojection error %.3f", error); BKE_reportf(op->reports, RPT_INFO, "Average reprojection error %.3f", error);
if(scene->clip)
id_us_min(&clip->id);
scene->clip= clip; scene->clip= clip;
id_us_plus(&clip->id); id_us_plus(&clip->id);

@ -84,7 +84,7 @@ Image *ED_space_image(SpaceImage *sima)
/* called to assign images to UV faces */ /* called to assign images to UV faces */
void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, Image *ima) void ED_space_image_set(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, Image *ima)
{ {
ED_uvedit_assign_image(G.main, scene, obedit, ima, sima->image); ED_uvedit_assign_image(CTX_data_main(C), scene, obedit, ima, sima->image);
/* change the space ima after because uvedit_face_visible uses the space ima /* change the space ima after because uvedit_face_visible uses the space ima
* to check if the face is displayed in UV-localview */ * to check if the face is displayed in UV-localview */

@ -49,6 +49,7 @@ set(SRC
node_ops.c node_ops.c
node_select.c node_select.c
node_state.c node_state.c
node_templates.c
space_node.c space_node.c
node_intern.h node_intern.h

@ -1125,7 +1125,7 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_VECT_MATH: case SH_NODE_VECT_MATH:
ntype->uifunc= node_shader_buts_vect_math; ntype->uifunc= node_shader_buts_vect_math;
break; break;
case SH_NODE_GEOM: case SH_NODE_GEOMETRY:
ntype->uifunc= node_shader_buts_geometry; ntype->uifunc= node_shader_buts_geometry;
break; break;
case SH_NODE_ATTRIBUTE: case SH_NODE_ATTRIBUTE:

@ -45,6 +45,7 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_node.h" #include "BKE_node.h"
#include "BKE_screen.h" #include "BKE_screen.h"
@ -122,6 +123,34 @@ static void active_node_panel(const bContext *C, Panel *pa)
node->typeinfo->uifunc(layout, (bContext *)C, &ptr); node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
} }
static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode= CTX_wm_space_node(C);
return (snode && snode->nodetree && G.rt == 777);
}
static void node_sockets_panel(const bContext *C, Panel *pa)
{
SpaceNode *snode= CTX_wm_space_node(C);
bNodeTree *ntree= (snode) ? snode->edittree : NULL;
bNode *node = (ntree) ? nodeGetActive(ntree) : NULL;
bNodeSocket *sock;
uiLayout *layout= pa->layout, *split;
char name[UI_MAX_NAME_STR];
if(ELEM(NULL, ntree, node))
return;
for(sock=node->inputs.first; sock; sock=sock->next) {
BLI_snprintf(name, sizeof(name), "%s:", sock->name);
split = uiLayoutSplit(layout, 0.35f, 0);
uiItemL(split, name, ICON_NONE);
uiTemplateNodeLink(split, ntree, node, sock);
}
}
/* ******************* node buttons registration ************** */ /* ******************* node buttons registration ************** */
void node_buttons_register(ARegionType *art) void node_buttons_register(ARegionType *art)
@ -134,6 +163,14 @@ void node_buttons_register(ARegionType *art)
pt->draw= active_node_panel; pt->draw= active_node_panel;
pt->poll= active_node_poll; pt->poll= active_node_poll;
BLI_addtail(&art->paneltypes, pt); BLI_addtail(&art->paneltypes, pt);
pt= MEM_callocN(sizeof(PanelType), "spacetype node panel node sockets");
strcpy(pt->idname, "NODE_PT_sockets");
strcpy(pt->label, "Sockets");
pt->draw= node_sockets_panel;
pt->poll= node_sockets_poll;
pt->flag |= PNL_DEFAULT_CLOSED;
BLI_addtail(&art->paneltypes, pt);
pt= MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil"); pt= MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil");
strcpy(pt->idname, "NODE_PT_gpencil"); strcpy(pt->idname, "NODE_PT_gpencil");

@ -2255,9 +2255,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
node->id = &scene->id; node->id = &scene->id;
} }
else if(ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) { else if(ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) {
if(G.main->movieclip.first == G.main->movieclip.last) { node->id = (ID *)scene->clip;
node->id= G.main->movieclip.first;
}
} }
ntreeCompositForceHidden(snode->edittree, scene); ntreeCompositForceHidden(snode->edittree, scene);

@ -226,52 +226,24 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
} }
} }
static void node_menu_add_foreach_cb(void *calldata, int nclass, const char *name)
{
uiLayout *layout= calldata;
uiItemMenuF(layout, name, 0, node_add_menu, SET_INT_IN_POINTER(nclass));
}
static void node_menu_add(const bContext *C, Menu *menu) static void node_menu_add(const bContext *C, Menu *menu)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceNode *snode= CTX_wm_space_node(C); SpaceNode *snode= CTX_wm_space_node(C);
uiLayout *layout= menu->layout; uiLayout *layout= menu->layout;
bNodeTreeType *ntreetype= ntreeGetType(snode->treetype);
if(!snode->nodetree) if(!snode->nodetree)
uiLayoutSetActive(layout, 0); uiLayoutSetActive(layout, 0);
if(snode->treetype==NTREE_SHADER) { if(ntreetype && ntreetype->foreach_nodeclass)
uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
if(scene_use_new_shading_nodes(scene)) {
uiItemMenuF(layout, IFACE_("Shader"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER));
uiItemMenuF(layout, IFACE_("Texture"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
}
uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
//uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
else if(snode->treetype==NTREE_COMPOSIT) {
uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
uiItemMenuF(layout, IFACE_("Filter"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER));
uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
uiItemMenuF(layout, IFACE_("Matte"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE));
uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
else if(snode->treetype==NTREE_TEXTURE) {
uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
uiItemMenuF(layout, IFACE_("Patterns"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN));
uiItemMenuF(layout, IFACE_("Textures"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT));
uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
} }
void node_menus_register(void) void node_menus_register(void)

@ -53,27 +53,14 @@
#include "WM_types.h" #include "WM_types.h"
#include "UI_interface.h" #include "UI_interface.h"
#include "interface_intern.h" #include "UI_resources.h"
#include "../interface/interface_intern.h"
#include "ED_node.h" #include "ED_node.h"
/************************* Node Link Menu **************************/ /************************* Node Socket Manipulation **************************/
#define UI_NODE_LINK_ADD 0 static void node_tag_recursive(bNode *node)
#define UI_NODE_LINK_DISCONNECT -1
#define UI_NODE_LINK_REMOVE -2
typedef struct NodeLinkArg {
bNodeTree *ntree;
bNode *node;
bNodeSocket *sock;
bNodeTree *ngroup;
int type;
int output;
} NodeLinkArg;
static void ui_node_tag_recursive(bNode *node)
{ {
bNodeSocket *input; bNodeSocket *input;
@ -84,10 +71,10 @@ static void ui_node_tag_recursive(bNode *node)
for(input=node->inputs.first; input; input=input->next) for(input=node->inputs.first; input; input=input->next)
if(input->link) if(input->link)
ui_node_tag_recursive(input->link->fromnode); node_tag_recursive(input->link->fromnode);
} }
static void ui_node_clear_recursive(bNode *node) static void node_clear_recursive(bNode *node)
{ {
bNodeSocket *input; bNodeSocket *input;
@ -98,10 +85,10 @@ static void ui_node_clear_recursive(bNode *node)
for(input=node->inputs.first; input; input=input->next) for(input=node->inputs.first; input; input=input->next)
if(input->link) if(input->link)
ui_node_clear_recursive(input->link->fromnode); node_clear_recursive(input->link->fromnode);
} }
static void ui_node_remove_linked(bNodeTree *ntree, bNode *rem_node) static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
{ {
bNode *node, *next; bNode *node, *next;
bNodeSocket *sock; bNodeSocket *sock;
@ -113,14 +100,14 @@ static void ui_node_remove_linked(bNodeTree *ntree, bNode *rem_node)
for(node=ntree->nodes.first; node; node=node->next) for(node=ntree->nodes.first; node; node=node->next)
node->flag &= ~NODE_TEST; node->flag &= ~NODE_TEST;
ui_node_tag_recursive(rem_node); node_tag_recursive(rem_node);
/* clear tags on nodes that are still used by other nodes */ /* clear tags on nodes that are still used by other nodes */
for(node=ntree->nodes.first; node; node=node->next) for(node=ntree->nodes.first; node; node=node->next)
if(!(node->flag & NODE_TEST)) if(!(node->flag & NODE_TEST))
for(sock=node->inputs.first; sock; sock=sock->next) for(sock=node->inputs.first; sock; sock=sock->next)
if(sock->link && sock->link->fromnode != rem_node) if(sock->link && sock->link->fromnode != rem_node)
ui_node_clear_recursive(sock->link->fromnode); node_clear_recursive(sock->link->fromnode);
/* remove nodes */ /* remove nodes */
for(node=ntree->nodes.first; node; node=next) { for(node=ntree->nodes.first; node; node=next) {
@ -132,8 +119,157 @@ static void ui_node_remove_linked(bNodeTree *ntree, bNode *rem_node)
nodeFreeNode(ntree, node); nodeFreeNode(ntree, node);
} }
} }
}
//node_tree_verify_groups(ntree);
/* disconnect socket from the node it is connected to */
static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
if(!sock_to->link)
return;
nodeRemLink(ntree, sock_to->link);
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
ED_node_generic_update(bmain, ntree, node_to);
}
/* remove all nodes connected to this socket, if they aren't connected to other nodes */
static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
{
if(!sock_to->link)
return;
node_remove_linked(ntree, sock_to->link->fromnode);
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
ED_node_generic_update(bmain, ntree, node_to);
}
/* add new node connected to this socket, or replace an existing one */
static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to, bNodeTemplate *ntemp, int sock_num)
{
bNode *node_from;
bNodeSocket *sock_from;
bNode *node_prev = NULL;
/* unlink existing node */
if(sock_to->link) {
node_prev = sock_to->link->fromnode;
nodeRemLink(ntree, sock_to->link);
}
/* find existing node that we can use */
for(node_from=ntree->nodes.first; node_from; node_from=node_from->next)
if(node_from->type == ntemp->type)
break;
if(node_from)
if(!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
node_from = NULL;
if(node_prev && node_prev->type == ntemp->type &&
(ntemp->type != NODE_GROUP || node_prev->id == &ntemp->ngroup->id)) {
/* keep the previous node if it's the same type */
node_from = node_prev;
}
else if(!node_from) {
node_from= nodeAddNode(ntree, ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
if(node_from->id)
id_us_plus(node_from->id);
}
nodeSetActive(ntree, node_from);
/* add link */
sock_from = BLI_findlink(&node_from->outputs, sock_num);
nodeAddLink(ntree, node_from, sock_from, node_to, sock_to);
/* copy input sockets from previous node */
if(node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
for(sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
for(sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
if(strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
if(link && link->fromnode) {
nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
nodeRemLink(ntree, link);
}
if(sock_prev->default_value) {
if(sock_from->default_value)
MEM_freeN(sock_from->default_value);
sock_from->default_value = MEM_dupallocN(sock_prev->default_value);
}
}
}
}
/* also preserve mapping for texture nodes */
if(node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
/* remove node */
node_remove_linked(ntree, node_prev);
}
nodeUpdate(ntree, node_from);
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
ED_node_generic_update(bmain, ntree, node_to);
}
/****************************** Node Link Menu *******************************/
#define UI_NODE_LINK_ADD 0
#define UI_NODE_LINK_DISCONNECT -1
#define UI_NODE_LINK_REMOVE -2
typedef struct NodeLinkArg {
Main *bmain;
Scene *scene;
bNodeTree *ntree;
bNode *node;
bNodeSocket *sock;
bNodeTree *ngroup;
int type;
int output;
uiLayout *layout;
} NodeLinkArg;
static void ui_node_link(bContext *UNUSED(C), void *arg_p, void *event_p)
{
NodeLinkArg *arg = (NodeLinkArg*)arg_p;
Main *bmain = arg->bmain;
bNode *node_to = arg->node;
bNodeSocket *sock_to = arg->sock;
bNodeTree *ntree = arg->ntree;
int event = GET_INT_FROM_POINTER(event_p);
bNodeTemplate ntemp;
ntemp.type = arg->type;
ntemp.ngroup = arg->ngroup;
if(event == UI_NODE_LINK_DISCONNECT)
node_socket_disconnect(bmain, ntree, node_to, sock_to);
else if(event == UI_NODE_LINK_REMOVE)
node_socket_remove(bmain, ntree, node_to, sock_to);
else
node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output);
} }
static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR]) static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
@ -160,128 +296,17 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
BLI_strncpy(name, "Default", UI_MAX_NAME_STR); BLI_strncpy(name, "Default", UI_MAX_NAME_STR);
} }
static void ui_node_link(bContext *C, void *arg_p, void *event_p)
{
NodeLinkArg *arg = (NodeLinkArg*)arg_p;
bNode *node_to = arg->node;
bNodeSocket *sock_to = arg->sock;
bNodeTree *ntree = arg->ntree;
bNode *node_from;
bNodeSocket *sock_from;
int event = GET_INT_FROM_POINTER(event_p);
if(event == UI_NODE_LINK_DISCONNECT) {
/* disconnect */
if(sock_to->link)
nodeRemLink(ntree, sock_to->link);
}
else if(event == UI_NODE_LINK_REMOVE) {
/* remove */
if(sock_to->link)
ui_node_remove_linked(ntree, sock_to->link->fromnode);
}
else {
bNode *node_prev = NULL;
/* unlink existing node */
if(sock_to->link) {
node_prev = sock_to->link->fromnode;
nodeRemLink(ntree, sock_to->link);
}
/* find existing node that we can use */
for(node_from=ntree->nodes.first; node_from; node_from=node_from->next)
if(node_from->type == arg->type)
break;
if(node_from)
if(!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
node_from = NULL;
if(node_prev && node_prev->type == arg->type &&
(arg->type != NODE_GROUP || node_prev->id == &arg->ngroup->id)) {
/* keep the previous node if it's the same type */
node_from = node_prev;
}
else if(!node_from) {
bNodeTemplate ntemp;
/* add new node */
if(arg->ngroup) {
ntemp.type = NODE_GROUP;
ntemp.ngroup = arg->ngroup;
}
else
ntemp.type = arg->type;
node_from= nodeAddNode(ntree, &ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
if(node_from->id)
id_us_plus(node_from->id);
}
nodeSetActive(ntree, node_from);
/* add link */
sock_from = BLI_findlink(&node_from->outputs, arg->output);
nodeAddLink(ntree, node_from, sock_from, node_to, sock_to);
/* copy input sockets from previous node */
if(node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
for(sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
for(sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
if(strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
if(link && link->fromnode) {
nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
nodeRemLink(ntree, link);
}
if(sock_prev->default_value) {
if(sock_from->default_value)
MEM_freeN(sock_from->default_value);
sock_from->default_value = MEM_dupallocN(sock_prev->default_value);
}
}
}
}
/* also preserve mapping for texture nodes */
if(node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
/* remove node */
ui_node_remove_linked(ntree, node_prev);
}
nodeUpdate(ntree, node_from);
}
nodeUpdate(ntree, node_to);
ntreeUpdateTree(ntree);
ED_node_generic_update(CTX_data_main(C), ntree, node_to);
}
static int ui_compatible_sockets(int typeA, int typeB) static int ui_compatible_sockets(int typeA, int typeB)
{ {
if(typeA == SOCK_SHADER || typeB == SOCK_SHADER)
return (typeA == typeB);
return (typeA == typeB); return (typeA == typeB);
} }
static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout, const char *cname, int nclass, int compatibility) static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
{ {
Main *bmain = arg->bmain;
bNodeTree *ntree = arg->ntree; bNodeTree *ntree = arg->ntree;
bNodeSocket *sock = arg->sock; bNodeSocket *sock = arg->sock;
uiLayout *layout = arg->layout;
uiLayout *column = NULL; uiLayout *column = NULL;
uiBlock *block = uiLayoutGetBlock(layout); uiBlock *block = uiLayoutGetBlock(layout);
uiBut *but; uiBut *but;
@ -289,6 +314,14 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
bNodeTree *ngroup; bNodeTree *ngroup;
NodeLinkArg *argN; NodeLinkArg *argN;
int first = 1; int first = 1;
int compatibility= 0;
if(ntree->type == NTREE_SHADER) {
if(scene_use_new_shading_nodes(arg->scene))
compatibility= NODE_NEW_SHADING;
else
compatibility= NODE_OLD_SHADING;
}
if(nclass == NODE_CLASS_GROUP) { if(nclass == NODE_CLASS_GROUP) {
for(ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) { for(ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
@ -311,7 +344,7 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
column= uiLayoutColumn(layout, 0); column= uiLayoutColumn(layout, 0);
uiBlockSetCurLayout(block, column); uiBlockSetCurLayout(block, column);
uiItemL(column, cname, ICON_NONE); uiItemL(column, cname, ICON_NODE);
but= block->buttons.last; but= block->buttons.last;
but->flag= UI_TEXT_LEFT; but->flag= UI_TEXT_LEFT;
@ -320,7 +353,7 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
if(num > 1) { if(num > 1) {
if(j == 0) { if(j == 0) {
uiItemL(column, ngroup->id.name+2, ICON_NONE); uiItemL(column, ngroup->id.name+2, ICON_NODE);
but= block->buttons.last; but= block->buttons.last;
but->flag= UI_TEXT_LEFT; but->flag= UI_TEXT_LEFT;
} }
@ -367,7 +400,7 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
column= uiLayoutColumn(layout, 0); column= uiLayoutColumn(layout, 0);
uiBlockSetCurLayout(block, column); uiBlockSetCurLayout(block, column);
uiItemL(column, cname, ICON_NONE); uiItemL(column, cname, ICON_NODE);
but= block->buttons.last; but= block->buttons.last;
but->flag= UI_TEXT_LEFT; but->flag= UI_TEXT_LEFT;
@ -376,7 +409,7 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
if(num > 1) { if(num > 1) {
if(j == 0) { if(j == 0) {
uiItemL(column, ntype->name, ICON_NONE); uiItemL(column, ntype->name, ICON_NODE);
but= block->buttons.last; but= block->buttons.last;
but->flag= UI_TEXT_LEFT; but->flag= UI_TEXT_LEFT;
} }
@ -399,6 +432,14 @@ static void ui_node_menu_column(Main *bmain, NodeLinkArg *arg, uiLayout *layout,
} }
} }
static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name)
{
NodeLinkArg *arg = (NodeLinkArg*)calldata;
if(!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
ui_node_menu_column(arg, nclass, name);
}
static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p) static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p)
{ {
Main *bmain= CTX_data_main(C); Main *bmain= CTX_data_main(C);
@ -408,25 +449,17 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
uiLayout *split, *column; uiLayout *split, *column;
NodeLinkArg *arg = (NodeLinkArg*)but->func_argN; NodeLinkArg *arg = (NodeLinkArg*)but->func_argN;
bNodeSocket *sock = arg->sock; bNodeSocket *sock = arg->sock;
int compatibility= 0; bNodeTreeType *ntreetype= ntreeGetType(arg->ntree->type);
if(arg->ntree->type == NTREE_SHADER) {
if(scene_use_new_shading_nodes(scene))
compatibility= NODE_NEW_SHADING;
else
compatibility= NODE_OLD_SHADING;
}
uiBlockSetCurLayout(block, layout); uiBlockSetCurLayout(block, layout);
split= uiLayoutSplit(layout, 0, 0); split= uiLayoutSplit(layout, 0, 0);
ui_node_menu_column(bmain, arg, split, "Input", NODE_CLASS_INPUT, compatibility); arg->bmain= bmain;
ui_node_menu_column(bmain, arg, split, "Output", NODE_CLASS_OUTPUT, compatibility); arg->scene= scene;
ui_node_menu_column(bmain, arg, split, "Shader", NODE_CLASS_SHADER, compatibility); arg->layout= split;
ui_node_menu_column(bmain, arg, split, "Texture", NODE_CLASS_TEXTURE, compatibility);
ui_node_menu_column(bmain, arg, split, "Color", NODE_CLASS_OP_COLOR, compatibility); if(ntreetype && ntreetype->foreach_nodeclass)
ui_node_menu_column(bmain, arg, split, "Vector", NODE_CLASS_OP_VECTOR, compatibility); ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
ui_node_menu_column(bmain, arg, split, "Convertor", NODE_CLASS_CONVERTOR, compatibility);
column= uiLayoutColumn(split, 0); column= uiLayoutColumn(split, 0);
uiBlockSetCurLayout(block, column); uiBlockSetCurLayout(block, column);
@ -445,7 +478,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT)); uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT));
} }
ui_node_menu_column(bmain, arg, column, "Group", NODE_CLASS_GROUP, compatibility); ui_node_menu_column(arg, NODE_CLASS_GROUP, IFACE_("Group"));
} }
void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSocket *sock) void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSocket *sock)
@ -481,7 +514,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
but->flag |= UI_BUT_NODE_ACTIVE; but->flag |= UI_BUT_NODE_ACTIVE;
} }
/************************* Node Tree Layout **************************/ /**************************** Node Tree Layout *******************************/
static void ui_node_draw_input(uiLayout *layout, bContext *C, static void ui_node_draw_input(uiLayout *layout, bContext *C,
bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth); bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth);
@ -518,6 +551,9 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
char label[UI_MAX_NAME_STR]; char label[UI_MAX_NAME_STR];
int indent = (depth > 1)? 2*(depth - 1): 0; int indent = (depth > 1)? 2*(depth - 1): 0;
if(input->flag & SOCK_UNAVAIL)
return;
/* to avoid eternal loops on cyclic dependencies */ /* to avoid eternal loops on cyclic dependencies */
node->flag |= NODE_TEST; node->flag |= NODE_TEST;
lnode = (input->link)? input->link->fromnode: NULL; lnode = (input->link)? input->link->fromnode: NULL;
@ -552,6 +588,8 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
} }
uiItemL(row, label, ICON_NONE); uiItemL(row, label, ICON_NONE);
bt= block->buttons.last;
bt->flag= UI_TEXT_LEFT;
if(lnode) { if(lnode) {
/* input linked to a node */ /* input linked to a node */

@ -2563,7 +2563,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
copy_v3_v3(v1, eed->v1->co); copy_v3_v3(v1, eed->v1->co);
copy_v3_v3(v2, eed->v2->co); copy_v3_v3(v2, eed->v2->co);
interp_v3_v3v3(vmid, v1, v2, 0.5f); mid_v3_v3v3(vmid, v1, v2);
if(do_global) { if(do_global) {
mul_mat3_m4_v3(ob->obmat, v1); mul_mat3_m4_v3(ob->obmat, v1);

@ -2233,7 +2233,6 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
mask |= CD_MASK_MTFACE | CD_MASK_MCOL; mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
if(scene_use_new_shading_nodes(scene)) { if(scene_use_new_shading_nodes(scene)) {
/* todo: use orco in textured draw mode */
if(v3d->drawtype == OB_MATERIAL) if(v3d->drawtype == OB_MATERIAL)
mask |= CD_MASK_ORCO; mask |= CD_MASK_ORCO;
} }

@ -781,7 +781,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
} }
if(ok) { if(ok) {
interp_v3_v3v3(vec, min, max, 0.5); mid_v3_v3v3(vec, min, max);
} }
} }

@ -513,7 +513,7 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
{NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""}, {NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""},
{NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
{TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
{TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""}, {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Proportional Influence", ""},
{TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""},
{TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};

@ -619,6 +619,65 @@ static void recalcData_nla(TransInfo *t)
} }
} }
/* helper for recalcData() - for Image Editor transforms */
static void recalcData_image(TransInfo *t)
{
if (t->obedit && t->obedit->type == OB_MESH) {
SpaceImage *sima= t->sa->spacedata.first;
flushTransUVs(t);
if(sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
DAG_id_tag_update(t->obedit->data, 0);
}
}
/* helper for recalcData() - for Movie Clip transforms */
static void recalcData_clip(TransInfo *t)
{
SpaceClip *sc= t->sa->spacedata.first;
MovieClip *clip= ED_space_clip(sc);
MovieTrackingTrack *track;
if(t->state == TRANS_CANCEL) {
track= clip->tracking.tracks.first;
while(track) {
if(TRACK_VIEW_SELECTED(sc, track)) {
MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
marker->flag= track->transflag;
}
track= track->next;
}
}
flushTransTracking(t);
track= clip->tracking.tracks.first;
while(track) {
if(TRACK_VIEW_SELECTED(sc, track)) {
if (t->mode == TFM_TRANSLATION) {
if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
}
else if (t->mode == TFM_RESIZE) {
if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
track= track->next;
}
DAG_id_tag_update(&clip->id, 0);
}
/* helper for recalcData() - for 3d-view transforms */ /* helper for recalcData() - for 3d-view transforms */
static void recalcData_view3d(TransInfo *t) static void recalcData_view3d(TransInfo *t)
{ {
@ -853,60 +912,13 @@ void recalcData(TransInfo *t)
recalcData_nla(t); recalcData_nla(t);
} }
else if (t->spacetype == SPACE_IMAGE) { else if (t->spacetype == SPACE_IMAGE) {
if (t->obedit && t->obedit->type == OB_MESH) { recalcData_image(t);
SpaceImage *sima= t->sa->spacedata.first;
flushTransUVs(t);
if(sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
DAG_id_tag_update(t->obedit->data, 0);
}
} }
else if (t->spacetype == SPACE_VIEW3D) { else if (t->spacetype == SPACE_VIEW3D) {
recalcData_view3d(t); recalcData_view3d(t);
} }
else if (t->spacetype == SPACE_CLIP) { else if (t->spacetype == SPACE_CLIP) {
SpaceClip *sc= t->sa->spacedata.first; recalcData_clip(t);
MovieClip *clip= ED_space_clip(sc);
MovieTrackingTrack *track;
if(t->state == TRANS_CANCEL) {
track= clip->tracking.tracks.first;
while(track) {
if(TRACK_VIEW_SELECTED(sc, track)) {
MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
marker->flag= track->transflag;
}
track= track->next;
}
}
flushTransTracking(t);
track= clip->tracking.tracks.first;
while(track) {
if(TRACK_VIEW_SELECTED(sc, track)) {
if (t->mode == TFM_TRANSLATION) {
if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
}
else if (t->mode == TFM_RESIZE) {
if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
track= track->next;
}
DAG_id_tag_update(&clip->id, 0);
} }
} }

@ -890,7 +890,7 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx)
static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
IMB_Timecode_Type tc) { IMB_Timecode_Type tc) {
int64_t pts_to_search = 0; unsigned long long pts_to_search = 0;
double frame_rate; double frame_rate;
double pts_time_base; double pts_time_base;
long long st_time; long long st_time;

@ -30,7 +30,8 @@
#define MODSTACK_DEBUG 1 #define MODSTACK_DEBUG 1
/* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE! */ /* WARNING ALERT! TYPEDEF VALUES ARE WRITTEN IN FILES! SO DO NOT CHANGE!
* (ONLY ADD NEW ITEMS AT THE END) */
typedef enum ModifierType { typedef enum ModifierType {
eModifierType_None = 0, eModifierType_None = 0,

@ -66,24 +66,6 @@ static void rna_MovieClip_size_get(PointerRNA *ptr, int *values)
values[1]= clip->lastsize[1]; values[1]= clip->lastsize[1];
} }
static void rna_MovieClip_resolution_get(PointerRNA *ptr, float *values)
{
MovieClip *clip= (MovieClip*)ptr->id.data;
ImBuf *ibuf;
ibuf= BKE_movieclip_get_ibuf(clip, NULL);
if (ibuf) {
values[0]= ibuf->ppm[0];
values[1]= ibuf->ppm[1];
IMB_freeImBuf(ibuf);
}
else {
values[0]= 0;
values[1]= 0;
}
}
#else #else
static void rna_def_movieclip_proxy(BlenderRNA *brna) static void rna_def_movieclip_proxy(BlenderRNA *brna)
@ -235,10 +217,6 @@ static void rna_def_movieclip(BlenderRNA *brna)
RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL); RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop= RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
RNA_def_property_float_funcs(prop, "rna_MovieClip_resolution_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ); prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "aspx"); RNA_def_property_float_sdna(prop, NULL, "aspx");
RNA_def_property_array(prop, 2); RNA_def_property_array(prop, 2);

@ -40,7 +40,7 @@ DefNode( ShaderNode, SH_NODE_VALTORGB, def_colorramp, "VALTO
DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" ) DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" ) DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" ) DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
DefNode( ShaderNode, SH_NODE_GEOM, def_sh_geometry, "GEOM", Geom, "Geometry", "" ) DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" ) DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" ) DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" ) DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" )
@ -53,40 +53,38 @@ DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVER
DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" ) DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" ) DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" )
DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" ) DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, 0, "OUTPUT_MATERIAL",OutputMaterial, "Material Output", "" )
DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, 0, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" )
//DefNode( ShaderNode, SH_NODE_OUTPUT_TEXTURE, 0, "OUTPUT_TEXTURE", OutputTexture, "Texture Output", "" )
DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, 0, "OUTPUT_WORLD", OutputWorld, "World Output", "" )
DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" )
DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "LayerWeight", "" )
DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" )
DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" )
DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "") DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, 0, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" )
DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "") DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, 0, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" )
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "") DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, 0, "OUTPUT_WORLD", OutputWorld, "World Output", "" )
DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Bsdf Anisotropic", "") DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" )
DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "") DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "LayerWeight", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "") DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "") DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" )
DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "") DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" )
DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "") DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" )
DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "") DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent, "Transparent Volume", "") DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "" )
DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "") DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "" )
DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "") DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, 0, "GEOMETRY", Geometry, "Geometry", "") DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "" )
DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", Light_path, "Light_path", "") DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "" )
DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "") DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "" )
DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture", "") DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent,"Transparent Volume","" )
DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "") DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "" )
DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "") DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" )
DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "") DefNode( ShaderNode, SH_NODE_NEW_GEOMETRY, 0, "NEW_GEOMETRY", NewGeometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "") DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", Light_path, "Light_path", "" )
DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "") DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "") DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" )
DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "") DefNode( ShaderNode, SH_NODE_TEX_SKY, def_sh_tex_sky, "TEX_SKY", TexSky, "Sky Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_COORD, 0, "TEX_COORD", TexCoord, "Texture Coordinate", "") DefNode( ShaderNode, SH_NODE_TEX_GRADIENT, def_sh_tex_gradient, "TEX_GRADIENT", TexGradient, "Gradient Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_NOISE, def_sh_tex_noise, "TEX_NOISE", TexNoise, "Noise Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_MAGIC, def_sh_tex_magic, "TEX_MAGIC", TexMagic, "Magic Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_WAVE, def_sh_tex_wave, "TEX_WAVE", TexWave, "Wave Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_MUSGRAVE, def_sh_tex_musgrave, "TEX_MUSGRAVE", TexMusgrave, "Musgrave Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_VORONOI, def_sh_tex_voronoi, "TEX_VORONOI", TexVoronoi, "Voronoi Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_COORD, 0, "TEX_COORD", TexCoord, "Texture Coordinate","")
DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" ) DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" ) DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" )

@ -76,7 +76,7 @@ EnumPropertyItem proportional_falloff_items[] ={
{PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
{PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"}, {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
{PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"}, {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
{PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Consant falloff"}, {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
{PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"}, {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};

@ -125,13 +125,6 @@ static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSE
BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
} }
static int rna_tracking_markers_length(PointerRNA *ptr)
{
MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
return track->markersnr;
}
static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr) static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr)
{ {
MovieClip *clip= (MovieClip*)ptr->id.data; MovieClip *clip= (MovieClip*)ptr->id.data;
@ -249,7 +242,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE); prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_int_sdna(prop, NULL, "frames_limit"); RNA_def_property_int_sdna(prop, NULL, "frames_limit");
RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_range(prop, 0, SHRT_MAX);
RNA_def_property_ui_text(prop, "Frames Limit", "Amount of frames to be tracked during single tracking operation"); RNA_def_property_ui_text(prop, "Frames Limit", "Amount of frames to be tracked during single tracking operation");
/* adjust frames */ /* adjust frames */
@ -425,7 +418,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
static EnumPropertyItem tracker_items[] = { static EnumPropertyItem tracker_items[] = {
{TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker"}, {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker"},
{TRACKER_KLT, "KLT", 0, "KLT", "KanadeLucasTomasi racker"}, {TRACKER_KLT, "KLT", 0, "KLT", "KanadeLucasTomasi tracker"},
{0, NULL, 0, NULL, NULL}}; {0, NULL, 0, NULL, NULL}};
rna_def_trackingMarker(brna); rna_def_trackingMarker(brna);
@ -499,7 +492,6 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MovieTrackingMarker"); RNA_def_property_struct_type(prop, "MovieTrackingMarker");
RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr"); RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, "rna_tracking_markers_length", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track"); RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
/* ** channels ** */ /* ** channels ** */

@ -130,7 +130,6 @@ set(SRC
shader/nodes/node_shader_vectMath.c shader/nodes/node_shader_vectMath.c
shader/nodes/node_shader_attribute.c shader/nodes/node_shader_attribute.c
shader/nodes/node_shader_background.c shader/nodes/node_shader_background.c
shader/nodes/node_shader_bsdf_anisotropic.c
shader/nodes/node_shader_bsdf_diffuse.c shader/nodes/node_shader_bsdf_diffuse.c
shader/nodes/node_shader_bsdf_glossy.c shader/nodes/node_shader_bsdf_glossy.c
shader/nodes/node_shader_bsdf_glass.c shader/nodes/node_shader_bsdf_glass.c
@ -149,7 +148,6 @@ set(SRC
shader/nodes/node_shader_add_shader.c shader/nodes/node_shader_add_shader.c
shader/nodes/node_shader_output_lamp.c shader/nodes/node_shader_output_lamp.c
shader/nodes/node_shader_output_material.c shader/nodes/node_shader_output_material.c
shader/nodes/node_shader_output_texture.c
shader/nodes/node_shader_output_world.c shader/nodes/node_shader_output_world.c
shader/nodes/node_shader_tex_gradient.c shader/nodes/node_shader_tex_gradient.c
shader/nodes/node_shader_tex_coord.c shader/nodes/node_shader_tex_coord.c
@ -161,7 +159,6 @@ set(SRC
shader/nodes/node_shader_tex_sky.c shader/nodes/node_shader_tex_sky.c
shader/nodes/node_shader_tex_voronoi.c shader/nodes/node_shader_tex_voronoi.c
shader/nodes/node_shader_tex_wave.c shader/nodes/node_shader_tex_wave.c
shader/nodes/node_shader_noise.h
shader/node_shader_tree.c shader/node_shader_tree.c
shader/node_shader_util.c shader/node_shader_util.c

@ -82,7 +82,6 @@ void register_node_type_sh_background(ListBase *lb);
void register_node_type_sh_bsdf_diffuse(ListBase *lb); void register_node_type_sh_bsdf_diffuse(ListBase *lb);
void register_node_type_sh_bsdf_glossy(ListBase *lb); void register_node_type_sh_bsdf_glossy(ListBase *lb);
void register_node_type_sh_bsdf_glass(ListBase *lb); void register_node_type_sh_bsdf_glass(ListBase *lb);
void register_node_type_sh_bsdf_anisotropic(ListBase *lb);
void register_node_type_sh_bsdf_translucent(ListBase *lb); void register_node_type_sh_bsdf_translucent(ListBase *lb);
void register_node_type_sh_bsdf_transparent(ListBase *lb); void register_node_type_sh_bsdf_transparent(ListBase *lb);
void register_node_type_sh_bsdf_velvet(ListBase *lb); void register_node_type_sh_bsdf_velvet(ListBase *lb);
@ -95,7 +94,6 @@ void register_node_type_sh_add_shader(ListBase *lb);
void register_node_type_sh_output_lamp(ListBase *lb); void register_node_type_sh_output_lamp(ListBase *lb);
void register_node_type_sh_output_material(ListBase *lb); void register_node_type_sh_output_material(ListBase *lb);
void register_node_type_sh_output_texture(ListBase *lb);
void register_node_type_sh_output_world(ListBase *lb); void register_node_type_sh_output_world(ListBase *lb);
void register_node_type_sh_tex_image(ListBase *lb); void register_node_type_sh_tex_image(ListBase *lb);

@ -68,6 +68,20 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
} }
} }
static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func)
{
func(calldata, NODE_CLASS_INPUT, "Input");
func(calldata, NODE_CLASS_OUTPUT, "Output");
func(calldata, NODE_CLASS_OP_COLOR, "Color");
func(calldata, NODE_CLASS_OP_VECTOR, "Vector");
func(calldata, NODE_CLASS_OP_FILTER, "Filter");
func(calldata, NODE_CLASS_CONVERTOR, "Convertor");
func(calldata, NODE_CLASS_MATTE, "Matte");
func(calldata, NODE_CLASS_DISTORT, "Distort");
func(calldata, NODE_CLASS_GROUP, "Group");
func(calldata, NODE_CLASS_LAYOUT, "Layout");
}
static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node) static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
{ {
bNodeSocket *sock; bNodeSocket *sock;
@ -207,6 +221,7 @@ bNodeTreeType ntreeType_Composite = {
/* free_cache */ free_cache, /* free_cache */ free_cache,
/* free_node_cache */ free_node_cache, /* free_node_cache */ free_node_cache,
/* foreach_nodetree */ foreach_nodetree, /* foreach_nodetree */ foreach_nodetree,
/* foreach_nodeclass */ foreach_nodeclass,
/* localize */ localize, /* localize */ localize,
/* local_sync */ local_sync, /* local_sync */ local_sync,
/* local_merge */ local_merge, /* local_merge */ local_merge,

@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void exec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{ {
if(in[0]->data) { if(in[0]->data) {
if(node->id) { if(node->id) {
@ -57,14 +57,18 @@ static void exec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
if(ibuf) { if(ibuf) {
RenderData *rd= data;
ImBuf *obuf; ImBuf *obuf;
MovieTracking *tracking= &clip->tracking; MovieTracking *tracking= &clip->tracking;
int width, height; int width, height;
float overscan= 0.0f; float overscan= 0.0f;
MovieClipUser user= {0};
BKE_movieclip_user_set_frame(&user, rd->cfra);
ibuf->rect_float= cbuf->rect; ibuf->rect_float= cbuf->rect;
BKE_movieclip_get_size(clip, NULL, &width, &height); BKE_movieclip_get_size(clip, &user, &width, &height);
if(!node->storage) if(!node->storage)
node->storage= BKE_tracking_distortion_create(); node->storage= BKE_tracking_distortion_create();

@ -35,6 +35,7 @@
#include "DNA_lamp_types.h" #include "DNA_lamp_types.h"
#include "DNA_material_types.h" #include "DNA_material_types.h"
#include "DNA_node_types.h" #include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_world_types.h" #include "DNA_world_types.h"
#include "BLI_listbase.h" #include "BLI_listbase.h"
@ -45,6 +46,7 @@
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_node.h" #include "BKE_node.h"
#include "BKE_scene.h"
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "GPU_material.h" #include "GPU_material.h"
@ -74,6 +76,23 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
func(calldata, &wo->id, wo->nodetree); func(calldata, &wo->id, wo->nodetree);
} }
static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback func)
{
func(calldata, NODE_CLASS_INPUT, "Input");
func(calldata, NODE_CLASS_OUTPUT, "Output");
if(scene_use_new_shading_nodes(scene)) {
func(calldata, NODE_CLASS_SHADER, "Shader");
func(calldata, NODE_CLASS_TEXTURE, "Texture");
}
func(calldata, NODE_CLASS_OP_COLOR, "Color");
func(calldata, NODE_CLASS_OP_VECTOR, "Vector");
func(calldata, NODE_CLASS_CONVERTOR, "Convertor");
func(calldata, NODE_CLASS_GROUP, "Group");
func(calldata, NODE_CLASS_LAYOUT, "Layout");
}
static void local_sync(bNodeTree *localtree, bNodeTree *ntree) static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
{ {
bNode *lnode; bNode *lnode;
@ -108,6 +127,7 @@ bNodeTreeType ntreeType_Shader = {
/* free_cache */ NULL, /* free_cache */ NULL,
/* free_node_cache */ NULL, /* free_node_cache */ NULL,
/* foreach_nodetree */ foreach_nodetree, /* foreach_nodetree */ foreach_nodetree,
/* foreach_nodeclass */ foreach_nodeclass,
/* localize */ NULL, /* localize */ NULL,
/* local_sync */ local_sync, /* local_sync */ local_sync,
/* local_merge */ NULL, /* local_merge */ NULL,
@ -209,7 +229,6 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data)
void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
{ {
ShaderCallData scd; ShaderCallData scd;
float co[3] = {0.0f, 0.0f, 0.0f};
/* /*
@note: preserve material from ShadeInput for material id, nodetree execs change it @note: preserve material from ShadeInput for material id, nodetree execs change it
fix for bug "[#28012] Mat ID messy with shader nodes" fix for bug "[#28012] Mat ID messy with shader nodes"
@ -219,10 +238,8 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
bNodeTreeExec *exec = ntree->execdata; bNodeTreeExec *exec = ntree->execdata;
/* convert caller data to struct */ /* convert caller data to struct */
memset(&scd, 0, sizeof(scd));
scd.shi= shi; scd.shi= shi;
scd.shr= shr; scd.shr= shr;
scd.co= co;
/* each material node has own local shaderesult, with optional copying */ /* each material node has own local shaderesult, with optional copying */
memset(shr, 0, sizeof(ShadeResult)); memset(shr, 0, sizeof(ShadeResult));

@ -325,7 +325,5 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link); GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link);
} }
else
printf("skip mapping!\n");
} }

@ -73,7 +73,6 @@
#include "IMB_imbuf.h" #include "IMB_imbuf.h"
#include "RE_pipeline.h" #include "RE_pipeline.h"
#include "RE_render_ext.h"
#include "RE_shader_ext.h" #include "RE_shader_ext.h"
#include "GPU_material.h" #include "GPU_material.h"
@ -83,10 +82,6 @@
typedef struct ShaderCallData { typedef struct ShaderCallData {
ShadeInput *shi; /* from render pipe */ ShadeInput *shi; /* from render pipe */
ShadeResult *shr; /* from render pipe */ ShadeResult *shr; /* from render pipe */
TexResult *texres;
float *co;
float *dxt, *dyt;
} ShaderCallData; } ShaderCallData;
/* output socket defines */ /* output socket defines */

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_add_shader_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_add_shader(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_add_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_add_shader", in, out); return GPU_stack_link(mat, "node_add_shader", in, out);
@ -62,7 +58,7 @@ void register_node_type_sh_add_shader(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_add_shader); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_add_shader); node_type_gpu(&ntype, node_shader_gpu_add_shader);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -38,10 +38,6 @@ static bNodeSocketTemplate sh_node_attribute_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_attribute(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp)) static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{ {
NodeShaderAttribute *attr = MEM_callocN(sizeof(NodeShaderAttribute), "NodeShaderAttribute"); NodeShaderAttribute *attr = MEM_callocN(sizeof(NodeShaderAttribute), "NodeShaderAttribute");
@ -59,7 +55,7 @@ void register_node_type_sh_attribute(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_attribute); node_type_init(&ntype, node_shader_init_attribute);
node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_attribute); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL); node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,11 +42,6 @@ static bNodeSocketTemplate sh_node_background_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_background(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
/* node type definition */ /* node type definition */
void register_node_type_sh_background(ListBase *lb) void register_node_type_sh_background(ListBase *lb)
{ {
@ -58,7 +53,7 @@ void register_node_type_sh_background(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_background); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL); node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -43,10 +43,6 @@ static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_anisotropic(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); return GPU_stack_link(mat, "node_bsdf_anisotropic", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
@ -63,7 +59,7 @@ void register_node_type_sh_bsdf_anisotropic(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_anisotropic); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic); node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -41,10 +41,6 @@ static bNodeSocketTemplate sh_node_bsdf_diffuse_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_diffuse(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL)); return GPU_stack_link(mat, "node_bsdf_diffuse", in, out, GPU_builtin(GPU_VIEW_NORMAL));
@ -61,7 +57,7 @@ void register_node_type_sh_bsdf_diffuse(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_diffuse); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse); node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -43,10 +43,6 @@ static bNodeSocketTemplate sh_node_bsdf_glass_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_glass(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_glass", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION)); return GPU_stack_link(mat, "node_bsdf_glass", in, out, GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_VIEW_POSITION));
@ -63,7 +59,7 @@ void register_node_type_sh_bsdf_glass(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_glass); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_glass); node_type_gpu(&ntype, node_shader_gpu_bsdf_glass);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_bsdf_glossy_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_glossy(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
/* todo: is incoming vector normalized? */ /* todo: is incoming vector normalized? */
@ -63,7 +59,7 @@ void register_node_type_sh_bsdf_glossy(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_glossy); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy); node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -41,10 +41,6 @@ static bNodeSocketTemplate sh_node_bsdf_translucent_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_translucent(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_translucent", in, out, GPU_builtin(GPU_VIEW_NORMAL)); return GPU_stack_link(mat, "node_bsdf_translucent", in, out, GPU_builtin(GPU_VIEW_NORMAL));
@ -61,7 +57,7 @@ void register_node_type_sh_bsdf_translucent(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_translucent); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_translucent); node_type_gpu(&ntype, node_shader_gpu_bsdf_translucent);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -41,10 +41,6 @@ static bNodeSocketTemplate sh_node_bsdf_transparent_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_transparent(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_transparent", in, out); return GPU_stack_link(mat, "node_bsdf_transparent", in, out);
@ -61,7 +57,7 @@ void register_node_type_sh_bsdf_transparent(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_transparent); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_transparent); node_type_gpu(&ntype, node_shader_gpu_bsdf_transparent);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_bsdf_velvet_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_bsdf_velvet(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_bsdf_velvet", in, out, GPU_builtin(GPU_VIEW_NORMAL)); return GPU_stack_link(mat, "node_bsdf_velvet", in, out, GPU_builtin(GPU_VIEW_NORMAL));
@ -62,7 +58,7 @@ void register_node_type_sh_bsdf_velvet(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_bsdf_velvet); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_bsdf_velvet); node_type_gpu(&ntype, node_shader_gpu_bsdf_velvet);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_emission_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_emission(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_emission(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_emission(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL)); return GPU_stack_link(mat, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL));
@ -62,7 +58,7 @@ void register_node_type_sh_emission(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_emission); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_emission); node_type_gpu(&ntype, node_shader_gpu_emission);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -40,10 +40,6 @@ static bNodeSocketTemplate sh_node_fresnel_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_fresnel(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
/* todo: is incoming vector normalized? */ /* todo: is incoming vector normalized? */
@ -61,7 +57,7 @@ void register_node_type_sh_fresnel(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_fresnel); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_fresnel); node_type_gpu(&ntype, node_shader_gpu_fresnel);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -138,7 +138,7 @@ void register_node_type_sh_geom(ListBase *lb)
{ {
static bNodeType ntype; static bNodeType ntype;
node_type_base(&ntype, SH_NODE_GEOM, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS); node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS);
node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_compatibility(&ntype, NODE_OLD_SHADING);
node_type_compatibility(&ntype, NODE_OLD_SHADING); node_type_compatibility(&ntype, NODE_OLD_SHADING);
node_type_socket_templates(&ntype, NULL, sh_node_geom_out); node_type_socket_templates(&ntype, NULL, sh_node_geom_out);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_geometry_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_geometry(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_geometry", in, out, return GPU_stack_link(mat, "node_geometry", in, out,
@ -58,13 +54,13 @@ void register_node_type_sh_geometry(ListBase *lb)
{ {
static bNodeType ntype; static bNodeType ntype;
node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0);
node_type_compatibility(&ntype, NODE_NEW_SHADING); node_type_compatibility(&ntype, NODE_NEW_SHADING);
node_type_socket_templates(&ntype, NULL, sh_node_geometry_out); node_type_socket_templates(&ntype, NULL, sh_node_geometry_out);
node_type_size(&ntype, 120, 60, 200); node_type_size(&ntype, 120, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_geometry); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_geometry); node_type_gpu(&ntype, node_shader_gpu_geometry);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -40,10 +40,6 @@ static bNodeSocketTemplate sh_node_holdout_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_holdout(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
/* node type definition */ /* node type definition */
void register_node_type_sh_holdout(ListBase *lb) void register_node_type_sh_holdout(ListBase *lb)
@ -56,7 +52,7 @@ void register_node_type_sh_holdout(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_holdout); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL); node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_layer_weight_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_layer_weight(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_layer_weight(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out)) static int node_shader_gpu_layer_weight(GPUMaterial *UNUSED(mat), bNode *UNUSED(node), GPUNodeStack *UNUSED(in), GPUNodeStack *UNUSED(out))
{ {
return 0; return 0;
@ -62,7 +58,7 @@ void register_node_type_sh_layer_weight(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_layer_weight); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_layer_weight); node_type_gpu(&ntype, node_shader_gpu_layer_weight);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -42,10 +42,6 @@ static bNodeSocketTemplate sh_node_light_path_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_light_path(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_light_path", in, out); return GPU_stack_link(mat, "node_light_path", in, out);
@ -62,7 +58,7 @@ void register_node_type_sh_light_path(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_light_path); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_light_path); node_type_gpu(&ntype, node_shader_gpu_light_path);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -35,8 +35,8 @@
/* **************** MIX RGB ******************** */ /* **************** MIX RGB ******************** */
static bNodeSocketTemplate sh_node_mix_rgb_in[]= { static bNodeSocketTemplate sh_node_mix_rgb_in[]= {
{ SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{ SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f},
{ SOCK_RGBA, 1, "Color", 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate sh_node_mix_rgb_out[]= { static bNodeSocketTemplate sh_node_mix_rgb_out[]= {

@ -43,10 +43,6 @@ static bNodeSocketTemplate sh_node_mix_shader_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_mix_shader(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
return GPU_stack_link(mat, "node_mix_shader", in, out); return GPU_stack_link(mat, "node_mix_shader", in, out);
@ -63,7 +59,7 @@ void register_node_type_sh_mix_shader(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_mix_shader); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_mix_shader); node_type_gpu(&ntype, node_shader_gpu_mix_shader);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -36,10 +36,6 @@ static bNodeSocketTemplate sh_node_output_lamp_in[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_output_lamp(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
/* node type definition */ /* node type definition */
void register_node_type_sh_output_lamp(ListBase *lb) void register_node_type_sh_output_lamp(ListBase *lb)
{ {
@ -51,7 +47,7 @@ void register_node_type_sh_output_lamp(ListBase *lb)
node_type_size(&ntype, 120, 60, 200); node_type_size(&ntype, 120, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_output_lamp); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL); node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -38,10 +38,6 @@ static bNodeSocketTemplate sh_node_output_material_in[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_output_material(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
GPUNodeLink *outlink; GPUNodeLink *outlink;
@ -64,7 +60,7 @@ void register_node_type_sh_output_material(ListBase *lb)
node_type_size(&ntype, 120, 60, 200); node_type_size(&ntype, 120, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_output_material); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_output_material); node_type_gpu(&ntype, node_shader_gpu_output_material);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -1,76 +0,0 @@
/**
* $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* 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.
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "../node_shader_util.h"
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_output_texture_in[]= {
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
static void node_shader_exec_output_texture(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
if(data && (node->flag & NODE_DO_OUTPUT)) {
ShaderCallData *scd= (ShaderCallData*)data;
TexResult *texres = scd->texres;
float col[4];
if(!texres)
return;
nodestack_get_vec(col, SOCK_RGBA, in[0]);
texres->tr= col[0];
texres->tg= col[1];
texres->tb= col[2];
texres->ta= 1.0f;
texres->tin= rgb_to_grayscale(col);
}
}
/* node type definition */
void register_node_type_sh_output_texture(ListBase *lb)
{
static bNodeType ntype;
node_type_base(&ntype, SH_NODE_OUTPUT_TEXTURE, "Texture Output", NODE_CLASS_OUTPUT, 0);
node_type_compatibility(&ntype, NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_output_texture_in, NULL);
node_type_size(&ntype, 120, 60, 200);
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_output_texture);
node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype);
};

@ -37,10 +37,6 @@ static bNodeSocketTemplate sh_node_output_world_in[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_output_world(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
/* node type definition */ /* node type definition */
void register_node_type_sh_output_world(ListBase *lb) void register_node_type_sh_output_world(ListBase *lb)
{ {
@ -52,7 +48,7 @@ void register_node_type_sh_output_world(ListBase *lb)
node_type_size(&ntype, 120, 60, 200); node_type_size(&ntype, 120, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_output_world); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, NULL); node_type_gpu(&ntype, NULL);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -43,10 +43,6 @@ static bNodeSocketTemplate sh_node_tex_coord_out[]= {
{ -1, 0, "" } { -1, 0, "" }
}; };
static void node_shader_exec_tex_coord(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
}
static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
{ {
GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); GPUNodeLink *orco = GPU_attribute(CD_ORCO, "");
@ -68,7 +64,7 @@ void register_node_type_sh_tex_coord(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, NULL); node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL); node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, node_shader_exec_tex_coord); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_coord); node_type_gpu(&ntype, node_shader_gpu_tex_coord);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -51,37 +51,6 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode* no
node->storage = tex; node->storage = tex;
} }
static void node_shader_exec_tex_environment(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
Image *ima= (Image*)node->id;
ShaderCallData *scd= (ShaderCallData*)data;
NodeTexEnvironment *tex= (NodeTexEnvironment*)node->storage;
bNodeSocket *vecsock = node->inputs.first;
float vec[3];
if(vecsock->link)
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
else
copy_v3_v3(vec, scd->co);
if(ima) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
if(ibuf) {
float u= (atan2f(vec[1], vec[0]) + (float)M_PI)/(2*M_PI);
float v= atan2f(vec[2], hypotf(vec[0], vec[1]))/M_PI + 0.5f;
float rgb[4];
ibuf_sample(ibuf, u, v, 0.0f, 0.0f, rgb);
if(tex->color_space == SHD_COLORSPACE_SRGB)
srgb_to_linearrgb_v3_v3(out[0]->vec, rgb);
else
copy_v3_v3(out[0]->vec, rgb);
}
}
}
static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{ {
Image *ima= (Image*)node->id; Image *ima= (Image*)node->id;
@ -112,7 +81,7 @@ void register_node_type_sh_tex_environment(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_tex_environment); node_type_init(&ntype, node_shader_init_tex_environment);
node_type_storage(&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_tex_environment); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_environment); node_type_gpu(&ntype, node_shader_gpu_tex_environment);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -29,44 +29,6 @@
#include "../node_shader_util.h" #include "../node_shader_util.h"
static float gradient(float p[3], int type)
{
float x, y;
x= p[0];
y= p[1];
if(type == SHD_BLEND_LINEAR) {
return (1.0f + x)/2.0f;
}
else if(type == SHD_BLEND_QUADRATIC) {
float r = MAX2((1.0f + x)/2.0f, 0.0f);
return r*r;
}
else if(type == SHD_BLEND_EASING) {
float r = MIN2(MAX2((1.0f + x)/2.0f, 0.0f), 1.0f);
float t = r*r;
return (3.0f*t - 2.0f*t*r);
}
else if(type == SHD_BLEND_DIAGONAL) {
return (2.0f + x + y)/4.0f;
}
else if(type == SHD_BLEND_RADIAL) {
return atan2(y, x)/(2.0f*(float)M_PI) + 0.5f;
}
else {
float r = MAX2(1.0f - sqrtf(x*x + y*y + p[2]*p[2]), 0.0f);
if(type == SHD_BLEND_QUADRATIC_SPHERE)
return r*r;
else if(type == SHD_BLEND_SPHERICAL)
return r;
}
return 0.0f;
}
/* **************** BLEND ******************** */ /* **************** BLEND ******************** */
static bNodeSocketTemplate sh_node_tex_gradient_in[]= { static bNodeSocketTemplate sh_node_tex_gradient_in[]= {
@ -90,27 +52,6 @@ static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node,
node->storage = tex; node->storage = tex;
} }
static void node_shader_exec_tex_gradient(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
ShaderCallData *scd= (ShaderCallData*)data;
NodeTexGradient *tex= (NodeTexGradient*)node->storage;
bNodeSocket *vecsock = node->inputs.first;
float vec[3], fac;
if(vecsock->link)
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
else
copy_v3_v3(vec, scd->co);
fac= gradient(vec, tex->gradient_type);
CLAMP(fac, 0.0f, 1.0f);
out[0]->vec[0]= fac;
out[0]->vec[1]= fac;
out[0]->vec[2]= fac;
out[1]->vec[0]= fac;
}
static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{ {
if(!in[0].link) if(!in[0].link)
@ -132,7 +73,7 @@ void register_node_type_sh_tex_gradient(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_tex_gradient); node_type_init(&ntype, node_shader_init_tex_gradient);
node_type_storage(&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_tex_gradient); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_gradient); node_type_gpu(&ntype, node_shader_gpu_tex_gradient);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -51,35 +51,6 @@ static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode* node, bN
node->storage = tex; node->storage = tex;
} }
static void node_shader_exec_tex_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
Image *ima= (Image*)node->id;
ShaderCallData *scd= (ShaderCallData*)data;
NodeTexImage *tex= (NodeTexImage*)node->storage;
bNodeSocket *vecsock = node->inputs.first;
float vec[3];
if(vecsock->link)
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
else
copy_v3_v3(vec, scd->co);
if(ima) {
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
if(ibuf) {
float rgb[4];
ibuf_sample(ibuf, vec[0], vec[1], 0.0f, 0.0f, rgb);
if(tex->color_space == SHD_COLORSPACE_SRGB)
srgb_to_linearrgb_v3_v3(out[0]->vec, rgb);
else
copy_v3_v3(out[0]->vec, rgb);
}
}
}
static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{ {
Image *ima= (Image*)node->id; Image *ima= (Image*)node->id;
@ -110,7 +81,7 @@ void register_node_type_sh_tex_image(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_tex_image); node_type_init(&ntype, node_shader_init_tex_image);
node_type_storage(&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_tex_image); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_image); node_type_gpu(&ntype, node_shader_gpu_tex_image);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -29,77 +29,6 @@
#include "../node_shader_util.h" #include "../node_shader_util.h"
static void magic(float rgb[3], float p[3], int n, float distortion)
{
float x = sinf((p[0] + p[1] + p[2])*5.0f);
float y = cosf((-p[0] + p[1] - p[2])*5.0f);
float z = -cosf((-p[0] - p[1] + p[2])*5.0f);
if(n > 0) {
x *= distortion;
y *= distortion;
z *= distortion;
y = -cosf(x-y+z);
y *= distortion;
if(n > 1) {
x= cosf(x-y-z);
x *= distortion;
if(n > 2) {
z= sinf(-x-y-z);
z *= distortion;
if(n > 3) {
x= -cosf(-x+y-z);
x *= distortion;
if(n > 4) {
y= -sinf(-x+y+z);
y *= distortion;
if(n > 5) {
y= -cosf(-x+y+z);
y *= distortion;
if(n > 6) {
x= cosf(x+y+z);
x *= distortion;
if(n > 7) {
z= sinf(x+y-z);
z *= distortion;
if(n > 8) {
x= -cosf(-x-y+z);
x *= distortion;
if(n > 9) {
y= -sinf(x-y+z);
y *= distortion;
}
}
}
}
}
}
}
}
}
}
if(distortion != 0.0f) {
distortion *= 2.0f;
x /= distortion;
y /= distortion;
z /= distortion;
}
rgb[0]= 0.5f - x;
rgb[1]= 0.5f - y;
rgb[2]= 0.5f - z;
}
/* **************** OUTPUT ******************** */ /* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_tex_magic_in[]= { static bNodeSocketTemplate sh_node_tex_magic_in[]= {
@ -125,24 +54,6 @@ static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode* node, bN
node->storage = tex; node->storage = tex;
} }
static void node_shader_exec_tex_magic(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
ShaderCallData *scd= (ShaderCallData*)data;
NodeTexMagic *tex= (NodeTexMagic*)node->storage;
bNodeSocket *vecsock = node->inputs.first;
float vec[3], distortion;
if(vecsock->link)
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
else
copy_v3_v3(vec, scd->co);
nodestack_get_vec(&distortion, SOCK_FLOAT, in[1]);
magic(out[0]->vec, vec, tex->depth, distortion);
out[1]->vec[0] = (out[0]->vec[0] + out[0]->vec[1] + out[0]->vec[2])*(1.0f/3.0f);
}
static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{ {
NodeTexMagic *tex = (NodeTexMagic*)node->storage; NodeTexMagic *tex = (NodeTexMagic*)node->storage;
@ -167,7 +78,7 @@ void register_node_type_sh_tex_magic(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_tex_magic); node_type_init(&ntype, node_shader_init_tex_magic);
node_type_storage(&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_tex_magic); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_magic); node_type_gpu(&ntype, node_shader_gpu_tex_magic);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

@ -28,191 +28,6 @@
*/ */
#include "../node_shader_util.h" #include "../node_shader_util.h"
#include "node_shader_noise.h"
/* Musgrave fBm
*
* H: fractal increment parameter
* lacunarity: gap between successive frequencies
* detail: number of frequencies in the fBm
*
* from "Texturing and Modelling: A procedural approach"
*/
static float noise_musgrave_fBm(float p[3], int basis, float H, float lacunarity, float detail)
{
float rmd;
float value = 0.0f;
float pwr = 1.0f;
float pwHL = pow(lacunarity, -H);
int i;
for(i = 0; i < (int)detail; i++) {
value += noise_basis(p, basis) * pwr;
pwr *= pwHL;
mul_v3_fl(p, lacunarity);
}
rmd = detail - floor(detail);
if(rmd != 0.0f)
value += rmd * noise_basis(p, basis) * pwr;
return value;
}
/* Musgrave Multifractal
*
* H: highest fractal dimension
* lacunarity: gap between successive frequencies
* detail: number of frequencies in the fBm
*/
static float noise_musgrave_multi_fractal(float p[3], int basis, float H, float lacunarity, float detail)
{
float rmd;
float value = 1.0f;
float pwr = 1.0f;
float pwHL = pow(lacunarity, -H);
int i;
for(i = 0; i < (int)detail; i++) {
value *= (pwr * noise_basis(p, basis) + 1.0f);
pwr *= pwHL;
mul_v3_fl(p, lacunarity);
}
rmd = detail - floor(detail);
if(rmd != 0.0f)
value *= (rmd * pwr * noise_basis(p, basis) + 1.0f); /* correct? */
return value;
}
/* Musgrave Heterogeneous Terrain
*
* H: fractal dimension of the roughest area
* lacunarity: gap between successive frequencies
* detail: number of frequencies in the fBm
* offset: raises the terrain from `sea level'
*/
static float noise_musgrave_hetero_terrain(float p[3], int basis, float H, float lacunarity, float detail, float offset)
{
float value, increment, rmd;
float pwHL = pow(lacunarity, -H);
float pwr = pwHL;
int i;
/* first unscaled octave of function; later detail are scaled */
value = offset + noise_basis(p, basis);
mul_v3_fl(p, lacunarity);
for(i = 1; i < (int)detail; i++) {
increment = (noise_basis(p, basis) + offset) * pwr * value;
value += increment;
pwr *= pwHL;
mul_v3_fl(p, lacunarity);
}
rmd = detail - floor(detail);
if(rmd != 0.0f) {
increment = (noise_basis(p, basis) + offset) * pwr * value;
value += rmd * increment;
}
return value;
}
/* Hybrid Additive/Multiplicative Multifractal Terrain
*
* H: fractal dimension of the roughest area
* lacunarity: gap between successive frequencies
* detail: number of frequencies in the fBm
* offset: raises the terrain from `sea level'
*/
static float noise_musgrave_hybrid_multi_fractal(float p[3], int basis, float H, float lacunarity, float detail, float offset, float gain)
{
float result, signal, weight, rmd;
float pwHL = pow(lacunarity, -H);
float pwr = pwHL;
int i;
result = noise_basis(p, basis) + offset;
weight = gain * result;
mul_v3_fl(p, lacunarity);
for(i = 1; (weight > 0.001f) && (i < (int)detail); i++) {
if(weight > 1.0f)
weight = 1.0f;
signal = (noise_basis(p, basis) + offset) * pwr;
pwr *= pwHL;
result += weight * signal;
weight *= gain * signal;
mul_v3_fl(p, lacunarity);
}
rmd = detail - floor(detail);
if(rmd != 0.0f)
result += rmd * ((noise_basis(p, basis) + offset) * pwr);
return result;
}
/* Ridged Multifractal Terrain
*
* H: fractal dimension of the roughest area
* lacunarity: gap between successive frequencies
* detail: number of frequencies in the fBm
* offset: raises the terrain from `sea level'
*/
static float noise_musgrave_ridged_multi_fractal(float p[3], int basis, float H, float lacunarity, float detail, float offset, float gain)
{
float result, signal, weight;
float pwHL = pow(lacunarity, -H);
float pwr = pwHL;
int i;
signal = offset - fabsf(noise_basis(p, basis));
signal *= signal;
result = signal;
weight = 1.0f;
for(i = 1; i < (int)detail; i++) {
mul_v3_fl(p, lacunarity);
weight = CLAMPIS(signal * gain, 0.0f, 1.0f);
signal = offset - fabsf(noise_basis(p, basis));
signal *= signal;
signal *= weight;
result += signal * pwr;
pwr *= pwHL;
}
return result;
}
static float musgrave(int type, float dimension, float lacunarity, float detail, float offset, float intensity, float gain, float scale, float vec[3])
{
float p[3];
int basis = SHD_NOISE_PERLIN;
mul_v3_v3fl(p, vec, scale);
if(type == SHD_MUSGRAVE_MULTIFRACTAL)
return intensity*noise_musgrave_multi_fractal(p, basis, dimension, lacunarity, detail);
else if(type == SHD_MUSGRAVE_FBM)
return intensity*noise_musgrave_fBm(p, basis, dimension, lacunarity, detail);
else if(type == SHD_MUSGRAVE_HYBRID_MULTIFRACTAL)
return intensity*noise_musgrave_hybrid_multi_fractal(p, basis, dimension, lacunarity, detail, offset, gain);
else if(type == SHD_MUSGRAVE_RIDGED_MULTIFRACTAL)
return intensity*noise_musgrave_ridged_multi_fractal(p, basis, dimension, lacunarity, detail, offset, gain);
else if(type == SHD_MUSGRAVE_HETERO_TERRAIN)
return intensity*noise_musgrave_hetero_terrain(p, basis, dimension, lacunarity, detail, offset);
return 0.0f;
}
/* **************** MUSGRAVE ******************** */ /* **************** MUSGRAVE ******************** */
@ -243,32 +58,6 @@ static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node,
node->storage = tex; node->storage = tex;
} }
static void node_shader_exec_tex_musgrave(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
ShaderCallData *scd= (ShaderCallData*)data;
NodeTexMusgrave *tex= (NodeTexMusgrave*)node->storage;
bNodeSocket *vecsock = node->inputs.first;
float vec[3], fac, scale, dimension, lacunarity, detail, offset, gain;
if(vecsock->link)
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
else
copy_v3_v3(vec, scd->co);
nodestack_get_vec(&scale, SOCK_FLOAT, in[1]);
nodestack_get_vec(&detail, SOCK_FLOAT, in[2]);
nodestack_get_vec(&dimension, SOCK_FLOAT, in[3]);
nodestack_get_vec(&lacunarity, SOCK_FLOAT, in[4]);
nodestack_get_vec(&offset, SOCK_FLOAT, in[5]);
nodestack_get_vec(&gain, SOCK_FLOAT, in[6]);
fac= musgrave(tex->musgrave_type, dimension, lacunarity, detail, offset, 1.0f, gain, scale, vec);
out[0]->vec[0]= fac;
out[0]->vec[1]= fac;
out[0]->vec[2]= fac;
out[1]->vec[0]= fac;
}
static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
{ {
if(!in[0].link) if(!in[0].link)
@ -290,7 +79,7 @@ void register_node_type_sh_tex_musgrave(ListBase *lb)
node_type_size(&ntype, 150, 60, 200); node_type_size(&ntype, 150, 60, 200);
node_type_init(&ntype, node_shader_init_tex_musgrave); node_type_init(&ntype, node_shader_init_tex_musgrave);
node_type_storage(&ntype, "NodeTexMusgrave", node_free_standard_storage, node_copy_standard_storage); node_type_storage(&ntype, "NodeTexMusgrave", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, node_shader_exec_tex_musgrave); node_type_exec(&ntype, NULL);
node_type_gpu(&ntype, node_shader_gpu_tex_musgrave); node_type_gpu(&ntype, node_shader_gpu_tex_musgrave);
nodeRegisterType(lb, &ntype); nodeRegisterType(lb, &ntype);

Some files were not shown because too many files have changed in this diff Show More