Merged changes in the trunk up to revision 52858.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 10 Dec 2012 23:34:41 +0000 (23:34 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 10 Dec 2012 23:34:41 +0000 (23:34 +0000)
Congratulations to all trunk devs on the Blender 2.65 release!

52 files changed:
CMakeLists.txt
build_files/cmake/cmake_static_check_cppcheck.py
extern/libmv/libmv/simple_pipeline/resect.cc
intern/audaspace/CMakeLists.txt
intern/audaspace/FX/AUD_BandpassCalculator.cpp [new file with mode: 0644]
intern/audaspace/FX/AUD_BandpassCalculator.h [new file with mode: 0644]
intern/audaspace/FX/AUD_ButterworthCalculator.cpp [new file with mode: 0644]
intern/audaspace/FX/AUD_ButterworthCalculator.h [new file with mode: 0644]
intern/audaspace/FX/AUD_ButterworthFactory.cpp
intern/audaspace/FX/AUD_ButterworthFactory.h
intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp
intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
intern/audaspace/FX/AUD_HighpassCalculator.cpp [new file with mode: 0644]
intern/audaspace/FX/AUD_HighpassCalculator.h [new file with mode: 0644]
intern/audaspace/FX/AUD_HighpassFactory.cpp
intern/audaspace/FX/AUD_HighpassFactory.h
intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h
intern/audaspace/FX/AUD_LowpassCalculator.cpp [new file with mode: 0644]
intern/audaspace/FX/AUD_LowpassCalculator.h [new file with mode: 0644]
intern/audaspace/FX/AUD_LowpassFactory.cpp
intern/audaspace/FX/AUD_LowpassFactory.h
intern/cycles/blender/blender_object.cpp
intern/cycles/kernel/osl/osl_shader.cpp
release/datafiles/splash.png
release/scripts/presets/keyconfig/maya.py
release/scripts/startup/bl_operators/image.py
release/scripts/startup/bl_ui/space_console.py
release/scripts/startup/bl_ui/space_info.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/intern/anim.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/string_cursor_utf8.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_operators.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_bvh.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/object/object_add.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_project.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_object.c
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/shader/nodes/node_shader_normal.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c

index 23e9eba0cf065267485c78cf6ea2ff622898fd75..3e1c8fec02a6e2cd322e42c73a5e3008e919887c 100644 (file)
@@ -241,11 +241,6 @@ option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install fol
 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
 mark_as_advanced(PYTHON_NUMPY_PATH)
 
-if(MINGW)
-       option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
-       mark_as_advanced(WITH_MINGW64)
-endif()
-
 # Cycles
 option(WITH_CYCLES                                     "Enable cycles Render Engine" ON)
 option(WITH_CYCLES_TEST                                "Build cycles test application" OFF)
@@ -867,8 +862,16 @@ elseif(WIN32)
 
        if(CMAKE_COMPILER_IS_GNUCC)
                set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
-
+               INCLUDE (CheckCSourceCompiles) 
                # Setup 64bit and 64bit windows systems
+               CHECK_C_SOURCE_COMPILES("
+                       #ifndef __MINGW64__
+                       #error
+                       #endif
+                       main(){}
+                       " 
+                       WITH_MINGW64)
+               
                if(WITH_MINGW64)
                        message("Compiling for 64 bit with MinGW-w64.")
                        set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
@@ -940,13 +943,6 @@ elseif(WIN32)
                endif()
        endif()
 
-       if(WITH_LLVM)
-               set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
-               file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
-               set(LLVM_STATIC YES)
-       endif()
-
-
        if(MSVC)
                set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
 
@@ -1149,6 +1145,12 @@ elseif(WIN32)
                        set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
                endif()
 
+               if(WITH_LLVM)
+                       set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
+                       file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
+                       set(LLVM_STATIC YES)
+               endif()
+       
                if(WITH_OPENCOLORIO)
                        set(OPENCOLORIO ${LIBDIR}/opencolorio)
                        set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1261,6 +1263,7 @@ elseif(WIN32)
 
                if(WITH_IMAGE_OPENEXR)
                        set(OPENEXR ${LIBDIR}/openexr)
+                       set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
                        set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
                        set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
@@ -1328,6 +1331,34 @@ elseif(WIN32)
                        set(OPENIMAGEIO_DEFINITIONS)
                endif()
                
+               if(WITH_LLVM)
+                       set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
+                       set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
+                       #Explicitly set llvm lib order.
+                       #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
+                       set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
+                               LLVMAsmParser LLVMAsmPrinter
+                               LLVMBitReader LLVMBitWriter
+                               LLVMDebugInfo LLVMExecutionEngine
+                               LLVMInstCombine LLVMInstrumentation
+                               LLVMInterpreter LLVMJIT
+                               LLVMLinker LLVMMC
+                               LLVMMCDisassembler LLVMMCJIT
+                               LLVMMCParser LLVMObject
+                               LLVMRuntimeDyld 
+                               LLVMSupport
+                               LLVMTableGen LLVMTarget
+                               LLVMTransformUtils LLVMVectorize
+                               LLVMX86AsmParser LLVMX86AsmPrinter
+                               LLVMX86CodeGen LLVMX86Desc
+                               LLVMX86Disassembler LLVMX86Info
+                               LLVMX86Utils LLVMipa
+                               LLVMipo LLVMCore)
+                               #imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
+                               set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
+                       set(LLVM_STATIC YES)
+               endif()
+               
                if(WITH_OPENCOLORIO)
                        set(OPENCOLORIO ${LIBDIR}/opencolorio)
                        set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1839,7 +1870,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
        # gcc 4.2 gives annoying warnings on every file with this
-       if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
+       if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
                ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
        endif()
 
@@ -1859,7 +1890,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
        # gcc 4.2 gives annoying warnings on every file with this
-       if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
+       if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
                ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
        endif()
 
@@ -1933,7 +1964,7 @@ if(WITH_PYTHON)
        if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
                # set but invalid
         # -- disabled until we make numpy bundled with blender - campbell
-               if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "")
+               if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
 #                      if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
 #                              message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
 #                                              "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
index 12369a5e8cddd9a3f5c2b9b1ff733c0bf35f8a36..d79145f8586d67f754e5c0f49bffc81b116aeef7 100644 (file)
@@ -46,6 +46,9 @@ CHECKER_ARGS = [
     #  "--enable=all",  # if you want sixty hundred pedantic suggestions
     ]
 
+if USE_QUIET:
+    CHECKER_ARGS.append("--quiet")
+
 
 def main():
     source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
@@ -78,6 +81,8 @@ def main():
 
     project_source_info.queue_processes(process_functions)
 
+    print("Finished!")
+
 
 if __name__ == "__main__":
     main()
index 4c9ca6d86775cfe1b27708954d89fa9cf6539dbb..3929271e66fd7e00a19fb47bc53947a10321e876 100644 (file)
@@ -57,7 +57,7 @@ struct EuclideanResectCostFunction {
 
   EuclideanResectCostFunction(const vector<Marker> &markers,
                               const EuclideanReconstruction &reconstruction,
-                              const Mat3 initial_R)
+                              const Mat3 &initial_R)
     : markers(markers),
       reconstruction(reconstruction),
       initial_R(initial_R) {}
index 1617e520ac7e44b37ce66a4505cbc90118a566d5..91b0549f7422ca9adb459508965245c87060fe2c 100644 (file)
@@ -34,6 +34,7 @@ set(INC_SYS
 set(SRC
        FX/AUD_AccumulatorFactory.cpp
        FX/AUD_BaseIIRFilterReader.cpp
+       FX/AUD_ButterworthCalculator.cpp
        FX/AUD_ButterworthFactory.cpp
        FX/AUD_CallbackIIRFilterReader.cpp
        FX/AUD_DelayFactory.cpp
@@ -47,6 +48,7 @@ set(SRC
        FX/AUD_EnvelopeFactory.cpp
        FX/AUD_FaderFactory.cpp
        FX/AUD_FaderReader.cpp
+       FX/AUD_HighpassCalculator.cpp
        FX/AUD_HighpassFactory.cpp
        FX/AUD_IIRFilterFactory.cpp
        FX/AUD_IIRFilterReader.cpp
@@ -54,6 +56,7 @@ set(SRC
        FX/AUD_LimiterReader.cpp
        FX/AUD_LoopFactory.cpp
        FX/AUD_LoopReader.cpp
+       FX/AUD_LowpassCalculator.cpp
        FX/AUD_LowpassFactory.cpp
        FX/AUD_PingPongFactory.cpp
        FX/AUD_PitchFactory.cpp
@@ -145,6 +148,7 @@ set(SRC
 
        FX/AUD_AccumulatorFactory.h
        FX/AUD_BaseIIRFilterReader.h
+       FX/AUD_ButterworthCalculator.h
        FX/AUD_ButterworthFactory.h
        FX/AUD_CallbackIIRFilterReader.h
        FX/AUD_DelayFactory.h
@@ -159,6 +163,7 @@ set(SRC
        FX/AUD_EnvelopeFactory.h
        FX/AUD_FaderFactory.h
        FX/AUD_FaderReader.h
+       FX/AUD_HighpassCalculator.h
        FX/AUD_HighpassFactory.h
        FX/AUD_IIRFilterFactory.h
        FX/AUD_IIRFilterReader.h
@@ -166,6 +171,7 @@ set(SRC
        FX/AUD_LimiterReader.h
        FX/AUD_LoopFactory.h
        FX/AUD_LoopReader.h
+       FX/AUD_LowpassCalculator.h
        FX/AUD_LowpassFactory.h
        FX/AUD_PingPongFactory.h
        FX/AUD_PitchFactory.h
diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.cpp b/intern/audaspace/FX/AUD_BandpassCalculator.cpp
new file mode 100644 (file)
index 0000000..f5bbd63
--- /dev/null
@@ -0,0 +1,5 @@
+#include "AUD_BandpassCalculator.h"
+
+AUD_BandpassCalculator::AUD_BandpassCalculator()
+{
+}
diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.h b/intern/audaspace/FX/AUD_BandpassCalculator.h
new file mode 100644 (file)
index 0000000..b5b3cad
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef AUD_BANDPASSCALCULATOR_H
+#define AUD_BANDPASSCALCULATOR_H
+
+class AUD_BandpassCalculator
+{
+public:
+  AUD_BandpassCalculator();
+};
+
+#endif // AUD_BANDPASSCALCULATOR_H
diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.cpp b/intern/audaspace/FX/AUD_ButterworthCalculator.cpp
new file mode 100644 (file)
index 0000000..7a3c6f7
--- /dev/null
@@ -0,0 +1,38 @@
+#include "AUD_ButterworthCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#define BWPB41 0.76536686473
+#define BWPB42 1.84775906502
+
+AUD_ButterworthCalculator::AUD_ButterworthCalculator(float frequency) :
+       m_frequency(frequency)
+{
+}
+
+void AUD_ButterworthCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+       float omega = 2 * tan(m_frequency * M_PI / rate);
+       float o2 = omega * omega;
+       float o4 = o2 * o2;
+       float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f;
+       float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f;
+       float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f;
+       float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f;
+       float o228 = 2.0f * o2 - 8.0f;
+       float norm = x1 * x2;
+       a.push_back(1);
+       a.push_back((x1 + x2) * o228 / norm);
+       a.push_back((x1 * y2 + x2 * y1 + o228 * o228) / norm);
+       a.push_back((y1 + y2) * o228 / norm);
+       a.push_back(y1 * y2 / norm);
+       b.push_back(o4 / norm);
+       b.push_back(4 * o4 / norm);
+       b.push_back(6 * o4 / norm);
+       b.push_back(b[1]);
+       b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.h b/intern/audaspace/FX/AUD_ButterworthCalculator.h
new file mode 100644 (file)
index 0000000..a7ae196
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef AUD_BUTTERWORTHCALCULATOR_H
+#define AUD_BUTTERWORTHCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_ButterworthCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+       /**
+        * The attack value in seconds.
+        */
+       const float m_frequency;
+
+public:
+       AUD_ButterworthCalculator(float frequency);
+
+       virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_BUTTERWORTHCALCULATOR_H
index 97d85c8122fc026da682c68349927905906b6ada..12c4306c2f7689872a510a706a4fcedef3c53806 100644 (file)
 
 #include "AUD_ButterworthFactory.h"
 #include "AUD_IIRFilterReader.h"
-
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define BWPB41 0.76536686473
-#define BWPB42 1.84775906502
+#include "AUD_ButterworthCalculator.h"
 
 AUD_ButterworthFactory::AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory,
                                                                                           float frequency) :
-               AUD_DynamicIIRFilterFactory(factory),
-               m_frequency(frequency)
+               AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_ButterworthCalculator(frequency)))
 {
 }
 
-void AUD_ButterworthFactory::recalculateCoefficients(AUD_SampleRate rate,
-                                                                                                        std::vector<float> &b,
-                                                                                                        std::vector<float> &a)
-{
-       float omega = 2 * tan(m_frequency * M_PI / rate);
-       float o2 = omega * omega;
-       float o4 = o2 * o2;
-       float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f;
-       float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f;
-       float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f;
-       float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f;
-       float o228 = 2.0f * o2 - 8.0f;
-       float norm = x1 * x2;
-       a.push_back(1);
-       a.push_back((x1 + x2) * o228 / norm);
-       a.push_back((x1 * y2 + x2 * y1 + o228 * o228) / norm);
-       a.push_back((y1 + y2) * o228 / norm);
-       a.push_back(y1 * y2 / norm);
-       b.push_back(o4 / norm);
-       b.push_back(4 * o4 / norm);
-       b.push_back(6 * o4 / norm);
-       b.push_back(b[1]);
-       b.push_back(b[0]);
-}
index e796f76aa29321bcd4efb4d20b189ee79ec44722..3a86b14a7a6cfda25a1bf2d484457c7511db64ed 100644 (file)
 class AUD_ButterworthFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-       /**
-        * The attack value in seconds.
-        */
-       const float m_frequency;
-
        // hide copy constructor and operator=
        AUD_ButterworthFactory(const AUD_ButterworthFactory&);
        AUD_ButterworthFactory& operator=(const AUD_ButterworthFactory&);
@@ -54,10 +49,6 @@ public:
         * \param frequency The cutoff frequency.
         */
        AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency);
-
-       virtual void recalculateCoefficients(AUD_SampleRate rate,
-                                            std::vector<float>& b,
-                                            std::vector<float>& a);
 };
 
 #endif //__AUD_BUTTERWORTHFACTORY_H__
index e8ea4323b2e8948f302f86e574ea979b38f842e2..319a78cfedd42ba29e753ea722f937406691c10c 100644 (file)
 #include "AUD_DynamicIIRFilterReader.h"
 
 
-AUD_DynamicIIRFilterFactory::AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory) :
-       AUD_EffectFactory(factory)
+AUD_DynamicIIRFilterFactory::AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory,
+                                                                                                                boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator) :
+       AUD_EffectFactory(factory),
+       m_calculator(calculator)
 {
 }
 
index f36a37f44b45ef0495d3873d3bc224d9819431d2..aece7a8c2ef60fc40a6b0f1e73ea1c7c286ed02e 100644 (file)
@@ -49,7 +49,8 @@ public:
         * Creates a new Dynmic IIR filter factory.
         * \param factory The input factory.
         */
-       AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory);
+       AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory,
+                                                               boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator);
 
        virtual boost::shared_ptr<AUD_IReader> createReader();
 };
diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.cpp b/intern/audaspace/FX/AUD_HighpassCalculator.cpp
new file mode 100644 (file)
index 0000000..573bba1
--- /dev/null
@@ -0,0 +1,27 @@
+#include "AUD_HighpassCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+AUD_HighpassCalculator::AUD_HighpassCalculator(float frequency, float Q) :
+       m_frequency(frequency),
+       m_Q(Q)
+{
+}
+
+void AUD_HighpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+       float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate;
+       float alpha = (float)(sin(w0) / (2.0 * (double)m_Q));
+       float norm = 1 + alpha;
+       float c = cos(w0);
+       a.push_back(1);
+       a.push_back(-2 * c / norm);
+       a.push_back((1 - alpha) / norm);
+       b.push_back((1 + c) / (2 * norm));
+       b.push_back((-1 - c) / norm);
+       b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.h b/intern/audaspace/FX/AUD_HighpassCalculator.h
new file mode 100644 (file)
index 0000000..bad1c08
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef AUD_HIGHPASSCALCULATOR_H
+#define AUD_HIGHPASSCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_HighpassCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+       /**
+        * The cutoff frequency.
+        */
+       const float m_frequency;
+
+       /**
+        * The Q factor.
+        */
+       const float m_Q;
+
+public:
+       AUD_HighpassCalculator(float frequency, float Q);
+
+       virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_HIGHPASSCALCULATOR_H
index ba5297d21edcdc8db10210b76c0d3de376f0a8c3..2456085a8a1d66cccf69a1130e853ffb06642b0c 100644 (file)
 
 #include "AUD_HighpassFactory.h"
 #include "AUD_IIRFilterReader.h"
-
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include "AUD_HighpassCalculator.h"
 
 AUD_HighpassFactory::AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency,
                                                                                 float Q) :
-               AUD_DynamicIIRFilterFactory(factory),
-               m_frequency(frequency),
-               m_Q(Q)
+               AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_HighpassCalculator(frequency, Q)))
 {
 }
 
-void AUD_HighpassFactory::recalculateCoefficients(AUD_SampleRate rate,
-                                                                                                 std::vector<float> &b,
-                                                                                                 std::vector<float> &a)
-{
-       float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate;
-       float alpha = (float)(sin(w0) / (2.0 * (double)m_Q));
-       float norm = 1 + alpha;
-       float c = cos(w0);
-       a.push_back(1);
-       a.push_back(-2 * c / norm);
-       a.push_back((1 - alpha) / norm);
-       b.push_back((1 + c) / (2 * norm));
-       b.push_back((-1 - c) / norm);
-       b.push_back(b[0]);
-}
index ed7e9db44a41be2347a3f3e73141cbb4dd18a74b..56ced91c53cbcc658fac0f54afc3c236a23a1c14 100644 (file)
 class AUD_HighpassFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-       /**
-        * The cutoff frequency.
-        */
-       const float m_frequency;
-
-       /**
-        * The Q factor.
-        */
-       const float m_Q;
-
        // hide copy constructor and operator=
        AUD_HighpassFactory(const AUD_HighpassFactory&);
        AUD_HighpassFactory& operator=(const AUD_HighpassFactory&);
@@ -60,8 +50,6 @@ public:
         * \param Q The Q factor.
         */
        AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f);
-
-       virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
 };
 
 #endif //__AUD_HIGHPASSFACTORY_H__
index 77d83360255dc4f6ba5d5c18c36af39295405934..29b87e57ad0a25b1ee25142656d14f918b6eef46 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef AUD_IDYNAMICIIRFILTERCALCULATOR_H
 #define AUD_IDYNAMICIIRFILTERCALCULATOR_H
 
+#include "AUD_Space.h"
+
 #include <vector>
 
 /**
diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.cpp b/intern/audaspace/FX/AUD_LowpassCalculator.cpp
new file mode 100644 (file)
index 0000000..57452f0
--- /dev/null
@@ -0,0 +1,27 @@
+#include "AUD_LowpassCalculator.h"
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+AUD_LowpassCalculator::AUD_LowpassCalculator(float frequency, float Q) :
+       m_frequency(frequency),
+       m_Q(Q)
+{
+}
+
+void AUD_LowpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a)
+{
+       float w0 = 2 * M_PI * m_frequency / rate;
+       float alpha = sin(w0) / (2 * m_Q);
+       float norm = 1 + alpha;
+       float c = cos(w0);
+       a.push_back(1);
+       a.push_back(-2 * c / norm);
+       a.push_back((1 - alpha) / norm);
+       b.push_back((1 - c) / (2 * norm));
+       b.push_back((1 - c) / norm);
+       b.push_back(b[0]);
+}
diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.h b/intern/audaspace/FX/AUD_LowpassCalculator.h
new file mode 100644 (file)
index 0000000..18bb11f
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef AUD_LOWPASSCALCULATOR_H
+#define AUD_LOWPASSCALCULATOR_H
+
+#include "AUD_IDynamicIIRFilterCalculator.h"
+
+class AUD_LowpassCalculator : public AUD_IDynamicIIRFilterCalculator
+{
+private:
+       /**
+        * The cutoff frequency.
+        */
+       const float m_frequency;
+
+       /**
+        * The Q factor.
+        */
+       const float m_Q;
+
+public:
+       AUD_LowpassCalculator(float frequency, float Q);
+
+       virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
+};
+
+#endif // AUD_LOWPASSCALCULATOR_H
index e2faa241ac9ae0b176088e07e1bdda452b09586c..bd225998392a342a6b40bd34f8f076903ae78da2 100644 (file)
 
 #include "AUD_LowpassFactory.h"
 #include "AUD_IIRFilterReader.h"
-
-#include <cmath>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
+#include "AUD_LowpassCalculator.h"
 
 AUD_LowpassFactory::AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency,
                                                                           float Q) :
-               AUD_DynamicIIRFilterFactory(factory),
-               m_frequency(frequency),
-               m_Q(Q)
-{
-}
-
-void AUD_LowpassFactory::recalculateCoefficients(AUD_SampleRate rate,
-                                                                                                std::vector<float> &b,
-                                                                                                std::vector<float> &a)
+               AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_LowpassCalculator(frequency, Q)))
 {
-       float w0 = 2 * M_PI * m_frequency / rate;
-       float alpha = sin(w0) / (2 * m_Q);
-       float norm = 1 + alpha;
-       float c = cos(w0);
-       a.push_back(1);
-       a.push_back(-2 * c / norm);
-       a.push_back((1 - alpha) / norm);
-       b.push_back((1 - c) / (2 * norm));
-       b.push_back((1 - c) / norm);
-       b.push_back(b[0]);
 }
index fdbc6e5d91d73682eada0cb8a5c7867b280f83ad..dfd8ab355212783bf803352935f618fec502e1bb 100644 (file)
 class AUD_LowpassFactory : public AUD_DynamicIIRFilterFactory
 {
 private:
-       /**
-        * The cutoff frequency.
-        */
-       const float m_frequency;
-
-       /**
-        * The Q factor.
-        */
-       const float m_Q;
-
        // hide copy constructor and operator=
        AUD_LowpassFactory(const AUD_LowpassFactory&);
        AUD_LowpassFactory& operator=(const AUD_LowpassFactory&);
@@ -60,8 +50,6 @@ public:
         * \param Q The Q factor.
         */
        AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f);
-
-       virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
 };
 
 #endif //__AUD_LOWPASSFACTORY_H__
index 95263ebe4630e9e85460f825b6545168a6c8c347..38f27bcf2af83ad360dee4e08c760818970350e8 100644 (file)
@@ -310,6 +310,13 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
        return object;
 }
 
+static bool object_dupli_hide_original(BL::Object::dupli_type_enum dupli_type)
+{
+       return (dupli_type == BL::Object::dupli_type_VERTS ||
+               dupli_type == BL::Object::dupli_type_FACES ||
+               dupli_type == BL::Object::dupli_type_FRAMES);
+}
+
 /* Object Loop */
 
 void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
@@ -371,6 +378,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                                                                        emitter_hide = false;
                                                }
 
+                                               /* hide original object for duplis */
+                                               BL::Object parent = b_dup_ob.parent();
+                                               if(parent && object_dupli_hide_original(parent.dupli_type()))
+                                                       if(b_dup->type() == BL::DupliObject::type_GROUP)
+                                                               dup_hide = true;
+
                                                if(!(b_dup->hide() || dup_hide || emitter_hide)) {
                                                        /* the persistent_id allows us to match dupli objects
                                                         * between frames and updates */
@@ -399,10 +412,14 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                                /* check if we should render or hide particle emitter */
                                BL::Object::particle_systems_iterator b_psys;
 
-                               for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
+                               for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
                                        if(b_psys->settings().use_render_emitter())
                                                hide = false;
-                               }
+
+                               /* hide original object for duplis */
+                               BL::Object parent = b_ob->parent();
+                               if(parent && object_dupli_hide_original(parent.dupli_type()))
+                                       hide = true;
 
                                if(!hide) {
                                        /* object itself */
index f72e4dd138464b61c2606b5eb8a9c729f3398628..32712b25e9212806d77808c2a95e85b12452cb8f 100644 (file)
@@ -152,6 +152,7 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
 
                                        sc.sample_weight = sample_weight;
                                        sc.type = bsdf->shaderclosure_type();
+                                       sc.N = bsdf->sc.N; /* needed for AO */
 
                                        /* add */
                                        if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) {
index 7f40ead3911a72ea22362d50239e169107df00ce..41284eff9c19c1920f9c68a24ebca19662df0cb3 100644 (file)
Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ
index b5df519cf597f4d7ff9999bafe8d07a45376ba26..ec8efc8d371f1b5acb677f9c04bf61e4135d0a26 100644 (file)
@@ -366,7 +366,7 @@ kmi = km.keymap_items.new('mesh.split', 'Y', 'PRESS')
 kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
 kmi = km.keymap_items.new('mesh.delete', 'X', 'PRESS')
 kmi = km.keymap_items.new('mesh.delete', 'DEL', 'PRESS')
-kmi = km.keymap_items.new('mesh.knifetool', 'LEFTMOUSE', 'PRESS', key_modifier='K')
+kmi = km.keymap_items.new('mesh.knife_tool', 'LEFTMOUSE', 'PRESS', key_modifier='K')
 # BMESH_TODO: midpoints for knife were moved to modal keymap
 #kmi = km.keymap_items.new('mesh.knifetool', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
 #kmi.properties.type = 'MIDPOINTS'
index 074069255bc2c50bbc4a6c5dd2ad6f8e3a92045e..ce328b86eac3f873128f01ac9cd3ee10f4949780 100644 (file)
@@ -224,7 +224,7 @@ class ProjectApply(Operator):
         image_name = ProjectEdit._proj_hack[0]  # TODO, deal with this nicer
 
         try:
-            image = bpy.data.images[image_name]
+            image = bpy.data.images[image_name, None]
         except KeyError:
             import traceback
             traceback.print_exc()
index 5ff179902a3dee2f7e51b8b0fe51e914afb4fb27..23d16c14f2d6e015925baa65ee3d65a9d05cb03f 100644 (file)
@@ -25,7 +25,7 @@ class CONSOLE_HT_header(Header):
     bl_space_type = 'CONSOLE'
 
     def draw(self, context):
-        layout = self.layout.row(align=True)
+        layout = self.layout.row()
 
         layout.template_header()
 
index 662d5526a37828f37287beb5a61bdb416ad992ee..8df117e27a0806d8b03f4085e5c24ae041db4dc8 100644 (file)
@@ -193,7 +193,7 @@ class INFO_MT_mesh_add(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = 'EXEC_REGION_WIN'
+        layout.operator_context = 'INVOKE_REGION_WIN'
         layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
         layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
         layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
index 3c210877de7f7347341d6900499560206b40f353..b624d0f9c3a0b33e3617e2606e2ca60431973782 100644 (file)
@@ -41,8 +41,8 @@ extern "C" {
 /* these lines are grep'd, watch out for our not-so-awesome regex
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
-#define BLENDER_VERSION         264
-#define BLENDER_SUBVERSION      9
+#define BLENDER_VERSION         265
+#define BLENDER_SUBVERSION      0
 
 /* 262 was the last editmesh release but it has compatibility code for bmesh data */
 #define BLENDER_MINVERSION      262
@@ -50,9 +50,9 @@ extern "C" {
 
 /* used by packaging tools */
 /* can be left blank, otherwise a,b,c... etc with no quotes */
-#define BLENDER_VERSION_CHAR    a
+#define BLENDER_VERSION_CHAR    
 /* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE   alpha
+#define BLENDER_VERSION_CYCLE   release
 
 extern char versionstr[]; /* from blender.c */
 
index f5c0660371bfb06201c8a06ba35a050872006ab6..9a2462e972490b45e90b4304e6377449f0383dea 100644 (file)
@@ -1257,6 +1257,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
        float (*obmat)[4], (*oldobmat)[4];
        int a, b, hair = 0;
        int totpart, totchild, totgroup = 0 /*, pa_num */;
+       int dupli_type_hack = !BKE_scene_use_new_shading_nodes(scene);
 
        int no_draw_flag = PARS_UNEXIST;
 
@@ -1474,6 +1475,13 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
                                }
                        }
                        else {
+                               int dupli_type = OB_DUPLIPARTS;
+
+                               /* blender internal needs this to be set to dupligroup to render
+                                * groups correctly, but we don't want this hack for cycles */
+                               if(dupli_type_hack && GS(id->name) == ID_GR)
+                                       dupli_type = OB_DUPLIGROUP;
+
                                /* to give ipos in object correct offset */
                                BKE_object_where_is_calc_time(scene, ob, ctime - pa_time);
 
@@ -1527,7 +1535,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
                                if (part->draw & PART_DRAW_GLOBAL_OB)
                                        add_v3_v3v3(mat[3], mat[3], vec);
 
-                               dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, (flag & DUPLILIST_ANIMATED));
+                               dob = new_dupli_object(lb, ob, mat, ob->lay, persistent_id, level, a, dupli_type, (flag & DUPLILIST_ANIMATED));
                                dob->particle_system = psys;
                                copy_m4_m4(dob->omat, oldobmat);
                                if (flag & DUPLILIST_FOR_RENDER)
index cd726179f56be3fd73ddf37d5c7ed222bd821713..74abd7e8c7ebb53eab7127ee2d8b8d8c785be4ad 100644 (file)
@@ -1453,9 +1453,16 @@ float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3
 float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
 {
        float h[2], u[2];
+       float dot;
        sub_v2_v2v2(u, l2, l1);
        sub_v2_v2v2(h, p, l1);
+#if 0
        return (dot_v2v2(u, h) / dot_v2v2(u, u));
+#else
+       /* better check for zero */
+       dot = dot_v2v2(u, u);
+       return (dot != 0.0f) ? (dot_v2v2(u, h) / dot) : 0.0f;
+#endif
 }
 
 /* ensure the distance between these points is no greater then 'dist'
index bab144266a4c53eefce0e3a8b00de2afc2a42bff..65763f21b0f228f7168a7908ac317c50d89dc9a7 100644 (file)
@@ -38,7 +38,7 @@
 
 typedef enum strCursorDelimType {
        STRCUR_DELIM_NONE,
-       STRCUR_DELIM_ALPHA,
+       STRCUR_DELIM_ALPHANUMERIC,
        STRCUR_DELIM_PUNCT,
        STRCUR_DELIM_BRACE,
        STRCUR_DELIM_OPERATOR,
@@ -47,21 +47,12 @@ typedef enum strCursorDelimType {
        STRCUR_DELIM_OTHER
 } strCursorDelimType;
 
-/* return 1 if char ch is special character, otherwise return 0 */
-static strCursorDelimType test_special_char(const char *ch_utf8)
+static strCursorDelimType cursor_delim_type(const char *ch_utf8)
 {
        /* for full unicode support we really need to have large lookup tables to figure
         * out whats what in every possible char set - and python, glib both have these. */
        unsigned int uch = BLI_str_utf8_as_unicode(ch_utf8);
 
-       if ((uch >= 'a' && uch <= 'z') ||
-           (uch >= 'A' && uch <= 'Z') ||
-           (uch == '_') /* not quite correct but allow for python, could become configurable */
-           )
-       {
-               return STRCUR_DELIM_ALPHA;
-       }
-
        switch (uch) {
                case ',':
                case '.':
@@ -86,10 +77,11 @@ static strCursorDelimType test_special_char(const char *ch_utf8)
                case '^':
                case '*':
                case '&':
+               case '|':
                        return STRCUR_DELIM_OPERATOR;
 
                case '\'':
-               case '\"': // " - an extra closing one for Aligorith's text editor
+               case '\"':
                        return STRCUR_DELIM_QUOTE;
 
                case ' ':
@@ -97,20 +89,22 @@ static strCursorDelimType test_special_char(const char *ch_utf8)
                        return STRCUR_DELIM_WHITESPACE;
 
                case '\\':
-               case '!':
                case '@':
                case '#':
                case '$':
                case ':':
                case ';':
                case '?':
+               case '!':
+               case 0xA3:  /* pound */
+               case 0x80:  /* euro */
                        /* case '_': *//* special case, for python */
                        return STRCUR_DELIM_OTHER;
 
                default:
                        break;
        }
-       return STRCUR_DELIM_NONE;
+       return STRCUR_DELIM_ALPHANUMERIC; /* Not quite true, but ok for now */
 }
 
 int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
@@ -153,14 +147,14 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
                BLI_str_cursor_step_next_utf8(str, maxlen, pos);
 
                if (jump != STRCUR_JUMP_NONE) {
-                       const strCursorDelimType is_special = (*pos) < maxlen ? test_special_char(&str[*pos]) : STRCUR_DELIM_NONE;
+                       const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE;
                        /* jump between special characters (/,\,_,-, etc.),
-                        * look at function test_special_char() for complete
+                        * look at function cursor_delim_type() for complete
                         * list of special character, ctr -> */
                        while ((*pos) < maxlen) {
                                if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) {
-                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
-                                               break;
+                                       if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
+                                       break;
                                }
                                else {
                                        break; /* unlikely but just in case */
@@ -172,13 +166,13 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
                BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
 
                if (jump != STRCUR_JUMP_NONE) {
-                       const strCursorDelimType is_special = (*pos) > 1 ? test_special_char(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
+                       const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
                        /* jump between special characters (/,\,_,-, etc.),
-                        * look at function test_special_char() for complete
+                        * look at function cursor_delim_type() for complete
                         * list of special character, ctr -> */
                        while ((*pos) > 0) {
                                if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) {
-                                       if ((jump != STRCUR_JUMP_ALL) && (is_special != test_special_char(&str[*pos])))
+                                       if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type(&str[*pos])))
                                                break;
                                }
                                else {
index bad884b90251c77b5a83ea9d84756242bcc02033..79a246e20f0b97e7386bb9f675bd59c4573e3d43 100644 (file)
@@ -8560,7 +8560,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
-       {
+       if (main->versionfile < 265) {
                Object *ob;
                for (ob = main->object.first; ob; ob = ob->id.next) {
                        if (ob->step_height == 0.0f) {
index baec0b7745d85da15cbc4ed6489c308616cb6adf..5e51f5a5ada13390ffe79212fe1cd4467d1a3a0b 100644 (file)
@@ -1225,7 +1225,7 @@ static void bmo_flag_layer_free(BMesh *bm)
        /* de-increment the totflags first.. */
        bm->totflags--;
        /* allocate new flag poo */
-       bm->toolflagpool = newpool = BLI_mempool_create(new_totflags_size, 512, 512, BLI_MEMPOOL_SYSMALLOC);
+       bm->toolflagpool = newpool = BLI_mempool_create(new_totflags_size, 512, 512, 0);
        
        /* now go through and memcpy all the flag */
        BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) {
index 62ffdc7fd3a7698b928a01c6572cff5577567561..1b980790fdcff337bbc054e6cb0290f060173aee 100644 (file)
@@ -1409,6 +1409,11 @@ static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
+static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+       return ed_markers_opwrap_invoke_custom(C, op, evt, WM_menu_invoke);
+}
+
 static void MARKER_OT_make_links_scene(wmOperatorType *ot)
 {
        PropertyRNA *prop;
@@ -1420,7 +1425,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = ed_marker_make_links_scene_exec;
-       ot->invoke = ed_markers_opwrap_invoke;
+       ot->invoke = ed_marker_make_links_scene_invoke_wrapper;
        ot->poll = ed_markers_poll_selected_markers;
 
        /* flags */
index d5c9b9ef01a2f9cb3661d50a4aba32eeb9704871..f15f2418707bd0e3676d5e4e09b8b3fca4f77264 100644 (file)
@@ -193,7 +193,8 @@ void ED_view3d_global_to_vector(struct RegionView3D *rv3d, const float coord[3],
 void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
 void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3]);
 void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+void ED_view3d_win_to_segment(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
+int  ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
 void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
 void ED_view3d_unproject(struct bglMats *mats, float out[3], const float x, const float y, const float z);
 
@@ -295,6 +296,8 @@ void ED_view3D_background_image_clear(struct View3D *v3d);
 
 #define VIEW3D_MARGIN 1.4f
 float ED_view3d_offset_distance(float mat[4][4], float ofs[3]);
+
+float ED_scene_grid_scale(struct Scene *scene, const char **grid_unit);
 float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit);
 
 /* view matrix properties utilities */
index 527f383c837912cf8473e7201113fdcd233d753f..c4b80f0a42fe526dc6dd5a180bf252521fb7e2e3 100644 (file)
@@ -651,8 +651,8 @@ static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert
        for (a = 0; a < totvert; a++) {
                quad_strip[a * 2][0] = wtb->outer_v[a][0];
                quad_strip[a * 2][1] = wtb->outer_v[a][1];
-               quad_strip[a * 2 + 1][0] = wtb->outer_v[a][0];
-               quad_strip[a * 2 + 1][1] = wtb->outer_v[a][1] - 1.0f;
+               quad_strip[a * 2 + 1][0] = wtb->inner_v[a][0];
+               quad_strip[a * 2 + 1][1] = wtb->inner_v[a][1];
        }
 }
 
index eed72935b3c6bfae4f92d8a7f5dec8b91b4a135e..4a425c83d86563da6783e90dad95b020718747ad 100644 (file)
@@ -204,7 +204,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
 
        if (!EDBM_op_call_and_selectf(em, op, "verts.out",
                                      "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4",
-                                     RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius") * dia,
+                                     RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"),
                                      cap_end, cap_tri, mat))
        {
                return OPERATOR_CANCELLED;
@@ -225,6 +225,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_circle_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_circle_exec;
        ot->poll = ED_operator_scene_editable;
 
@@ -260,10 +261,10 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
                em, op, "verts.out",
                "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4",
                RNA_int_get(op->ptr, "vertices"),
-               RNA_float_get(op->ptr, "radius") * dia,
-               RNA_float_get(op->ptr, "radius") * dia,
+               RNA_float_get(op->ptr, "radius"),
+               RNA_float_get(op->ptr, "radius"),
                cap_end, cap_tri,
-               RNA_float_get(op->ptr, "depth") * dia, mat))
+               RNA_float_get(op->ptr, "depth"), mat))
        {
                return OPERATOR_CANCELLED;
        }
@@ -283,6 +284,7 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_cylinder_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_cylinder_exec;
        ot->poll = ED_operator_scene_editable;
 
@@ -319,8 +321,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
        if (!EDBM_op_call_and_selectf(
                em, op, "verts.out",
                "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4",
-               RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1") * dia,
-               RNA_float_get(op->ptr, "radius2") * dia, cap_end, cap_tri, RNA_float_get(op->ptr, "depth") * dia, mat))
+               RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"),
+               RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat))
        {
                return OPERATOR_CANCELLED;
        }
@@ -340,6 +342,7 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_cone_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_cone_exec;
        ot->poll = ED_operator_scene_editable;
 
@@ -376,7 +379,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
                                      "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4",
                                      RNA_int_get(op->ptr, "x_subdivisions"),
                                      RNA_int_get(op->ptr, "y_subdivisions"),
-                                     RNA_float_get(op->ptr, "size") * dia, mat))
+                                     RNA_float_get(op->ptr, "size"), mat))
        {
                return OPERATOR_CANCELLED;
        }
@@ -396,6 +399,7 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_grid_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_grid_exec;
        ot->poll = ED_operator_scene_editable;
 
@@ -473,7 +477,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
        if (!EDBM_op_call_and_selectf(em, op, "verts.out",
                                      "create_uvsphere u_segments=%i v_segments=%i diameter=%f matrix=%m4",
                                      RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"),
-                                     RNA_float_get(op->ptr, "size") * dia, mat))
+                                     RNA_float_get(op->ptr, "size"), mat))
        {
                return OPERATOR_CANCELLED;
        }
@@ -493,6 +497,7 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_uv_sphere_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_uvsphere_exec;
        ot->poll = ED_operator_scene_editable;
 
@@ -525,7 +530,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
                em, op, "verts.out",
                "create_icosphere subdivisions=%i diameter=%f matrix=%m4",
                RNA_int_get(op->ptr, "subdivisions"),
-               RNA_float_get(op->ptr, "size") * dia, mat))
+               RNA_float_get(op->ptr, "size"), mat))
        {
                return OPERATOR_CANCELLED;
        }
@@ -545,6 +550,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
        ot->idname = "MESH_OT_primitive_ico_sphere_add";
 
        /* api callbacks */
+       ot->invoke = WM_operator_view3d_distance_invoke;
        ot->exec = add_primitive_icosphere_exec;
        ot->poll = ED_operator_scene_editable;
 
index 4324e50f914327696ab4b4bca6c9e1eee778a4a2..8e397797dd987751eed9938fbfb80bab0a49daac 100644 (file)
@@ -399,7 +399,7 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje
        const float mval_f[2] = {ar->winx / 2.0f,
                                 ar->winy / 2.0f};
 
-       ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end);
+       ED_view3d_win_to_segment(ar, v3d, mval_f, origin, end);
        
        invert_m4_m4(invmat, obedit->obmat);
        mul_m4_v3(invmat, origin);
index d5cf174b1a1601764016ef53a959a8bc63653960..a59c491fe1326eeb57bdb1934df277886d895eca 100644 (file)
@@ -1181,7 +1181,6 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
        result = results = BLI_bvhtree_overlap(tree, tree2, &tot);
 
        for (i = 0; i < tot; i++, result++) {
-               float p[3];
                BMLoop *l1;
                BMFace *hitf;
                ListBase *lst;
@@ -1200,7 +1199,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
                        }
 
                        if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, NULL)) {
-                               float no[3], view[3], sp[3];
+                               float p[3], no[3], view[3], sp[3];
 
                                interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
 
@@ -1215,6 +1214,11 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
                                {
                                        continue;
                                }
+                               if ((kcd->vc.rv3d->rflag & RV3D_CLIPPING) &&
+                                   ED_view3d_clipping_test(kcd->vc.rv3d, p, TRUE))
+                               {
+                                       continue;
+                               }
 
                                knife_project_v3(kcd, p, sp);
                                ED_view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
@@ -1523,12 +1527,7 @@ static int knife_sample_screen_density(KnifeTool_OpData *kcd, float radius)
                                dis = len_v2v2(kfv->sco, sco);
                                if (dis < radius) {
                                        if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-                                               float vec[3];
-
-                                               copy_v3_v3(vec, kfv->cageco);
-                                               mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
-                                               if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+                                               if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
                                                        c++;
                                                }
                                        }
@@ -1595,13 +1594,10 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
                        dis = dist_to_line_segment_v2(sco, kfe->v1->sco, kfe->v2->sco);
                        if (dis < curdis && dis < maxdist) {
                                if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-                                       float labda = labda_PdistVL2Dfl(sco, kfe->v1->sco, kfe->v2->sco);
+                                       float labda = line_point_factor_v2(sco, kfe->v1->sco, kfe->v2->sco);
                                        float vec[3];
 
-                                       vec[0] = kfe->v1->cageco[0] + labda * (kfe->v2->cageco[0] - kfe->v1->cageco[0]);
-                                       vec[1] = kfe->v1->cageco[1] + labda * (kfe->v2->cageco[1] - kfe->v1->cageco[1]);
-                                       vec[2] = kfe->v1->cageco[2] + labda * (kfe->v2->cageco[2] - kfe->v1->cageco[2]);
-                                       mul_m4_v3(kcd->vc.obedit->obmat, vec);
+                                       interp_v3_v3v3(vec, kfe->v1->cageco, kfe->v2->cageco, labda);
 
                                        if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
                                                cure = kfe;
@@ -1693,12 +1689,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
                                dis = len_v2v2(kfv->sco, sco);
                                if (dis < curdis && dis < maxdist) {
                                        if (kcd->vc.rv3d->rflag & RV3D_CLIPPING) {
-                                               float vec[3];
-
-                                               copy_v3_v3(vec, kfv->cageco);
-                                               mul_m4_v3(kcd->vc.obedit->obmat, vec);
-
-                                               if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+                                               if (ED_view3d_clipping_test(kcd->vc.rv3d, kfv->cageco, TRUE) == 0) {
                                                        curv = kfv;
                                                        curdis = dis;
                                                }
@@ -3114,6 +3105,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
        Object *obedit = CTX_data_edit_object(C);
        KnifeTool_OpData *kcd = op->customdata;
+       int do_refresh = FALSE;
 
        if (!obedit || obedit->type != OB_MESH || BMEdit_FromObject(obedit) != kcd->em) {
                knifetool_exit(C, op);
@@ -3122,6 +3114,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
        }
 
        view3d_operator_needs_opengl(C);
+       ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d);  /* needed to initialize clipping */
 
        if (kcd->mode == MODE_PANNING)
                kcd->mode = kcd->prevmode;
@@ -3153,6 +3146,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
                                knife_update_active(kcd);
                                knife_update_header(C, kcd);
                                ED_region_tag_redraw(kcd->ar);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODAL_MIDPOINT_OFF:
                                kcd->snap_midpoints = 0;
@@ -3161,25 +3155,29 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
                                knife_update_active(kcd);
                                knife_update_header(C, kcd);
                                ED_region_tag_redraw(kcd->ar);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODEL_IGNORE_SNAP_ON:
                                ED_region_tag_redraw(kcd->ar);
                                kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = 1;
                                knife_update_header(C, kcd);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODEL_IGNORE_SNAP_OFF:
                                ED_region_tag_redraw(kcd->ar);
                                kcd->ignore_vert_snapping = kcd->ignore_edge_snapping = 0;
                                knife_update_header(C, kcd);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODAL_ANGLE_SNAP_TOGGLE:
                                kcd->angle_snapping = !kcd->angle_snapping;
                                knife_update_header(C, kcd);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODAL_CUT_THROUGH_TOGGLE:
                                kcd->cut_through = !kcd->cut_through;
-                               knifetool_update_mval(kcd, event->mval);  /* refresh knife path */
                                knife_update_header(C, kcd);
+                               do_refresh = TRUE;
                                break;
                        case KNF_MODAL_NEW_CUT:
                                ED_region_tag_redraw(kcd->ar);
@@ -3232,6 +3230,12 @@ static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
                }
        }
 
+       if (do_refresh) {
+               /* we don't really need to update mval,
+                * but this happens to be the best way to refresh at the moment */
+               knifetool_update_mval(kcd, event->mval);
+       }
+
        /* keep going until the user confirms */
        return OPERATOR_RUNNING_MODAL;
 }
index cb1b4ebba7228d93928dcbdcabc8847726dc2d0d..68dfbf66ec33b7a8b951832d8dbd48adf69b9604 100644 (file)
@@ -450,20 +450,6 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const short sel,
        }
 }
 
-/* returns labda for closest distance v1 to line-piece v2 - v3 */
-float labda_PdistVL2Dfl(const float v1[2], const float v2[2], const float v3[2])
-{
-       float rc[2], len;
-       
-       rc[0] = v3[0] - v2[0];
-       rc[1] = v3[1] - v2[1];
-       len = rc[0] * rc[0] + rc[1] * rc[1];
-       if (len == 0.0f)
-               return 0.0f;
-       
-       return (rc[0] * (v1[0] - v2[0]) + rc[1] * (v1[1] - v2[1])) / len;
-}
-
 /* note; uses v3d, so needs active 3d window */
 static void findnearestedge__doClosest(void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int UNUSED(index))
 {
@@ -478,7 +464,7 @@ static void findnearestedge__doClosest(void *userData, BMEdge *eed, const float
 
        if (distance < data->dist) {
                if (data->vc.rv3d->rflag & RV3D_CLIPPING) {
-                       float labda = labda_PdistVL2Dfl(data->mval_fl, screen_co_a, screen_co_b);
+                       float labda = line_point_factor_v2(data->mval_fl, screen_co_a, screen_co_b);
                        float vec[3];
 
                        vec[0] = eed->v1->co[0] + labda * (eed->v2->co[0] - eed->v1->co[0]);
index 58f05df83f127c425cc05c0590ccea55b27054e8..043679b9d8a89de2d2aee10608c82101155a7842 100644 (file)
@@ -80,9 +80,6 @@ int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
 void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
 void EDBM_stats_update(struct BMEditMesh *em);
 
-/* TODO, move to math_geometry.c */
-float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3]);
-
 /* ******************** editface.c */
 
 void MESH_OT_separate(struct wmOperatorType *ot);
index ad1e2816c10097f762f19b3c0922527faf8d5632..7c4a547debc7fc707a037882e7e2d2d08d774c49 100644 (file)
@@ -210,8 +210,8 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
        invert_m3_m3(imat, mat);
        mul_m3_v3(imat, primmat[3]);
 
-       if (v3d) {
-               float dia = ED_view3d_grid_scale(scene, v3d, NULL);
+       {
+               const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL);
 
                if (apply_diameter) {
                        primmat[0][0] *= dia;
index 25ea08a4bb1c9a0278b23ecd1c6c301b81a21716..e2ed7776b7e249ed5e800e404c0bc5546b1e2aee 100644 (file)
@@ -3764,6 +3764,7 @@ int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2])
        mval[0] = mouse[0] - vc.ar->winrct.xmin;
        mval[1] = mouse[1] - vc.ar->winrct.ymin;
 
+       /* TODO: what if the segment is totally clipped? (return == 0) */
        ED_view3d_win_to_segment_clip(vc.ar, vc.v3d, mval, ray_start, ray_end);
 
        invert_m4_m4(obimat, ob->obmat);
index 6c23635da90da30e39cea3c911b91847a9633568..51261f4c341c7aae3509afea0b89497899cbeda7 100644 (file)
@@ -451,10 +451,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 }
 #undef GRID_MIN_PX
 
-float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
+/** could move this elsewhere, but tied into #ED_view3d_grid_scale */
+float ED_scene_grid_scale(Scene *scene, const char **grid_unit)
 {
-       float grid_scale = v3d->grid;
-
        /* apply units */
        if (scene->unit.system) {
                void *usys;
@@ -466,11 +465,16 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
                        int i = bUnit_GetBaseUnit(usys);
                        if (grid_unit)
                                *grid_unit = bUnit_GetNameDisplay(usys, i);
-                       grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
+                       return (float)bUnit_GetScaler(usys, i) / scene->unit.scale_length;
                }
        }
 
-       return grid_scale;
+       return 1.0f;
+}
+
+float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
+{
+       return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
 }
 
 static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
index 6ba05abae9a5f9df5e115eed35bc11590a3f0dad..34b983f83dfdb2cd5f423c6b24939bd779903eea 100644 (file)
@@ -296,7 +296,7 @@ void ED_view3d_win_to_ray(ARegion *ar, View3D *v3d, const float mval[2], float r
 {
        float ray_end[3];
        
-       ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
+       ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
        sub_v3_v3v3(ray_normal, ray_end, ray_start);
        normalize_v3(ray_normal);
 }
@@ -419,19 +419,7 @@ void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
        normalize_v3(out);
 }
 
-/**
- * Calculate a 3d segment from 2d window coordinates.
- * This ray_start is located at the viewpoint, ray_end is a far point.
- * ray_start and ray_end are clipped by the view near and far limits
- * so points along this line are always in view.
- * In orthographic view all resulting segments will be parallel.
- * \param ar The region (used for the window width and height).
- * \param v3d The 3d viewport (used for near and far clipping range).
- * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
- * \param ray_start The world-space starting point of the segment.
- * \param ray_end The world-space end point of the segment.
- */
-void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+void ED_view3d_win_to_segment(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
 {
        RegionView3D *rv3d = ar->regiondata;
 
@@ -455,14 +443,46 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
                madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2],  1000.0f);
                madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f);
        }
+}
+
+/**
+ * Calculate a 3d segment from 2d window coordinates.
+ * This ray_start is located at the viewpoint, ray_end is a far point.
+ * ray_start and ray_end are clipped by the view near and far limits
+ * so points along this line are always in view.
+ * In orthographic view all resulting segments will be parallel.
+ * \param ar The region (used for the window width and height).
+ * \param v3d The 3d viewport (used for near and far clipping range).
+ * \param mval The area relative 2d location (such as event->mval, converted into float[2]).
+ * \param ray_start The world-space starting point of the segment.
+ * \param ray_end The world-space end point of the segment.
+ * \return success, FALSE if the segment is totally clipped.
+ */
+int ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3])
+{
+       RegionView3D *rv3d = ar->regiondata;
+       ED_view3d_win_to_segment(ar, v3d, mval, ray_start, ray_end);
 
        /* clipping */
        if (rv3d->rflag & RV3D_CLIPPING) {
+               /* if the ray is totally clipped,
+                * restore the original values but return FALSE
+                * caller can choose what to do */
+               float tray_start[3] = {UNPACK3(ray_start)};
+               float tray_end[3]   = {UNPACK3(ray_end)};
                int a;
                for (a = 0; a < 4; a++) {
-                       clip_line_plane(ray_start, ray_end, rv3d->clip[a]);
+                       if (clip_line_plane(tray_start, tray_end, rv3d->clip[a]) == FALSE) {
+                               return FALSE;
+                       }
                }
+
+               /* copy in clipped values */
+               copy_v3_v3(ray_start, tray_start);
+               copy_v3_v3(ray_end, tray_end);
        }
+
+       return TRUE;
 }
 
 
index 8af971b9b65b5a37facb4b8b9ecd361a4381c5a4..44db8d25b778069bb22ef3162b5ccb775de0a0c2 100644 (file)
@@ -1342,46 +1342,46 @@ typedef struct Scene {
 #define TESTBASE(v3d, base)  (                                                \
        ((base)->flag & SELECT) &&                                                \
        ((base)->lay & v3d->lay) &&                                               \
-       (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+       (((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define TESTBASELIB(v3d, base)  (                                             \
        ((base)->flag & SELECT) &&                                                \
        ((base)->lay & v3d->lay) &&                                               \
-       ((base)->object->id.lib==NULL) &&                                         \
-       (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+       ((base)->object->id.lib == NULL) &&                                       \
+       (((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define TESTBASELIB_BGMODE(v3d, scene, base)  (                               \
        ((base)->flag & SELECT) &&                                                \
        ((base)->lay & (v3d ? v3d->lay : scene->lay)) &&                          \
-       ((base)->object->id.lib==NULL) &&                                         \
-       (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)  )
+       ((base)->object->id.lib == NULL) &&                                       \
+       (((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define BASE_EDITABLE_BGMODE(v3d, scene, base)  (                             \
        ((base)->lay & (v3d ? v3d->lay : scene->lay)) &&                          \
-       ((base)->object->id.lib==NULL) &&                                         \
-       (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
+       ((base)->object->id.lib == NULL) &&                                       \
+       (((base)->object->restrictflag & OB_RESTRICT_VIEW) == 0))
 #define BASE_SELECTABLE(v3d, base)  (                                         \
        (base->lay & v3d->lay) &&                                                 \
-       (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0  )
+       (base->object->restrictflag & (OB_RESTRICT_SELECT | OB_RESTRICT_VIEW)) == 0)
 #define BASE_VISIBLE(v3d, base)  (                                            \
        (base->lay & v3d->lay) &&                                                 \
-       (base->object->restrictflag & OB_RESTRICT_VIEW)==0  )
+       (base->object->restrictflag & OB_RESTRICT_VIEW) == 0)
 
 #define FIRSTBASE              scene->base.first
 #define LASTBASE               scene->base.last
 #define BASACT                 (scene->basact)
-#define OBACT                  (BASACT? BASACT->object: NULL)
+#define OBACT                  (BASACT ? BASACT->object: NULL)
 
 #define V3D_CAMERA_LOCAL(v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : NULL)
 #define V3D_CAMERA_SCENE(scene, v3d) ((!(v3d)->scenelock && (v3d)->camera) ? (v3d)->camera : (scene)->camera)
 
-#define        CFRA                    (scene->r.cfra)
-#define SUBFRA                 (scene->r.subframe)
-#define        SFRA                    (scene->r.sfra)
-#define        EFRA                    (scene->r.efra)
-#define PRVRANGEON             (scene->r.flag & SCER_PRV_RANGE)
-#define PSFRA                  ((PRVRANGEON) ? (scene->r.psfra) : (scene->r.sfra))
-#define PEFRA                  ((PRVRANGEON) ? (scene->r.pefra) : (scene->r.efra))
-#define FRA2TIME(a)           ((((double) scene->r.frs_sec_base) * (double)(a)) / (double)scene->r.frs_sec)
-#define TIME2FRA(a)           ((((double) scene->r.frs_sec) * (double)(a)) / (double)scene->r.frs_sec_base)
-#define FPS                     (((double) scene->r.frs_sec) / (double)scene->r.frs_sec_base)
+#define CFRA            (scene->r.cfra)
+#define SUBFRA          (scene->r.subframe)
+#define SFRA            (scene->r.sfra)
+#define EFRA            (scene->r.efra)
+#define PRVRANGEON      (scene->r.flag & SCER_PRV_RANGE)
+#define PSFRA           ((PRVRANGEON) ? (scene->r.psfra) : (scene->r.sfra))
+#define PEFRA           ((PRVRANGEON) ? (scene->r.pefra) : (scene->r.efra))
+#define FRA2TIME(a)     ((((double) scene->r.frs_sec_base) * (double)(a)) / (double)scene->r.frs_sec)
+#define TIME2FRA(a)     ((((double) scene->r.frs_sec) * (double)(a)) / (double)scene->r.frs_sec_base)
+#define FPS              (((double) scene->r.frs_sec) / (double)scene->r.frs_sec_base)
 
 /* base->flag is in DNA_object_types.h */
 
@@ -1614,4 +1614,4 @@ typedef enum SculptFlags {
 }
 #endif
 
-#endif
+#endif  /* __DNA_SCENE_TYPES_H__ */
index bd51af77b34d0d38f64e8c67e9b5f30b0a3b3ed3..1d08ea97b79b529c711a6f739c8ef7a60bbe1cec 100644 (file)
@@ -94,6 +94,15 @@ static EnumPropertyItem parent_type_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+static EnumPropertyItem dupli_items[] = {
+       {0, "NONE", 0, "None", ""},
+       {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
+       {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
+       {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
+       {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
+       {0, NULL, 0, NULL, NULL}
+};
+
 static EnumPropertyItem collision_bounds_items[] = {
        {OB_BOUND_BOX, "BOX", 0, "Box", ""},
        {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
@@ -2019,15 +2028,7 @@ static void rna_def_object(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem dupli_items[] = {
-               {0, "NONE", 0, "None", ""},
-               {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
-               {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
-               {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
-               {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
-               {0, NULL, 0, NULL, NULL}
-       };
-               
+       
        /* XXX: this RNA enum define is currently duplicated for objects,
         *      since there is some text here which is not applicable */
        static EnumPropertyItem prop_rotmode_items[] = {
@@ -2681,6 +2682,11 @@ static void rna_def_dupli_object(BlenderRNA *brna)
        RNA_def_property_array(prop, 2);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
+
+       prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_items(prop, dupli_items);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object");
 }
 
 static void rna_def_object_base(BlenderRNA *brna)
index 9a7e587ff56b922155576f36f0bdba84b20d6c28..03462738d58ceb3e7342dea5d608fc76b4163943 100644 (file)
@@ -719,6 +719,16 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int
 
 /* *********************************************** */
 
+static void set_output_visible(bNode *node, int passflag, int index, int pass)
+{
+       bNodeSocket *sock = BLI_findlink(&node->outputs, index);
+       /* clear the SOCK_HIDDEN flag as well, in case a socket was hidden before */
+       if (passflag & pass)
+               sock->flag &= ~(SOCK_HIDDEN | SOCK_UNAVAIL);
+       else
+               sock->flag |= SOCK_UNAVAIL;
+}
+
 /* clumsy checking... should do dynamic outputs once */
 static void force_hidden_passes(bNode *node, int passflag)
 {
@@ -727,68 +737,35 @@ static void force_hidden_passes(bNode *node, int passflag)
        for (sock= node->outputs.first; sock; sock= sock->next)
                sock->flag &= ~SOCK_UNAVAIL;
        
-       if (!(passflag & SCE_PASS_COMBINED)) {
-               sock= BLI_findlink(&node->outputs, RRES_OUT_IMAGE);
-               sock->flag |= SOCK_UNAVAIL;
-               sock= BLI_findlink(&node->outputs, RRES_OUT_ALPHA);
-               sock->flag |= SOCK_UNAVAIL;
-       }
-       
-       sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
-       if (!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_NORMAL);
-       if (!(passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_VEC);
-       if (!(passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_UV);
-       if (!(passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA);
-       if (!(passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF);
-       if (!(passflag & SCE_PASS_DIFFUSE)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_SPEC);
-       if (!(passflag & SCE_PASS_SPEC)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_SHADOW);
-       if (!(passflag & SCE_PASS_SHADOW)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_AO);
-       if (!(passflag & SCE_PASS_AO)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_REFLECT);
-       if (!(passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
-       if (!(passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_INDIRECT);
-       if (!(passflag & SCE_PASS_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
-       if (!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXMA);
-       if (!(passflag & SCE_PASS_INDEXMA)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
-       if (!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_EMIT);
-       if (!(passflag & SCE_PASS_EMIT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_ENV);
-       if (!(passflag & SCE_PASS_ENVIRONMENT)) sock->flag |= SOCK_UNAVAIL;
-
-       sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_DIRECT);
-       if (!(passflag & SCE_PASS_DIFFUSE_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_INDIRECT);
-       if (!(passflag & SCE_PASS_DIFFUSE_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF_COLOR);
-       if (!(passflag & SCE_PASS_DIFFUSE_COLOR)) sock->flag |= SOCK_UNAVAIL;
-
-       sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_DIRECT);
-       if (!(passflag & SCE_PASS_GLOSSY_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_INDIRECT);
-       if (!(passflag & SCE_PASS_GLOSSY_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_GLOSSY_COLOR);
-       if (!(passflag & SCE_PASS_GLOSSY_COLOR)) sock->flag |= SOCK_UNAVAIL;
-
-       sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_DIRECT);
-       if (!(passflag & SCE_PASS_TRANSM_DIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_INDIRECT);
-       if (!(passflag & SCE_PASS_TRANSM_INDIRECT)) sock->flag |= SOCK_UNAVAIL;
-       sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
-       if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
+       set_output_visible(node, passflag, RRES_OUT_IMAGE,            SCE_PASS_COMBINED);
+       set_output_visible(node, passflag, RRES_OUT_ALPHA,            SCE_PASS_COMBINED);
+       
+       set_output_visible(node, passflag, RRES_OUT_Z,                SCE_PASS_Z);
+       set_output_visible(node, passflag, RRES_OUT_NORMAL,           SCE_PASS_NORMAL);
+       set_output_visible(node, passflag, RRES_OUT_VEC,              SCE_PASS_VECTOR);
+       set_output_visible(node, passflag, RRES_OUT_UV,               SCE_PASS_UV);
+       set_output_visible(node, passflag, RRES_OUT_RGBA,             SCE_PASS_RGBA);
+       set_output_visible(node, passflag, RRES_OUT_DIFF,             SCE_PASS_DIFFUSE);
+       set_output_visible(node, passflag, RRES_OUT_SPEC,             SCE_PASS_SPEC);
+       set_output_visible(node, passflag, RRES_OUT_SHADOW,           SCE_PASS_SHADOW);
+       set_output_visible(node, passflag, RRES_OUT_AO,               SCE_PASS_AO);
+       set_output_visible(node, passflag, RRES_OUT_REFLECT,          SCE_PASS_REFLECT);
+       set_output_visible(node, passflag, RRES_OUT_REFRACT,          SCE_PASS_REFRACT);
+       set_output_visible(node, passflag, RRES_OUT_INDIRECT,         SCE_PASS_INDIRECT);
+       set_output_visible(node, passflag, RRES_OUT_INDEXOB,          SCE_PASS_INDEXOB);
+       set_output_visible(node, passflag, RRES_OUT_INDEXMA,          SCE_PASS_INDEXMA);
+       set_output_visible(node, passflag, RRES_OUT_MIST,             SCE_PASS_MIST);
+       set_output_visible(node, passflag, RRES_OUT_EMIT,             SCE_PASS_EMIT);
+       set_output_visible(node, passflag, RRES_OUT_ENV,              SCE_PASS_ENVIRONMENT);
+       set_output_visible(node, passflag, RRES_OUT_DIFF_DIRECT,      SCE_PASS_DIFFUSE_DIRECT);
+       set_output_visible(node, passflag, RRES_OUT_DIFF_INDIRECT,    SCE_PASS_DIFFUSE_INDIRECT);
+       set_output_visible(node, passflag, RRES_OUT_DIFF_COLOR,       SCE_PASS_DIFFUSE_COLOR);
+       set_output_visible(node, passflag, RRES_OUT_GLOSSY_DIRECT,    SCE_PASS_GLOSSY_DIRECT);
+       set_output_visible(node, passflag, RRES_OUT_GLOSSY_INDIRECT,  SCE_PASS_GLOSSY_INDIRECT);
+       set_output_visible(node, passflag, RRES_OUT_GLOSSY_COLOR,     SCE_PASS_GLOSSY_COLOR);
+       set_output_visible(node, passflag, RRES_OUT_TRANSM_DIRECT,    SCE_PASS_TRANSM_DIRECT);
+       set_output_visible(node, passflag, RRES_OUT_TRANSM_INDIRECT,  SCE_PASS_TRANSM_INDIRECT);
+       set_output_visible(node, passflag, RRES_OUT_TRANSM_COLOR,     SCE_PASS_TRANSM_COLOR);
 }
 
 /* based on rules, force sockets hidden always */
index 98a56c85279fd8fa885045fac2b956e42a3d9f39..0ad58d6af763d614d9d4812bfc7e8db36504cffa 100644 (file)
 
 /* **************** NORMAL  ******************** */
 static bNodeSocketTemplate sh_node_normal_in[] = {
-       {       SOCK_VECTOR, 1, N_("Normal"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
+       {       SOCK_VECTOR, 1, N_("Normal"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
        {       -1, 0, ""       }
 };
 
 static bNodeSocketTemplate sh_node_normal_out[] = {
-       {       SOCK_VECTOR, 0, N_("Normal")},
+       {       SOCK_VECTOR, 0, N_("Normal"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
        {       SOCK_FLOAT, 0, N_("Dot")},
        {       -1, 0, ""       }
 };
index 1037542759fa344e0585aaff2d9b9355ce5649be..8d885bf6d6f27ca54e9774a9c92dd19be380eb45 100644 (file)
@@ -171,6 +171,7 @@ void                WM_event_timer_sleep(struct wmWindowManager *wm, struct wmWindow *win, str
 
                /* operator api, default callbacks */
                        /* invoke callback, uses enum property named "type" */
+int                    WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int                    WM_menu_invoke                  (struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int                    WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
                        /* invoke callback, confirm menu + exec */
index c555f771a48d406a503e4e945bc7398d6061c041..8a0701b1063f523df96c474a9b16d49c2be64153 100644 (file)
@@ -87,6 +87,7 @@
 #include "ED_screen.h"
 #include "ED_util.h"
 #include "ED_object.h"
+#include "ED_view3d.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -689,6 +690,35 @@ void WM_operator_properties_free(PointerRNA *ptr)
 
 /* ************ default op callbacks, exported *********** */
 
+int WM_operator_view3d_distance_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *UNUSED(event))
+{
+       Scene *scene = CTX_data_scene(C);
+       View3D *v3d = CTX_wm_view3d(C);
+
+       const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) : ED_scene_grid_scale(scene, NULL);
+
+       /* always run, so the values are initialized,
+        * otherwise we may get differ behavior when (dia != 1.0) */
+       RNA_STRUCT_BEGIN(op->ptr, prop)
+       {
+               if (RNA_property_type(prop) == PROP_FLOAT) {
+                       PropertySubType pstype = RNA_property_subtype(prop);
+                       if (pstype == PROP_DISTANCE) {
+                               /* we don't support arrays yet */
+                               BLI_assert(RNA_property_array_check(prop) == FALSE);
+                               /* initialize */
+                               if (!RNA_property_is_set_ex(op->ptr, prop, FALSE)) {
+                                       const float value = RNA_property_float_get_default(op->ptr, prop) * dia;
+                                       RNA_property_float_set(op->ptr, prop, value);
+                               }
+                       }
+               }
+       }
+       RNA_STRUCT_END;
+
+       return op->type->exec(C, op);
+}
+
 /* invoke callback, uses enum property named "type" */
 int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {