diff options
342 files changed, 3946 insertions, 3530 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 89ee0707280..c3001b605d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -689,7 +690,7 @@ elseif(WIN32) endif() # used in many places so include globally, like OpenGL - include_directories(${PTHREADS_INC}) + blender_include_dirs(${PTHREADS_INC}) elseif(APPLE) @@ -944,7 +945,7 @@ endif() #----------------------------------------------------------------------------- # Configure OpenGL. find_package(OpenGL) -include_directories(${OPENGL_INCLUDE_DIR}) +blender_include_dirs(${OPENGL_INCLUDE_DIR}) # unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake # unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake @@ -962,6 +963,9 @@ if(WITH_OPENMP) else() set(WITH_OPENMP OFF) endif() + + mark_as_advanced(OpenMP_C_FLAGS) + mark_as_advanced(OpenMP_CXX_FLAGS) endif() #----------------------------------------------------------------------------- @@ -984,32 +988,31 @@ endif() if(CMAKE_COMPILER_IS_GNUCC) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wall) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wcast-align) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wdeclaration-after-statement) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Werror=declaration-after-statement) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Werror=implicit-function-declaration) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Werror=return-type) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Werror=strict-prototypes) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wno-char-subscripts) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wno-unknown-pragmas) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wpointer-arith) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wunused-parameter) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wwrite-strings) - - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wall) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wno-invalid-offsetof) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wno-sign-compare) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_STRICT_PROTOTYPES -Werror=strict-prototypes) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings) + + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare) elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wall) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wpointer-arith) - ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS -Wno-unknown-pragmas) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wall) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wno-invalid-offsetof) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS -Wno-sign-compare) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare) endif() diff --git a/SConstruct b/SConstruct index 12926a29cef..7b6f6f2fcf7 100644 --- a/SConstruct +++ b/SConstruct @@ -70,7 +70,7 @@ quickdebug = None ##### BEGIN SETUP ##### -B.possible_types = ['core', 'player', 'intern', 'extern'] +B.possible_types = ['core', 'player', 'player2', 'intern', 'extern'] B.binarykind = ['blender' , 'blenderplayer'] ################################## @@ -395,7 +395,7 @@ SConscript(B.root_build_dir+'/source/SConscript') # libraries to give as objects to linking phase mainlist = [] for tp in B.possible_types: - if not tp == 'player': + if (not tp == 'player') and (not tp == 'player2'): mainlist += B.create_blender_liblist(env, tp) if B.arguments.get('BF_PRIORITYLIST', '0')=='1': @@ -409,6 +409,7 @@ if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']: env.BlenderProg(B.root_build_dir, "blender", mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') if env['WITH_BF_PLAYER']: playerlist = B.create_blender_liblist(env, 'player') + playerlist += B.create_blender_liblist(env, 'player2') playerlist += B.create_blender_liblist(env, 'intern') playerlist += B.create_blender_liblist(env, 'extern') env.BlenderProg(B.root_build_dir, "blenderplayer", playerlist, thestatlibs + dobj + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') diff --git a/build_files/cmake/example_scripts/make_quiet.sh b/build_files/cmake/example_scripts/make_quiet.sh new file mode 100755 index 00000000000..9e179201541 --- /dev/null +++ b/build_files/cmake/example_scripts/make_quiet.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# filters CMake output to be more like nan-makefiles + +FILTER="^\[ *[0-9]*%] \|^Built target \|^Scanning " +make $@ | \ + sed -u -e 's/^Linking .*\//Linking /' | \ + sed -u -e 's/^.*\// /' | \ + grep --line-buffered -v "$FILTER" + +echo "Build Done" diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index ff8baa544b8..2b044e4df1f 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1,20 +1,34 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- +# $Id$ + +# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/ +# use it instead of include_directories() +macro(blender_include_dirs + includes) + + foreach(inc ${ARGV}) + get_filename_component(abs_inc ${inc} ABSOLUTE) + list(APPEND all_incs ${abs_inc}) + endforeach() + include_directories(${all_incs}) +endmacro() # only MSVC uses SOURCE_GROUP -macro(blenderlib_nolist +macro(blender_add_lib_nolist name sources includes) # message(STATUS "Configuring library ${name}") - include_directories(${includes}) + blender_include_dirs("${includes}") add_library(${name} ${sources}) # Group by location on disk source_group("Source Files" FILES CMakeLists.txt) foreach(SRC ${sources}) get_filename_component(SRC_EXT ${SRC} EXT) - if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") + if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") source_group("Header Files" FILES ${SRC}) else() source_group("Source Files" FILES ${SRC}) @@ -23,7 +37,7 @@ macro(blenderlib_nolist endmacro() # # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC) -# macro(blenderlib_nolist +# macro(blender_add_lib_nolist # name # sources # includes) @@ -33,13 +47,12 @@ endmacro() # add_library(${name} ${sources}) # endmacro() - -macro(blenderlib +macro(blender_add_lib name sources includes) - blenderlib_nolist(${name} "${sources}" "${includes}") + blender_add_lib_nolist(${name} "${sources}" "${includes}") set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name}) @@ -50,7 +63,7 @@ macro(SETUP_LIBDIRS) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif() - + link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH}) if(WITH_PYTHON) @@ -136,7 +149,7 @@ macro(setup_liblinks if(WITH_OPENAL) target_link_libraries(${target} ${OPENAL_LIBRARY}) endif() - if(WITH_FFTW3) + if(WITH_FFTW3) target_link_libraries(${target} ${FFTW3_LIB}) endif() if(WITH_JACK) @@ -147,7 +160,7 @@ macro(setup_liblinks endif() if(WITH_SAMPLERATE) target_link_libraries(${target} ${LIBSAMPLERATE_LIB}) - endif() + endif() if(WITH_SDL) target_link_libraries(${target} ${SDL_LIBRARY}) endif() @@ -212,27 +225,32 @@ macro(TEST_SSE_SUPPORT) set(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ? endif() - check_c_source_runs(" - #include <xmmintrin.h> - int main() { __m128 v = _mm_setzero_ps(); return 0; }" - SUPPORT_SSE_BUILD) - - check_c_source_runs(" - #include <emmintrin.h> - int main() { __m128d v = _mm_setzero_pd(); return 0; }" - SUPPORT_SSE2_BUILD) - # message(STATUS "Detecting SSE support") + if(NOT DEFINED ${SUPPORT_SSE_BUILD}) + check_c_source_runs(" + #include <xmmintrin.h> + int main() { __m128 v = _mm_setzero_ps(); return 0; }" + SUPPORT_SSE_BUILD) + + if(SUPPORT_SSE_BUILD) + message(STATUS "SSE Support: detected.") + else() + message(STATUS "SSE Support: missing.") + endif() + set(${SUPPORT_SSE_BUILD} ${SUPPORT_SSE_BUILD} CACHE INTERNAL "SSE Test") + endif() - if(SUPPORT_SSE_BUILD) - message(STATUS "SSE Support: detected.") - else() - message(STATUS "SSE Support: missing.") - endif() + if(NOT DEFINED ${SUPPORT_SSE2_BUILD}) + check_c_source_runs(" + #include <emmintrin.h> + int main() { __m128d v = _mm_setzero_pd(); return 0; }" + SUPPORT_SSE2_BUILD) - if(SUPPORT_SSE2_BUILD) - message(STATUS "SSE2 Support: detected.") - else() - message(STATUS "SSE2 Support: missing.") + if(SUPPORT_SSE2_BUILD) + message(STATUS "SSE2 Support: detected.") + else() + message(STATUS "SSE2 Support: missing.") + endif() + set(${SUPPORT_SSE2_BUILD} ${SUPPORT_SSE2_BUILD} CACHE INTERNAL "SSE2 Test") endif() endmacro() @@ -243,7 +261,7 @@ endmacro() # utility macro macro(_remove_strict_flags flag) - + string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") @@ -276,7 +294,7 @@ macro(remove_strict_flags) endmacro() -# XXX, until cmake fix this bug! from CheckCCompilerFlag.cmakem reported 11615 +# XXX, until cmake 2.8.4 is released. INCLUDE(CheckCSourceCompiles) MACRO (CHECK_C_COMPILER_FLAG__INTERNAL _FLAG _RESULT) SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") @@ -295,14 +313,13 @@ ENDMACRO (CHECK_C_COMPILER_FLAG__INTERNAL) macro(ADD_CHECK_C_COMPILER_FLAG _CFLAGS + _CACHE_VAR _FLAG) # include(CheckCCompilerFlag) - # odd workaround - set(CFLAG_TEST "CFLAG_TEST") - CHECK_C_COMPILER_FLAG__INTERNAL("${_FLAG}" CFLAG_TEST) - if(CFLAG_TEST) + CHECK_C_COMPILER_FLAG__INTERNAL("${_FLAG}" "${_CACHE_VAR}") + if(${_CACHE_VAR}) # message(STATUS "Using CFLAG: ${_FLAG}") set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}") else() @@ -312,14 +329,13 @@ endmacro() macro(ADD_CHECK_CXX_COMPILER_FLAG _CXXFLAGS + _CACHE_VAR _FLAG) include(CheckCXXCompilerFlag) - # odd workaround - set(CFLAG_TEST "CXXFLAG_TEST") - CHECK_CXX_COMPILER_FLAG("${_FLAG}" CXXFLAG_TEST) - if(CXXFLAG_TEST) + CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}") + if(${_CACHE_VAR}) # message(STATUS "Using CXXFLAG: ${_FLAG}") set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}") else() @@ -339,24 +355,24 @@ macro(get_blender_version) MATH(EXPR BLENDER_VERSION_MINOR "${ITEM} % 100") set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}") endif() - + if(LASTITEM MATCHES "BLENDER_SUBVERSION") set(BLENDER_SUBVERSION ${ITEM}) endif() - + if(LASTITEM MATCHES "BLENDER_MINVERSION") MATH(EXPR BLENDER_MINVERSION_MAJOR "${ITEM} / 100") MATH(EXPR BLENDER_MINVERSION_MINOR "${ITEM} % 100") set(BLENDER_MINVERSION "${BLENDER_MINVERSION_MAJOR}.${BLENDER_MINVERSION_MINOR}") endif() - + if(LASTITEM MATCHES "BLENDER_MINSUBVERSION") set(BLENDER_MINSUBVERSION ${ITEM}) endif() set(LASTITEM ${ITEM}) endforeach() - + # message(STATUS "Version major: ${BLENDER_VERSION_MAJOR}, Version minor: ${BLENDER_VERSION_MINOR}, Subversion: ${BLENDER_SUBVERSION}, Version: ${BLENDER_VERSION}") # message(STATUS "Minversion major: ${BLENDER_MINVERSION_MAJOR}, Minversion minor: ${BLENDER_MINVERSION_MINOR}, MinSubversion: ${BLENDER_MINSUBVERSION}, Minversion: ${BLENDER_MINVERSION}") endmacro() diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index be3886b9fe8..7cf286b5ac1 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -51,7 +51,6 @@ import os import inspect import bpy import rna_info -reload(rna_info) # lame, python wont give some access ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) diff --git a/extern/binreloc/CMakeLists.txt b/extern/binreloc/CMakeLists.txt index d0bba4c3cf9..e3f0b05d563 100644 --- a/extern/binreloc/CMakeLists.txt +++ b/extern/binreloc/CMakeLists.txt @@ -31,4 +31,4 @@ set(INC add_definitions(-DENABLE_BINRELOC) -blenderlib(extern_binreloc "${SRC}" "${INC}") +blender_add_lib(extern_binreloc "${SRC}" "${INC}") diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt index 278a7d46e54..5f8901a646c 100644 --- a/extern/bullet2/CMakeLists.txt +++ b/extern/bullet2/CMakeLists.txt @@ -319,4 +319,4 @@ set(SRC src/btBulletDynamicsCommon.h ) -blenderlib(extern_bullet "${SRC}" "${INC}") +blender_add_lib(extern_bullet "${SRC}" "${INC}") diff --git a/extern/bullet2/src/BulletCollision/CMakeLists.txt b/extern/bullet2/src/BulletCollision/CMakeLists.txt deleted file mode 100644 index c3c0224c8a3..00000000000 --- a/extern/bullet2/src/BulletCollision/CMakeLists.txt +++ /dev/null @@ -1,234 +0,0 @@ -include_directories( ${BULLET_PHYSICS_SOURCE_DIR}/src } ) - -set(BulletCollision_SRCS - BroadphaseCollision/btAxisSweep3.cpp - BroadphaseCollision/btBroadphaseProxy.cpp - BroadphaseCollision/btCollisionAlgorithm.cpp - BroadphaseCollision/btDispatcher.cpp - BroadphaseCollision/btDbvtBroadphase.cpp - BroadphaseCollision/btDbvt.cpp - BroadphaseCollision/btMultiSapBroadphase.cpp - BroadphaseCollision/btOverlappingPairCache.cpp - BroadphaseCollision/btQuantizedBvh.cpp - BroadphaseCollision/btSimpleBroadphase.cpp - CollisionDispatch/btActivatingCollisionAlgorithm.cpp - CollisionDispatch/btCollisionDispatcher.cpp - CollisionDispatch/btCollisionObject.cpp - CollisionDispatch/btCollisionWorld.cpp - CollisionDispatch/btCompoundCollisionAlgorithm.cpp - CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp - CollisionDispatch/btDefaultCollisionConfiguration.cpp - CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp - CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp - CollisionDispatch/btBoxBoxDetector.cpp - CollisionDispatch/btGhostObject.cpp - CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp - CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp - CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp - CollisionDispatch/btConvexConvexAlgorithm.cpp - CollisionDispatch/btEmptyCollisionAlgorithm.cpp - CollisionDispatch/btManifoldResult.cpp - CollisionDispatch/btSimulationIslandManager.cpp - CollisionDispatch/btUnionFind.cpp - CollisionDispatch/SphereTriangleDetector.cpp - CollisionShapes/btBoxShape.cpp - CollisionShapes/btBvhTriangleMeshShape.cpp - CollisionShapes/btCapsuleShape.cpp - CollisionShapes/btCollisionShape.cpp - CollisionShapes/btCompoundShape.cpp - CollisionShapes/btConcaveShape.cpp - CollisionShapes/btConeShape.cpp - CollisionShapes/btConvexHullShape.cpp - CollisionShapes/btConvexPointCloudShape.cpp - CollisionShapes/btConvexShape.cpp - CollisionShapes/btConvexInternalShape.cpp - CollisionShapes/btConvexTriangleMeshShape.cpp - CollisionShapes/btCylinderShape.cpp - CollisionShapes/btEmptyShape.cpp - CollisionShapes/btHeightfieldTerrainShape.cpp - CollisionShapes/btMinkowskiSumShape.cpp - CollisionShapes/btMultimaterialTriangleMeshShape.cpp - CollisionShapes/btMultiSphereShape.cpp - CollisionShapes/btOptimizedBvh.cpp - CollisionShapes/btPolyhedralConvexShape.cpp - CollisionShapes/btScaledBvhTriangleMeshShape.cpp - CollisionShapes/btTetrahedronShape.cpp - CollisionShapes/btSphereShape.cpp - CollisionShapes/btShapeHull.cpp - CollisionShapes/btStaticPlaneShape.cpp - CollisionShapes/btStridingMeshInterface.cpp - CollisionShapes/btTriangleCallback.cpp - CollisionShapes/btTriangleBuffer.cpp - CollisionShapes/btTriangleIndexVertexArray.cpp - CollisionShapes/btTriangleIndexVertexMaterialArray.cpp - CollisionShapes/btTriangleMesh.cpp - CollisionShapes/btTriangleMeshShape.cpp - CollisionShapes/btUniformScalingShape.cpp - Gimpact/btContactProcessing.cpp - Gimpact/btGImpactShape.cpp - Gimpact/gim_contact.cpp - Gimpact/btGImpactBvh.cpp - Gimpact/btGenericPoolAllocator.cpp - Gimpact/gim_memory.cpp - Gimpact/btGImpactCollisionAlgorithm.cpp - Gimpact/btTriangleShapeEx.cpp - Gimpact/gim_tri_collision.cpp - Gimpact/btGImpactQuantizedBvh.cpp - Gimpact/gim_box_set.cpp - NarrowPhaseCollision/btContinuousConvexCollision.cpp - NarrowPhaseCollision/btGjkEpa2.cpp - NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp - NarrowPhaseCollision/btConvexCast.cpp - NarrowPhaseCollision/btGjkConvexCast.cpp - NarrowPhaseCollision/btGjkPairDetector.cpp - NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp - NarrowPhaseCollision/btPersistentManifold.cpp - NarrowPhaseCollision/btRaycastCallback.cpp - NarrowPhaseCollision/btSubSimplexConvexCast.cpp - NarrowPhaseCollision/btVoronoiSimplexSolver.cpp -) - -set(Root_HDRS - ../btBulletCollisionCommon.h -) -set(BroadphaseCollision_HDRS - BroadphaseCollision/btAxisSweep3.h - BroadphaseCollision/btBroadphaseInterface.h - BroadphaseCollision/btBroadphaseProxy.h - BroadphaseCollision/btCollisionAlgorithm.h - BroadphaseCollision/btDispatcher.h - BroadphaseCollision/btDbvtBroadphase.h - BroadphaseCollision/btDbvt.h - BroadphaseCollision/btMultiSapBroadphase.h - BroadphaseCollision/btOverlappingPairCache.h - BroadphaseCollision/btOverlappingPairCallback.h - BroadphaseCollision/btQuantizedBvh.h - BroadphaseCollision/btSimpleBroadphase.h -) -set(CollisionDispatch_HDRS - CollisionDispatch/btActivatingCollisionAlgorithm.h - CollisionDispatch/btCollisionConfiguration.h - CollisionDispatch/btCollisionCreateFunc.h - CollisionDispatch/btCollisionDispatcher.h - CollisionDispatch/btCollisionObject.h - CollisionDispatch/btCollisionWorld.h - CollisionDispatch/btCompoundCollisionAlgorithm.h - CollisionDispatch/btConvexConcaveCollisionAlgorithm.h - CollisionDispatch/btDefaultCollisionConfiguration.h - CollisionDispatch/btSphereSphereCollisionAlgorithm.h - CollisionDispatch/btBoxBoxCollisionAlgorithm.h - CollisionDispatch/btBoxBoxDetector.h - CollisionDispatch/btGhostObject.h - CollisionDispatch/btSphereBoxCollisionAlgorithm.h - CollisionDispatch/btConvexPlaneCollisionAlgorithm.h - CollisionDispatch/btSphereTriangleCollisionAlgorithm.h - CollisionDispatch/btConvexConvexAlgorithm.h - CollisionDispatch/btEmptyCollisionAlgorithm.h - CollisionDispatch/btManifoldResult.h - CollisionDispatch/btSimulationIslandManager.h - CollisionDispatch/btUnionFind.h - CollisionDispatch/SphereTriangleDetector.h -) -set(CollisionShapes_HDRS - CollisionShapes/btBoxShape.h - CollisionShapes/btBvhTriangleMeshShape.h - CollisionShapes/btCapsuleShape.h - CollisionShapes/btCollisionMargin - CollisionShapes/btCollisionShape.h - CollisionShapes/btCompoundShape.h - CollisionShapes/btConcaveShape.h - CollisionShapes/btConeShape.h - CollisionShapes/btConvexHullShape.h - CollisionShapes/btConvexPointCloudShape.h - CollisionShapes/btConvexShape.h - CollisionShapes/btConvexInternalShape.h - CollisionShapes/btConvexTriangleMeshShape.h - CollisionShapes/btCylinderShape.h - CollisionShapes/btEmptyShape.h - CollisionShapes/btHeightfieldTerrainShape.h - CollisionShapes/btMinkowskiSumShape.h - CollisionShapes/btMaterial.h - CollisionShapes/btMultimaterialTriangleMeshShape.h - CollisionShapes/btMultiSphereShape.h - CollisionShapes/btOptimizedBvh.h - CollisionShapes/btPolyhedralConvexShape.h - CollisionShapes/btScaledBvhTriangleMeshShape.h - CollisionShapes/btTetrahedronShape.h - CollisionShapes/btSphereShape.h - CollisionShapes/btShapeHull.h - CollisionShapes/btStaticPlaneShape.h - CollisionShapes/btStridingMeshInterface.h - CollisionShapes/btTriangleCallback.h - CollisionShapes/btTriangleBuffer.h - CollisionShapes/btTriangleIndexVertexArray.h - CollisionShapes/btTriangleIndexVertexMaterialArray.h - CollisionShapes/btTriangleMesh.h - CollisionShapes/btTriangleMeshShape.h - CollisionShapes/btUniformScalingShape.h -) -set(Gimpact_HDRS - Gimpact/btGImpactShape.h - Gimpact/gim_contact.h - Gimpact/btGImpactBvh.h - Gimpact/btGenericPoolAllocator.h - Gimpact/gim_memory.h - Gimpact/btGImpactCollisionAlgorithm.h - Gimpact/btTriangleShapeEx.h - Gimpact/gim_tri_collision.h - Gimpact/btGImpactQuantizedBvh.h - Gimpact/gim_box_set.h -) -set(NarrowPhaseCollision_HDRS - NarrowPhaseCollision/btContinuousConvexCollision.h - NarrowPhaseCollision/btConvexCast.h - NarrowPhaseCollision/btConvexPenetrationDepthSolver.h - NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h - NarrowPhaseCollision/btGjkConvexCast.h - NarrowPhaseCollision/btGjkEpa2.h - NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h - NarrowPhaseCollision/btGjkPairDetector.h - NarrowPhaseCollision/btManifoldPoint.h - NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h - NarrowPhaseCollision/btPersistentManifold.h - NarrowPhaseCollision/btPointCollector.h - NarrowPhaseCollision/btRaycastCallback.h - NarrowPhaseCollision/btSimplexSolverInterface.h - NarrowPhaseCollision/btSubSimplexConvexCast.h - NarrowPhaseCollision/btVoronoiSimplexSolver.h -) - -set(BulletCollision_HDRS - ${Root_HDRS} - ${BroadphaseCollision_HDRS} - ${CollisionDispatch_HDRS} - ${CollisionShapes_HDRS} - ${Gimpact_HDRS} - ${NarrowPhaseCollision_HDRS} -) - - -add_library(BulletCollision ${BulletCollision_SRCS} ${BulletCollision_HDRS}) -SET_TARGET_PROPERTIES(BulletCollision PROPERTIES VERSION ${BULLET_VERSION}) -SET_TARGET_PROPERTIES(BulletCollision PROPERTIES SOVERSION ${BULLET_VERSION}) -if(BUILD_SHARED_LIBS) - target_link_libraries(BulletCollision LinearMath) -endif() - -#INSTALL of other files requires CMake 2.6 -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - install(TARGETS BulletCollision DESTINATION lib) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h") -endif() - -if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) - SET_TARGET_PROPERTIES(BulletCollision PROPERTIES FRAMEWORK true) - - SET_TARGET_PROPERTIES(BulletCollision PROPERTIES PUBLIC_HEADER "${Root_HDRS}") - # Have to list out sub-directories manually: - set_property(SOURCE ${BroadphaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/BroadphaseCollision) - set_property(SOURCE ${CollisionDispatch_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionDispatch) - set_property(SOURCE ${CollisionShapes_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/CollisionShapes) - set_property(SOURCE ${Gimpact_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Gimpact) - set_property(SOURCE ${NarrowPhaseCollision_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/NarrowPhaseCollision) - -endif() diff --git a/extern/bullet2/src/BulletDynamics/CMakeLists.txt b/extern/bullet2/src/BulletDynamics/CMakeLists.txt deleted file mode 100644 index f605e6272f3..00000000000 --- a/extern/bullet2/src/BulletDynamics/CMakeLists.txt +++ /dev/null @@ -1,93 +0,0 @@ -include_directories( ${BULLET_PHYSICS_SOURCE_DIR}/src } ) - -set(BulletDynamics_SRCS - ConstraintSolver/btContactConstraint.cpp - ConstraintSolver/btConeTwistConstraint.cpp - ConstraintSolver/btGeneric6DofConstraint.cpp - ConstraintSolver/btHingeConstraint.cpp - ConstraintSolver/btPoint2PointConstraint.cpp - ConstraintSolver/btSequentialImpulseConstraintSolver.cpp - ConstraintSolver/btSliderConstraint.cpp - ConstraintSolver/btSolve2LinearConstraint.cpp - ConstraintSolver/btTypedConstraint.cpp - Dynamics/Bullet-C-API.cpp - Dynamics/btDiscreteDynamicsWorld.cpp - Dynamics/btSimpleDynamicsWorld.cpp - Dynamics/btRigidBody.cpp - Vehicle/btRaycastVehicle.cpp - Vehicle/btWheelInfo.cpp - Character/btKinematicCharacterController.cpp -) - -set(Root_HDRS - ../btBulletDynamicsCommon.h - ../btBulletCollisionCommon.h -) -set(ConstraintSolver_HDRS - ConstraintSolver/btConstraintSolver.h - ConstraintSolver/btContactConstraint.h - ConstraintSolver/btContactSolverInfo.h - ConstraintSolver/btConeTwistConstraint.h - ConstraintSolver/btGeneric6DofConstraint.h - ConstraintSolver/btHingeConstraint.h - ConstraintSolver/btJacobianEntry.h - ConstraintSolver/btPoint2PointConstraint.h - ConstraintSolver/btSequentialImpulseConstraintSolver.h - ConstraintSolver/btSliderConstraint.h - ConstraintSolver/btSolve2LinearConstraint.h - ConstraintSolver/btSolverBody.h - ConstraintSolver/btSolverConstraint.h - ConstraintSolver/btTypedConstraint.h -) -set(Dynamics_HDRS - Dynamics/btContinuousDynamicsWorld.h - Dynamics/btDiscreteDynamicsWorld.h - Dynamics/btDynamicsWorld.h - Dynamics/btSimpleDynamicsWorld.h - Dynamics/btRigidBody.h -) -set(Vehicle_HDRS - Vehicle/btRaycastVehicle.h - Vehicle/btVehicleRaycaster.h - Vehicle/btWheelInfo.h -) - -set(Character_HDRS - Character/btCharacterControllerInterface.h - Character/btKinematicCharacterController.h -) - - - -set(BulletDynamics_HDRS - ${Root_HDRS} - ${ConstraintSolver_HDRS} - ${Dynamics_HDRS} - ${Vehicle_HDRS} - ${Character_HDRS} -) - - -add_library(BulletDynamics ${BulletDynamics_SRCS} ${BulletDynamics_HDRS}) -SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES VERSION ${BULLET_VERSION}) -SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES SOVERSION ${BULLET_VERSION}) -if(BUILD_SHARED_LIBS) - target_link_libraries(BulletDynamics BulletCollision LinearMath) -endif() - -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - install(TARGETS BulletDynamics DESTINATION lib) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h") -endif() - -if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) - SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES FRAMEWORK true) - - SET_TARGET_PROPERTIES(BulletDynamics PROPERTIES PUBLIC_HEADER "${Root_HDRS}") - # Have to list out sub-directories manually: - set_property(SOURCE ${ConstraintSolver_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/ConstraintSolver) - set_property(SOURCE ${Dynamics_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Dynamics) - set_property(SOURCE ${Vehicle_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Vehicle) - set_property(SOURCE ${Character_HDRS} PROPERTY MACOSX_PACKAGE_LOCATION Headers/Character) - -endif() diff --git a/extern/bullet2/src/BulletSoftBody/CMakeLists.txt b/extern/bullet2/src/BulletSoftBody/CMakeLists.txt deleted file mode 100644 index 16fc86f4c56..00000000000 --- a/extern/bullet2/src/BulletSoftBody/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ - -include_directories( -${BULLET_PHYSICS_SOURCE_DIR}/src } -) - -set(BulletSoftBody_SRCS - btSoftBody.cpp - btSoftBodyHelpers.cpp - btSoftBodyRigidBodyCollisionConfiguration.cpp - btSoftRigidCollisionAlgorithm.cpp - btSoftSoftCollisionAlgorithm.cpp - btSoftBodyConcaveCollisionAlgorithm.cpp - btSoftRigidDynamicsWorld.cpp -) - -set(BulletSoftBody_HDRS - btSoftBody.h - btSparseSDF.h - btSoftBodyHelpers.h - btSoftRigidCollisionAlgorithm.h - btSoftSoftCollisionAlgorithm.h - btSoftBodyConcaveCollisionAlgorithm.h - btSoftRigidDynamicsWorld.h -) - - - -add_library(BulletSoftBody ${BulletSoftBody_SRCS} ${BulletSoftBody_HDRS}) -SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES VERSION ${BULLET_VERSION}) -SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES SOVERSION ${BULLET_VERSION}) -if(BUILD_SHARED_LIBS) - target_link_libraries(BulletSoftBody BulletDynamics) -endif() - -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - install(TARGETS BulletSoftBody DESTINATION lib) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h") -endif() - -if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) - SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES FRAMEWORK true) - SET_TARGET_PROPERTIES(BulletSoftBody PROPERTIES PUBLIC_HEADER "${BulletSoftBody_HDRS}") -endif() diff --git a/extern/bullet2/src/CMakeLists.txt b/extern/bullet2/src/CMakeLists.txt deleted file mode 100644 index 6c9b6b0127b..00000000000 --- a/extern/bullet2/src/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_subdirectory(BulletCollision) -add_subdirectory(BulletDynamics) -add_subdirectory(LinearMath) -add_subdirectory(BulletSoftBody ) diff --git a/extern/bullet2/src/LinearMath/CMakeLists.txt b/extern/bullet2/src/LinearMath/CMakeLists.txt deleted file mode 100644 index acd3dbc406d..00000000000 --- a/extern/bullet2/src/LinearMath/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ - -include_directories( -${BULLET_PHYSICS_SOURCE_DIR}/src } -) - -set(LinearMath_SRCS - btConvexHull.cpp - btQuickprof.cpp - btGeometryUtil.cpp - btAlignedAllocator.cpp -) - -set(LinearMath_HDRS - btAlignedObjectArray.h - btList.h - btPoolAllocator.h - btRandom.h - btVector3.h - btDefaultMotionState.h - btMatrix3x3.h - btQuadWord.h - btHashMap.h - btScalar.h - btAabbUtil2.h - btConvexHull.h - btMinMax.h - btQuaternion.h - btStackAlloc.h - btGeometryUtil.h - btMotionState.h - btTransform.h - btAlignedAllocator.h - btIDebugDraw.h - btQuickprof.h - btTransformUtil.h -) - -add_library(LinearMath ${LinearMath_SRCS} ${LinearMath_HDRS}) -SET_TARGET_PROPERTIES(LinearMath PROPERTIES VERSION ${BULLET_VERSION}) -SET_TARGET_PROPERTIES(LinearMath PROPERTIES SOVERSION ${BULLET_VERSION}) - -#FILES_MATCHING requires CMake 2.6 -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - install(TARGETS LinearMath DESTINATION lib) - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.h") -endif() - -if(APPLE AND BUILD_SHARED_LIBS AND FRAMEWORK) - SET_TARGET_PROPERTIES(LinearMath PROPERTIES FRAMEWORK true) - SET_TARGET_PROPERTIES(LinearMath PROPERTIES PUBLIC_HEADER "${LinearMath_HDRS}") -endif() diff --git a/extern/glew/CMakeLists.txt b/extern/glew/CMakeLists.txt index 82778fd13fb..1a20dbdb9d7 100644 --- a/extern/glew/CMakeLists.txt +++ b/extern/glew/CMakeLists.txt @@ -42,4 +42,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blenderlib(extern_glew "${SRC}" "${INC}") +blender_add_lib(extern_glew "${SRC}" "${INC}") diff --git a/extern/libopenjpeg/CMakeLists.txt b/extern/libopenjpeg/CMakeLists.txt index f52c48264b6..c5ba1363246 100644 --- a/extern/libopenjpeg/CMakeLists.txt +++ b/extern/libopenjpeg/CMakeLists.txt @@ -73,4 +73,4 @@ set(SRC tgt.h ) -blenderlib(extern_openjpeg "${SRC}" "${INC}") +blender_add_lib(extern_openjpeg "${SRC}" "${INC}") diff --git a/extern/libredcode/CMakeLists.txt b/extern/libredcode/CMakeLists.txt index 269de031f90..20ad6ae9f7d 100644 --- a/extern/libredcode/CMakeLists.txt +++ b/extern/libredcode/CMakeLists.txt @@ -39,4 +39,4 @@ set(SRC format.h ) -blenderlib(extern_redcode "${SRC}" "${INC}") +blender_add_lib(extern_redcode "${SRC}" "${INC}") diff --git a/extern/lzma/CMakeLists.txt b/extern/lzma/CMakeLists.txt index 8a4cf166b2d..710165d2496 100644 --- a/extern/lzma/CMakeLists.txt +++ b/extern/lzma/CMakeLists.txt @@ -44,4 +44,4 @@ set(SRC Types.h ) -blenderlib(extern_lzma "${SRC}" "${INC}") +blender_add_lib(extern_lzma "${SRC}" "${INC}") diff --git a/extern/lzo/CMakeLists.txt b/extern/lzo/CMakeLists.txt index 3c68d64d181..17728aad43e 100644 --- a/extern/lzo/CMakeLists.txt +++ b/extern/lzo/CMakeLists.txt @@ -36,4 +36,4 @@ set(SRC minilzo/minilzo.h ) -blenderlib(extern_minilzo "${SRC}" "${INC}") +blender_add_lib(extern_minilzo "${SRC}" "${INC}") diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 1805e7ed494..5748b7b03d9 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -252,4 +252,4 @@ set(SRC ${PYTHONSRC} ) -blenderlib(bf_intern_audaspace "${SRC}" "${INC}") +blender_add_lib(bf_intern_audaspace "${SRC}" "${INC}") diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp index a87a4ad5eef..5df7ec4fb0c 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp @@ -128,13 +128,15 @@ void AUD_OpenALDevice::updateStreams() ALint info; AUD_DeviceSpecs specs = m_specs; + ALCenum cerr; while(1) { lock(); alcSuspendContext(m_context); - + cerr = alcGetError(m_device); + if(cerr == ALC_NO_ERROR) { // for all sounds for(AUD_HandleIterator it = m_playingSounds->begin(); it != m_playingSounds->end(); it++) @@ -253,12 +255,12 @@ void AUD_OpenALDevice::updateStreams() alSourcePlay(sound->source); } } - } - alcProcessContext(m_context); + alcProcessContext(m_context); + } // stop thread - if(m_playingSounds->empty()) + if(m_playingSounds->empty() || (cerr != ALC_NO_ERROR)) { unlock(); m_playing = false; diff --git a/intern/audaspace/jack/AUD_JackDevice.cpp b/intern/audaspace/jack/AUD_JackDevice.cpp index 5aa3f7b3fc1..0d72e85c351 100644 --- a/intern/audaspace/jack/AUD_JackDevice.cpp +++ b/intern/audaspace/jack/AUD_JackDevice.cpp @@ -236,9 +236,9 @@ AUD_JackDevice::AUD_JackDevice(std::string name, AUD_DeviceSpecs specs, int buff create(); m_valid = true; - m_playing = false; m_sync = 0; m_syncFunc = NULL; + m_nextState = m_state = jack_transport_query(m_client, NULL); pthread_mutex_init(&m_mixingLock, NULL); pthread_cond_init(&m_mixingCondition, NULL); @@ -307,11 +307,13 @@ void AUD_JackDevice::playing(bool playing) void AUD_JackDevice::startPlayback() { jack_transport_start(m_client); + m_nextState = JackTransportRolling; } void AUD_JackDevice::stopPlayback() { jack_transport_stop(m_client); + m_nextState = JackTransportStopped; } void AUD_JackDevice::seekPlayback(float time) @@ -335,5 +337,10 @@ float AUD_JackDevice::getPlaybackPosition() bool AUD_JackDevice::doesPlayback() { - return jack_transport_query(m_client, NULL) != JackTransportStopped; + jack_transport_state_t state = jack_transport_query(m_client, NULL); + + if(state != m_state) + m_nextState = m_state = state; + + return m_nextState != JackTransportStopped; } diff --git a/intern/audaspace/jack/AUD_JackDevice.h b/intern/audaspace/jack/AUD_JackDevice.h index 418992e0db1..cc3cf7d6598 100644 --- a/intern/audaspace/jack/AUD_JackDevice.h +++ b/intern/audaspace/jack/AUD_JackDevice.h @@ -87,9 +87,14 @@ private: static int jack_sync(jack_transport_state_t state, jack_position_t* pos, void* data); /** - * Last Jack Transport playing state. + * Next Jack Transport state (-1 if not expected to change). */ - bool m_playing; + jack_transport_state_t m_nextState; + + /** + * Current jack transport status. + */ + jack_transport_state_t m_state; /** * Syncronisation state. diff --git a/intern/boolop/CMakeLists.txt b/intern/boolop/CMakeLists.txt index dcc152531c4..7e36f255268 100644 --- a/intern/boolop/CMakeLists.txt +++ b/intern/boolop/CMakeLists.txt @@ -75,4 +75,4 @@ set(SRC intern/BOP_Vertex.h ) -blenderlib(bf_intern_bop "${SRC}" "${INC}") +blender_add_lib(bf_intern_bop "${SRC}" "${INC}") diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt index 82abcf86a34..2e615314543 100644 --- a/intern/bsp/CMakeLists.txt +++ b/intern/bsp/CMakeLists.txt @@ -43,4 +43,4 @@ set(SRC intern/BSP_MeshPrimitives.h ) -blenderlib(bf_intern_bsp "${SRC}" "${INC}") +blender_add_lib(bf_intern_bsp "${SRC}" "${INC}") diff --git a/intern/container/CMakeLists.txt b/intern/container/CMakeLists.txt index e603e2701eb..7f15854e538 100644 --- a/intern/container/CMakeLists.txt +++ b/intern/container/CMakeLists.txt @@ -38,4 +38,4 @@ set(SRC CTR_UHeap.h ) -blenderlib(bf_intern_ctr "${SRC}" "${INC}") +blender_add_lib(bf_intern_ctr "${SRC}" "${INC}") diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt index 14998415031..b726a8cd6a1 100644 --- a/intern/decimation/CMakeLists.txt +++ b/intern/decimation/CMakeLists.txt @@ -56,4 +56,4 @@ set(SRC intern/LOD_QuadricEditor.h ) -blenderlib(bf_intern_decimate "${SRC}" "${INC}") +blender_add_lib(bf_intern_decimate "${SRC}" "${INC}") diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt index 8d6f3fa0a9f..44a4eb1f278 100644 --- a/intern/elbeem/CMakeLists.txt +++ b/intern/elbeem/CMakeLists.txt @@ -95,4 +95,4 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -blenderlib_nolist(bf_intern_elbeem "${SRC}" "${INC}") +blender_add_lib_nolist(bf_intern_elbeem "${SRC}" "${INC}") diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index 509741092c5..7a147097cc7 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -144,5 +144,5 @@ elseif(WIN32) ) endif() -blenderlib(bf_intern_ghost "${SRC}" "${INC}") +blender_add_lib(bf_intern_ghost "${SRC}" "${INC}") diff --git a/intern/guardedalloc/CMakeLists.txt b/intern/guardedalloc/CMakeLists.txt index 4ae0b17575b..eb101eee102 100644 --- a/intern/guardedalloc/CMakeLists.txt +++ b/intern/guardedalloc/CMakeLists.txt @@ -41,12 +41,12 @@ if(WIN32 AND NOT UNIX) ) endif() -blenderlib(bf_intern_guardedalloc "${SRC}" "${INC}") +blender_add_lib(bf_intern_guardedalloc "${SRC}" "${INC}") # Override C++ alloc, optional. if(WITH_CXX_GUARDEDALLOC) set(SRC cpp/mallocn.cpp ) - blenderlib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}") + blender_add_lib(bf_intern_guardedalloc_cpp "${SRC}" "${INC}") endif() diff --git a/intern/iksolver/CMakeLists.txt b/intern/iksolver/CMakeLists.txt index e2cd389e849..46be310b7ec 100644 --- a/intern/iksolver/CMakeLists.txt +++ b/intern/iksolver/CMakeLists.txt @@ -70,4 +70,4 @@ set(SRC intern/TNT/version.h ) -blenderlib(bf_intern_ik "${SRC}" "${INC}") +blender_add_lib(bf_intern_ik "${SRC}" "${INC}") diff --git a/intern/itasc/CMakeLists.txt b/intern/itasc/CMakeLists.txt index 3a42cd4a64f..a0489c48144 100644 --- a/intern/itasc/CMakeLists.txt +++ b/intern/itasc/CMakeLists.txt @@ -222,4 +222,4 @@ set(SRC ../../extern/Eigen2/Eigen/src/Sparse/UmfPackSupport.h ) -blenderlib(bf_intern_itasc "${SRC}" "${INC}") +blender_add_lib(bf_intern_itasc "${SRC}" "${INC}") diff --git a/intern/memutil/CMakeLists.txt b/intern/memutil/CMakeLists.txt index 03b9192f71a..aecd3d5b6c9 100644 --- a/intern/memutil/CMakeLists.txt +++ b/intern/memutil/CMakeLists.txt @@ -43,4 +43,4 @@ set(SRC MEM_SmartPtr.h ) -blenderlib(bf_intern_memutil "${SRC}" "${INC}") +blender_add_lib(bf_intern_memutil "${SRC}" "${INC}") diff --git a/intern/moto/CMakeLists.txt b/intern/moto/CMakeLists.txt index 54d59e4e32d..b9fd8986268 100644 --- a/intern/moto/CMakeLists.txt +++ b/intern/moto/CMakeLists.txt @@ -67,4 +67,4 @@ set(SRC include/NM_Scalar.h ) -blenderlib(bf_intern_moto "${SRC}" "${INC}") +blender_add_lib(bf_intern_moto "${SRC}" "${INC}") diff --git a/intern/opennl/CMakeLists.txt b/intern/opennl/CMakeLists.txt index b7253a241fe..f200e24fff1 100644 --- a/intern/opennl/CMakeLists.txt +++ b/intern/opennl/CMakeLists.txt @@ -75,4 +75,4 @@ set(SRC superlu/util.h ) -blenderlib(bf_intern_opennl "${SRC}" "${INC}") +blender_add_lib(bf_intern_opennl "${SRC}" "${INC}") diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt index 3505cd2c05d..ec4f0d4ca6d 100644 --- a/intern/smoke/CMakeLists.txt +++ b/intern/smoke/CMakeLists.txt @@ -89,5 +89,5 @@ if(WITH_FFTW3) list(APPEND INC ${FFTW3_INC}) endif() -blenderlib(bf_intern_smoke "${SRC}" "${INC}") +blender_add_lib(bf_intern_smoke "${SRC}" "${INC}") diff --git a/intern/string/CMakeLists.txt b/intern/string/CMakeLists.txt index 5aef036e55a..60796185e70 100644 --- a/intern/string/CMakeLists.txt +++ b/intern/string/CMakeLists.txt @@ -35,4 +35,4 @@ set(SRC STR_String.h ) -blenderlib(bf_intern_string "${SRC}" "${INC}") +blender_add_lib(bf_intern_string "${SRC}" "${INC}") diff --git a/release/scripts/io/netrender/__init__.py b/release/scripts/io/netrender/__init__.py index 2ee57708fe0..2fc9e78c097 100644 --- a/release/scripts/io/netrender/__init__.py +++ b/release/scripts/io/netrender/__init__.py @@ -20,17 +20,18 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "init_data" in locals(): - reload(model) - reload(operators) - reload(client) - reload(slave) - reload(master) - reload(master_html) - reload(utils) - reload(balancing) - reload(ui) - reload(repath) - reload(versioning) + import imp + imp.reload(model) + imp.reload(operators) + imp.reload(client) + imp.reload(slave) + imp.reload(master) + imp.reload(master_html) + imp.reload(utils) + imp.reload(balancing) + imp.reload(ui) + imp.reload(repath) + imp.reload(versioning) else: from netrender import model from netrender import operators diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 624f111d85f..e979c75f95e 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -140,6 +140,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): traceback.print_exc() def test_reload(mod): + import imp # reloading this causes internal errors # because the classes from this module are stored internally # possibly to refresh internal references too but for now, best not to. @@ -147,7 +148,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): return mod try: - return reload(mod) + return imp.reload(mod) except: traceback.print_exc() @@ -365,6 +366,7 @@ def addon_enable(module_name, default_set=True): import os import sys import bpy_types as _bpy_types + import imp _bpy_types._register_immediate = False @@ -385,7 +387,7 @@ def addon_enable(module_name, default_set=True): print("module changed on disk:", mod.__file__, "reloading...") try: - reload(mod) + imp.reload(mod) except: handle_error() del sys.modules[module_name] @@ -477,7 +479,8 @@ def addon_reset_all(reload_scripts=False): """ Sets the addon state based on the user preferences. """ - + import imp + # RELEASE SCRIPTS: official scripts distributed in Blender releases paths = script_paths("addons") @@ -496,7 +499,7 @@ def addon_reset_all(reload_scripts=False): if reload_scripts: mod = _sys.modules.get(mod_name) if mod: - reload(mod) + imp.reload(mod) if is_enabled == is_loaded: pass @@ -560,7 +563,7 @@ def keyconfig_set(filepath): keyconfigs.active = kc_new -def user_resource(type, path, create=False): +def user_resource(type, path="", create=False): """ Return a user resource path (normally from the users home directory). @@ -588,7 +591,7 @@ def user_resource(type, path, create=False): traceback.print_exc() target_path = "" elif not _os.path.isdir(target_path): - print("Path %r found but isn't a directory!" % path) + print("Path %r found but isn't a directory!" % target_path) target_path = "" return target_path diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 7c77a01d646..2e3f9af8d1b 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -60,7 +60,11 @@ def rna_idprop_ui_prop_clear(item, prop): def rna_idprop_context_value(context, context_member, property_type): space = context.space_data - pin_id = space.pin_id + + if space is None or isinstance(space, bpy.types.SpaceProperties): + pin_id = space.pin_id + else: + pin_id = None if pin_id and isinstance(pin_id, property_type): rna_item = pin_id diff --git a/release/scripts/op/animsys_update.py b/release/scripts/op/animsys_update.py index 41ad65b1d71..24a56c7a1e1 100644 --- a/release/scripts/op/animsys_update.py +++ b/release/scripts/op/animsys_update.py @@ -692,7 +692,6 @@ class UpdateAnimData(bpy.types.Operator): def execute(self, context): import animsys_refactor - reload(animsys_refactor) animsys_refactor.update_data_paths(data_path_update) return {'FINISHED'} diff --git a/release/scripts/op/io_anim_bvh/__init__.py b/release/scripts/op/io_anim_bvh/__init__.py index d32fdfad0ce..ec56f76b11f 100644 --- a/release/scripts/op/io_anim_bvh/__init__.py +++ b/release/scripts/op/io_anim_bvh/__init__.py @@ -20,9 +20,9 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "import_bvh" in locals(): - reload(import_bvh) + imp.reload(import_bvh) import bpy diff --git a/release/scripts/op/io_mesh_ply/__init__.py b/release/scripts/op/io_mesh_ply/__init__.py index 73ac15167ae..b7004be98c2 100644 --- a/release/scripts/op/io_mesh_ply/__init__.py +++ b/release/scripts/op/io_mesh_ply/__init__.py @@ -18,9 +18,9 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "export_ply" in locals(): - reload(export_ply) + imp.reload(export_ply) import bpy diff --git a/release/scripts/op/io_mesh_ply/export_ply.py b/release/scripts/op/io_mesh_ply/export_ply.py index 08369a46c84..e08f0105a44 100644 --- a/release/scripts/op/io_mesh_ply/export_ply.py +++ b/release/scripts/op/io_mesh_ply/export_ply.py @@ -113,7 +113,7 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/ if vertexColors: col = active_col_layer[i] - col = col.color1, col.color2, col.color3, col.color4 + col = col.color1[:], col.color2[:], col.color3[:], col.color4[:] f_verts = f.vertices @@ -176,7 +176,7 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u file.write('end_header\n') for i, v in enumerate(ply_verts): - file.write('%.6f %.6f %.6f ' % tuple(mesh_verts[v[0]].co)) # co + file.write('%.6f %.6f %.6f ' % mesh_verts[v[0]].co[:]) # co if use_normals: file.write('%.6f %.6f %.6f ' % v[1]) # no if use_uv_coords: diff --git a/release/scripts/op/io_scene_3ds/__init__.py b/release/scripts/op/io_scene_3ds/__init__.py index da5807b5c4a..51cec065ac0 100644 --- a/release/scripts/op/io_scene_3ds/__init__.py +++ b/release/scripts/op/io_scene_3ds/__init__.py @@ -20,11 +20,11 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "import_3ds" in locals(): - reload(import_3ds) + imp.reload(import_3ds) if "export_3ds" in locals(): - reload(export_3ds) + imp.reload(export_3ds) import bpy diff --git a/release/scripts/op/io_scene_3ds/export_3ds.py b/release/scripts/op/io_scene_3ds/export_3ds.py index fccb904ed7a..00b0f879dc2 100644 --- a/release/scripts/op/io_scene_3ds/export_3ds.py +++ b/release/scripts/op/io_scene_3ds/export_3ds.py @@ -120,9 +120,9 @@ SZ_FLOAT = 4 class _3ds_short(object): '''Class representing a short (2-byte integer) for a 3ds file. *** This looks like an unsigned short H is unsigned from the struct docs - Cam***''' - __slots__ = 'value' + __slots__ = ('value', ) def __init__(self, val=0): - self.value=val + self.value = val def get_size(self): return SZ_SHORT @@ -135,9 +135,9 @@ class _3ds_short(object): class _3ds_int(object): '''Class representing an int (4-byte integer) for a 3ds file.''' - __slots__ = 'value' - def __init__(self, val=0): - self.value=val + __slots__ = ('value', ) + def __init__(self, val): + self.value = val def get_size(self): return SZ_INT @@ -150,8 +150,8 @@ class _3ds_int(object): class _3ds_float(object): '''Class representing a 4-byte IEEE floating point number for a 3ds file.''' - __slots__ = 'value' - def __init__(self, val=0.0): + __slots__ = ('value', ) + def __init__(self, val): self.value=val def get_size(self): @@ -166,8 +166,8 @@ class _3ds_float(object): class _3ds_string(object): '''Class representing a zero-terminated string for a 3ds file.''' - __slots__ = 'value' - def __init__(self, val=""): + __slots__ = ('value', ) + def __init__(self, val): self.value=val def get_size(self): @@ -183,7 +183,7 @@ class _3ds_string(object): class _3ds_point_3d(object): '''Class representing a three-dimensional point for a 3ds file.''' __slots__ = 'x','y','z' - def __init__(self, point=(0.0,0.0,0.0)): + def __init__(self, point): self.x, self.y, self.z = point def get_size(self): @@ -216,8 +216,8 @@ class _3ds_point_4d(object): class _3ds_point_uv(object): '''Class representing a UV-coordinate for a 3ds file.''' - __slots__ = 'uv' - def __init__(self, point=(0.0,0.0)): + __slots__ = ('uv', ) + def __init__(self, point): self.uv = point def __cmp__(self, other): @@ -236,7 +236,7 @@ class _3ds_point_uv(object): class _3ds_rgb_color(object): '''Class representing a (24-bit) rgb color for a 3ds file.''' __slots__ = 'r','g','b' - def __init__(self, col=(0,0,0)): + def __init__(self, col): self.r, self.g, self.b = col def get_size(self): @@ -251,7 +251,7 @@ class _3ds_rgb_color(object): class _3ds_face(object): '''Class representing a face for a 3ds file.''' - __slots__ = 'vindex' + __slots__ = ('vindex', ) def __init__(self, vindex): self.vindex = vindex diff --git a/release/scripts/op/io_scene_fbx/__init__.py b/release/scripts/op/io_scene_fbx/__init__.py index d2c809cab0b..6a76cf0d756 100644 --- a/release/scripts/op/io_scene_fbx/__init__.py +++ b/release/scripts/op/io_scene_fbx/__init__.py @@ -20,9 +20,9 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "export_fbx" in locals(): - reload(export_fbx) + imp.reload(export_fbx) import bpy @@ -34,6 +34,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper): '''Selection to an ASCII Autodesk FBX''' bl_idname = "export_scene.fbx" bl_label = "Export FBX" + bl_options = {'PRESET'} filename_ext = ".fbx" filter_glob = StringProperty(default="*.fbx", options={'HIDDEN'}) diff --git a/release/scripts/op/io_scene_fbx/export_fbx.py b/release/scripts/op/io_scene_fbx/export_fbx.py index 621e51ab493..20b574b09f0 100644 --- a/release/scripts/op/io_scene_fbx/export_fbx.py +++ b/release/scripts/op/io_scene_fbx/export_fbx.py @@ -1436,12 +1436,14 @@ def save(operator, context, filepath="", i=-1 for v in me_vertices: - if i==-1: - file.write('%.6f,%.6f,%.6f' % tuple(v.co)); i=0 + if i == -1: + file.write('%.6f,%.6f,%.6f' % v.co[:]) + i = 0 else: - if i==7: - file.write('\n\t\t'); i=0 - file.write(',%.6f,%.6f,%.6f'% tuple(v.co)) + if i == 7: + file.write('\n\t\t') + i = 0 + file.write(',%.6f,%.6f,%.6f'% v.co[:]) i+=1 file.write('\n\t\tPolygonVertexIndex: ') @@ -1508,11 +1510,11 @@ def save(operator, context, filepath="", i=-1 for v in me_vertices: if i==-1: - file.write('%.15f,%.15f,%.15f' % tuple(v.normal)); i=0 + file.write('%.15f,%.15f,%.15f' % v.normal[:]); i=0 else: if i==2: file.write('\n '); i=0 - file.write(',%.15f,%.15f,%.15f' % tuple(v.normal)) + file.write(',%.15f,%.15f,%.15f' % v.normal[:]) i+=1 file.write('\n\t\t}') @@ -1558,14 +1560,6 @@ def save(operator, context, filepath="", file.write('\n\t\t}') - # small utility function - # returns a slice of data depending on number of face verts - # data is either a MeshTextureFace or MeshColor - def face_data(data, face): - totvert = len(f.vertices) - - return data[:totvert] - # Write VertexColor Layers # note, no programs seem to use this info :/ @@ -1585,21 +1579,21 @@ def save(operator, context, filepath="", i = -1 ii = 0 # Count how many Colors we write - for f, cf in zip(me_faces, collayer.data): - colors = [cf.color1, cf.color2, cf.color3, cf.color4] - - # determine number of verts - colors = face_data(colors, f) + for fi, cf in enumerate(collayer.data): + if len(me_faces[fi].vertices) == 4: + colors = cf.color1[:], cf.color2[:], cf.color3[:], cf.color4[:] + else: + colors = cf.color1[:], cf.color2[:], cf.color3[:] for col in colors: if i==-1: - file.write('%.4f,%.4f,%.4f,1' % tuple(col)) + file.write('%.4f,%.4f,%.4f,1' % col) i=0 else: if i==7: file.write('\n\t\t\t\t') i=0 - file.write(',%.4f,%.4f,%.4f,1' % tuple(col)) + file.write(',%.4f,%.4f,%.4f,1' % col) i+=1 ii+=1 # One more Color @@ -1646,7 +1640,7 @@ def save(operator, context, filepath="", i=0 else: if i==7: - file.write('\n ') + file.write('\n\t\t\t ') i=0 file.write(',%.6f,%.6f' % tuple(uv)) i+=1 @@ -2104,7 +2098,8 @@ def save(operator, context, filepath="", # The mesh uses this bones armature! if my_bone.fbxArm == my_mesh.fbxArm: - my_bone.blenMeshes[my_mesh.fbxName] = me + if my_bone.blenBone.use_deform: + my_bone.blenMeshes[my_mesh.fbxName] = me # parent bone: replace bone names with our class instances diff --git a/release/scripts/op/io_scene_obj/__init__.py b/release/scripts/op/io_scene_obj/__init__.py index f2825d4e33e..b87c6b44347 100644 --- a/release/scripts/op/io_scene_obj/__init__.py +++ b/release/scripts/op/io_scene_obj/__init__.py @@ -20,11 +20,11 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "import_obj" in locals(): - reload(import_obj) + imp.reload(import_obj) if "export_obj" in locals(): - reload(export_obj) + imp.reload(export_obj) import bpy @@ -65,6 +65,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper): bl_idname = "export_scene.obj" bl_label = 'Export OBJ' + bl_options = {'PRESET'} filename_ext = ".obj" filter_glob = StringProperty(default="*.obj;*.mtl", options={'HIDDEN'}) diff --git a/release/scripts/op/io_scene_obj/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py index 7cfebf20525..f3852666ac4 100644 --- a/release/scripts/op/io_scene_obj/export_obj.py +++ b/release/scripts/op/io_scene_obj/export_obj.py @@ -34,7 +34,10 @@ def fixName(name): def write_mtl(scene, filepath, copy_images, mtl_dict): world = scene.world - worldAmb = world.ambient_color + if world: + worldAmb = world.ambient_color[:] + else: + worldAmb = 0.0, 0.0, 0.0 dest_dir = os.path.dirname(filepath) @@ -69,10 +72,10 @@ def write_mtl(scene, filepath, copy_images, mtl_dict): file.write('newmtl %s\n' % mtl_mat_name) # Define a new material: matname_imgname if mat: - file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901) ) # Hardness, convert blenders 1-511 to MTL's - file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.ambient for c in worldAmb]) ) # Ambient, uses mirror colour, - file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_intensity for c in mat.diffuse_color]) ) # Diffuse - file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_intensity for c in mat.specular_color]) ) # Specular + file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901)) # Hardness, convert blenders 1-511 to MTL's + file.write('Ka %.6f %.6f %.6f\n' % tuple(c * mat.ambient for c in worldAmb)) # Ambient, uses mirror colour, + file.write('Kd %.6f %.6f %.6f\n' % tuple(c * mat.diffuse_intensity for c in mat.diffuse_color)) # Diffuse + file.write('Ks %.6f %.6f %.6f\n' % tuple(c * mat.specular_intensity for c in mat.specular_color)) # Specular if hasattr(mat, "ior"): file.write('Ni %.6f\n' % mat.ior) # Refraction index else: @@ -90,7 +93,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict): else: #write a dummy material here? file.write('Ns 0\n') - file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in worldAmb]) ) # Ambient, uses mirror colour, + file.write('Ka %.6f %.6f %.6f\n' % tuple(c for c in worldAmb)) # Ambient, uses mirror colour, file.write('Kd 0.8 0.8 0.8\n') file.write('Ks 0.8 0.8 0.8\n') file.write('d 1\n') # No alpha @@ -485,7 +488,7 @@ def write_file(filepath, objects, scene, # Vert for v in me_verts: - file.write('v %.6f %.6f %.6f\n' % tuple(v.co)) + file.write('v %.6f %.6f %.6f\n' % v.co[:]) # UV if faceuv: diff --git a/release/scripts/op/io_scene_x3d/__init__.py b/release/scripts/op/io_scene_x3d/__init__.py index a33c5c05dfd..545c90a9a2a 100644 --- a/release/scripts/op/io_scene_x3d/__init__.py +++ b/release/scripts/op/io_scene_x3d/__init__.py @@ -18,9 +18,9 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "export_x3d" in locals(): - reload(export_x3d) + imp.reload(export_x3d) import bpy diff --git a/release/scripts/op/io_scene_x3d/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py index f8fe6e0efd4..72c69152d54 100644 --- a/release/scripts/op/io_scene_x3d/export_x3d.py +++ b/release/scripts/op/io_scene_x3d/export_x3d.py @@ -234,10 +234,7 @@ class x3d_class: # beamWidth=((lamp.spotSize*math.pi)/180.0)*.37; cutOffAngle=beamWidth*1.3 - dx,dy,dz=self.computeDirection(mtx) - # note -dx seems to equal om[3][0] - # note -dz seems to equal om[3][1] - # note dy seems to equal om[3][2] + dx, dy, dz = self.computeDirection(mtx) #location=(ob.matrix_world*MATWORLD).translation_part() # now passed location=(MATWORLD * mtx).translation_part() @@ -266,7 +263,7 @@ class x3d_class: ambientIntensity = 0 intensity=min(lamp.energy/1.75,1.0) - (dx,dy,dz)=self.computeDirection(mtx) + dx, dy, dz = self.computeDirection(mtx) self.file.write("<DirectionalLight DEF=\"%s\" " % safeName) self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp))) self.file.write("color=\"%s %s %s\" " % (round(lamp.color[0],self.cp), round(lamp.color[1],self.cp), round(lamp.color[2],self.cp))) @@ -391,38 +388,49 @@ class x3d_class: # (meshName, loc[0], loc[1], loc[2], sca[0], sca[1], sca[2], rot[0], rot[1], rot[2], quat.angle*DEG2RAD) ) self.writeIndented("<Shape>\n",1) - maters=mesh.materials - hasImageTexture = False is_smooth = False - if len(maters) > 0 or mesh.uv_textures.active: - # if len(maters) > 0 or mesh.faceUV: + # XXX, lame, only exports first material. + mat_first = None + for mat_first in mesh.materials: + if mat_first: + break + + if mat_first or mesh.uv_textures.active: self.writeIndented("<Appearance>\n", 1) # right now this script can only handle a single material per mesh. - if len(maters) >= 1 and maters[0].use_face_texture == False: - mat = maters[0] - self.writeMaterial(mat, self.cleanStr(mat.name,''), world) - if len(maters) > 1: + if mat_first and mat_first.use_face_texture == False: + self.writeMaterial(mat_first, self.cleanStr(mat_first.name, ""), world) + if len(mesh.materials) > 1: print("Warning: mesh named %s has multiple materials" % meshName) print("Warning: only one material per object handled") - if not len(maters) or maters[0].use_face_texture: + image = None + + if mat_first is None or mat_first.use_face_texture: #-- textures - image = None if mesh.uv_textures.active: for face in mesh.uv_textures.active.data: if face.use_image: image = face.image if image: - self.writeImageTexture(image) + break + elif mat_first: + for mtex in mat_first.texture_slots: + if mtex: + tex = mtex.texture + if tex and tex.type == 'IMAGE': + image = tex.image + if image: break - if image: - hasImageTexture = True + # XXX, incorrect, uses first image + if image: + self.writeImageTexture(image) - if self.tilenode == 1: - self.writeIndented("<TextureTransform scale=\"%s %s\" />\n" % (image.xrep, image.yrep)) - self.tilenode = 0 + if self.tilenode == 1: + self.writeIndented("<TextureTransform scale=\"%s %s\" />\n" % (image.xrep, image.yrep)) + self.tilenode = 0 self.writeIndented("</Appearance>\n", -1) @@ -506,22 +514,16 @@ class x3d_class: if self.writingcoords == 0: self.file.write('coordIndex="') for face in mesh.faces: - fv = face.vertices - # fv = face.v + fv = face.vertices[:] if len(fv)==3: - # if len(face)==3: self.file.write("%i %i %i -1, " % (fv[0], fv[1], fv[2])) - # self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index)) else: if EXPORT_TRI: self.file.write("%i %i %i -1, " % (fv[0], fv[1], fv[2])) - # self.file.write("%i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index)) self.file.write("%i %i %i -1, " % (fv[0], fv[2], fv[3])) - # self.file.write("%i %i %i -1, " % (fv[0].index, fv[2].index, fv[3].index)) else: self.file.write("%i %i %i %i -1, " % (fv[0], fv[1], fv[2], fv[3])) - # self.file.write("%i %i %i %i -1, " % (fv[0].index, fv[1].index, fv[2].index, fv[3].index)) self.file.write("\">\n") else: @@ -530,7 +532,7 @@ class x3d_class: self.writeIndented("<Coordinate DEF=\"%s%s\" \n" % ("coord_",meshName), 1) self.file.write("\t\t\t\tpoint=\"") for v in mesh.vertices: - self.file.write("%.6f %.6f %.6f, " % tuple(v.co)) + self.file.write("%.6f %.6f %.6f, " % v.co[:]) self.file.write("\" />") self.writeIndented("\n", -1) @@ -572,23 +574,10 @@ class x3d_class: if self.writingcolor == 0: self.file.write("colorPerVertex=\"false\" ") elif mesh.vertex_colors.active: - # else: self.writeIndented("<Color color=\"", 1) for face in mesh.vertex_colors.active.data: - c = face.color1 - if self.verbose > 2: - print("Debug: face.col r=%d g=%d b=%d" % (c[0], c[1], c[2])) - # print("Debug: face.col r=%d g=%d b=%d" % (c.r, c.g, c.b)) - aColor = self.rgbToFS(c) - self.file.write("%s, " % aColor) - - # for face in mesh.faces: - # if face.col: - # c=face.col[0] - # if self.verbose > 2: - # print("Debug: face.col r=%d g=%d b=%d" % (c.r, c.g, c.b)) - # aColor = self.rgbToFS(c) - # self.file.write("%s, " % aColor) + # XXX, 1 color per face, only + self.file.write("%.3f %.3f %.3f, " % face.color1[:]) self.file.write("\" />") self.writeIndented("\n",-1) @@ -912,11 +901,6 @@ class x3d_class: print("Debug: mesh.faces=%d" % len(mesh.faces)) print("Debug: mesh.materials=%d" % len(mesh.materials)) - def rgbToFS(self, c): - s="%s %s %s" % (round(c[0]/255.0,self.cp), - round(c[1]/255.0,self.cp), - round(c[2]/255.0,self.cp)) - # s="%s %s %s" % ( # round(c.r/255.0,self.cp), # round(c.g/255.0,self.cp), @@ -924,7 +908,7 @@ class x3d_class: return s def computeDirection(self, mtx): - return (mathutils.Vector((0, -1, 0)) * (MATWORLD * mtx).rotation_part())[:] + return (mathutils.Vector((0.0, 0.0, -1.0)) * (MATWORLD * mtx).rotation_part()).normalize()[:] # swap Y and Z to handle axis difference between Blender and VRML #------------------------------------------------------------------------ diff --git a/release/scripts/op/io_shape_mdd/__init__.py b/release/scripts/op/io_shape_mdd/__init__.py index dc4f6513d61..1cd1ff5dce1 100644 --- a/release/scripts/op/io_shape_mdd/__init__.py +++ b/release/scripts/op/io_shape_mdd/__init__.py @@ -20,11 +20,11 @@ # To support reload properly, try to access a package var, if it's there, reload everything if "bpy" in locals(): - from imp import reload + import imp if "import_mdd" in locals(): - reload(import_mdd) + imp.reload(import_mdd) if "export_mdd" in locals(): - reload(export_mdd) + imp.reload(export_mdd) import bpy diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index e5a6375e2eb..acea7d53572 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -75,8 +75,6 @@ def pose_info(): def bake(frame_start, frame_end, step=1, only_selected=False): - # import nla; reload(nla); nla.bake() - scene = bpy.context.scene obj = bpy.context.object pose = obj.pose diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index cb6db059e9f..01e6a5f3cd0 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -207,9 +207,12 @@ class SubdivisionSet(bpy.types.Operator): return - # adda new modifier - mod = obj.modifiers.new("Subsurf", 'SUBSURF') - mod.levels = level + # add a new modifier + try: + mod = obj.modifiers.new("Subsurf", 'SUBSURF') + mod.levels = level + except: + self.report({'WARNING'}, "Modifiers cannot be added to object: " + obj.name) for obj in context.selected_editable_objects: set_object_subd(obj) @@ -464,7 +467,7 @@ class JoinUVs(bpy.types.Operator): class MakeDupliFace(bpy.types.Operator): '''Make linked objects into dupli-faces''' bl_idname = "object.make_dupli_face" - bl_label = "Make DupliFace" + bl_label = "Make Dupli-Face" @classmethod def poll(cls, context): @@ -484,7 +487,7 @@ class MakeDupliFace(bpy.types.Operator): trans = matrix.translation_part() rot = matrix.rotation_part() # also contains scale - return [(rot * b) + trans for b in base_tri] + return [(b * rot) + trans for b in base_tri] scene = bpy.context.scene linked = {} for obj in bpy.context.selected_objects: diff --git a/release/scripts/op/object_align.py b/release/scripts/op/object_align.py index ff566206a49..fc2c9b2731f 100644 --- a/release/scripts/op/object_align.py +++ b/release/scripts/op/object_align.py @@ -26,206 +26,213 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to): cursor = bpy.context.scene.cursor_location - Left_Up_Front_SEL = [[], [], []] - Right_Down_Back_SEL = [[], [], []] + Left_Up_Front_SEL = [0.0, 0.0, 0.0] + Right_Down_Back_SEL = [0.0, 0.0, 0.0] flag_first = True + objs = [] + for obj in bpy.context.selected_objects: - if obj.type == 'MESH': + matrix_world = obj.matrix_world + bb_world = [Vector(v[:]) * matrix_world for v in obj.bound_box] + objs.append((obj, bb_world)) + + if not objs: + return False - bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] + for obj, bb_world in objs: + Left_Up_Front = bb_world[1] + Right_Down_Back = bb_world[7] - Left_Up_Front = bb_world[1] - Right_Down_Back = bb_world[7] + # Active Center - # Active Center + if obj == bpy.context.active_object: - if obj == bpy.context.active_object: + center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0 + center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0 + center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0 - center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2 - center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2 - center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2 + size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2.0 + size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2.0 + size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2.0 - size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2 - size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2 - size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2 + # Selection Center - # Selection Center + if flag_first: + flag_first = False - if flag_first: - flag_first = False + Left_Up_Front_SEL[0] = Left_Up_Front[0] + Left_Up_Front_SEL[1] = Left_Up_Front[1] + Left_Up_Front_SEL[2] = Left_Up_Front[2] + Right_Down_Back_SEL[0] = Right_Down_Back[0] + Right_Down_Back_SEL[1] = Right_Down_Back[1] + Right_Down_Back_SEL[2] = Right_Down_Back[2] + + else: + # X axis + if Left_Up_Front[0] < Left_Up_Front_SEL[0]: Left_Up_Front_SEL[0] = Left_Up_Front[0] + # Y axis + if Left_Up_Front[1] < Left_Up_Front_SEL[1]: Left_Up_Front_SEL[1] = Left_Up_Front[1] + # Z axis + if Left_Up_Front[2] > Left_Up_Front_SEL[2]: Left_Up_Front_SEL[2] = Left_Up_Front[2] + # X axis + if Right_Down_Back[0] > Right_Down_Back_SEL[0]: Right_Down_Back_SEL[0] = Right_Down_Back[0] + # Y axis + if Right_Down_Back[1] > Right_Down_Back_SEL[1]: Right_Down_Back_SEL[1] = Right_Down_Back[1] + # Z axis + if Right_Down_Back[2] < Right_Down_Back_SEL[2]: Right_Down_Back_SEL[2] = Right_Down_Back[2] - else: - # X axis - if Left_Up_Front[0] < Left_Up_Front_SEL[0]: - Left_Up_Front_SEL[0] = Left_Up_Front[0] - # Y axis - if Left_Up_Front[1] < Left_Up_Front_SEL[1]: - Left_Up_Front_SEL[1] = Left_Up_Front[1] - # Z axis - if Left_Up_Front[2] > Left_Up_Front_SEL[2]: - Left_Up_Front_SEL[2] = Left_Up_Front[2] - - # X axis - if Right_Down_Back[0] > Right_Down_Back_SEL[0]: - Right_Down_Back_SEL[0] = Right_Down_Back[0] - # Y axis - if Right_Down_Back[1] > Right_Down_Back_SEL[1]: - Right_Down_Back_SEL[1] = Right_Down_Back[1] - # Z axis - if Right_Down_Back[2] < Right_Down_Back_SEL[2]: - Right_Down_Back_SEL[2] = Right_Down_Back[2] - - center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2 - center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2 - center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2 + center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2.0 + center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2.0 + center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2.0 # Main Loop - for obj in bpy.context.selected_objects: - if obj.type == 'MESH': + for obj, bb_world in objs: - loc_world = obj.location - bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] + loc_world = obj.location + bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] - Left_Up_Front = bb_world[1] - Right_Down_Back = bb_world[7] + Left_Up_Front = bb_world[1] + Right_Down_Back = bb_world[7] - center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2 - center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2 - center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2 + center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0 + center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0 + center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0 - positive_x = Right_Down_Back[0] - positive_y = Right_Down_Back[1] - positive_z = Left_Up_Front[2] + positive_x = Right_Down_Back[0] + positive_y = Right_Down_Back[1] + positive_z = Left_Up_Front[2] - negative_x = Left_Up_Front[0] - negative_y = Left_Up_Front[1] - negative_z = Right_Down_Back[2] + negative_x = Left_Up_Front[0] + negative_y = Left_Up_Front[1] + negative_z = Right_Down_Back[2] - obj_loc = obj.location + obj_loc = obj.location - if align_x: + if align_x: - # Align Mode + # Align Mode - if relative_to == 'OPT_4': # Active relative - if align_mode == 'OPT_1': - obj_x = obj_loc[0] - negative_x - size_active_x + if relative_to == 'OPT_4': # Active relative + if align_mode == 'OPT_1': + obj_x = obj_loc[0] - negative_x - size_active_x - elif align_mode == 'OPT_3': - obj_x = obj_loc[0] - positive_x + size_active_x + elif align_mode == 'OPT_3': + obj_x = obj_loc[0] - positive_x + size_active_x - else: # Everything else relative - if align_mode == 'OPT_1': - obj_x = obj_loc[0] - negative_x + else: # Everything else relative + if align_mode == 'OPT_1': + obj_x = obj_loc[0] - negative_x - elif align_mode == 'OPT_3': - obj_x = obj_loc[0] - positive_x + elif align_mode == 'OPT_3': + obj_x = obj_loc[0] - positive_x - if align_mode == 'OPT_2': # All relative - obj_x = obj_loc[0] - center_x + if align_mode == 'OPT_2': # All relative + obj_x = obj_loc[0] - center_x - # Relative To + # Relative To - if relative_to == 'OPT_1': - loc_x = obj_x + if relative_to == 'OPT_1': + loc_x = obj_x - elif relative_to == 'OPT_2': - loc_x = obj_x + cursor[0] + elif relative_to == 'OPT_2': + loc_x = obj_x + cursor[0] - elif relative_to == 'OPT_3': - loc_x = obj_x + center_sel_x + elif relative_to == 'OPT_3': + loc_x = obj_x + center_sel_x - elif relative_to == 'OPT_4': - loc_x = obj_x + center_active_x + elif relative_to == 'OPT_4': + loc_x = obj_x + center_active_x - obj.location[0] = loc_x + obj.location[0] = loc_x - if align_y: + if align_y: - # Align Mode + # Align Mode - if relative_to == 'OPT_4': # Active relative - if align_mode == 'OPT_1': - obj_y = obj_loc[1] - negative_y - size_active_y + if relative_to == 'OPT_4': # Active relative + if align_mode == 'OPT_1': + obj_y = obj_loc[1] - negative_y - size_active_y - elif align_mode == 'OPT_3': - obj_y = obj_loc[1] - positive_y + size_active_y + elif align_mode == 'OPT_3': + obj_y = obj_loc[1] - positive_y + size_active_y - else: # Everything else relative - if align_mode == 'OPT_1': - obj_y = obj_loc[1] - negative_y + else: # Everything else relative + if align_mode == 'OPT_1': + obj_y = obj_loc[1] - negative_y - elif align_mode == 'OPT_3': - obj_y = obj_loc[1] - positive_y + elif align_mode == 'OPT_3': + obj_y = obj_loc[1] - positive_y - if align_mode == 'OPT_2': # All relative - obj_y = obj_loc[1] - center_y + if align_mode == 'OPT_2': # All relative + obj_y = obj_loc[1] - center_y - # Relative To + # Relative To - if relative_to == 'OPT_1': - loc_y = obj_y + if relative_to == 'OPT_1': + loc_y = obj_y - elif relative_to == 'OPT_2': - loc_y = obj_y + cursor[1] + elif relative_to == 'OPT_2': + loc_y = obj_y + cursor[1] - elif relative_to == 'OPT_3': - loc_y = obj_y + center_sel_y + elif relative_to == 'OPT_3': + loc_y = obj_y + center_sel_y - elif relative_to == 'OPT_4': - loc_y = obj_y + center_active_y + elif relative_to == 'OPT_4': + loc_y = obj_y + center_active_y - obj.location[1] = loc_y + obj.location[1] = loc_y - if align_z: + if align_z: - # Align Mode + # Align Mode - if relative_to == 'OPT_4': # Active relative - if align_mode == 'OPT_1': - obj_z = obj_loc[2] - negative_z - size_active_z + if relative_to == 'OPT_4': # Active relative + if align_mode == 'OPT_1': + obj_z = obj_loc[2] - negative_z - size_active_z - elif align_mode == 'OPT_3': - obj_z = obj_loc[2] - positive_z + size_active_z + elif align_mode == 'OPT_3': + obj_z = obj_loc[2] - positive_z + size_active_z - else: # Everything else relative - if align_mode == 'OPT_1': - obj_z = obj_loc[2] - negative_z + else: # Everything else relative + if align_mode == 'OPT_1': + obj_z = obj_loc[2] - negative_z - elif align_mode == 'OPT_3': - obj_z = obj_loc[2] - positive_z + elif align_mode == 'OPT_3': + obj_z = obj_loc[2] - positive_z - if align_mode == 'OPT_2': # All relative - obj_z = obj_loc[2] - center_z + if align_mode == 'OPT_2': # All relative + obj_z = obj_loc[2] - center_z - # Relative To + # Relative To - if relative_to == 'OPT_1': - loc_z = obj_z + if relative_to == 'OPT_1': + loc_z = obj_z - elif relative_to == 'OPT_2': - loc_z = obj_z + cursor[2] + elif relative_to == 'OPT_2': + loc_z = obj_z + cursor[2] - elif relative_to == 'OPT_3': - loc_z = obj_z + center_sel_z + elif relative_to == 'OPT_3': + loc_z = obj_z + center_sel_z - elif relative_to == 'OPT_4': - loc_z = obj_z + center_active_z + elif relative_to == 'OPT_4': + loc_z = obj_z + center_active_z - obj.location[2] = loc_z + obj.location[2] = loc_z + + return True from bpy.props import * @@ -254,23 +261,28 @@ class AlignObjects(bpy.types.Operator): description="", default='OPT_4') - align_x = BoolProperty(name="Align X", - description="Align in the X axis", default=False) - - align_y = BoolProperty(name="Align Y", - description="Align in the Y axis", default=False) - - align_z = BoolProperty(name="Align Z", - description="Align in the Z axis", default=False) + align_axis = EnumProperty(items=( + ('X', "X", ""), + ('Y', "Y", ""), + ('Z', "Z", ""), + ), + name="Align", + description="Align to axis", + options={'ENUM_FLAG'}) @classmethod def poll(cls, context): return context.mode == 'OBJECT' def execute(self, context): - align_objects(self.align_x, self.align_y, self.align_z, self.align_mode, self.relative_to) - - return {'FINISHED'} + align_axis = self.align_axis + ret = align_objects('X' in align_axis, 'Y' in align_axis, 'Z' in align_axis, self.align_mode, self.relative_to) + + if not ret: + self.report({'WARNING'}, "No objects with bound-box selected") + return {'CANCELLED'} + else: + return {'FINISHED'} def menu_func(self, context): diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 0ee20966fad..dd16a4ee5e0 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -69,6 +69,12 @@ class AddPresetBase(): file_preset = open(filepath, 'w') file_preset.write("import bpy\n") + if hasattr(self, "preset_defines"): + for rna_path in self.preset_defines: + exec(rna_path) + file_preset.write("%s\n" % rna_path) + file_preset.write("\n") + for rna_path in self.preset_values: value = eval(rna_path) # convert thin wrapped sequences to simple lists to repr() @@ -150,17 +156,21 @@ class AddPresetRender(AddPresetBase, bpy.types.Operator): bl_label = "Add Render Preset" preset_menu = "RENDER_MT_presets" + preset_defines = [ + "scene = bpy.context.scene" + ] + preset_values = [ - "bpy.context.scene.render.field_order", - "bpy.context.scene.render.fps", - "bpy.context.scene.render.fps_base", - "bpy.context.scene.render.pixel_aspect_x", - "bpy.context.scene.render.pixel_aspect_y", - "bpy.context.scene.render.resolution_percentage", - "bpy.context.scene.render.resolution_x", - "bpy.context.scene.render.resolution_y", - "bpy.context.scene.render.use_fields", - "bpy.context.scene.render.use_fields_still", + "scene.render.field_order", + "scene.render.fps", + "scene.render.fps_base", + "scene.render.pixel_aspect_x", + "scene.render.pixel_aspect_y", + "scene.render.resolution_percentage", + "scene.render.resolution_x", + "scene.render.resolution_y", + "scene.render.use_fields", + "scene.render.use_fields_still", ] preset_subdir = "render" @@ -172,20 +182,20 @@ class AddPresetSSS(AddPresetBase, bpy.types.Operator): bl_label = "Add SSS Preset" preset_menu = "MATERIAL_MT_sss_presets" + preset_defines = [ + "material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)" + ] + preset_values = [ - "bpy.context.material.subsurface_scattering.back", - "bpy.context.material.subsurface_scattering.color[0]", - "bpy.context.material.subsurface_scattering.color[1]", - "bpy.context.material.subsurface_scattering.color[2]", - "bpy.context.material.subsurface_scattering.color_factor", - "bpy.context.material.subsurface_scattering.error_threshold", - "bpy.context.material.subsurface_scattering.front", - "bpy.context.material.subsurface_scattering.ior", - "bpy.context.material.subsurface_scattering.radius[0]", - "bpy.context.material.subsurface_scattering.radius[1]", - "bpy.context.material.subsurface_scattering.radius[2]", - "bpy.context.material.subsurface_scattering.scale", - "bpy.context.material.subsurface_scattering.texture_factor", + "material.subsurface_scattering.back", + "material.subsurface_scattering.color", + "material.subsurface_scattering.color_factor", + "material.subsurface_scattering.error_threshold", + "material.subsurface_scattering.front", + "material.subsurface_scattering.ior", + "material.subsurface_scattering.radius", + "material.subsurface_scattering.scale", + "material.subsurface_scattering.texture_factor", ] preset_subdir = "sss" @@ -197,13 +207,17 @@ class AddPresetCloth(AddPresetBase, bpy.types.Operator): bl_label = "Add Cloth Preset" preset_menu = "CLOTH_MT_presets" + preset_defines = [ + "cloth = bpy.context.cloth" + ] + preset_values = [ - "bpy.context.cloth.settings.air_damping", - "bpy.context.cloth.settings.bending_stiffness", - "bpy.context.cloth.settings.mass", - "bpy.context.cloth.settings.quality", - "bpy.context.cloth.settings.spring_damping", - "bpy.context.cloth.settings.structural_stiffness", + "cloth.settings.air_damping", + "cloth.settings.bending_stiffness", + "cloth.settings.mass", + "cloth.settings.quality", + "cloth.settings.spring_damping", + "cloth.settings.structural_stiffness", ] preset_subdir = "cloth" @@ -215,20 +229,24 @@ class AddPresetSunSky(AddPresetBase, bpy.types.Operator): bl_label = "Add Sunsky Preset" preset_menu = "LAMP_MT_sunsky_presets" + preset_defines = [ + "sky = bpy.context.object.data.sky" + ] + preset_values = [ - "bpy.context.object.data.sky.atmosphere_extinction", - "bpy.context.object.data.sky.atmosphere_inscattering", - "bpy.context.object.data.sky.atmosphere_turbidity", - "bpy.context.object.data.sky.backscattered_light", - "bpy.context.object.data.sky.horizon_brightness", - "bpy.context.object.data.sky.spread", - "bpy.context.object.data.sky.sun_brightness", - "bpy.context.object.data.sky.sun_intensity", - "bpy.context.object.data.sky.sun_size", - "bpy.context.object.data.sky.use_sky_blend", - "bpy.context.object.data.sky.use_sky_blend_type", - "bpy.context.object.data.sky.use_sky_color_space", - "bpy.context.object.data.sky.use_sky_exposure", + "sky.atmosphere_extinction", + "sky.atmosphere_inscattering", + "sky.atmosphere_turbidity", + "sky.backscattered_light", + "sky.horizon_brightness", + "sky.spread", + "sky.sun_brightness", + "sky.sun_intensity", + "sky.sun_size", + "sky.use_sky_blend", + "sky.use_sky_blend_type", + "sky.use_sky_color_space", + "sky.use_sky_exposure", ] preset_subdir = "sunsky" @@ -240,17 +258,21 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator): bl_label = "Add Interaction Preset" preset_menu = "USERPREF_MT_interaction_presets" + preset_defines = [ + "user_preferences = bpy.context.user_preferences" + ] + preset_values = [ - "bpy.context.user_preferences.edit.use_drag_immediately", - "bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb", - "bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom", - "bpy.context.user_preferences.inputs.select_mouse", - "bpy.context.user_preferences.inputs.use_emulate_numpad", - "bpy.context.user_preferences.inputs.use_mouse_continuous", - "bpy.context.user_preferences.inputs.use_mouse_emulate_3_button", - "bpy.context.user_preferences.inputs.view_rotate_method", - "bpy.context.user_preferences.inputs.view_zoom_axis", - "bpy.context.user_preferences.inputs.view_zoom_method", + "user_preferences.edit.use_drag_immediately", + "user_preferences.edit.use_insertkey_xyz_to_rgb", + "user_preferences.inputs.invert_mouse_wheel_zoom", + "user_preferences.inputs.select_mouse", + "user_preferences.inputs.use_emulate_numpad", + "user_preferences.inputs.use_mouse_continuous", + "user_preferences.inputs.use_mouse_emulate_3_button", + "user_preferences.inputs.view_rotate_method", + "user_preferences.inputs.view_zoom_axis", + "user_preferences.inputs.view_zoom_method", ] preset_subdir = "interaction" @@ -279,6 +301,57 @@ class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator): keyconfigs.remove(keyconfigs.active) +class AddPresetOperator(AddPresetBase, bpy.types.Operator): + '''Add an Application Interaction Preset''' + bl_idname = "wm.operator_preset_add" + bl_label = "Operator Preset" + preset_menu = "WM_MT_operator_presets" + + operator = bpy.props.StringProperty(name="Operator", maxlen=64, options={'HIDDEN'}) + + # XXX, not ideal + preset_defines = [ + "op = bpy.context.space_data.operator", + ] + + @property + def preset_subdir(self): + return __class__.operator_path(self.operator) + + @property + def preset_values(self): + properties_blacklist = bpy.types.Operator.bl_rna.properties.keys() + + prefix, suffix = self.operator.split("_OT_", 1) + operator_rna = getattr(getattr(bpy.ops, prefix.lower()), suffix).get_rna().bl_rna + + ret = [] + for prop_id, prop in operator_rna.properties.items(): + if (not prop.is_hidden) and prop_id not in properties_blacklist: + ret.append("op.%s" % prop_id) + + return ret + + @staticmethod + def operator_path(operator): + import os + prefix, suffix = operator.split("_OT_", 1) + return os.path.join("operator", "%s.%s" % (prefix.lower(), suffix)) + + +class WM_MT_operator_presets(bpy.types.Menu): + bl_label = "Operator Presets" + + def draw(self, context): + self.operator = context.space_data.operator.bl_idname + bpy.types.Menu.draw_preset(self, context) + + @property + def preset_subdir(self): + return AddPresetOperator.operator_path(self.operator) + + preset_operator = "script.execute_preset" + def register(): pass diff --git a/release/scripts/presets/sss/apple.py b/release/scripts/presets/sss/apple.py index d505be2b435..c5f60ee5095 100644 --- a/release/scripts/presets/sss/apple.py +++ b/release/scripts/presets/sss/apple.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 11.605, 3.884, 1.754 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.430, 0.210, 0.168 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 11.605, 3.884, 1.754 +material.subsurface_scattering.color = 0.430, 0.210, 0.168 diff --git a/release/scripts/presets/sss/chicken.py b/release/scripts/presets/sss/chicken.py index 53e199455c1..9acc2f3e25f 100644 --- a/release/scripts/presets/sss/chicken.py +++ b/release/scripts/presets/sss/chicken.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 9.436, 3.348, 1.790 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.439, 0.216, 0.141 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 9.436, 3.348, 1.790 +material.subsurface_scattering.color = 0.439, 0.216, 0.141 diff --git a/release/scripts/presets/sss/cream.py b/release/scripts/presets/sss/cream.py index 221739a30ab..c03cc0243d9 100644 --- a/release/scripts/presets/sss/cream.py +++ b/release/scripts/presets/sss/cream.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 15.028, 4.664, 2.541 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.987, 0.943, 0.827 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 15.028, 4.664, 2.541 +material.subsurface_scattering.color = 0.987, 0.943, 0.827 diff --git a/release/scripts/presets/sss/ketchup.py b/release/scripts/presets/sss/ketchup.py index 96d136dc271..b94c7cced27 100644 --- a/release/scripts/presets/sss/ketchup.py +++ b/release/scripts/presets/sss/ketchup.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 4.762, 0.575, 0.394 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.222, 0.008, 0.002 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 4.762, 0.575, 0.394 +material.subsurface_scattering.color = 0.222, 0.008, 0.002 diff --git a/release/scripts/presets/sss/marble.py b/release/scripts/presets/sss/marble.py index cd68fd7d26f..c85719900e2 100644 --- a/release/scripts/presets/sss/marble.py +++ b/release/scripts/presets/sss/marble.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 8.509, 5.566, 3.951 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.925, 0.905, 0.884 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 8.509, 5.566, 3.951 +material.subsurface_scattering.color = 0.925, 0.905, 0.884 diff --git a/release/scripts/presets/sss/potato.py b/release/scripts/presets/sss/potato.py index 7a6c25db833..74807014bd3 100644 --- a/release/scripts/presets/sss/potato.py +++ b/release/scripts/presets/sss/potato.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 14.266, 7.228, 2.036 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.855, 0.740, 0.292 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 14.266, 7.228, 2.036 +material.subsurface_scattering.color = 0.855, 0.740, 0.292 diff --git a/release/scripts/presets/sss/skim_milk.py b/release/scripts/presets/sss/skim_milk.py index 5be37b820da..163659faf34 100644 --- a/release/scripts/presets/sss/skim_milk.py +++ b/release/scripts/presets/sss/skim_milk.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 18.424, 10.443, 3.502 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.889, 0.888, 0.796 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 18.424, 10.443, 3.502 +material.subsurface_scattering.color = 0.889, 0.888, 0.796 diff --git a/release/scripts/presets/sss/skin1.py b/release/scripts/presets/sss/skin1.py index 76dc64f61f9..ef284019637 100644 --- a/release/scripts/presets/sss/skin1.py +++ b/release/scripts/presets/sss/skin1.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 3.673, 1.367, 0.683 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.574, 0.313, 0.174 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 3.673, 1.367, 0.683 +material.subsurface_scattering.color = 0.574, 0.313, 0.174 diff --git a/release/scripts/presets/sss/skin2.py b/release/scripts/presets/sss/skin2.py index 6a72a782638..16a7d154309 100644 --- a/release/scripts/presets/sss/skin2.py +++ b/release/scripts/presets/sss/skin2.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 4.821, 1.694, 1.090 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.749, 0.571, 0.467 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 4.821, 1.694, 1.090 +material.subsurface_scattering.color = 0.749, 0.571, 0.467 diff --git a/release/scripts/presets/sss/whole_milk.py b/release/scripts/presets/sss/whole_milk.py index 59aaa135933..c11b18557e3 100644 --- a/release/scripts/presets/sss/whole_milk.py +++ b/release/scripts/presets/sss/whole_milk.py @@ -1,3 +1,5 @@ import bpy -bpy.context.active_object.active_material.subsurface_scattering.radius = 10.899, 6.575, 2.508 -bpy.context.active_object.active_material.subsurface_scattering.color = 0.947, 0.931, 0.852 +material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material) + +material.subsurface_scattering.radius = 10.899, 6.575, 2.508 +material.subsurface_scattering.color = 0.947, 0.931, 0.852 diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py new file mode 100644 index 00000000000..070bf2a9a3a --- /dev/null +++ b/release/scripts/templates/addon_add_object.py @@ -0,0 +1,72 @@ +bl_addon_info = { + "name": "New Object", + "author": "YourNameHere", + "version": (1, 0), + "blender": (2, 5, 5), + "api": 33333, + "location": "View3D > Add > Mesh > New Object", + "description": "Adds a new Mesh Object", + "warning": "", + "wiki_url": "", + "tracker_url": "", + "category": "Add Mesh"} + + +import bpy +from bpy.props import FloatVectorProperty +from add_utils import AddObjectHelper, add_object_data +from mathutils import Vector + + +def add_object(self, context): + scale_x = self.scale.x + scale_y = self.scale.y + + verts = [Vector((-1 * scale_x, 1 * scale_y, 0)), + Vector(( 1 * scale_x, 1 * scale_y, 0)), + Vector(( 1 * scale_x, -1 * scale_y, 0)), + Vector((-1 * scale_x, -1 * scale_y, 0)),] + edges = [] + faces = [[0,1,2,3]] + + mesh_data = bpy.data.meshes.new(name='New Object Mesh') + mesh_data.from_pydata(verts, edges, faces) + add_object_data(context, mesh_data, operator=self) + + +class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper): + """Add a Mesh Object""" + bl_idname = "mesh.add_object" + bl_label = "Add Mesh Object" + bl_description = "Create a new Mesh Object" + bl_options = {'REGISTER', 'UNDO'} + + scale = FloatVectorProperty(name='scale', + default=(1,1,1), + subtype='TRANSLATION', + description='scaling') + + def execute(self, context): + + add_object(self, context) + + return {'FINISHED'} + + +#### REGISTER #### + +def add_object_button(self, context): + self.layout.operator( + OBJECT_OT_add_object.bl_idname, + text="Add Object", + icon="PLUGIN") + +def register(): + bpy.types.INFO_MT_mesh_add.append(add_object_button) + +def unregister(): + bpy.types.INFO_MT_mesh_add.remove(add_object_button) + + +if __name__ == '__main__': + register() diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 5e13560136b..57ac8ff7e2d 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -42,13 +42,10 @@ class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel): arm = context.armature space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif arm: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py index 33dcd8d4c7c..d13232ca2e1 100644 --- a/release/scripts/ui/properties_data_curve.py +++ b/release/scripts/ui/properties_data_curve.py @@ -59,14 +59,10 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel): curve = context.curve space = context.space_data - split = layout.split(percentage=0.65) - if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif curve: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") # XXX: broken class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 4814d067436..52ac88ba168 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -70,13 +70,10 @@ class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel): mesh = context.mesh space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif mesh: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py index 6cb58cb4939..115a20682a9 100644 --- a/release/scripts/ui/properties_data_metaball.py +++ b/release/scripts/ui/properties_data_metaball.py @@ -42,13 +42,10 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel): mball = context.meta_ball space = context.space_data - split = layout.split(percentage=0.65) if ob: - split.template_ID(ob, "data") - split.separator() + layout.template_ID(ob, "data", unlink="None") elif mball: - split.template_ID(space, "pin_id") - split.separator() + layout.template_ID(space, "pin_id", unlink="None") class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index d0184c2d0af..c16dc052b86 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -36,11 +36,11 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel): space = context.space_data ob = context.object - row = layout.row() - row.label(text="", icon='OBJECT_DATA') if space.use_pin_id: - row.template_ID(space, "pin_id") + layout.template_ID(space, "pin_id", unlink="None") else: + row = layout.row() + row.label(text="", icon='OBJECT_DATA') row.prop(ob, "name", text="") diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py index ba1cc9ef626..9fff45d25f9 100644 --- a/release/scripts/ui/properties_physics_common.py +++ b/release/scripts/ui/properties_physics_common.py @@ -56,31 +56,34 @@ def point_cache_ui(self, context, cache, enabled, cachetype): layout.label(text="Cache is disabled until the file is saved") layout.enabled = False - layout.prop(cache, "name", text="File Name") + if cache.use_disk_cache: + layout.prop(cache, "name", text="File Name") + else: + layout.prop(cache, "name", text="Cache Name") - split = layout.split() - col = split.column(align=True) + row = layout.row(align=True) if cachetype != 'PSYS': - col.enabled = enabled - col.prop(cache, "frame_start") - col.prop(cache, "frame_end") + row.enabled = enabled + row.prop(cache, "frame_start") + row.prop(cache, "frame_end") if cachetype not in ('SMOKE', 'CLOTH'): - col.prop(cache, "frame_step") - - col = split.column() + row.prop(cache, "frame_step") + if cachetype != 'SMOKE': + layout.label(text=cache.info) if cachetype != 'SMOKE': - sub = col.column() - sub.enabled = enabled - sub.prop(cache, "use_quick_cache") + split = layout.split() - sub = col.column() - sub.enabled = (not bpy.data.is_dirty) - sub.prop(cache, "use_disk_cache") - col.label(text=cache.info) + col = split.column() + col.enabled = enabled + col.prop(cache, "use_quick_cache") + col = split.column() + col.enabled = (not bpy.data.is_dirty) + col.prop(cache, "use_disk_cache") sub = col.column() + sub.enabled = cache.use_disk_cache sub.prop(cache, "use_library_path", "Use Lib Path") layout.separator() diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index c6fa942eb2d..c72a2f5ca94 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -447,8 +447,12 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel): col = split.column(align=True) col.label(text="Mirror:") - col.prop(tex, "use_mirror_x", text="X") - col.prop(tex, "use_mirror_y", text="Y") + row = col.row() + row.prop(tex, "use_mirror_x", text="X") + row.active = (tex.repeat_x > 1) + row = col.row() + row.prop(tex, "use_mirror_y", text="Y") + row.active = (tex.repeat_y > 1) layout.separator() elif tex.extension == 'CHECKER': diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index de295d0fe76..93c6af38dbc 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -57,8 +57,16 @@ class TIME_HT_header(bpy.types.Header): row.operator("screen.frame_jump", text="", icon='REW').end = False row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False if not screen.is_animation_playing: - row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True - row.operator("screen.animation_play", text="", icon='PLAY') + # if using JACK and A/V sync: + # hide the play-reversed button + # since JACK transport doesn't support reversed playback + if (context.user_preferences.system.audio_device == 'JACK' and scene.sync_mode == 'AUDIO_SYNC'): + sub = row.row() + sub.scale_x = 2.0 + sub.operator("screen.animation_play", text="", icon='PLAY') + else: + row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True + row.operator("screen.animation_play", text="", icon='PLAY') else: sub = row.row() sub.scale_x = 2.0 diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 3a3a526dab5..c3ef572d5c4 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -676,7 +676,7 @@ class VIEW3D_MT_object(bpy.types.Menu): layout.operator("object.delete", text="Delete...") layout.operator("object.proxy_make", text="Make Proxy...") layout.menu("VIEW3D_MT_make_links", text="Make Links...") - layout.operator("object.make_dupli_face", text="Make Dupliface...") + layout.operator("object.make_dupli_face") layout.operator_menu_enum("object.make_local", "type", text="Make Local...") layout.menu("VIEW3D_MT_make_single_user") @@ -897,16 +897,16 @@ class VIEW3D_MT_make_single_user(bpy.types.Menu): props = layout.operator("object.make_single_user", text="Object") props.object = True - props = layout.operator("object.make_single_user", text="Object & ObData") + props = layout.operator("object.make_single_user", text="Object & Data") props.object = props.obdata = True - props = layout.operator("object.make_single_user", text="Object & ObData & Materials+Tex") + props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex") props.object = props.obdata = props.material = props.texture = True props = layout.operator("object.make_single_user", text="Materials+Tex") props.material = props.texture = True - props = layout.operator("object.make_single_user", text="Animation") + props = layout.operator("object.make_single_user", text="Object Animation") props.animation = True @@ -2290,12 +2290,11 @@ class VIEW3D_PT_context_properties(bpy.types.Panel): def draw(self, context): import rna_prop_ui - # reload(rna_prop_ui) member = __class__._active_context_member(context) if member: # Draw with no edit button - rna_prop_ui.draw(self.layout, context, member, False) + rna_prop_ui.draw(self.layout, context, member, object, False) def register(): diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 39d590be8c8..529ec750d67 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -1298,7 +1298,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel): if not pe.is_editable: layout.label(text="Point cache must be baked") - layout.label(text="to enable editing!") + layout.label(text="in memory to enable editing!") col = layout.column(align=True) if pe.is_hair: diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index 376c1147a71..5153cc5b68d 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -47,4 +47,4 @@ set(SRC intern/rgb32.h ) -blenderlib(bf_avi "${SRC}" "${INC}") +blender_add_lib(bf_avi "${SRC}" "${INC}") diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 0b7cb20af83..4f211bdda17 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -55,5 +55,5 @@ if(WIN32 AND NOT UNIX) add_definitions(-DUSE_GETTEXT_DLL) endif() -blenderlib(bf_blenfont "${SRC}" "${INC}") +blender_add_lib(bf_blenfont "${SRC}" "${INC}") diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 83c35cc9799..534427c9da3 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -88,6 +88,8 @@ void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowMa /* use when "" is given to new_id() */ #define ID_FALLBACK_NAME "Untitled" +#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT)) + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 53bb95cb8be..16c99cd850f 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -49,6 +49,7 @@ void resize_object_material(struct Object *ob, const short totcol); void init_material(struct Material *ma); struct Material *add_material(const char *name); struct Material *copy_material(struct Material *ma); +struct Material *localize_material(struct Material *ma); struct Material *give_node_material(struct Material *ma); /* returns node material or self */ void make_local_material(struct Material *ma); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index aba22df0fe3..a7ad95b8ffc 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -95,7 +95,7 @@ typedef struct PTCacheData { typedef struct PTCacheFile { FILE *fp; - int totpoint, type; + int totpoint, type, frame, old_format; unsigned int data_types; struct PTCacheData data; @@ -223,8 +223,8 @@ typedef struct PTCacheEdit { int totpoint, totframes, totcached, edited; - char sel_col[3]; - char nosel_col[3]; + unsigned char sel_col[3]; + unsigned char nosel_col[3]; } PTCacheEdit; /* Particle functions */ @@ -256,9 +256,9 @@ void BKE_ptcache_update_info(PTCacheID *pid); int BKE_ptcache_data_size(int data_type); /* Memory cache read/write helpers. */ -void BKE_ptcache_mem_init_pointers(struct PTCacheMem *pm); -void BKE_ptcache_mem_incr_pointers(struct PTCacheMem *pm); -int BKE_ptcache_mem_seek_pointers(int point_index, struct PTCacheMem *pm); +void BKE_ptcache_mem_pointers_init(struct PTCacheMem *pm); +void BKE_ptcache_mem_pointers_incr(struct PTCacheMem *pm); +int BKE_ptcache_mem_pointers_seek(int point_index, struct PTCacheMem *pm); /* Copy a specific data type from cache data to point data. */ void BKE_ptcache_data_get(void **data, int type, int index, void *to); @@ -267,10 +267,10 @@ void BKE_ptcache_data_get(void **data, int type, int index, void *to); void BKE_ptcache_data_set(void **data, int type, void *from); /* Main cache reading call. */ -int BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec); +int BKE_ptcache_read(PTCacheID *pid, float cfra, float frs_sec); /* Main cache writing call. */ -int BKE_ptcache_write_cache(PTCacheID *pid, int cfra); +int BKE_ptcache_write(PTCacheID *pid, int cfra); /****************** Continue physics ***************/ void BKE_ptcache_set_continue_physics(struct Main *bmain, struct Scene *scene, int enable); @@ -289,7 +289,7 @@ struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct L void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene); /* Bake cache or simulate to current frame with settings defined in the baker. */ -void BKE_ptcache_make_cache(struct PTCacheBaker* baker); +void BKE_ptcache_bake(struct PTCacheBaker* baker); /* Convert disk cache to memory cache. */ void BKE_ptcache_disk_to_mem(struct PTCacheID *pid); diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 2d4ea812f57..cf77049b599 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -96,4 +96,6 @@ int sound_scene_playing(struct Scene *scene); int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end); +int sound_get_channels(struct bSound* sound); + #endif diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index f98d5842eb5..5f55f8b351e 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -94,7 +94,7 @@ void indent (struct Text *text); void uncomment (struct Text *text); int setcurr_tab_spaces (struct Text *text, int space); -void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags); +void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags); short txt_clear_marker_region (struct Text *text, struct TextLine *line, int start, int end, int group, int flags); short txt_clear_markers (struct Text *text, int group, int flags); struct TextMarker *txt_find_marker (struct Text *text, struct TextLine *line, int curs, int group, int flags); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 7b709e217d6..b869bb51864 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -304,4 +304,4 @@ if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif() -blenderlib(bf_blenkernel "${SRC}" "${INC}") +blender_add_lib(bf_blenkernel "${SRC}" "${INC}") diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 20b7efe2a89..c5c7575da38 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -91,4 +91,4 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25]) #, cc_compileflags = env['CCFLAGS'].append('/WX') ) else: - env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25] ) + env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player', 'player2'], priority = [166,25,0] ) diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 0d1d08af44c..22d27dc2fde 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1500,7 +1500,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected */ extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints); copy_constraints(&pchanw.constraints, &pchanp->constraints, FALSE); - addlisttolist(&pchanw.constraints, &proxylocal_constraints); + BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints); /* constraints - set target ob pointer to own object */ for (con= pchanw.constraints.first; con; con= con->next) { diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index d6c91c3c908..8030a3655ad 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -744,6 +744,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if( !GPU_buffer_legacy(dm) ) { glShadeModel( GL_SMOOTH ); + lastFlag = 0; for(i = 0; i < dm->drawObject->nelements/3; i++) { int actualFace = dm->drawObject->faceRemap[i]; int flag = 1; @@ -754,6 +755,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, else { if(index) { orig = index[actualFace]; + if(orig == ORIGINDEX_NONE) continue; if(drawParamsMapped) flag = drawParamsMapped(userData, orig); } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 7473ff6875a..f644b28b137 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -504,7 +504,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, } /* try to read from cache */ - cache_result = BKE_ptcache_read_cache(&pid, (float)framenr+scene->r.subframe, scene->r.frs_sec); + cache_result = BKE_ptcache_read(&pid, (float)framenr+scene->r.subframe, scene->r.frs_sec); if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) { implicit_set_positions(clmd); @@ -513,7 +513,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, BKE_ptcache_validate(cache, framenr); if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) - BKE_ptcache_write_cache(&pid, framenr); + BKE_ptcache_write(&pid, framenr); return result; } @@ -528,7 +528,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - BKE_ptcache_write_cache(&pid, startframe); + BKE_ptcache_write(&pid, startframe); clmd->sim_parms->timescale *= framenr - cache->simframe; @@ -539,7 +539,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, BKE_ptcache_invalidate(cache); } else - BKE_ptcache_write_cache(&pid, framenr); + BKE_ptcache_write(&pid, framenr); cloth_to_object (ob, clmd, result); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index bb0fc23c02c..b0932533ea6 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -861,6 +861,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta } } +/* XXX note, con->flag should be CONSTRAINT_SPACEONCE for bone-childof, patched in readfile.c */ static bConstraintTypeInfo CTI_CHILDOF = { CONSTRAINT_TYPE_CHILDOF, /* type */ sizeof(bChildOfConstraint), /* size */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 9be64e27d20..6368c139baf 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -139,7 +139,7 @@ Curve *add_curve(const char *name, int type) cu->size[0]= cu->size[1]= cu->size[2]= 1.0; cu->flag= CU_FRONT|CU_BACK|CU_DEFORM_BOUNDS_OFF|CU_PATH_RADIUS; cu->pathlen= 100; - cu->resolu= cu->resolv= 12; + cu->resolu= cu->resolv= (type == OB_SURF) ? 4 : 12; cu->width= 1.0; cu->wordspace = 1.0; cu->spacing= cu->linedist= 1.0; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 67d485d2dc3..e178beaaa50 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -692,7 +692,7 @@ static void layerInterp_mdisps(void **sources, float *UNUSED(weights), s = sources[0]; dst_corners = multires_mdisp_corners(d); - src_corners = multires_mdisp_corners(d); + src_corners = multires_mdisp_corners(s); /* XXX: For now, some restrictions on the input should be implemented to allow quad<->tris face conversion */ @@ -1444,9 +1444,8 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, data->layers[index].type = type; data->layers[index].flag = flag; data->layers[index].data = newlayerdata; - if(name || (name=typeInfo->defaultname)) { - strcpy(data->layers[index].name, name); + BLI_strncpy(data->layers[index].name, name, 32); CustomData_set_layer_unique_name(data, index); } else diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f2a100134b3..70bfc96f0a2 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2221,7 +2221,7 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr) if(cfra==0) cfra= len; } - if(cfra<1) cfra= 1; + if(cfra<0) cfra= 0; else if(cfra>len) cfra= len; /* convert current frame to current field */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5be8bda4cd9..a040c27caa0 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1516,14 +1516,14 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], } /* add F-Curves to action */ - addlisttolist(&adt->action->curves, &anim); + BLI_movelisttolist(&adt->action->curves, &anim); } /* deal with drivers */ if (drivers.first) { if (G.f & G_DEBUG) printf("\thas drivers \n"); /* add drivers to end of driver stack */ - addlisttolist(&adt->drivers, &drivers); + BLI_movelisttolist(&adt->drivers, &drivers); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index b8562460fcd..9d6a430cb56 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -44,6 +44,7 @@ #include "DNA_scene_types.h" #include "BLI_math.h" +#include "BLI_listbase.h" #include "BKE_animsys.h" #include "BKE_displist.h" @@ -197,6 +198,7 @@ Material *add_material(const char *name) return ma; } +/* XXX keep synced with next function */ Material *copy_material(Material *ma) { Material *man; @@ -204,9 +206,6 @@ Material *copy_material(Material *ma) man= copy_libblock(ma); -#if 0 // XXX old animation system - id_us_plus((ID *)man->ipo); -#endif // XXX old animation system id_lib_extern((ID *)man->group); for(a=0; a<MAX_MTEX; a++) { @@ -231,6 +230,38 @@ Material *copy_material(Material *ma) return man; } +/* XXX (see above) material copy without adding to main dbase */ +Material *localize_material(Material *ma) +{ + Material *man; + int a; + + man= copy_libblock(ma); + BLI_remlink(&G.main->mat, man); + + for(a=0; a<MAX_MTEX; a++) { + if(ma->mtex[a]) { + man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial"); + memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex)); + /* free_material decrements! */ + id_us_plus((ID *)man->mtex[a]->tex); + } + } + + if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col); + if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec); + + if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview); + + if(ma->nodetree) { + man->nodetree= ntreeLocalize(ma->nodetree); + } + + man->gpumaterial.first= man->gpumaterial.last= NULL; + + return man; +} + void make_local_material(Material *ma) { Main *bmain= G.main; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 6381315a8ca..f8fdc9e32a4 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -236,7 +236,8 @@ void modifier_setError(ModifierData *md, const char *format, ...) * there * * also used in transform_conversion.c, to detect CrazySpace [tm] (2nd arg - * then is NULL) + * then is NULL) + * also used for some mesh tools to give warnings */ int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCageIndex_r, int virtual_) { diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 4b158f4b405..f52a538cc00 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1186,12 +1186,12 @@ static void node_init_preview(bNode *node, int xsize, int ysize) } if(node->preview->rect==NULL) { - node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(float)*4, "node preview rect"); + node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(char)*4, "node preview rect"); node->preview->xsize= xsize; node->preview->ysize= ysize; } else - memset(node->preview->rect, 0, 4*xsize + xsize*ysize*sizeof(float)*4); + memset(node->preview->rect, 0, 4*xsize + xsize*ysize*sizeof(char)*4); } void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize) @@ -1241,12 +1241,18 @@ void nodeAddToPreview(bNode *node, float *col, int x, int y) if(x>=0 && y>=0) { if(x<preview->xsize && y<preview->ysize) { unsigned char *tar= preview->rect+ 4*((preview->xsize*y) + x); - //if(tar[0]==0.0f) { - tar[0]= FTOCHAR(col[0]); - tar[1]= FTOCHAR(col[1]); - tar[2]= FTOCHAR(col[2]); + + if(TRUE) { + tar[0]= FTOCHAR(linearrgb_to_srgb(col[0])); + tar[1]= FTOCHAR(linearrgb_to_srgb(col[1])); + tar[2]= FTOCHAR(linearrgb_to_srgb(col[2])); + } + else { + tar[0]= FTOCHAR(col[0]); + tar[1]= FTOCHAR(col[1]); + tar[2]= FTOCHAR(col[2]); + } tar[3]= FTOCHAR(col[3]); - //} } //else printf("prv out bound x y %d %d\n", x, y); } @@ -1712,14 +1718,28 @@ static void ntreeSetOutput(bNodeTree *ntree) /* there is more types having output class, each one is checked */ for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) { if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) { - /* same type, exception for viewer */ - if(tnode->type==node->type || - (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && - ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))) { - if(tnode->flag & NODE_DO_OUTPUT) { - output++; - if(output>1) - tnode->flag &= ~NODE_DO_OUTPUT; + + if(ntree->type==NTREE_COMPOSIT) { + + /* same type, exception for viewer */ + if(tnode->type==node->type || + (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && + ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))) { + if(tnode->flag & NODE_DO_OUTPUT) { + output++; + if(output>1) + tnode->flag &= ~NODE_DO_OUTPUT; + } + } + } + else { + /* same type */ + if(tnode->type==node->type) { + if(tnode->flag & NODE_DO_OUTPUT) { + output++; + if(output>1) + tnode->flag &= ~NODE_DO_OUTPUT; + } } } } @@ -2586,8 +2606,6 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) /* ensures only a single output node is enabled */ ntreeSetOutput(ntree); - /* move over the compbufs */ - /* right after ntreeCopyTree() oldsock pointers are valid */ for(node= ntree->nodes.first; node; node= node->next) { /* store new_node pointer to original */ @@ -2595,22 +2613,27 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) /* ensure new user input gets handled ok */ node->need_exec= 0; - if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { - if(node->id) { - if(node->flag & NODE_DO_OUTPUT) - node->new_node->id= (ID *)copy_image((Image *)node->id); - else - node->new_node->id= NULL; - } - } - - for(sock= node->outputs.first; sock; sock= sock->next) { + if(ntree->type==NTREE_COMPOSIT) { + /* move over the compbufs */ + /* right after ntreeCopyTree() oldsock pointers are valid */ - sock->new_sock->ns.data= sock->ns.data; - compbuf_set_node(sock->new_sock->ns.data, node->new_node); + if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { + if(node->id) { + if(node->flag & NODE_DO_OUTPUT) + node->new_node->id= (ID *)copy_image((Image *)node->id); + else + node->new_node->id= NULL; + } + } - sock->ns.data= NULL; - sock->new_sock->new_sock= sock; + for(sock= node->outputs.first; sock; sock= sock->next) { + + sock->new_sock->ns.data= sock->ns.data; + compbuf_set_node(sock->new_sock->ns.data, node->new_node); + + sock->ns.data= NULL; + sock->new_sock->new_sock= sock; + } } } @@ -2638,19 +2661,38 @@ static int outsocket_exists(bNode *node, bNodeSocket *testsock) /* sync local composite with real tree */ /* local composite is supposed to be running, be careful moving previews! */ +/* is called by jobs manager, outside threads, so it doesnt happen during draw */ void ntreeLocalSync(bNodeTree *localtree, bNodeTree *ntree) { bNode *lnode; - /* move over the compbufs and previews */ - for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { - if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) { + if(ntree->type==NTREE_COMPOSIT) { + /* move over the compbufs and previews */ + for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { + if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) { + if(node_exists(ntree, lnode->new_node)) { + + if(lnode->preview && lnode->preview->rect) { + node_free_preview(lnode->new_node); + lnode->new_node->preview= lnode->preview; + lnode->preview= NULL; + } + } + } + } + } + else if(ntree->type==NTREE_SHADER) { + /* copy over contents of previews */ + for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) { if(node_exists(ntree, lnode->new_node)) { + bNode *node= lnode->new_node; - if(lnode->preview && lnode->preview->rect) { - node_free_preview(lnode->new_node); - lnode->new_node->preview= lnode->preview; - lnode->preview= NULL; + if(node->preview && node->preview->rect) { + if(lnode->preview && lnode->preview->rect) { + int xsize= node->preview->xsize; + int ysize= node->preview->ysize; + memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4); + } } } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 28b26ac18b2..60503128f80 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2560,12 +2560,12 @@ void object_handle_update(Scene *scene, Object *ob) case OB_MESH: { EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL; - // here was vieweditdatamask? XXX + BKE_assert((scene->customdata_mask & CD_MASK_BAREMESH) == CD_MASK_BAREMESH); if(em) { - makeDerivedMesh(scene, ob, em, CD_MASK_BAREMESH); + makeDerivedMesh(scene, ob, em, scene->customdata_mask); /* was CD_MASK_BAREMESH */ BKE_mesh_end_editmesh(ob->data, em); } else - makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH); + makeDerivedMesh(scene, ob, NULL, scene->customdata_mask); } break; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f112689a63b..1f36f0845a2 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3663,9 +3663,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) part->sta=part->end = 1.0f; part->lifetime = sim->scene->r.efra + 1; - /* initialize particles */ + /* allocate particles */ realloc_particles(sim, part->totpart); - initialize_all_particles(sim); // set up reading mask readMask = fss->typeFlags; @@ -3697,6 +3696,9 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) pa->state.rot[0] = 1.0; pa->state.rot[1] = pa->state.rot[2] = pa->state.rot[3] = 0.0; + pa->time = 1.f; + pa->dietime = sim->scene->r.efra + 1; + pa->lifetime = sim->scene->r.efra; pa->alive = PARS_ALIVE; //if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime ); } else { @@ -3793,7 +3795,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) /* 2. try to read from the cache */ if(pid) { - int cache_result = BKE_ptcache_read_cache(pid, cache_cfra, sim->scene->r.frs_sec); + int cache_result = BKE_ptcache_read(pid, cache_cfra, sim->scene->r.frs_sec); if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) { cached_step(sim, cfra); @@ -3803,7 +3805,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) BKE_ptcache_validate(cache, (int)cache_cfra); if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) - BKE_ptcache_write_cache(pid, (int)cache_cfra); + BKE_ptcache_write(pid, (int)cache_cfra); return; } @@ -3818,7 +3820,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) /* if on second frame, write cache for first frame */ if(psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - BKE_ptcache_write_cache(pid, startframe); + BKE_ptcache_write(pid, startframe); } else BKE_ptcache_invalidate(cache); @@ -3859,7 +3861,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) if(pid) { BKE_ptcache_validate(cache, (int)cache_cfra); if((int)cache_cfra != startframe) - BKE_ptcache_write_cache(pid, (int)cache_cfra); + BKE_ptcache_write(pid, (int)cache_cfra); } update_children(sim); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 8c5d38b63a3..7a8d3a8b19c 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -106,8 +106,12 @@ int ptcache_data_size[] = { sizeof(BoidData) // case BPHYS_DATA_BOIDS: }; +/* forward declerations */ +static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size); +static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size); + /* Common functions */ -static int ptcache_read_basic_header(PTCacheFile *pf) +static int ptcache_basic_header_read(PTCacheFile *pf) { int error=0; @@ -120,7 +124,7 @@ static int ptcache_read_basic_header(PTCacheFile *pf) return !error; } -static int ptcache_write_basic_header(PTCacheFile *pf) +static int ptcache_basic_header_write(PTCacheFile *pf) { /* Custom functions should write these basic elements too! */ if(!fwrite(&pf->totpoint, sizeof(int), 1, pf->fp)) @@ -132,7 +136,7 @@ static int ptcache_write_basic_header(PTCacheFile *pf) return 1; } /* Softbody functions */ -static int ptcache_write_softbody(int index, void *soft_v, void **data, int UNUSED(cfra)) +static int ptcache_softbody_write(int index, void *soft_v, void **data, int UNUSED(cfra)) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -142,7 +146,7 @@ static int ptcache_write_softbody(int index, void *soft_v, void **data, int UNUS return 1; } -static void ptcache_read_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) +static void ptcache_softbody_read(int index, void *soft_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -156,7 +160,7 @@ static void ptcache_read_softbody(int index, void *soft_v, void **data, float UN PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, bp->vec); } } -static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -188,13 +192,29 @@ static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, f VECCOPY(bp->pos, keys->co); VECCOPY(bp->vec, keys->vel); } -static int ptcache_totpoint_softbody(void *soft_v, int UNUSED(cfra)) +static int ptcache_softbody_totpoint(void *soft_v, int UNUSED(cfra)) { SoftBody *soft= soft_v; return soft->totpoint; } /* Particle functions */ -static int ptcache_write_particle(int index, void *psys_v, void **data, int cfra) +void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time) +{ + PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co); + PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel); + + /* no rotation info, so make something nice up */ + if(data[BPHYS_DATA_ROTATION]==NULL) { + vec_to_quat( key->rot, key->vel, OB_NEGX, OB_POSZ); + } + else { + PTCACHE_DATA_TO(data, BPHYS_DATA_ROTATION, index, key->rot); + } + + PTCACHE_DATA_TO(data, BPHYS_DATA_AVELOCITY, index, key->ave); + key->time = time; +} +static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra) { ParticleSystem *psys= psys_v; ParticleData *pa = psys->particles + index; @@ -224,23 +244,7 @@ static int ptcache_write_particle(int index, void *psys_v, void **data, int cfra /* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */ return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time); } -void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time) -{ - PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co); - PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel); - - /* no rotation info, so make something nice up */ - if(data[BPHYS_DATA_ROTATION]==NULL) { - vec_to_quat( key->rot, key->vel, OB_NEGX, OB_POSZ); - } - else { - PTCACHE_DATA_TO(data, BPHYS_DATA_ROTATION, index, key->rot); - } - - PTCACHE_DATA_TO(data, BPHYS_DATA_AVELOCITY, index, key->ave); - key->time = time; -} -static void ptcache_read_particle(int index, void *psys_v, void **data, float frs_sec, float cfra, float *old_data) +static void ptcache_particle_read(int index, void *psys_v, void **data, float frs_sec, float cfra, float *old_data) { ParticleSystem *psys= psys_v; ParticleData *pa; @@ -298,7 +302,7 @@ static void ptcache_read_particle(int index, void *psys_v, void **data, float fr vec_to_quat( pa->state.rot,pa->state.vel, OB_NEGX, OB_POSZ); } } -static void ptcache_interpolate_particle(int index, void *psys_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) { ParticleSystem *psys= psys_v; ParticleData *pa; @@ -360,12 +364,12 @@ static void ptcache_interpolate_particle(int index, void *psys_v, void **data, f pa->state.time = cfra; } -static int ptcache_totpoint_particle(void *psys_v, int UNUSED(cfra)) +static int ptcache_particle_totpoint(void *psys_v, int UNUSED(cfra)) { ParticleSystem *psys = psys_v; return psys->totpart; } -static int ptcache_totwrite_particle(void *psys_v, int cfra) +static int ptcache_particle_totwrite(void *psys_v, int cfra) { ParticleSystem *psys = psys_v; ParticleData *pa= psys->particles; @@ -378,134 +382,8 @@ static int ptcache_totwrite_particle(void *psys_v, int cfra) return totwrite; } -//static int ptcache_write_particle_stream(PTCacheFile *pf, PTCacheMem *pm, void *psys_v) -//{ -// ParticleSystem *psys= psys_v; -// ParticleData *pa = psys->particles; -// BoidParticle *boid = NULL; -// float times[3]; -// int i = 0; -// -// if(!pf && !pm) -// return 0; -// -// for(i=0; i<psys->totpart; i++, pa++) { -// -// if(data[BPHYS_DATA_INDEX]) { -// int step = psys->pointcache->step; -// /* No need to store unborn or died particles */ -// if(pa->time - step > pa->state.time || pa->dietime + step < pa->state.time) -// continue; -// } -// -// times[0] = pa->time; -// times[1] = pa->dietime; -// times[2] = pa->lifetime; -// -// PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, pa->state.rot); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_AVELOCITY, pa->state.ave); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size); -// PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times); -// -// boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL; -// if(boid) -// PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data); -// -// if(pf && !ptcache_file_write_data(pf)) -// return 0; -// -// if(pm) -// BKE_ptcache_mem_incr_pointers(pm); -// } -// -// return 1; -//} -//static void ptcache_read_particle_stream(PTCacheFile *pf, PTCacheMem *pm, void *psys_v, void **data, float frs_sec, float cfra, float *old_data) -//{ -// ParticleSystem *psys= psys_v; -// ParticleData *pa = psys->particles + index; -// BoidParticle *boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL; -// -// if(cfra > pa->state.time) -// memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey)); -// -// if(old_data){ -// /* old format cache */ -// memcpy(&pa->state, old_data, sizeof(ParticleKey)); -// return; -// } -// -// BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra); -// -// if(data[BPHYS_DATA_SIZE]) -// PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size); -// -// if(data[BPHYS_DATA_TIMES]) { -// float times[3]; -// PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, ×); -// pa->time = times[0]; -// pa->dietime = times[1]; -// pa->lifetime = times[2]; -// } -// -// if(boid) -// PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data); -// -// /* determine velocity from previous location */ -// if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { -// if(cfra > pa->prev_state.time) { -// sub_v3_v3v3(pa->state.vel, pa->state.co, pa->prev_state.co); -// mul_v3_fl(pa->state.vel, (cfra - pa->prev_state.time) / frs_sec); -// } -// else { -// sub_v3_v3v3(pa->state.vel, pa->prev_state.co, pa->state.co); -// mul_v3_fl(pa->state.vel, (pa->prev_state.time - cfra) / frs_sec); -// } -// } -// -// /* determine rotation from velocity */ -// if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) { -// vec_to_quat( pa->state.rot,pa->state.vel, OB_POSX, OB_POSZ); -// } -//} -//static void ptcache_interpolate_particle_stream(int index, void *psys_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) -//{ -// ParticleSystem *psys= psys_v; -// ParticleData *pa = psys->particles + index; -// ParticleKey keys[4]; -// float dfra; -// -// cfra = MIN2(cfra, pa->dietime); -// cfra1 = MIN2(cfra1, pa->dietime); -// cfra2 = MIN2(cfra2, pa->dietime); -// -// if(cfra1 == cfra2) -// return; -// -// memcpy(keys+1, &pa->state, sizeof(ParticleKey)); -// if(old_data) -// memcpy(keys+2, old_data, sizeof(ParticleKey)); -// else -// BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); -// -// dfra = cfra2 - cfra1; -// -// mul_v3_fl(keys[1].vel, dfra / frs_sec); -// mul_v3_fl(keys[2].vel, dfra / frs_sec); -// -// psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &pa->state, 1); -// interp_qt_qtqt(pa->state.rot, keys[1].rot,keys[2].rot, (cfra - cfra1) / dfra); -// -// mul_v3_fl(pa->state.vel, frs_sec / dfra); -// -// pa->state.time = cfra; -//} -// /* Cloth functions */ -static int ptcache_write_cloth(int index, void *cloth_v, void **data, int UNUSED(cfra)) +static int ptcache_cloth_write(int index, void *cloth_v, void **data, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -517,7 +395,7 @@ static int ptcache_write_cloth(int index, void *cloth_v, void **data, int UNUSED return 1; } -static void ptcache_read_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) +static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -534,7 +412,7 @@ static void ptcache_read_cloth(int index, void *cloth_v, void **data, float UNUS PTCACHE_DATA_TO(data, BPHYS_DATA_XCONST, 0, vert->xconst); } } -static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -570,114 +448,14 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo /* should vert->xconst be interpolated somehow too? - jahka */ } -static int ptcache_totpoint_cloth(void *cloth_v, int UNUSED(cfra)) +static int ptcache_cloth_totpoint(void *cloth_v, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; return clmd->clothObject ? clmd->clothObject->numverts : 0; } -/* Creating ID's */ -void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) -{ - memset(pid, 0, sizeof(PTCacheID)); - - pid->ob= ob; - pid->calldata= sb; - pid->type= PTCACHE_TYPE_SOFTBODY; - pid->cache= sb->pointcache; - pid->cache_ptr= &sb->pointcache; - pid->ptcaches= &sb->ptcaches; - pid->totpoint= pid->totwrite= ptcache_totpoint_softbody; - - pid->write_elem= ptcache_write_softbody; - pid->write_stream = NULL; - pid->read_stream = NULL; - pid->read_elem= ptcache_read_softbody; - pid->interpolate_elem= ptcache_interpolate_softbody; - - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; - - pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY); - pid->info_types= 0; - - pid->stack_index = pid->cache->index; -} - -void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys) -{ - memset(pid, 0, sizeof(PTCacheID)); - - pid->ob= ob; - pid->calldata= psys; - pid->type= PTCACHE_TYPE_PARTICLES; - pid->stack_index= psys->pointcache->index; - pid->cache= psys->pointcache; - pid->cache_ptr= &psys->pointcache; - pid->ptcaches= &psys->ptcaches; - - if(psys->part->type != PART_HAIR) - pid->flag |= PTCACHE_VEL_PER_SEC; - - pid->write_elem= ptcache_write_particle; - pid->write_stream = NULL; - pid->read_stream = NULL; - pid->read_elem= ptcache_read_particle; - pid->interpolate_elem= ptcache_interpolate_particle; - - pid->totpoint= ptcache_totpoint_particle; - pid->totwrite= ptcache_totwrite_particle; - - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; - - pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX); - - if(psys->part->phystype == PART_PHYS_BOIDS) - pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS); - - if(psys->part->rotmode!=PART_ROT_VEL - || psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f) - pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION); - - if(psys->part->flag & PART_ROT_DYN) - pid->data_types|= (1<<BPHYS_DATA_ROTATION); - - pid->info_types= (1<<BPHYS_DATA_TIMES); -} - -/* Smoke functions */ -static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra)) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - - if(sds->fluid) { - return sds->res[0]*sds->res[1]*sds->res[2]; - } - else - return 0; -} - /* Smoke functions */ -#if 0 -static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - - if(sds->wt) { - return sds->res_wt[0]*sds->res_wt[1]*sds->res_wt[2]; - } - else - return 0; -} -#endif - -// forward decleration -static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size); - -static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode) +static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode) { int r = 0; unsigned char compressed = 0; @@ -731,7 +509,66 @@ static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned i return r; } -static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) +static int ptcache_compress_read(PTCacheFile *pf, unsigned char *result, unsigned int len) +{ + int r = 0; + unsigned char compressed = 0; + unsigned int in_len; +#ifdef WITH_LZO + unsigned int out_len = len; + size_t sizeOfIt = 5; +#endif + unsigned char *in; + unsigned char *props = MEM_callocN(16*sizeof(char), "tmp"); + + ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char)); + if(compressed) { + ptcache_file_read(pf, &in_len, 1, sizeof(unsigned int)); + if(in_len==0) { + /* do nothing */ + } + else { + in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer"); + ptcache_file_read(pf, in, in_len, sizeof(unsigned char)); +#ifdef WITH_LZO + if(compressed == 1) + r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL); +#endif +#ifdef WITH_LZMA + if(compressed == 2) + { + size_t leni = in_len, leno = out_len; + ptcache_file_read(pf, &sizeOfIt, 1, sizeof(unsigned int)); + ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char)); + r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt); + } +#endif + MEM_freeN(in); + } + } + else { + ptcache_file_read(pf, result, len, sizeof(unsigned char)); + } + + MEM_freeN(props); + + return r; +} + +static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra)) +{ + SmokeModifierData *smd= (SmokeModifierData *)smoke_v; + SmokeDomainSettings *sds = smd->domain; + + if(sds->fluid) { + return sds->res[0]*sds->res[1]*sds->res[2]; + } + else + return 0; +} + + +static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -807,56 +644,8 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) } -// forward decleration -static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size); - -static int ptcache_compress_read(PTCacheFile *pf, unsigned char *result, unsigned int len) -{ - int r = 0; - unsigned char compressed = 0; - unsigned int in_len; -#ifdef WITH_LZO - unsigned int out_len = len; - size_t sizeOfIt = 5; -#endif - unsigned char *in; - unsigned char *props = MEM_callocN(16*sizeof(char), "tmp"); - - ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char)); - if(compressed) { - ptcache_file_read(pf, &in_len, 1, sizeof(unsigned int)); - if(in_len==0) { - /* do nothing */ - } - else { - in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer"); - ptcache_file_read(pf, in, in_len, sizeof(unsigned char)); -#ifdef WITH_LZO - if(compressed == 1) - r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL); -#endif -#ifdef WITH_LZMA - if(compressed == 2) - { - size_t leni = in_len, leno = out_len; - ptcache_file_read(pf, &sizeOfIt, 1, sizeof(unsigned int)); - ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char)); - r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt); - } -#endif - MEM_freeN(in); - } - } - else { - ptcache_file_read(pf, result, len, sizeof(unsigned char)); - } - - MEM_freeN(props); - - return r; -} -static void ptcache_read_smoke(PTCacheFile *pf, void *smoke_v) +static void ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -907,42 +696,74 @@ static void ptcache_read_smoke(PTCacheFile *pf, void *smoke_v) } } -void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd) +/* Creating ID's */ +void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) { - SmokeDomainSettings *sds = smd->domain; + memset(pid, 0, sizeof(PTCacheID)); + + pid->ob= ob; + pid->calldata= sb; + pid->type= PTCACHE_TYPE_SOFTBODY; + pid->cache= sb->pointcache; + pid->cache_ptr= &sb->pointcache; + pid->ptcaches= &sb->ptcaches; + pid->totpoint= pid->totwrite= ptcache_softbody_totpoint; + + pid->write_elem= ptcache_softbody_write; + pid->write_stream = NULL; + pid->read_stream = NULL; + pid->read_elem= ptcache_softbody_read; + pid->interpolate_elem= ptcache_softbody_interpolate; + + pid->write_header= ptcache_basic_header_write; + pid->read_header= ptcache_basic_header_read; + + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY); + pid->info_types= 0; + pid->stack_index = pid->cache->index; +} + +void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys) +{ memset(pid, 0, sizeof(PTCacheID)); pid->ob= ob; - pid->calldata= smd; - - pid->type= PTCACHE_TYPE_SMOKE_DOMAIN; - pid->stack_index= sds->point_cache[0]->index; + pid->calldata= psys; + pid->type= PTCACHE_TYPE_PARTICLES; + pid->stack_index= psys->pointcache->index; + pid->cache= psys->pointcache; + pid->cache_ptr= &psys->pointcache; + pid->ptcaches= &psys->ptcaches; - pid->cache= sds->point_cache[0]; - pid->cache_ptr= &(sds->point_cache[0]); - pid->ptcaches= &(sds->ptcaches[0]); + if(psys->part->type != PART_HAIR) + pid->flag |= PTCACHE_VEL_PER_SEC; - pid->totpoint= pid->totwrite= ptcache_totpoint_smoke; + pid->write_elem= ptcache_particle_write; + pid->write_stream = NULL; + pid->read_stream = NULL; + pid->read_elem= ptcache_particle_read; + pid->interpolate_elem= ptcache_particle_interpolate; - pid->write_elem= NULL; - pid->read_elem= NULL; + pid->totpoint= ptcache_particle_totpoint; + pid->totwrite= ptcache_particle_totwrite; - pid->read_stream = ptcache_read_smoke; - pid->write_stream = ptcache_write_smoke; - - pid->interpolate_elem= NULL; + pid->write_header= ptcache_basic_header_write; + pid->read_header= ptcache_basic_header_read; - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX); - pid->data_types= 0; - pid->info_types= 0; + if(psys->part->phystype == PART_PHYS_BOIDS) + pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS); - if(sds->fluid) - pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW); - if(sds->wt) - pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH); + if(psys->part->rotmode!=PART_ROT_VEL + || psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f) + pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION); + + if(psys->part->flag & PART_ROT_DYN) + pid->data_types|= (1<<BPHYS_DATA_ROTATION); + + pid->info_types= (1<<BPHYS_DATA_TIMES); } void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd) @@ -956,21 +777,59 @@ void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *cl pid->cache= clmd->point_cache; pid->cache_ptr= &clmd->point_cache; pid->ptcaches= &clmd->ptcaches; - pid->totpoint= pid->totwrite= ptcache_totpoint_cloth; + pid->totpoint= pid->totwrite= ptcache_cloth_totpoint; - pid->write_elem= ptcache_write_cloth; + pid->write_elem= ptcache_cloth_write; pid->write_stream = NULL; pid->read_stream = NULL; - pid->read_elem= ptcache_read_cloth; - pid->interpolate_elem= ptcache_interpolate_cloth; + pid->read_elem= ptcache_cloth_read; + pid->interpolate_elem= ptcache_cloth_interpolate; - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; + pid->write_header= ptcache_basic_header_write; + pid->read_header= ptcache_basic_header_read; pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_XCONST); pid->info_types= 0; } +void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd) +{ + SmokeDomainSettings *sds = smd->domain; + + memset(pid, 0, sizeof(PTCacheID)); + + pid->ob= ob; + pid->calldata= smd; + + pid->type= PTCACHE_TYPE_SMOKE_DOMAIN; + pid->stack_index= sds->point_cache[0]->index; + + pid->cache= sds->point_cache[0]; + pid->cache_ptr= &(sds->point_cache[0]); + pid->ptcaches= &(sds->ptcaches[0]); + + pid->totpoint= pid->totwrite= ptcache_smoke_totpoint; + + pid->write_elem= NULL; + pid->read_elem= NULL; + + pid->read_stream = ptcache_smoke_read; + pid->write_stream = ptcache_smoke_write; + + pid->interpolate_elem= NULL; + + pid->write_header= ptcache_basic_header_write; + pid->read_header= ptcache_basic_header_read; + + pid->data_types= 0; + pid->info_types= 0; + + if(sds->fluid) + pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW); + if(sds->wt) + pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH); +} + void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis) { PTCacheID *pid; @@ -1031,7 +890,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup if(dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */ ListBase lb_dupli_pid; BKE_ptcache_ids_from_object(&lb_dupli_pid, dob->ob, scene, duplis); - addlisttolist(lb, &lb_dupli_pid); + BLI_movelisttolist(lb, &lb_dupli_pid); if(lb_dupli_pid.first) printf("Adding Dupli\n"); } @@ -1090,7 +949,7 @@ static int ptcache_path(PTCacheID *pid, char *filename) return BLI_add_slash(filename); /* new strlen() */ } -static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, short do_path, short do_ext) +static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_path, short do_ext) { int len=0; char *idname; @@ -1155,7 +1014,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) #endif if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */ - BKE_ptcache_id_filename(pid, filename, cfra, 1, 1); + ptcache_filename(pid, filename, cfra, 1, 1); if (mode==PTCACHE_FILE_READ) { if (!BLI_exists(filename)) { @@ -1175,6 +1034,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) pf= MEM_mallocN(sizeof(PTCacheFile), "PTCacheFile"); pf->fp= fp; + pf->old_format = 0; return pf; } @@ -1193,7 +1053,7 @@ static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size) { return (fwrite(f, size, tot, pf->fp) == tot); } -static int ptcache_file_read_data(PTCacheFile *pf) +static int ptcache_file_data_read(PTCacheFile *pf) { int i; @@ -1204,7 +1064,7 @@ static int ptcache_file_read_data(PTCacheFile *pf) return 1; } -static int ptcache_file_write_data(PTCacheFile *pf) +static int ptcache_file_data_write(PTCacheFile *pf) { int i; @@ -1215,7 +1075,7 @@ static int ptcache_file_write_data(PTCacheFile *pf) return 1; } -static int ptcache_file_read_header_begin(PTCacheFile *pf) +static int ptcache_file_header_begin_read(PTCacheFile *pf) { int error=0; char bphysics[8]; @@ -1239,7 +1099,7 @@ static int ptcache_file_read_header_begin(PTCacheFile *pf) } -static int ptcache_file_write_header_begin(PTCacheFile *pf) +static int ptcache_file_header_begin_write(PTCacheFile *pf) { const char *bphysics = "BPHYSICS"; @@ -1259,7 +1119,7 @@ int BKE_ptcache_data_size(int data_type) return ptcache_data_size[data_type]; } -static void ptcache_file_init_pointers(PTCacheFile *pf) +static void ptcache_file_pointers_init(PTCacheFile *pf) { int data_types = pf->data_types; @@ -1273,7 +1133,7 @@ static void ptcache_file_init_pointers(PTCacheFile *pf) pf->cur[BPHYS_DATA_BOIDS] = (data_types & (1<<BPHYS_DATA_BOIDS)) ? &pf->data.boids : NULL; } -static void ptcache_file_seek_pointers(int index, PTCacheFile *pf) +static void ptcache_file_pointers_seek(int index, PTCacheFile *pf) { int i, size=0; int data_types = pf->data_types; @@ -1303,9 +1163,9 @@ static void ptcache_file_seek_pointers(int index, PTCacheFile *pf) fseek(pf->fp, 8 + 3*sizeof(int) + index * size, SEEK_SET); } - ptcache_file_init_pointers(pf); + ptcache_file_pointers_init(pf); } -void BKE_ptcache_mem_init_pointers(PTCacheMem *pm) +void BKE_ptcache_mem_pointers_init(PTCacheMem *pm) { int data_types = pm->data_types; int i; @@ -1314,7 +1174,7 @@ void BKE_ptcache_mem_init_pointers(PTCacheMem *pm) pm->cur[i] = ((data_types & (1<<i)) ? pm->data[i] : NULL); } -void BKE_ptcache_mem_incr_pointers(PTCacheMem *pm) +void BKE_ptcache_mem_pointers_incr(PTCacheMem *pm) { int i; @@ -1323,7 +1183,7 @@ void BKE_ptcache_mem_incr_pointers(PTCacheMem *pm) pm->cur[i] = (char*)pm->cur[i] + ptcache_data_size[i]; } } -int BKE_ptcache_mem_seek_pointers(int point_index, PTCacheMem *pm) +int BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm) { int data_types = pm->data_types; int i, index = pm->index_array ? pm->index_array[point_index] - 1 : point_index; @@ -1342,7 +1202,7 @@ int BKE_ptcache_mem_seek_pointers(int point_index, PTCacheMem *pm) return 1; } -static void ptcache_alloc_data(PTCacheMem *pm) +static void ptcache_data_alloc(PTCacheMem *pm) { int data_types = pm->data_types; int totpoint = pm->totpoint; @@ -1353,7 +1213,7 @@ static void ptcache_alloc_data(PTCacheMem *pm) pm->data[i] = MEM_callocN(totpoint * ptcache_data_size[i], "PTCache Data"); } } -static void ptcache_free_data(PTCacheMem *pm) +static void ptcache_data_free(PTCacheMem *pm) { void **data = pm->data; int i; @@ -1368,7 +1228,7 @@ static void ptcache_free_data(PTCacheMem *pm) pm->index_array = NULL; } } -static void ptcache_copy_data(void *from[], void *to[]) +static void ptcache_data_copy(void *from[], void *to[]) { int i; for(i=0; i<BPHYS_TOT_DATA; i++) { @@ -1381,7 +1241,7 @@ static void ptcache_copy_data(void *from[], void *to[]) -static int ptcache_pid_old_elemsize(PTCacheID *pid) +static int ptcache_old_elemsize(PTCacheID *pid) { if(pid->type==PTCACHE_TYPE_SOFTBODY) return 6 * sizeof(float); @@ -1393,268 +1253,302 @@ static int ptcache_pid_old_elemsize(PTCacheID *pid) return 0; } -/* reads cache from disk or memory */ -/* possible to get old or interpolated result */ -int BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec) +static void *ptcache_find_frame(PTCacheID *pid, int frame) { - PTCacheFile *pf=NULL, *pf2=NULL; - PTCacheMem *pm=NULL, *pm2=NULL; - float old_data1[14], old_data2[14]; - int cfrai = (int)cfra; - int old_elemsize = ptcache_pid_old_elemsize(pid); - int i; - - int cfra1 = 0, cfra2 = 0; - int totpoint = 0, totpoint2 = 0; - int *index = &i, *index2 = &i; - int use_old = 0, old_frame = 0; - - int ret = 0, error = 0; - - /* nothing to read to */ - if(pid->totpoint(pid->calldata, (int)cfra) == 0) - return 0; - - if(pid->cache->flag & PTCACHE_READ_INFO) { - pid->cache->flag &= ~PTCACHE_READ_INFO; - BKE_ptcache_read_cache(pid, 0, frs_sec); + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + PTCacheFile *pf = ptcache_file_open(pid, PTCACHE_FILE_READ, frame); + if(pf) + pf->frame = frame; + return pf; } - - - /* first check if we have the actual frame cached */ - if(cfra == (float)cfrai) { - if(pid->cache->flag & PTCACHE_DISK_CACHE) { - pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); - } - else { - pm = pid->cache->mem_cache.first; - - for(; pm; pm=pm->next) { - if(pm->frame == cfrai) - break; - } + else { + PTCacheMem *pm = pid->cache->mem_cache.first; + for(; pm; pm=pm->next) { + if(pm->frame == frame) + break; } + return (void*)pm; } +} - /* no exact cache frame found so try to find cached frames around cfra */ - if(!pm && !pf) { - if(pid->cache->flag & PTCACHE_DISK_CACHE) { - pf=NULL; - while(cfrai >= pid->cache->startframe && !pf) { - cfrai--; - pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); - cfra1 = cfrai; - } +static void ptcache_find_frames_around(PTCacheID *pid, int frame, void **cache1, void **cache2) +{ + int cfra1=frame, cfra2=frame; - old_frame = cfrai; + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + PTCacheFile *pf=NULL; + PTCacheFile *pf2=NULL; - cfrai = (int)cfra; - while(cfrai < pid->cache->endframe && !pf2) { - cfrai++; - pf2= ptcache_file_open(pid, PTCACHE_FILE_READ, cfrai); - cfra2 = cfrai; - } + while(cfra1 >= pid->cache->startframe && pf==NULL) { + cfra1--; + pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cfra1); + } - if(pf && !pf2) { - pf2 = pf; - pf = NULL; - } + if(pf) + pf->frame = cfra1; + + while(cfra2 < pid->cache->endframe && !pf2) { + cfra2++; + pf2= ptcache_file_open(pid, PTCACHE_FILE_READ, cfra2); } - else if(pid->cache->mem_cache.first){ - pm = pid->cache->mem_cache.first; - while(pm->next && pm->next->frame < cfra) - pm= pm->next; + if(pf2) + pf2->frame = cfra2; - if(pm) { - old_frame = pm->frame; - cfra1 = pm->frame; - } + if(pf && !pf2) { + pf2 = pf; + pf = NULL; + } - pm2 = pid->cache->mem_cache.last; + *cache1 = (void*)pf; + *cache2 = (void*)pf2; + } + else if(pid->cache->mem_cache.first){ + PTCacheMem *pm = pid->cache->mem_cache.first; + PTCacheMem *pm2 = pid->cache->mem_cache.last; - if(pm2 && pm2->frame < cfra) - pm2 = NULL; - else { - while(pm2->prev && pm2->prev->frame > cfra) - pm2= pm2->prev; + while(pm->next && pm->next->frame < frame) + pm= pm->next; - if(pm2) - cfra2 = pm2->frame; - } + if(pm2 && pm2->frame < frame) + pm2 = NULL; + else { + while(pm2->prev && pm2->prev->frame > frame) + pm2= pm2->prev; + } - if(pm && !pm2) { - pm2 = pm; - pm = NULL; - } + if(pm && !pm2) { + pm2 = pm; + pm = NULL; } - } - if(!pm && !pm2 && !pf && !pf2) + *cache1 = (void*)pm; + *cache2 = (void*)pm2; + } +} +static int ptcache_read_init(PTCacheID *pid, void **cache, int *totpoint) +{ + if(*cache==NULL) return 0; - if(pm) { - BKE_ptcache_mem_init_pointers(pm); - totpoint = pm->totpoint; - index = ((pm->data_types & (1<<BPHYS_DATA_INDEX)) ? pm->cur[BPHYS_DATA_INDEX] : &i); - } - if(pm2) { - BKE_ptcache_mem_init_pointers(pm2); - totpoint2 = pm2->totpoint; - index2 = ((pm2->data_types & (1<<BPHYS_DATA_INDEX)) ? pm2->cur[BPHYS_DATA_INDEX] : &i); - } - if(pf) { - if(ptcache_file_read_header_begin(pf)) { + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + PTCacheFile *pf = (PTCacheFile *)(*cache); + + if(ptcache_file_header_begin_read(pf)) { if(pf->type != pid->type) { /* todo report error */ ptcache_file_close(pf); - pf = NULL; + *cache = NULL; + return 0; } else if(pid->read_header(pf)) { - ptcache_file_init_pointers(pf); - totpoint = pf->totpoint; - index = ((pf->data_types & (1<<BPHYS_DATA_INDEX)) ? &pf->data.index : &i); + ptcache_file_pointers_init(pf); + *totpoint = pf->totpoint; } } else { /* fall back to old cache file format */ - use_old = 1; - totpoint = pid->totpoint(pid->calldata, (int) cfra); + pf->old_format = 1; + *totpoint = pid->totpoint(pid->calldata, (int) pf->frame); } + return pf->frame; } - if(pf2) { - if(ptcache_file_read_header_begin(pf2)) { - if(pf2->type != pid->type) { - /* todo report error */ - ptcache_file_close(pf2); - pf2 = NULL; + else { + PTCacheMem *pm = (PTCacheMem *)(*cache); + + BKE_ptcache_mem_pointers_init(pm); + *totpoint = pm->totpoint; + return pm->frame; + } +} +static int ptcache_read(PTCacheID *pid, void *cache, int totpoint, float frs_sec) +{ + int i; + int *index = &i; + + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + PTCacheFile *pf = (PTCacheFile *)cache; + if(pf->old_format) { + int old_elemsize = ptcache_old_elemsize(pid); + float old_data[14]; + + for(i=0; i<totpoint; i++) { + if(ptcache_file_read(pf, (void*)old_data, 1, old_elemsize)) + pid->read_elem(i, pid->calldata, NULL, frs_sec, (float)pf->frame, old_data); + else + return 0; } - else if(pid->read_header(pf2)) { - ptcache_file_init_pointers(pf2); - totpoint2 = pf2->totpoint; - index2 = ((pf2->data_types & (1<<BPHYS_DATA_INDEX)) ? &pf2->data.index : &i); + } + else { + if(pf->data_types & (1<<BPHYS_DATA_INDEX)) + index = &pf->data.index; + + for(i=0; i<totpoint; i++) { + if(ptcache_file_data_read(pf)) + pid->read_elem(*index, pid->calldata, pf->cur, frs_sec, (float)pf->frame, NULL); + else + return 0; + } + } + } + else { + PTCacheMem *pm = (PTCacheMem *)cache; + + for(i=0; i<totpoint; i++) { + if(pm->data_types & (1<<BPHYS_DATA_INDEX)) + index = pm->cur[BPHYS_DATA_INDEX]; + + pid->read_elem(*index, pid->calldata, pm->cur, frs_sec, (float)pm->frame, NULL); + + BKE_ptcache_mem_pointers_incr(pm); + } + } + + return 1; +} +static int ptcache_interpolate(PTCacheID *pid, void *cache1, void *cache2, int totpoint, float cfra, float frs_sec) +{ + int i; + int *index = &i; + + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + PTCacheFile *pf1 = (PTCacheFile *)cache1; + PTCacheFile *pf2 = (PTCacheFile *)cache2; + if(pf2->old_format) { + int old_elemsize = ptcache_old_elemsize(pid); + float old_data[14]; + + for(i=0; i<totpoint; i++) { + if(ptcache_file_read(pf2, (void*)old_data, 1, old_elemsize)) + pid->interpolate_elem(i, pid->calldata, NULL, frs_sec, cfra, (float)pf1->frame, (float)pf2->frame, old_data); + else + return 0; } } else { - /* fall back to old cache file format */ - use_old = 1; - totpoint2 = pid->totpoint(pid->calldata, (int) cfra); + if(pf2->data_types & (1<<BPHYS_DATA_INDEX)) + index = &pf2->data.index; + + for(i=0; i<totpoint; i++) { + if(ptcache_file_data_read(pf2)) + pid->interpolate_elem(*index, pid->calldata, pf2->cur, frs_sec, cfra, (float)pf1->frame, (float)pf2->frame, NULL); + else + return 0; + } } } + else { + PTCacheMem *pm1 = (PTCacheMem *)cache1; + PTCacheMem *pm2 = (PTCacheMem *)cache2; + + for(i=0; i<totpoint; i++) { + if(pm2->data_types & (1<<BPHYS_DATA_INDEX)) + index = pm2->cur[BPHYS_DATA_INDEX]; + + pid->interpolate_elem(*index, pid->calldata, pm2->cur, frs_sec, cfra, (float)pm1->frame, (float)pm2->frame, NULL); + BKE_ptcache_mem_pointers_incr(pm2); + } + } + + return 1; +} +/* reads cache from disk or memory */ +/* possible to get old or interpolated result */ +int BKE_ptcache_read(PTCacheID *pid, float cfra, float frs_sec) +{ + void *cache1=NULL, *cache2=NULL; + int cfrai = (int)cfra, cfra1=0, cfra2=0; + int totpoint = 0, totpoint2 = 0; + int ret = 0; + + /* nothing to read to */ + if(pid->totpoint(pid->calldata, cfrai) == 0) + return 0; + + if(pid->cache->flag & PTCACHE_READ_INFO) { + pid->cache->flag &= ~PTCACHE_READ_INFO; + BKE_ptcache_read(pid, 0, frs_sec); + } + + /* first check if we have the actual frame cached */ + if(cfra == (float)cfrai) + cache1 = ptcache_find_frame(pid, cfrai); + + /* no exact cache frame found so try to find cached frames around cfra */ + if(cache1==NULL) + ptcache_find_frames_around(pid, cfrai, &cache1, &cache2); + + if(cache1==NULL && cache2==NULL) + return 0; + + cfra1 = ptcache_read_init(pid, &cache1, &totpoint); + cfra2 = ptcache_read_init(pid, &cache2, &totpoint2); /* don't read old cache if already simulated past cached frame */ - if(!pm && !pf && cfra1 && cfra1 <= pid->cache->simframe) - error = 1; + if(!cache1 && cfra2 && cfra2 <= pid->cache->simframe) + goto cleanup; if(cfra1 && cfra1==cfra2) - error = 1; + goto cleanup; - if(!error) - { - if(pf && pid->read_stream) { + if(cache1) { + if(pid->read_stream) { if(totpoint != pid->totpoint(pid->calldata, (int) cfra)) - error = 1; + goto cleanup; else { - // we have stream writing here - pid->read_stream(pf, pid->calldata); + // we have stream reading here + pid->read_stream((PTCacheFile *)cache1, pid->calldata); } } - } - - if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0) - totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, (int) cfra)); + else if(pid->read_elem) { + if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0) + totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, (int) cfra)); - if(!error) - { - for(i=0; i<totpoint; i++) { - /* read old cache file format */ - if(use_old) { - if(pid->read_elem && ptcache_file_read(pf, (void*)old_data1, 1, old_elemsize)) - pid->read_elem(i, pid->calldata, NULL, frs_sec, cfra, old_data1); - else if(pid->read_elem) - { error = 1; break; } - } - else { - if(pid->read_elem && (pm || ptcache_file_read_data(pf))) - pid->read_elem(*index, pid->calldata, (pm ? pm->cur : pf->cur), frs_sec, (cfra1 ? (float)cfra1 : (float)cfrai), NULL); - else if(pid->read_elem) - { error = 1; break; } - } - - if(pm) { - BKE_ptcache_mem_incr_pointers(pm); - index = ((pm->data_types & (1<<BPHYS_DATA_INDEX)) ? pm->cur[BPHYS_DATA_INDEX] : &i); - } + if(ptcache_read(pid, cache1, totpoint, frs_sec)==0) + goto cleanup; } } - if(!error) - { - if(pf2 && pid->read_stream) { + if(cache2) { + if(pid->read_stream) { if(totpoint2 != pid->totpoint(pid->calldata, (int) cfra)) - error = 1; + goto cleanup; else { - // we have stream writing here - pid->read_stream(pf2, pid->calldata); + // we have stream reading here + pid->read_stream((PTCacheFile *)cache2, pid->calldata); } } - } + else if(pid->read_elem) { + if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0) + totpoint2 = MIN2(totpoint2, pid->totpoint(pid->calldata, (int) cfra)); - if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0) - totpoint2 = MIN2(totpoint2, pid->totpoint(pid->calldata, (int) cfra)); - - if(!error) - { - for(i=0; i<totpoint2; i++) { - /* read old cache file format */ - if(use_old) { - if(pid->read_elem && ptcache_file_read(pf2, (void*)old_data2, 1, old_elemsize)) { - if(!pf && pf2) - pid->read_elem(i, pid->calldata, NULL, frs_sec, (float)cfra2, old_data2); - else if(pid->interpolate_elem) - pid->interpolate_elem(i, pid->calldata, NULL, frs_sec, cfra, (float)cfra1, (float)cfra2, old_data2); - else - { error = 1; break; } - } - else if(pid->read_elem) - { error = 1; break; } + if(cache1 && cache2 && pid->interpolate_elem) { + if(ptcache_interpolate(pid, cache1, cache2, totpoint2, cfra, frs_sec)==0) + goto cleanup; } else { - if(pid->read_elem && (pm2 || ptcache_file_read_data(pf2))) { - if((!pf && pf2) || (!pm && pm2)) - pid->read_elem(*index2, pid->calldata, pm2 ? pm2->cur : pf2->cur, frs_sec, (float)cfra2, NULL); - else if(pid->interpolate_elem) - pid->interpolate_elem(*index2, pid->calldata, pm2 ? pm2->cur : pf2->cur, frs_sec, cfra, (float)cfra1, (float)cfra2, NULL); - else - { error = 1; break; } - } - else if(pid->read_elem) - { error = 1; break; } - } - - if(pm2) { - BKE_ptcache_mem_incr_pointers(pm2); - index2 = ((pm2->data_types & (1<<BPHYS_DATA_INDEX)) ? pm2->cur[BPHYS_DATA_INDEX] : &i); + if(ptcache_read(pid, cache2, totpoint2, frs_sec)==0) + goto cleanup; } } } - if(pm || pf) - ret = ((pm2 || pf2) ? PTCACHE_READ_INTERPOLATED : PTCACHE_READ_EXACT); - else if(pm2 || pf2) { + if(cache1) + ret = (cache2 ? PTCACHE_READ_INTERPOLATED : PTCACHE_READ_EXACT); + else if(cache2) { ret = PTCACHE_READ_OLD; - pid->cache->simframe = old_frame; + pid->cache->simframe = ((pid->cache->flag & PTCACHE_DISK_CACHE) ? + ((PTCacheFile*)cache2)->frame : ((PTCacheMem*)cache2)->frame); } - if(pf) { - ptcache_file_close(pf); - pf = NULL; - } +cleanup: - if(pf2) { - ptcache_file_close(pf2); - pf = NULL; + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + if(cache1) + ptcache_file_close((PTCacheFile*)cache1); + if(cache2) + ptcache_file_close((PTCacheFile*)cache2); } if((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) { @@ -1671,9 +1565,8 @@ int BKE_ptcache_read_cache(PTCacheID *pid, float cfra, float frs_sec) } } - return (error ? 0 : ret); + return ret; } -/* TODO for later */ static void ptcache_make_index_array(PTCacheMem *pm, int totpoint) { int i, *index; @@ -1692,187 +1585,174 @@ static void ptcache_make_index_array(PTCacheMem *pm, int totpoint) for(i=0; i<pm->totpoint; i++, index++) pm->index_array[*index] = i + 1; } + +static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite) +{ + PointCache *cache = pid->cache; + int ofra = 0, efra = cache->endframe; + + /* allways start from scratch on the first frame */ + if(cfra && cfra == cache->startframe) { + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra); + cache->flag &= ~PTCACHE_REDO_NEEDED; + return 1; + } + + if(pid->cache->flag & PTCACHE_DISK_CACHE) { + if(cfra==0 && cache->startframe > 0) + return 1; + + /* find last cached frame */ + while(efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra)) + efra--; + + /* find second last cached frame */ + ofra = efra-1; + while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra)) + ofra--; + } + else { + PTCacheMem *pm = cache->mem_cache.last; + /* don't write info file in memory */ + if(cfra == 0) + return 0; + + if(pm == NULL) + return 1; + + efra = pm->frame; + ofra = (pm->prev ? pm->prev->frame : efra - cache->step); + } + + if(efra >= cache->startframe && cfra > efra) { + if(ofra >= cache->startframe && efra - ofra < cache->step) { + /* overwrite previous frame */ + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, efra); + *overwrite = 1; + } + return 1; + } + + return 0; +} /* writes cache to disk or memory */ -int BKE_ptcache_write_cache(PTCacheID *pid, int cfra) +int BKE_ptcache_write(PTCacheID *pid, int cfra) { PointCache *cache = pid->cache; PTCacheFile *pf= NULL, *pf2= NULL; - int i; + int i, ret = 0; int totpoint = pid->totpoint(pid->calldata, cfra); - int add = 0, overwrite = 0; + int overwrite = 0; if(totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0)) return 0; - if(cache->flag & PTCACHE_DISK_CACHE) { - int ofra=0, efra = cache->endframe; - - if(cfra==0 && cache->startframe > 0) - add = 1; - /* allways start from scratch on the first frame */ - else if(cfra == cache->startframe) { - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra); - cache->flag &= ~PTCACHE_REDO_NEEDED; - add = 1; - } - else { - /* find last cached frame */ - while(efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra)) - efra--; - - /* find second last cached frame */ - ofra = efra-1; - while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra)) - ofra--; - - if(efra >= cache->startframe && cfra > efra) { - if(ofra >= cache->startframe && efra - ofra < cache->step) - overwrite = 1; - else - add = 1; - } - } - - if(add || overwrite) { - if(overwrite) - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, efra); + if(ptcache_write_needed(pid, cfra, &overwrite)==0) + return 0; - pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra); - if(!pf) - return 0; + if(cache->flag & PTCACHE_DISK_CACHE) { + pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra); + if(!pf) + goto cleanup; - pf->type = pid->type; - pf->totpoint = cfra ? pid->totwrite(pid->calldata, cfra) : totpoint; - pf->data_types = cfra ? pid->data_types : pid->info_types; + pf->type = pid->type; + pf->totpoint = cfra ? pid->totwrite(pid->calldata, cfra) : totpoint; + pf->data_types = cfra ? pid->data_types : pid->info_types; - if(!ptcache_file_write_header_begin(pf) || !pid->write_header(pf)) { - ptcache_file_close(pf); - return 0; - } + if(!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)) + goto cleanup; - ptcache_file_init_pointers(pf); + ptcache_file_pointers_init(pf); - if(pf && pid->write_stream) { - // we have stream writing here - pid->write_stream(pf, pid->calldata); - } - else - for(i=0; i<totpoint; i++) { - if(pid->write_elem) { - int write = pid->write_elem(i, pid->calldata, pf->cur, cfra); - if(write) { - if(!ptcache_file_write_data(pf)) { - ptcache_file_close(pf); - if(pf2) ptcache_file_close(pf2); - return 0; - } - /* newly born particles have to be copied to previous cached frame */ - else if(overwrite && write == 2) { - if(!pf2) { - pf2 = ptcache_file_open(pid, PTCACHE_FILE_UPDATE, ofra); - if(!pf2) { - ptcache_file_close(pf); - return 0; - } - pf2->type = pid->type; - pf2->totpoint = totpoint; - pf2->data_types = pid->data_types; - } - ptcache_file_seek_pointers(i, pf2); - pid->write_elem(i, pid->calldata, pf2->cur, cfra); - if(!ptcache_file_write_data(pf2)) { - ptcache_file_close(pf); - ptcache_file_close(pf2); - return 0; - } - } + if(pid->write_stream) { + // we have stream writing here + pid->write_stream(pf, pid->calldata); + } + else if(pid->write_elem){ + for(i=0; i<totpoint; i++) { + int write = pid->write_elem(i, pid->calldata, pf->cur, cfra); + if(write) { + if(!ptcache_file_data_write(pf)) + goto cleanup; + + /* newly born particles have to be copied to previous cached frame */ + if(overwrite && write == 2) { + if(!pf2) { + /* find and initialize previous frame */ + int ofra = cfra-1; + while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra)) + ofra--; + + pf2 = ptcache_file_open(pid, PTCACHE_FILE_UPDATE, ofra); + if(!pf2) + goto cleanup; + + pf2->type = pid->type; + pf2->totpoint = totpoint; + pf2->data_types = pid->data_types; } + ptcache_file_pointers_seek(i, pf2); + pid->write_elem(i, pid->calldata, pf2->cur, cfra); + if(!ptcache_file_data_write(pf2)) + goto cleanup; } } + } } } else { PTCacheMem *pm; PTCacheMem *pm2; - pm2 = cache->mem_cache.first; - - /* don't write info file in memory */ - if(cfra==0) - return 1; - /* allways start from scratch on the first frame */ - if(cfra == cache->startframe) { - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra); - cache->flag &= ~PTCACHE_REDO_NEEDED; - add = 1; - } - else if (cache->mem_cache.last) { - pm2 = cache->mem_cache.last; - - if(pm2 && cfra > pm2->frame) { - if(pm2->prev && pm2->frame - pm2->prev->frame < cache->step) - overwrite = 1; - else - add = 1; - } - } - else - add = 1; + pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem"); - if(add || overwrite) { - if(overwrite) - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm2->frame); + pm->totpoint = pid->totwrite(pid->calldata, cfra); + pm->data_types = cfra ? pid->data_types : pid->info_types; - pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem"); - - pm->totpoint = pid->totwrite(pid->calldata, cfra); - pm->data_types = cfra ? pid->data_types : pid->info_types; - - ptcache_alloc_data(pm); - BKE_ptcache_mem_init_pointers(pm); + ptcache_data_alloc(pm); + BKE_ptcache_mem_pointers_init(pm); + if(pid->write_elem) { for(i=0; i<totpoint; i++) { - if(pid->write_elem) { - int write = pid->write_elem(i, pid->calldata, pm->cur, cfra); - if(write) { - BKE_ptcache_mem_incr_pointers(pm); - - /* newly born particles have to be copied to previous cached frame */ - if(overwrite && write == 2) { - pm2 = cache->mem_cache.last; - if(BKE_ptcache_mem_seek_pointers(i, pm2)) - pid->write_elem(i, pid->calldata, pm2->cur, cfra); - } + int write = pid->write_elem(i, pid->calldata, pm->cur, cfra); + if(write) { + BKE_ptcache_mem_pointers_incr(pm); + + /* newly born particles have to be copied to previous cached frame */ + if(overwrite && write == 2) { + pm2 = cache->mem_cache.last; + if(BKE_ptcache_mem_pointers_seek(i, pm2)) + pid->write_elem(i, pid->calldata, pm2->cur, cfra); } } } - ptcache_make_index_array(pm, pid->totpoint(pid->calldata, cfra)); - - pm->frame = cfra; - BLI_addtail(&cache->mem_cache, pm); } + ptcache_make_index_array(pm, pid->totpoint(pid->calldata, cfra)); + + pm->frame = cfra; + BLI_addtail(&cache->mem_cache, pm); } - if(add || overwrite) { - if(cfra - cache->last_exact == 1 - || cfra == cache->startframe) { - cache->last_exact = cfra; - cache->flag &= ~PTCACHE_FRAMES_SKIPPED; - } - else - cache->flag |= PTCACHE_FRAMES_SKIPPED; + if(cfra - cache->last_exact == 1 || cfra == cache->startframe) { + cache->last_exact = cfra; + cache->flag &= ~PTCACHE_FRAMES_SKIPPED; } + else + cache->flag |= PTCACHE_FRAMES_SKIPPED; if(cache->cached_frames) cache->cached_frames[cfra-cache->startframe] = 1; - + + ret = 1; + +cleanup: if(pf) ptcache_file_close(pf); if(pf2) ptcache_file_close(pf2); BKE_ptcache_update_info(pid); - return 1; + return ret; } /* youll need to close yourself after! * mode - PTCACHE_CLEAR_ALL, @@ -1915,7 +1795,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) if(pid->cache->flag & PTCACHE_DISK_CACHE) { ptcache_path(pid, path); - len = BKE_ptcache_id_filename(pid, filename, cfra, 0, 0); /* no path */ + len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */ dir = opendir(path); if (dir==NULL) @@ -1966,7 +1846,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) /*we want startframe if the cache starts before zero*/ pid->cache->last_exact = MIN2(pid->cache->startframe, 0); for(; pm; pm=pm->next) - ptcache_free_data(pm); + ptcache_data_free(pm); BLI_freelistN(&pid->cache->mem_cache); if(pid->cache->cached_frames) for(i=0; i<end-sta+1; i++) @@ -1978,7 +1858,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) link = pm; if(pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end) pid->cache->cached_frames[pm->frame-sta] = 0; - ptcache_free_data(pm); + ptcache_data_free(pm); pm = pm->next; BLI_freelinkN(&pid->cache->mem_cache, link); } @@ -1992,7 +1872,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) case PTCACHE_CLEAR_FRAME: if(pid->cache->flag & PTCACHE_DISK_CACHE) { if(BKE_ptcache_id_exist(pid, cfra)) { - BKE_ptcache_id_filename(pid, filename, cfra, 1, 1); /* no path */ + ptcache_filename(pid, filename, cfra, 1, 1); /* no path */ BLI_delete(filename, 0, 0); } } @@ -2001,7 +1881,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) for(; pm; pm=pm->next) { if(pm->frame == cfra) { - ptcache_free_data(pm); + ptcache_data_free(pm); BLI_freelinkN(&pid->cache->mem_cache, pm); break; } @@ -2015,7 +1895,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra) BKE_ptcache_update_info(pid); } -int BKE_ptcache_id_exist(PTCacheID *pid, int cfra) +int BKE_ptcache_id_exist(PTCacheID *pid, int cfra) { if(!pid->cache) return 0; @@ -2029,7 +1909,7 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra) if(pid->cache->flag & PTCACHE_DISK_CACHE) { char filename[MAX_PTCACHE_FILE]; - BKE_ptcache_id_filename(pid, filename, cfra, 1, 1); + ptcache_filename(pid, filename, cfra, 1, 1); return BLI_exists(filename); } @@ -2110,7 +1990,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra ptcache_path(pid, path); - len = BKE_ptcache_id_filename(pid, filename, (int)cfra, 0, 0); /* no path */ + len = ptcache_filename(pid, filename, (int)cfra, 0, 0); /* no path */ dir = opendir(path); if (dir==NULL) @@ -2151,7 +2031,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra } } -int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) +int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) { PointCache *cache; int reset, clear, after; @@ -2214,7 +2094,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) return (reset || clear || after); } -int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) +int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) { PTCacheID pid; ParticleSystem *psys; @@ -2328,7 +2208,7 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) } } -int BKE_ptcache_get_continue_physics() +int BKE_ptcache_get_continue_physics() { return CONTINUE_PHYSICS; } @@ -2356,7 +2236,7 @@ void BKE_ptcache_free_mem(ListBase *mem_cache) if(pm) { for(; pm; pm=pm->next) - ptcache_free_data(pm); + ptcache_data_free(pm); BLI_freelistN(mem_cache); } @@ -2430,7 +2310,7 @@ void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene) baker.scene=scene; baker.quick_step=scene->physics_settings.quick_cache_step; - BKE_ptcache_make_cache(&baker); + BKE_ptcache_bake(&baker); } /* Simulation thread, no need for interlocks as data written in both threads @@ -2443,10 +2323,10 @@ typedef struct { int *cfra_ptr; Main *main; Scene *scene; -} ptcache_make_cache_data; +} ptcache_bake_data; -static void *ptcache_make_cache_thread(void *ptr) { - ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr; +static void *ptcache_bake_thread(void *ptr) { + ptcache_bake_data *data = (ptcache_bake_data*)ptr; for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) { scene_update_for_newframe(data->main, data->scene, data->scene->lay); @@ -2460,7 +2340,7 @@ static void *ptcache_make_cache_thread(void *ptr) { } /* if bake is not given run simulations to current frame */ -void BKE_ptcache_make_cache(PTCacheBaker* baker) +void BKE_ptcache_bake(PTCacheBaker* baker) { Main *bmain = baker->main; Scene *scene = baker->scene; @@ -2475,7 +2355,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) int bake = baker->bake; int render = baker->render; ListBase threads; - ptcache_make_cache_data thread_data; + ptcache_bake_data thread_data; int progress, old_progress; thread_data.endframe = baker->anim_init ? scene->r.sfra : CFRA; @@ -2580,10 +2460,10 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) WM_cursor_wait(1); if(G.background) { - ptcache_make_cache_thread((void*)&thread_data); + ptcache_bake_thread((void*)&thread_data); } else { - BLI_init_threads(&threads, ptcache_make_cache_thread, 1); + BLI_init_threads(&threads, ptcache_bake_thread, 1); BLI_insert_thread(&threads, (void*)&thread_data); while (thread_data.thread_ended == FALSE) { @@ -2621,7 +2501,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) cache->flag |= PTCACHE_BAKED; /* write info file */ if(cache->flag & PTCACHE_DISK_CACHE) - BKE_ptcache_write_cache(pid, 0); + BKE_ptcache_write(pid, 0); } } else for(SETLOOPER(scene, sce_iter, base)) { @@ -2644,7 +2524,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) if(bake) { cache->flag |= PTCACHE_BAKED; if(cache->flag & PTCACHE_DISK_CACHE) - BKE_ptcache_write_cache(pid, 0); + BKE_ptcache_write(pid, 0); } } BLI_freelistN(&pidlist); @@ -2681,7 +2561,7 @@ void BKE_ptcache_disk_to_mem(PTCacheID *pid) pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra); if(pf) { - if(!ptcache_file_read_header_begin(pf)) { + if(!ptcache_file_header_begin_read(pf)) { printf("Can't yet convert old cache format\n"); cache->flag |= PTCACHE_DISK_CACHE; ptcache_file_close(pf); @@ -2700,24 +2580,24 @@ void BKE_ptcache_disk_to_mem(PTCacheID *pid) pm->data_types = pf->data_types; pm->frame = cfra; - ptcache_alloc_data(pm); - BKE_ptcache_mem_init_pointers(pm); - ptcache_file_init_pointers(pf); + ptcache_data_alloc(pm); + BKE_ptcache_mem_pointers_init(pm); + ptcache_file_pointers_init(pf); for(i=0; i<pm->totpoint; i++) { - if(!ptcache_file_read_data(pf)) { + if(!ptcache_file_data_read(pf)) { printf("Error reading from disk cache\n"); cache->flag |= PTCACHE_DISK_CACHE; - ptcache_free_data(pm); + ptcache_data_free(pm); MEM_freeN(pm); ptcache_file_close(pf); return; } - ptcache_copy_data(pf->cur, pm->cur); - BKE_ptcache_mem_incr_pointers(pm); + ptcache_data_copy(pf->cur, pm->cur); + BKE_ptcache_mem_pointers_incr(pm); } ptcache_make_index_array(pm, pid->totpoint(pid->calldata, cfra)); @@ -2748,10 +2628,10 @@ void BKE_ptcache_mem_to_disk(PTCacheID *pid) pf->totpoint = pm->totpoint; pf->type = pid->type; - BKE_ptcache_mem_init_pointers(pm); - ptcache_file_init_pointers(pf); + BKE_ptcache_mem_pointers_init(pm); + ptcache_file_pointers_init(pf); - if(!ptcache_file_write_header_begin(pf) || !pid->write_header(pf)) { + if(!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)) { if (G.f & G_DEBUG) printf("Error writing to disk cache\n"); cache->flag &= ~PTCACHE_DISK_CACHE; @@ -2761,8 +2641,8 @@ void BKE_ptcache_mem_to_disk(PTCacheID *pid) } for(i=0; i<pm->totpoint; i++) { - ptcache_copy_data(pm->cur, pf->cur); - if(!ptcache_file_write_data(pf)) { + ptcache_data_copy(pm->cur, pf->cur); + if(!ptcache_file_data_write(pf)) { if (G.f & G_DEBUG) printf("Error writing to disk cache\n"); cache->flag &= ~PTCACHE_DISK_CACHE; @@ -2770,14 +2650,14 @@ void BKE_ptcache_mem_to_disk(PTCacheID *pid) ptcache_file_close(pf); return; } - BKE_ptcache_mem_incr_pointers(pm); + BKE_ptcache_mem_pointers_incr(pm); } ptcache_file_close(pf); /* write info file */ if(cache->flag & PTCACHE_BAKED) - BKE_ptcache_write_cache(pid, 0); + BKE_ptcache_write(pid, 0); } else if (G.f & G_DEBUG) @@ -2807,6 +2687,13 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) cache->last_exact = last_exact; + if(cache->cached_frames) { + MEM_freeN(cache->cached_frames); + cache->cached_frames=NULL; + } + + BKE_ptcache_id_time(pid, NULL, 0.0f, NULL, NULL, NULL); + BKE_ptcache_update_info(pid); } @@ -2829,7 +2716,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) /* get "from" filename */ strcpy(pid->cache->name, from); - len = BKE_ptcache_id_filename(pid, old_filename, 0, 0, 0); /* no path */ + len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */ ptcache_path(pid, path); dir = opendir(path); @@ -2855,7 +2742,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) frame = atoi(num); BLI_join_dirfile(old_path_full, path, de->d_name); - BKE_ptcache_id_filename(pid, new_path_full, frame, 1, 1); + ptcache_filename(pid, new_path_full, frame, 1, 1); BLI_rename(old_path_full, new_path_full); } } @@ -2886,7 +2773,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) ptcache_path(pid, path); - len = BKE_ptcache_id_filename(pid, filename, 1, 0, 0); /* no path */ + len = ptcache_filename(pid, filename, 1, 0, 0); /* no path */ dir = opendir(path); if (dir==NULL) @@ -2932,7 +2819,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0); if(pf) { - if(ptcache_file_read_header_begin(pf)) { + if(ptcache_file_header_begin_read(pf)) { if(pf->type == pid->type && pid->read_header(pf)) { cache->totpoint = pf->totpoint; cache->flag |= PTCACHE_READ_INFO; @@ -2947,7 +2834,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) /* or from any old format cache file */ else { float old_data[14]; - int elemsize = ptcache_pid_old_elemsize(pid); + int elemsize = ptcache_old_elemsize(pid); pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cache->startframe); if(pf) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index c3e22e0e7d3..fcaf44e2961 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -953,6 +953,7 @@ float BKE_curframe(Scene *scene) static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent) { Base *base; + scene->customdata_mask= scene_parent->customdata_mask; /* sets first, we allow per definition current scene to have dependencies on sets, but not the other way around. */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 17d63fa2349..19f872fbd40 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -790,7 +790,7 @@ void sort_seq(Scene *scene) } } - addlisttolist(&seqbase, &effbase); + BLI_movelisttolist(&seqbase, &effbase); *(ed->seqbasep)= seqbase; } @@ -1609,7 +1609,7 @@ static ImBuf * input_preprocess( if(seq->sat != 1.0f) { /* inline for now, could become an imbuf function */ int i; - char *rct= (char *)ibuf->rect; + unsigned char *rct= (unsigned char *)ibuf->rect; float *rctf= ibuf->rect_float; const float sat= seq->sat; float hsv[3]; @@ -3234,7 +3234,7 @@ void seq_dupe_animdata(Scene *scene, char *name_from, char *name_to) BKE_animdata_fix_paths_rename(&scene->id, scene->adt, "sequence_editor.sequences_all", name_from, name_to, 0, 0, 0); /* add the original fcurves back */ - addlisttolist(&scene->adt->action->curves, &lb); + BLI_movelisttolist(&scene->adt->action->curves, &lb); } /* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */ diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index adaab2046dc..babe4209a31 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1376,7 +1376,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM } /* try to read from cache */ - if(BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec) == PTCACHE_READ_EXACT) { + if(BKE_ptcache_read(&pid, (float)framenr, scene->r.frs_sec) == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, framenr); smd->time = framenr; return; @@ -1407,7 +1407,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_turbulence_step(sds->wt, sds->fluid); } - BKE_ptcache_write_cache(&pid, startframe); + BKE_ptcache_write(&pid, startframe); } // set new time @@ -1439,7 +1439,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM BKE_ptcache_validate(cache, framenr); if(framenr != startframe) - BKE_ptcache_write_cache(&pid, framenr); + BKE_ptcache_write(&pid, framenr); tend(); //printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() ); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index ceee544d1b8..4653562e5f4 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -4134,7 +4134,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i } /* try to read from cache */ - cache_result = BKE_ptcache_read_cache(&pid, framenr, scene->r.frs_sec); + cache_result = BKE_ptcache_read(&pid, framenr, scene->r.frs_sec); if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) { softbody_to_object(ob, vertexCos, numVerts, sb->local); @@ -4142,7 +4142,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i BKE_ptcache_validate(cache, framenr); if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED) - BKE_ptcache_write_cache(&pid, framenr); + BKE_ptcache_write(&pid, framenr); return; } @@ -4157,7 +4157,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i /* if on second frame, write cache for first frame */ if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) - BKE_ptcache_write_cache(&pid, startframe); + BKE_ptcache_write(&pid, startframe); softbody_update_positions(ob, sb, vertexCos, numVerts); @@ -4170,6 +4170,6 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i softbody_to_object(ob, vertexCos, numVerts, 0); BKE_ptcache_validate(cache, framenr); - BKE_ptcache_write_cache(&pid, framenr); + BKE_ptcache_write(&pid, framenr); } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 443ed1f7987..3dc2221e0c8 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -484,3 +484,12 @@ int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, flo return AUD_readSound(limiter, buffer, length); AUD_unload(limiter); } + +int sound_get_channels(struct bSound* sound) +{ + AUD_SoundInfo info; + + info = AUD_getInfo(sound->playback_handle); + + return info.specs.channels; +} diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 6e0289e907b..bbdc188d580 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2746,7 +2746,7 @@ int setcurr_tab_spaces (Text *text, int space) /*********************************/ /* Creates and adds a marker to the list maintaining sorted order */ -void txt_add_marker(Text *text, TextLine *line, int start, int end, char color[4], int group, int flags) { +void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsigned char color[4], int group, int flags) { TextMarker *tmp, *marker; marker= MEM_mallocN(sizeof(TextMarker), "text_marker"); diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index c4dc0894f80..a41b49de242 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -40,13 +40,12 @@ extern "C" { #endif -void addlisttolist(struct ListBase *list1, struct ListBase *list2); void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink); -void *BLI_findlink(struct ListBase *listbase, int number); -int BLI_findindex(struct ListBase *listbase, void *vlink); -void *BLI_findstring(struct ListBase *listbase, const char *id, int offset); -void *BLI_findstring_ptr(struct ListBase *listbase, const char *id, int offset); -int BLI_findstringindex(struct ListBase *listbase, const char *id, int offset); +void *BLI_findlink(const struct ListBase *listbase, int number); +int BLI_findindex(const struct ListBase *listbase, void *vlink); +void *BLI_findstring(const struct ListBase *listbase, const char *id, const int offset); +void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset); +int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset); void BLI_freelistN(struct ListBase *listbase); void BLI_addtail(struct ListBase *listbase, void *vlink); void BLI_remlink(struct ListBase *listbase, void *vlink); @@ -57,9 +56,11 @@ void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnew void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink); void BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *)); void BLI_freelist(struct ListBase *listbase); -int BLI_countlist(struct ListBase *listbase); +int BLI_countlist(const struct ListBase *listbase); void BLI_freelinkN(struct ListBase *listbase, void *vlink); -void BLI_duplicatelist(struct ListBase *list1, const struct ListBase *list2); + +void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src); +void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src); /* create a generic list node containing link to provided data */ struct LinkData *BLI_genericNodeN(void *data); diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 2095c40b5aa..0d88ef46104 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -89,14 +89,14 @@ int constrain_rgb(float *r, float *g, float *b); void minmax_rgb(short c[3]); void rgb_float_set_hue_float_offset(float * rgb, float hue_offset); -void rgb_byte_set_hue_float_offset(char * rgb, float hue_offset); +void rgb_byte_set_hue_float_offset(unsigned char * rgb, float hue_offset); /***************** lift/gamma/gain / ASC-CDL conversion *****************/ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power); -void rgb_byte_to_float(char *in, float *out); -void rgb_float_to_byte(float *in, char *out); +void rgb_byte_to_float(const unsigned char *in, float *out); +void rgb_float_to_byte(const float *in, unsigned char *out); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 3a63e87ac76..5f6251bf382 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -176,6 +176,7 @@ void mul_vn_fl(float *array, const int size, const float f); void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); void add_vn_vn(float *array_tar, const float *array_src, const int size); void fill_vni(int *array_tar, const int size, const int val); +void fill_vn(float *array_tar, const int size, const float val); #ifdef __cplusplus } diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index cb0cffeea31..d8be94c211a 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -140,4 +140,4 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -blenderlib(bf_blenlib "${SRC}" "${INC}") +blender_add_lib(bf_blenlib "${SRC}" "${INC}") diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 776f2d085df..b8b0b5b6eda 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -46,20 +46,20 @@ /* implementation */ /* Ripped this from blender.c */ -void addlisttolist(ListBase *list1, ListBase *list2) +void BLI_movelisttolist(ListBase *dst, ListBase *src) { - if (list2->first==0) return; + if (src->first==0) return; - if (list1->first==0) { - list1->first= list2->first; - list1->last= list2->last; + if (dst->first==0) { + dst->first= src->first; + dst->last= src->last; } else { - ((Link *)list1->last)->next= list2->first; - ((Link *)list2->first)->prev= list1->last; - list1->last= list2->last; + ((Link *)dst->last)->next= src->first; + ((Link *)src->first)->prev= dst->last; + dst->last= src->last; } - list2->first= list2->last= 0; + src->first= src->last= 0; } void BLI_addhead(ListBase *listbase, void *vlink) @@ -304,7 +304,7 @@ void BLI_freelistN(ListBase *listbase) } -int BLI_countlist(ListBase *listbase) +int BLI_countlist(const ListBase *listbase) { Link *link; int count = 0; @@ -319,7 +319,7 @@ int BLI_countlist(ListBase *listbase) return count; } -void *BLI_findlink(ListBase *listbase, int number) +void *BLI_findlink(const ListBase *listbase, int number) { Link *link = NULL; @@ -334,7 +334,7 @@ void *BLI_findlink(ListBase *listbase, int number) return link; } -int BLI_findindex(ListBase *listbase, void *vlink) +int BLI_findindex(const ListBase *listbase, void *vlink) { Link *link= NULL; int number= 0; @@ -354,7 +354,7 @@ int BLI_findindex(ListBase *listbase, void *vlink) return -1; } -void *BLI_findstring(ListBase *listbase, const char *id, int offset) +void *BLI_findstring(const ListBase *listbase, const char *id, const int offset) { Link *link= NULL; const char *id_iter; @@ -374,7 +374,7 @@ void *BLI_findstring(ListBase *listbase, const char *id, int offset) return NULL; } -void *BLI_findstring_ptr(ListBase *listbase, const char *id, int offset) +void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset) { Link *link= NULL; const char *id_iter; @@ -395,7 +395,7 @@ void *BLI_findstring_ptr(ListBase *listbase, const char *id, int offset) return NULL; } -int BLI_findstringindex(ListBase *listbase, const char *id, int offset) +int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset) { Link *link= NULL; const char *id_iter; @@ -416,20 +416,20 @@ int BLI_findstringindex(ListBase *listbase, const char *id, int offset) return -1; } -void BLI_duplicatelist(ListBase *list1, const ListBase *list2) +void BLI_duplicatelist(ListBase *dst, const ListBase *src) { - struct Link *link1, *link2; - - /* in this order, to ensure it works if list1 == list2 */ - link2= list2->first; - list1->first= list1->last= 0; - - while(link2) { - link1= MEM_dupallocN(link2); - BLI_addtail(list1, link1); - - link2= link2->next; - } + struct Link *dst_link, *src_link; + + /* in this order, to ensure it works if dst == src */ + src_link= src->first; + dst->first= dst->last= 0; + + while(src_link) { + dst_link= MEM_dupallocN(src_link); + BLI_addtail(dst, dst_link); + + src_link= src_link->next; + } } /* create a generic list node containing link to provided data */ diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 09a419b0e04..cf7a122e1bf 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -326,14 +326,14 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b) *b /= 255.0f; } -void rgb_byte_to_float(char *in, float *out) +void rgb_byte_to_float(const unsigned char *in, float *out) { out[0]= ((float)in[0]) / 255.0f; out[1]= ((float)in[1]) / 255.0f; out[2]= ((float)in[2]) / 255.0f; } -void rgb_float_to_byte(float *in, char *out) +void rgb_float_to_byte(const float *in, unsigned char *out) { int r, g, b; @@ -511,7 +511,7 @@ void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset) } /* Applies an hue offset to a byte rgb color */ -void rgb_byte_set_hue_float_offset(char rgb[3], float hue_offset) +void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset) { float rgb_float[3]; diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 6ac1fcfab7e..2ff1e948317 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -404,3 +404,10 @@ void fill_vni(int *array_tar, const int size, const int val) int i= size; while(i--) { *(tar--) = val; } } + +void fill_vn(float *array_tar, const int size, const float val) +{ + float *tar= array_tar + (size-1); + int i= size; + while(i--) { *(tar--) = val; } +} diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 85412e28c4f..86167078094 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -465,8 +465,8 @@ static void splitlist(ListBase *tempve, ListBase *temped, short nr) EditVert *eve,*nextve; EditEdge *eed,*nexted; - addlisttolist(tempve,&fillvertbase); - addlisttolist(temped,&filledgebase); + BLI_movelisttolist(tempve,&fillvertbase); + BLI_movelisttolist(temped,&filledgebase); eve= tempve->first; while(eve) { @@ -1029,8 +1029,8 @@ int BLI_edgefill(int mat_nr) } pf++; } - addlisttolist(&fillvertbase,&tempve); - addlisttolist(&filledgebase,&temped); + BLI_movelisttolist(&fillvertbase,&tempve); + BLI_movelisttolist(&filledgebase,&temped); /* FREE */ diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 2d80d565af1..a9a89120b73 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -50,4 +50,4 @@ set(SRC intern/readfile.h ) -blenderlib(bf_blenloader "${SRC}" "${INC}") +blender_add_lib(bf_blenloader "${SRC}" "${INC}") diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript index 87cfc47b4de..695d17f0638 100644 --- a/source/blender/blenloader/SConscript +++ b/source/blender/blenloader/SConscript @@ -14,4 +14,4 @@ defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30]) #, cc_compileflags=['/WX'] ) else: - env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30] ) + env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player','player2'], priority = [167,30,5] ) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d213b215bd1..9d304fe4e58 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -385,7 +385,7 @@ static void add_main_to_main(Main *mainvar, Main *from) a= set_listbasepointers(mainvar, lbarray); a= set_listbasepointers(from, fromarray); while(a--) { - addlisttolist(lbarray[a], fromarray[a]); + BLI_movelisttolist(lbarray[a], fromarray[a]); } } @@ -2201,6 +2201,12 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) con->lin_error = 0.f; con->rot_error = 0.f; } + case CONSTRAINT_TYPE_CHILDOF: + { + /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */ + if(con->ownspace == CONSTRAINT_SPACE_POSE) + con->flag |= CONSTRAINT_SPACEONCE; + } break; } } @@ -2238,7 +2244,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) /* hurms... loop in a loop, but yah... later... (ton) */ pchan->bone= get_named_bone(arm, pchan->name); - pchan->custom= newlibadr(fd, arm->id.lib, pchan->custom); + pchan->custom= newlibadr_us(fd, arm->id.lib, pchan->custom); if(pchan->bone==NULL) rebuild= 1; else if(ob->id.lib==NULL && arm->id.lib) { diff --git a/source/blender/blenpluginapi/CMakeLists.txt b/source/blender/blenpluginapi/CMakeLists.txt index 8005afc5615..64e4ab04e08 100644 --- a/source/blender/blenpluginapi/CMakeLists.txt +++ b/source/blender/blenpluginapi/CMakeLists.txt @@ -49,4 +49,4 @@ if(WITH_CODEC_QUICKTIME) add_definitions(-DWITH_QUICKTIME) endif() -blenderlib(bf_blenpluginapi "${SRC}" "${INC}") +blender_add_lib(bf_blenpluginapi "${SRC}" "${INC}") diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 7bbbc65d6e2..0dae0b6b9cb 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -200,6 +200,7 @@ void ArmatureImporter::fix_leaf_bones() } } +#if 0 void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm) { bPose *pose = ob_arm->pose; @@ -218,7 +219,6 @@ void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm) } } -#if 0 void ArmatureImporter::set_euler_rotmode() { // just set rotmode = ROT_MODE_EUL on pose channel for each joint @@ -373,7 +373,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) leaf_bones.clear(); totbone = 0; // bone_direction_row = 1; // TODO: don't default to Y but use asset and based on it decide on default row - leaf_bone_length = 0.1f; + leaf_bone_length = FLT_MAX; // min_angle = 360.0f; // minimum angle between bone head-tail and a row of bone matrix // create bones @@ -404,8 +404,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) ED_armature_edit_free(ob_arm); DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA); - set_leaf_bone_shapes(ob_arm); - + // set_leaf_bone_shapes(ob_arm); // set_euler_rotmode(); } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index a857ab67f12..7111e2fd9af 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -105,9 +105,8 @@ private: void fix_leaf_bones(); - void set_leaf_bone_shapes(Object *ob_arm); - #if 0 + void set_leaf_bone_shapes(Object *ob_arm); void set_euler_rotmode(); #endif diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index e0d53d2c2e4..3a2c085335b 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -99,4 +99,4 @@ if(WITH_BUILDINFO) add_definitions(-DNAN_BUILDINFO) endif() -blenderlib(bf_collada "${SRC}" "${INC}") +blender_add_lib(bf_collada "${SRC}" "${INC}") diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index be7abc3ec4e..0f997a616e4 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -500,10 +500,8 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) } #else for (k = 0; k < index_list_array.getCount(); k++) { - int uvset_index = index_list_array[k]->getSetIndex(); - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false); } #endif @@ -548,10 +546,8 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) } #else for (k = 0; k < index_list_array.getCount(); k++) { - int uvset_index = index_list_array[k]->getSetIndex(); - // get mtface by face index and uv set index - MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index); + MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k); set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0); } #endif diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index 64677282bf5..66ec9cf75d6 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -49,4 +49,4 @@ set(SRC anim_intern.h ) -blenderlib(bf_editor_animation "${SRC}" "${INC}") +blender_add_lib(bf_editor_animation "${SRC}" "${INC}") diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index c7d9fe58441..592149157aa 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -163,7 +163,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) && ((grp) && (grp->customCol)) ) { - char cp[3]; + unsigned char cp[3]; if (indent == 2) { VECCOPY(cp, grp->cs.solid); @@ -3331,7 +3331,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b uiBut *but; /* create the slider button, and assign relevant callback to ensure keyframes are inserted... */ - but= uiDefAutoButR(block, &ptr, prop, array_index, "", 0, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc); + but= uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NULL, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc); /* assign keyframing function according to slider type */ if (ale->type == ANIMTYPE_SHAPEKEY) diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 2a137364b3f..9d6b6d80a78 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -889,7 +889,7 @@ static void join_groups_action_temp (bAction *act) /* add list of channels to action's channels */ tempGroup= agrp->channels; - addlisttolist(&act->curves, &agrp->channels); + BLI_movelisttolist(&act->curves, &agrp->channels); agrp->channels= tempGroup; /* clear moved flag */ diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 2b8d0f35b9a..7642f63b531 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -225,14 +225,14 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm /* add the settings */ col= uiLayoutColumn(layout, 1); - uiItemR(col, &ptr, "function_type", 0, "", 0); - uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, &ptr, "function_type", 0, "", ICON_NULL); + uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); col= uiLayoutColumn(layout, 0); // no grouping for now - uiItemR(col, &ptr, "amplitude", 0, NULL, 0); - uiItemR(col, &ptr, "phase_multiplier", 0, NULL, 0); - uiItemR(col, &ptr, "phase_offset", 0, NULL, 0); - uiItemR(col, &ptr, "value_offset", 0, NULL, 0); + uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "value_offset", 0, NULL, ICON_NULL); } /* --------------- */ @@ -253,15 +253,15 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor /* before range */ col= uiLayoutColumn(split, 1); - uiItemL(col, "Before:", 0); - uiItemR(col, &ptr, "mode_before", 0, "", 0); - uiItemR(col, &ptr, "cycles_before", 0, NULL, 0); + uiItemL(col, "Before:", ICON_NULL); + uiItemR(col, &ptr, "mode_before", 0, "", ICON_NULL); + uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NULL); /* after range */ col= uiLayoutColumn(split, 1); - uiItemL(col, "After:", 0); - uiItemR(col, &ptr, "mode_after", 0, "", 0); - uiItemR(col, &ptr, "cycles_after", 0, NULL, 0); + uiItemL(col, "After:", ICON_NULL); + uiItemR(col, &ptr, "mode_after", 0, "", ICON_NULL); + uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NULL); } /* --------------- */ @@ -276,20 +276,20 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr); /* blending mode */ - uiItemR(layout, &ptr, "blend_type", 0, NULL, 0); + uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NULL); /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); /* col 1 */ col= uiLayoutColumn(split, 0); - uiItemR(col, &ptr, "scale", 0, NULL, 0); - uiItemR(col, &ptr, "strength", 0, NULL, 0); + uiItemR(col, &ptr, "scale", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "strength", 0, NULL, ICON_NULL); /* col 2 */ col= uiLayoutColumn(split, 0); - uiItemR(col, &ptr, "phase", 0, NULL, 0); - uiItemR(col, &ptr, "depth", 0, NULL, 0); + uiItemR(col, &ptr, "phase", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "depth", 0, NULL, ICON_NULL); } /* --------------- */ @@ -469,12 +469,12 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* general settings */ col= uiLayoutColumn(layout, 1); - uiItemL(col, "Envelope:", 0); - uiItemR(col, &ptr, "reference_value", 0, NULL, 0); + uiItemL(col, "Envelope:", ICON_NULL); + uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NULL); row= uiLayoutRow(col, 1); - uiItemR(row, &ptr, "default_min", 0, "Min", 0); - uiItemR(row, &ptr, "default_max", 0, "Max", 0); + uiItemR(row, &ptr, "default_min", 0, "Min", ICON_NULL); + uiItemR(row, &ptr, "default_max", 0, "Max", ICON_NULL); /* control points header */ // TODO: move this control-point control stuff to using the new special widgets for lists @@ -526,13 +526,13 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* x-minimum */ col= uiLayoutColumn(split, 1); - uiItemR(col, &ptr, "use_min_x", 0, NULL, 0); - uiItemR(col, &ptr, "min_x", 0, NULL, 0); + uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NULL); /* y-minimum*/ col= uiLayoutColumn(split, 1); - uiItemR(col, &ptr, "use_min_y", 0, NULL, 0); - uiItemR(col, &ptr, "min_y", 0, NULL, 0); + uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NULL); } /* row 2: maximum */ @@ -544,13 +544,13 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* x-minimum */ col= uiLayoutColumn(split, 1); - uiItemR(col, &ptr, "use_max_x", 0, NULL, 0); - uiItemR(col, &ptr, "max_x", 0, NULL, 0); + uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NULL); /* y-minimum*/ col= uiLayoutColumn(split, 1); - uiItemR(col, &ptr, "use_max_y", 0, NULL, 0); - uiItemR(col, &ptr, "max_y", 0, NULL, 0); + uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NULL); } } @@ -567,24 +567,24 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho /* block 1: "stepping" settings */ col= uiLayoutColumn(layout, 0); - uiItemR(col, &ptr, "frame_step", 0, NULL, 0); - uiItemR(col, &ptr, "frame_offset", 0, NULL, 0); + uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NULL); + uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NULL); /* block 2: start range settings */ col= uiLayoutColumn(layout, 1); - uiItemR(col, &ptr, "use_frame_start", 0, NULL, 0); + uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_start")); - uiItemR(subcol, &ptr, "frame_start", 0, NULL, 0); + uiItemR(subcol, &ptr, "frame_start", 0, NULL, ICON_NULL); /* block 3: end range settings */ col= uiLayoutColumn(layout, 1); - uiItemR(col, &ptr, "use_frame_end", 0, NULL, 0); + uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end")); - uiItemR(subcol, &ptr, "frame_end", 0, NULL, 0); + uiItemR(subcol, &ptr, "frame_end", 0, NULL, ICON_NULL); } /* --------------- */ @@ -616,16 +616,16 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie uiBlockSetEmboss(block, UI_EMBOSSN); /* expand */ - uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(subrow, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); /* checkbox for 'active' status (for now) */ - uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(subrow, &ptr, "active", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); /* name */ if (fmi) - uiItemL(subrow, fmi->name, 0); + uiItemL(subrow, fmi->name, ICON_NULL); else - uiItemL(subrow, "<Unknown Modifier>", 0); + uiItemL(subrow, "<Unknown Modifier>", ICON_NULL); /* right-align ------------------------------------------- */ subrow= uiLayoutRow(row, 0); @@ -633,7 +633,7 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie /* 'mute' button */ - uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(subrow, &ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); uiBlockSetEmboss(block, UI_EMBOSSN); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 899f5ed2229..e588a3610d8 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -572,6 +572,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) case CONSTRAINT_TYPE_CHILDOF: return 1; case CONSTRAINT_TYPE_TRANSFORM: + case CONSTRAINT_TYPE_TRANSLIKE: return 1; case CONSTRAINT_TYPE_FOLLOWPATH: return 1; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 61cf17adf81..d0e7d8be769 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -700,14 +700,14 @@ void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op uiLayout *layout; int i = 0; - pup= uiPupMenuBegin(C, title, 0); + pup= uiPupMenuBegin(C, title, ICON_NULL); layout= uiPupMenuLayout(pup); /* active Keying Set * - only include entry if it exists */ if (scene->active_keyingset) { - uiItemIntO(layout, "Active Keying Set", 0, op_name, "type", i++); + uiItemIntO(layout, "Active Keying Set", ICON_NULL, op_name, "type", i++); uiItemS(layout); } else @@ -719,7 +719,7 @@ void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op if (scene->keyingsets.first) { for (ks= scene->keyingsets.first; ks; ks= ks->next) { if (ANIM_keyingset_context_ok_poll(C, ks)) - uiItemIntO(layout, ks->name, 0, op_name, "type", i++); + uiItemIntO(layout, ks->name, ICON_NULL, op_name, "type", i++); } uiItemS(layout); } @@ -729,7 +729,7 @@ void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op for (ks= builtin_keyingsets.first; ks; ks= ks->next) { /* only show KeyingSet if context is suitable */ if (ANIM_keyingset_context_ok_poll(C, ks)) - uiItemIntO(layout, ks->name, 0, op_name, "type", i--); + uiItemIntO(layout, ks->name, ICON_NULL, op_name, "type", i--); } uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 8db4d3b2d73..6355cc20617 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -50,4 +50,4 @@ set(SRC reeb.h ) -blenderlib(bf_editor_armature "${SRC}" "${INC}") +blender_add_lib(bf_editor_armature "${SRC}" "${INC}") diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d9f2a9f2aca..829a1d78900 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -3946,7 +3946,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { EditBone *actbone = CTX_data_active_bone(C); - uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", 0); + uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", ICON_NULL); uiLayout *layout= uiPupMenuLayout(pup); int allchildbones = 0; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index e143425036e..71b6be42900 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -304,17 +304,17 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED return OPERATOR_CANCELLED; /* start building */ - pup= uiPupMenuBegin(C, op->type->name, 0); + pup= uiPupMenuBegin(C, op->type->name, ICON_NULL); layout= uiPupMenuLayout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); /* add new (adds to the first unoccupied frame) */ - uiItemIntO(layout, "Add New", 0, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); + uiItemIntO(layout, "Add New", ICON_NULL, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); /* check if we have any choices to add a new pose in any other way */ if ((ob->poselib) && (ob->poselib->markers.first)) { /* add new (on current frame) */ - uiItemIntO(layout, "Add New (Current Frame)", 0, "POSELIB_OT_pose_add", "frame", CFRA); + uiItemIntO(layout, "Add New (Current Frame)", ICON_NULL, "POSELIB_OT_pose_add", "frame", CFRA); /* replace existing - submenu */ uiItemMenuF(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu, NULL); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index f1bace1201f..bea7155291b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -729,7 +729,7 @@ void pose_copy_menu(Scene *scene) for (con= tmp_constraints.first; con; con= con->next) con->flag |= CONSTRAINT_PROXY_LOCAL; } - addlisttolist(&pchan->constraints, &tmp_constraints); + BLI_movelisttolist(&pchan->constraints, &tmp_constraints); /* update flags (need to add here, not just copy) */ pchan->constflag |= pchanact->constflag; @@ -836,7 +836,7 @@ void pose_copy_menu(Scene *scene) for (con= tmp_constraints.first; con; con= con->next) con->flag |= CONSTRAINT_PROXY_LOCAL; } - addlisttolist(&pchan->constraints, &tmp_constraints); + BLI_movelisttolist(&pchan->constraints, &tmp_constraints); /* update flags (need to add here, not just copy) */ pchan->constflag |= pchanact->constflag; @@ -1091,7 +1091,7 @@ void POSE_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", ""); + RNA_def_boolean(ot->srna, "flipped", 0, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose"); } /* ********************************************** */ @@ -1204,20 +1204,20 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED /* if there's no active group (or active is invalid), create a new menu to find it */ if (pose->active_group <= 0) { /* create a new menu, and start populating it with group names */ - pup= uiPupMenuBegin(C, op->type->name, 0); + pup= uiPupMenuBegin(C, op->type->name, ICON_NULL); layout= uiPupMenuLayout(pup); /* special entry - allow to create new group, then use that * (not to be used for removing though) */ if (strstr(op->idname, "assign")) { - uiItemIntO(layout, "New Group", 0, op->idname, "type", 0); + uiItemIntO(layout, "New Group", ICON_NULL, op->idname, "type", 0); uiItemS(layout); } /* add entries for each group */ for (grp= pose->agroups.first, i=1; grp; grp=grp->next, i++) - uiItemIntO(layout, grp->name, 0, op->idname, "type", i); + uiItemIntO(layout, grp->name, ICON_NULL, op->idname, "type", i); /* finish building the menu, and process it (should result in calling self again) */ uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 3ac78f2c727..e896cccd1b3 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -2204,7 +2204,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d e->arc = aDst; // Edge is stolen by new arc } - addlisttolist(&aDst->edges , &aSrc->edges); + BLI_movelisttolist(&aDst->edges , &aSrc->edges); } else { diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index c828ed87497..708908eda2b 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -38,4 +38,4 @@ set(SRC curve_intern.h ) -blenderlib(bf_editor_curve "${SRC}" "${INC}") +blender_add_lib(bf_editor_curve "${SRC}" "${INC}") diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index f57c51fd559..3dbf71b5ec7 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -83,6 +83,7 @@ typedef struct { ListBase nubase; void *lastsel; GHash *undoIndex; + ListBase fcurves; } UndoCurve; /* Definitions needed for shape keys */ @@ -1032,7 +1033,8 @@ static void fcurve_path_rename(char *orig_rna_path, char *rna_path, ListBase *or } } -void ED_curve_updateAnimPaths(Object *obedit) +/* return 0 if animation data wasn't changed, 1 otherwise */ +int ED_curve_updateAnimPaths(Object *obedit) { int nu_index= 0, a, pt_index; Curve *cu= (Curve*)obedit->data; @@ -1043,10 +1045,11 @@ void ED_curve_updateAnimPaths(Object *obedit) ListBase orig_curves= {0, 0}; ListBase curves= {0, 0}; AnimData *ad= BKE_animdata_from_id(&cu->id); + FCurve *fcu, *next; - if(!curve_is_animated(obedit)) return; + if(!curve_is_animated(obedit)) return 0; - copy_fcurves(&orig_curves, &editnurb->fcurves); + copy_fcurves(&orig_curves, &ad->action->curves); while(nu) { if(nu->bezt) { @@ -1072,6 +1075,9 @@ void ED_curve_updateAnimPaths(Object *obedit) } fcurve_path_rename(orig_rna_path, rna_path, &orig_curves, &curves); + + keyIndex->nu_index= nu_index; + keyIndex->pt_index= pt_index; } bezt++; @@ -1088,6 +1094,9 @@ void ED_curve_updateAnimPaths(Object *obedit) sprintf(rna_path, "splines[%d].points[%d]", nu_index, pt_index); sprintf(orig_rna_path, "splines[%d].points[%d]", keyIndex->nu_index, keyIndex->pt_index); fcurve_path_rename(orig_rna_path, rna_path, &orig_curves, &curves); + + keyIndex->nu_index= nu_index; + keyIndex->pt_index= pt_index; } bp++; @@ -1109,10 +1118,18 @@ void ED_curve_updateAnimPaths(Object *obedit) } /* the remainders in orig_curves can be copied back (like follow path) */ - addlisttolist(&curves, &orig_curves); + /* (if it's not path to spline) */ + for(fcu= orig_curves.first; fcu; fcu= next) { + next= fcu->next; + + if(!strncmp(fcu->rna_path, "splines", 7)) free_fcurve(fcu); + else BLI_addtail(&curves, fcu); + } free_fcurves(&ad->action->curves); ad->action->curves= curves; + + return 1; } /* ********************* LOAD and MAKE *************** */ @@ -1208,12 +1225,8 @@ void make_editNurb(Object *obedit) init_editNurb_keyIndex(editnurb, &cu->nurb); } - if(is_anim) { - AnimData *ad= BKE_animdata_from_id(&cu->id); - + if(is_anim) init_editNurb_keyIndex(editnurb, &cu->nurb); - copy_fcurves(&editnurb->fcurves, &ad->action->curves); - } } } @@ -1222,7 +1235,6 @@ void free_curve_editNurb (Curve *cu) if(cu->editnurb) { freeNurblist(&cu->editnurb->nurbs); free_editNurb_keyIndex(cu->editnurb); - free_fcurves(&cu->editnurb->fcurves); MEM_freeN(cu->editnurb); cu->editnurb= NULL; } @@ -1644,7 +1656,8 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag) nu= next; } - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); return OPERATOR_FINISHED; } @@ -1956,7 +1969,9 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) keyData_switchDirectionNurb(cu, nu); } - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); + DAG_id_tag_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -3184,7 +3199,8 @@ static int subdivide_exec(bContext *C, wmOperator *op) subdividenurb(obedit, number_cuts); - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); @@ -3489,7 +3505,8 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) } if(changed) { - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -4073,7 +4090,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); @@ -4280,7 +4298,8 @@ static int spin_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); @@ -4325,54 +4344,134 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) Object *obedit= CTX_data_edit_object(C); Curve *cu= (Curve*)obedit->data; EditNurb *editnurb= cu->editnurb; - Nurb *nu; + Nurb *nu, *newnu= NULL; BezTriple *bezt, *newbezt = NULL; BPoint *bp, *newbp = NULL; float mat[3][3],imat[3][3], temp[3]; + int ok= 0; copy_m3_m4(mat, obedit->obmat); invert_m3_m3(imat,mat); findselectedNurbvert(&editnurb->nurbs, &nu, &bezt, &bp); - if((nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) { - return OPERATOR_CANCELLED; + if ((nu == NULL) || (nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) { + if(cu->actnu >= 0 && mode!='e') { + nu= BLI_findlink(&editnurb->nurbs, cu->actnu); + + if(nu->type==CU_BEZIER) { + newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb"); + newbezt->radius= 1; + newbezt->alfa= 0; + BEZ_SEL(newbezt); + newbezt->h2= newbezt->h1= HD_AUTO; + + newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); + memcpy(newnu, nu, sizeof(Nurb)); + BLI_addtail(&editnurb->nurbs, newnu); + set_actNurb(obedit, newnu); + newnu->bezt= newbezt; + newnu->pntsu= 1; + + temp[0] = 1; + temp[1] = 0; + temp[2] = 0; + copy_v3_v3(newbezt->vec[1], location); + sub_v3_v3(newbezt->vec[1], obedit->obmat[3]); + sub_v3_v3v3(newbezt->vec[0], newbezt->vec[1],temp); + add_v3_v3v3(newbezt->vec[2], newbezt->vec[1],temp); + + ok= 1; + } else if(nu->pntsv == 1) { + newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5"); + newbp->radius= 1; + newbp->alfa= 0; + newbp->f1|= SELECT; + cu->lastsel= newbp; + + newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); + memcpy(newnu, nu, sizeof(Nurb)); + BLI_addtail(&editnurb->nurbs, newnu); + set_actNurb(obedit, newnu); + newnu->bp= newbp; + newnu->orderu= 2; + newnu->pntsu= 1; + + copy_v3_v3(newbp->vec, location); + sub_v3_v3(newbp->vec, obedit->obmat[3]); + mul_m3_v3(imat,newbp->vec); + newbp->vec[3]= 1.0; + + newnu->knotsu= newnu->knotsv= 0; + nurbs_knot_calc_u(newnu); + + ok= 1; + } + + } + + if(!ok) + return OPERATOR_CANCELLED; } - if(nu->type == CU_BEZIER) { + if(!ok && nu->type == CU_BEZIER) { /* which bezpoint? */ - if(bezt== nu->bezt) { /* first */ + if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */ BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); - ED_curve_beztcpy(editnurb, newbezt+1, bezt, nu->pntsu); - *newbezt= *bezt; - BEZ_SEL(newbezt); - newbezt->h2= newbezt->h1; + ED_curve_beztcpy(editnurb, newbezt, nu->bezt, nu->pntsu); + *(newbezt+nu->pntsu)= *bezt; VECCOPY(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; - bezt= newbezt+1; + newbezt+= nu->pntsu; + BEZ_SEL(newbezt); + cu->lastsel= newbezt; + newbezt->h2= newbezt->h1; + bezt= nu->bezt+nu->pntsu-1; + ok= 1; } - else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */ + else if(bezt== nu->bezt) { /* first */ BEZ_DESEL(bezt); newbezt = (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); - ED_curve_beztcpy(editnurb, newbezt, nu->bezt, nu->pntsu); - *(newbezt+nu->pntsu)= *bezt; + ED_curve_beztcpy(editnurb, newbezt+1, bezt, nu->pntsu); + *newbezt= *bezt; + BEZ_SEL(newbezt); + cu->lastsel= newbezt; + newbezt->h2= newbezt->h1; VECCOPY(temp, bezt->vec[1]); MEM_freeN(nu->bezt); nu->bezt= newbezt; - newbezt+= nu->pntsu; + bezt= newbezt+1; + ok= 1; + } + else if(mode!='e') { + BEZ_DESEL(bezt); + newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb"); + *newbezt= *bezt; BEZ_SEL(newbezt); newbezt->h2= newbezt->h1; - bezt= nu->bezt+nu->pntsu-1; + VECCOPY(temp, bezt->vec[1]); + + newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); + memcpy(newnu, nu, sizeof(Nurb)); + BLI_addtail(&editnurb->nurbs, newnu); + set_actNurb(obedit, newnu); + newnu->bezt= newbezt; + newnu->pntsu= 1; + + cu->lastsel= newbezt; + + bezt= newbezt; + ok= 1; } else bezt= 0; if(bezt) { - nu->pntsu++; - + if(!newnu) nu->pntsu++; + if(mode=='e') { copy_v3_v3(newbezt->vec[0], bezt->vec[0]); copy_v3_v3(newbezt->vec[1], bezt->vec[1]); @@ -4385,11 +4484,13 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) sub_v3_v3v3(temp, newbezt->vec[1],temp); add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp); add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp); - calchandlesNurb(nu); + + if(newnu) calchandlesNurb(newnu); + else calchandlesNurb(nu); } } } - else if(nu->pntsv==1) { + else if(!ok && nu->pntsv==1) { /* which b-point? */ if(bp== nu->bp) { /* first */ bp->f1= 0; @@ -4397,10 +4498,12 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3"); ED_curve_bpcpy(editnurb, newbp+1, bp, nu->pntsu); *newbp= *bp; - newbp->f1= 1; + newbp->f1|= SELECT; + cu->lastsel= newbp; MEM_freeN(nu->bp); nu->bp= newbp; bp= newbp + 1; + ok= 1; } else if(bp== (nu->bp+nu->pntsu-1)) { /* last */ bp->f1= 0; @@ -4411,16 +4514,33 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) MEM_freeN(nu->bp); nu->bp= newbp; newbp+= nu->pntsu; - newbp->f1= 1; + newbp->f1|= SELECT; + cu->lastsel= newbp; bp= newbp - 1; + ok= 1; + } + else if(mode!='e') { + bp->f1= 0; + newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5"); + *newbp= *bp; + newbp->f1|= SELECT; + cu->lastsel= newbp; + + newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu"); + memcpy(newnu, nu, sizeof(Nurb)); + BLI_addtail(&editnurb->nurbs, newnu); + set_actNurb(obedit, newnu); + newnu->bp= newbp; + newnu->orderu= 2; + newnu->pntsu= 1; + newnu->knotsu= newnu->knotsv= NULL; + + bp= newbp; + ok= 1; } else bp= 0; if(bp) { - nu->pntsu++; - - nurbs_knot_calc_u(nu); - if(mode=='e') { copy_v3_v3(newbp->vec, bp->vec); } @@ -4429,20 +4549,33 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) sub_v3_v3(newbp->vec, obedit->obmat[3]); mul_m3_v3(imat,newbp->vec); newbp->vec[3]= 1.0; + + if(!newnu && nu->orderu<4 && nu->orderu<=nu->pntsu) + nu->orderu++; } + + if(!newnu) { + nu->pntsu++; + nurbs_knot_calc_u(nu); + } else nurbs_knot_calc_u(newnu); } } // XXX retopo_do_all(); - test2DNurb(nu); + if(ok) { + test2DNurb(nu); - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + DAG_id_tag_update(obedit->data, OB_RECALC_DATA); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; + } + + return OPERATOR_CANCELLED; } static int add_vertex_exec(bContext *C, wmOperator *op) @@ -4510,7 +4643,8 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op)) } else { if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */ - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); @@ -4641,7 +4775,7 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve for(nu= editnurb->first; nu; nu= nu->next) { if(nu->pntsu>1 || nu->pntsv>1) { if(nu->type==CU_NURBS) { - pup= uiPupMenuBegin(C, "Direction", 0); + pup= uiPupMenuBegin(C, "Direction", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemsEnumO(layout, op->type->idname, "direction"); uiPupMenuEnd(C, pup); @@ -5441,7 +5575,9 @@ static int delete_exec(bContext *C, wmOperator *op) } else { keyIndex_delNurbList(editnurb, nubase); freeNurblist(nubase); - ED_curve_updateAnimPaths(obedit); + + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); } WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -5715,7 +5851,8 @@ static int delete_exec(bContext *C, wmOperator *op) freeNurblist(nubase); } - ED_curve_updateAnimPaths(obedit); + if(ED_curve_updateAnimPaths(obedit)) + WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, OB_RECALC_DATA); @@ -5730,14 +5867,14 @@ static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) uiLayout *layout; if(obedit->type==OB_SURF) { - pup= uiPupMenuBegin(C, "Delete", 0); + pup= uiPupMenuBegin(C, "Delete", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, op->type->idname, NULL, 0, "type", 0); uiItemEnumO(layout, op->type->idname, NULL, 0, "type", 2); uiPupMenuEnd(C, pup); } else { - pup= uiPupMenuBegin(C, "Delete", 0); + pup= uiPupMenuBegin(C, "Delete", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemsEnumO(layout, op->type->idname, "type"); uiPupMenuEnd(C, pup); @@ -5888,7 +6025,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_END; cu= ob->data; - addlisttolist(&cu->nurb, &tempbase); + BLI_movelisttolist(&cu->nurb, &tempbase); DAG_scene_sort(bmain, scene); // because we removed object(s), call before editmode! @@ -6711,6 +6848,7 @@ static void undoCurve_to_editCurve(void *ucu, void *obe) Nurb *nu, *newnu; EditNurb *editnurb= cu->editnurb; void *lastsel= NULL; + AnimData *ad= BKE_animdata_from_id(&cu->id); freeNurblist(editbase); @@ -6719,6 +6857,11 @@ static void undoCurve_to_editCurve(void *ucu, void *obe) editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex); } + if(ad && ad->action) { + free_fcurves(&ad->action->curves); + copy_fcurves(&ad->action->curves, &undoCurve->fcurves); + } + /* copy */ for(nu= undobase->first; nu; nu= nu->next) { newnu= duplicateNurb(nu); @@ -6748,6 +6891,7 @@ static void *editCurve_to_undoCurve(void *obe) EditNurb *editnurb= cu->editnurb, tmpEditnurb; Nurb *nu, *newnu; void *lastsel= NULL; + AnimData *ad= BKE_animdata_from_id(&cu->id); undoCurve= MEM_callocN(sizeof(UndoCurve), "undoCurve"); @@ -6756,6 +6900,9 @@ static void *editCurve_to_undoCurve(void *obe) tmpEditnurb.keyindex= undoCurve->undoIndex; } + if(ad && ad->action) + copy_fcurves(&undoCurve->fcurves, &ad->action->curves); + /* copy */ for(nu= nubase->first; nu; nu= nu->next) { newnu= duplicateNurb(nu); @@ -6782,9 +6929,10 @@ static void free_undoCurve(void *ucv) freeNurblist(&undoCurve->nubase); - if (undoCurve->undoIndex) { + if(undoCurve->undoIndex) BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)free_cvKeyIndex); - } + + free_fcurves(&undoCurve->fcurves); MEM_freeN(undoCurve); } diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index df0c4331195..a359b0ef6f5 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -60,4 +60,4 @@ set(SRC vertexdraw.png.c ) -blenderlib(bf_editor_datafiles "${SRC}" "${INC}") +blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}") diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 544ee83b83d..7b22a5a3171 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -41,4 +41,4 @@ set(SRC gpencil_intern.h ) -blenderlib(bf_editor_gpencil "${SRC}" "${INC}") +blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}") diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index f0b2f960a8d..96bc4259661 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -138,7 +138,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl) sprintf(name, "%s (Hidden)", gpl->info); else sprintf(name, "%s (Locked)", gpl->info); - uiItemL(subrow, name, 0); + uiItemL(subrow, name, ICON_NULL); /* delete button (only if hidden but not locked!) */ if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) { @@ -165,7 +165,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl) uiBlockSetEmboss(block, UI_EMBOSS); /* name */ - uiItemR(subrow, &ptr, "info", 0, "", 0); + uiItemR(subrow, &ptr, "info", 0, "", ICON_NULL); /* delete 'button' */ uiBlockSetEmboss(block, UI_EMBOSSN); @@ -189,17 +189,17 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl) /* color */ subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "color", 0, "", 0); - uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(subcol, &ptr, "color", 0, "", ICON_NULL); + uiItemR(subcol, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NULL); /* stroke thickness */ subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(subcol, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NULL); /* debugging options */ if (G.f & G_DEBUG) { subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "show_points", 0, NULL, 0); + uiItemR(subcol, &ptr, "show_points", 0, NULL, ICON_NULL); } /* right column ................... */ @@ -207,8 +207,8 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl) /* onion-skinning */ subcol= uiLayoutColumn(col, 1); - uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", 0); - uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", 0); // XXX shorter name here? i.e. GStep + uiItemR(subcol, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NULL); + uiItemR(subcol, &ptr, "ghost_range_max", 0, "Frames", ICON_NULL); // XXX shorter name here? i.e. GStep } } @@ -238,10 +238,10 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink"); /* add new layer button - can be used even when no data, since it can add a new block too */ - uiItemO(col, "New Layer", 0, "GPENCIL_OT_layer_add"); + uiItemO(col, "New Layer", ICON_NULL, "GPENCIL_OT_layer_add"); row= uiLayoutRow(col, 1); - uiItemO(row, "Delete Frame", 0, "GPENCIL_OT_active_frame_delete"); - uiItemO(row, "Convert", 0, "GPENCIL_OT_convert"); + uiItemO(row, "Delete Frame", ICON_NULL, "GPENCIL_OT_active_frame_delete"); + uiItemO(row, "Convert", ICON_NULL, "GPENCIL_OT_convert"); /* sanity checks... */ if (gpd == NULL) @@ -256,7 +256,7 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi /* draw gpd drawing settings first ------------------------------------- */ col= uiLayoutColumn(layout, 1); /* label */ - uiItemL(col, "Drawing Settings:", 0); + uiItemL(col, "Drawing Settings:", ICON_NULL); /* check whether advanced 3D-View drawing space options can be used */ if (CTX_wm_view3d(C)) { @@ -268,16 +268,16 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi /* drawing space options */ row= uiLayoutRow(col, 1); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, 0); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, 0); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NULL); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, ICON_NULL); row= uiLayoutRow(col, 1); uiLayoutSetActive(row, v3d_stroke_opts); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, 0); - uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, 0); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NULL); + uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NULL); row= uiLayoutRow(col, 0); uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON); - uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, 0); + uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NULL); } diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 666b11c7c0f..ec3c5e69830 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -83,7 +83,7 @@ ListBase *ED_curve_editnurbs(struct Curve *cu); void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count); void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count); -void ED_curve_updateAnimPaths(struct Object *obedit); +int ED_curve_updateAnimPaths(struct Object *obedit); #endif /* ED_CURVE_H */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 750bad8f4eb..e5a95f23ab6 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -170,5 +170,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); +unsigned int ED_viewedit_datamask(struct bScreen *screen); + #endif /* ED_VIEW3D_H */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index bab5fef5721..fc8e0ca98a1 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -637,6 +637,9 @@ void UI_exit(void); #define UI_LAYOUT_OP_SHOW_TITLE 1 #define UI_LAYOUT_OP_SHOW_EMPTY 2 +/* for more readable function names */ +#define ICON_NULL 0 + uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style); void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout); void uiBlockLayoutResolve(uiBlock *block, int *x, int *y); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index e3c83291089..5c97da4ebc9 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -232,6 +232,10 @@ enum { TH_PREVIEW_BACK, TH_EDGE_CREASE, + + TH_DRAWEXTRA_EDGELEN, + TH_DRAWEXTRA_FACEAREA, + TH_DRAWEXTRA_FACEANG }; /* XXX WARNING: previous is saved in file, so do not change order! */ @@ -270,17 +274,17 @@ void UI_GetThemeColor3fv(int colorid, float *col); void UI_GetThemeColorShade3fv(int colorid, int offset, float *col); // get the 3 or 4 byte values -void UI_GetThemeColor3ubv(int colorid, char *col); -void UI_GetThemeColor4ubv(int colorid, char *col); +void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]); +void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]); // get a theme color from specified space type -void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col); +void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]); // blends and shades between two color pointers -void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset); +void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset); // get a 3 byte color, blended and shaded between two other char color pointers -void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset); +void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset); // clear the openGL ClearColor using the input colorid void UI_ThemeClearColor(int colorid); @@ -289,9 +293,8 @@ void UI_ThemeClearColor(int colorid); void UI_SetTheme(int spacetype, int regionid); /* only for buttons in theme editor! */ -char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); -char *UI_ThemeColorsPup(int spacetype); +const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); -void UI_make_axis_color(char *src_col, char *dst_col, char axis); +void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis); #endif /* UI_ICONS_H */ diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 79fd3cc3b8e..6be7314304f 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -62,4 +62,4 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_editor_interface "${SRC}" "${INC}") +blender_add_lib(bf_editor_interface "${SRC}" "${INC}") diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index d06fe5efcf0..65261371329 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1342,7 +1342,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o } -static void glColor3ubvShade(char *col, int shade) +static void glColor3ubvShade(unsigned char *col, int shade) { glColor3ub(col[0]-shade>0?col[0]-shade:0, col[1]-shade>0?col[1]-shade:0, @@ -1379,7 +1379,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect /* backdrop */ if(cumap->flag & CUMA_DO_CLIP) { - glColor3ubvShade(wcol->inner, -20); + glColor3ubvShade((unsigned char *)wcol->inner, -20); glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); glColor3ubv((unsigned char*)wcol->inner); glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx), @@ -1393,13 +1393,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect } /* grid, every .25 step */ - glColor3ubvShade(wcol->inner, -16); + glColor3ubvShade((unsigned char *)wcol->inner, -16); ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f); /* grid, every 1.0 step */ - glColor3ubvShade(wcol->inner, -24); + glColor3ubvShade((unsigned char *)wcol->inner, -24); ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f); /* axes */ - glColor3ubvShade(wcol->inner, -50); + glColor3ubvShade((unsigned char *)wcol->inner, -50); glBegin(GL_LINES); glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy)); glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy)); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index d66f7d262a9..4c35b3cf5c8 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4022,7 +4022,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg) layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); - uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); + uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", ICON_NULL); uiPopupBoundsBlock(block, 6, -50, 26); uiEndBlock(C, block); @@ -4060,7 +4060,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); - uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); + uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", ICON_NULL); uiPopupBoundsBlock(block, 6, -50, 26); uiEndBlock(C, block); @@ -4116,7 +4116,7 @@ static int ui_but_menu(bContext *C, uiBut *but) else name= "<needs_name>"; // XXX - should never happen. - pup= uiPupMenuBegin(C, name, 0); + pup= uiPupMenuBegin(C, name, ICON_NULL); layout= uiPupMenuLayout(pup); uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); @@ -4133,24 +4133,24 @@ static int ui_but_menu(bContext *C, uiBut *but) /* Keyframes */ if(but->flag & UI_BUT_ANIMATED_KEY) { if(length) { - uiItemBooleanO(layout, "Replace Keyframes", 0, "ANIM_OT_keyframe_insert_button", "all", 1); - uiItemBooleanO(layout, "Replace Single Keyframe", 0, "ANIM_OT_keyframe_insert_button", "all", 0); - uiItemBooleanO(layout, "Delete Keyframes", 0, "ANIM_OT_keyframe_delete_button", "all", 1); - uiItemBooleanO(layout, "Delete Single Keyframe", 0, "ANIM_OT_keyframe_delete_button", "all", 0); + uiItemBooleanO(layout, "Replace Keyframes", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 1); + uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 0); + uiItemBooleanO(layout, "Delete Keyframes", ICON_NULL, "ANIM_OT_keyframe_delete_button", "all", 1); + uiItemBooleanO(layout, "Delete Single Keyframe", ICON_NULL, "ANIM_OT_keyframe_delete_button", "all", 0); } else { - uiItemBooleanO(layout, "Replace Keyframe", 0, "ANIM_OT_keyframe_insert_button", "all", 0); - uiItemBooleanO(layout, "Delete Keyframe", 0, "ANIM_OT_keyframe_delete_button", "all", 0); + uiItemBooleanO(layout, "Replace Keyframe", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 0); + uiItemBooleanO(layout, "Delete Keyframe", ICON_NULL, "ANIM_OT_keyframe_delete_button", "all", 0); } } else if(but->flag & UI_BUT_DRIVEN); else if(is_anim) { if(length) { - uiItemBooleanO(layout, "Insert Keyframes", 0, "ANIM_OT_keyframe_insert_button", "all", 1); - uiItemBooleanO(layout, "Insert Single Keyframe", 0, "ANIM_OT_keyframe_insert_button", "all", 0); + uiItemBooleanO(layout, "Insert Keyframes", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 1); + uiItemBooleanO(layout, "Insert Single Keyframe", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 0); } else - uiItemBooleanO(layout, "Insert Keyframe", 0, "ANIM_OT_keyframe_insert_button", "all", 0); + uiItemBooleanO(layout, "Insert Keyframe", ICON_NULL, "ANIM_OT_keyframe_insert_button", "all", 0); } /* Drivers */ @@ -4158,29 +4158,29 @@ static int ui_but_menu(bContext *C, uiBut *but) uiItemS(layout); if(length) { - uiItemBooleanO(layout, "Delete Drivers", 0, "ANIM_OT_driver_button_remove", "all", 1); - uiItemBooleanO(layout, "Delete Single Driver", 0, "ANIM_OT_driver_button_remove", "all", 0); + uiItemBooleanO(layout, "Delete Drivers", ICON_NULL, "ANIM_OT_driver_button_remove", "all", 1); + uiItemBooleanO(layout, "Delete Single Driver", ICON_NULL, "ANIM_OT_driver_button_remove", "all", 0); } else - uiItemBooleanO(layout, "Delete Driver", 0, "ANIM_OT_driver_button_remove", "all", 0); + uiItemBooleanO(layout, "Delete Driver", ICON_NULL, "ANIM_OT_driver_button_remove", "all", 0); - uiItemO(layout, "Copy Driver", 0, "ANIM_OT_copy_driver_button"); + uiItemO(layout, "Copy Driver", ICON_NULL, "ANIM_OT_copy_driver_button"); if (ANIM_driver_can_paste()) - uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button"); + uiItemO(layout, "Paste Driver", ICON_NULL, "ANIM_OT_paste_driver_button"); } else if(but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED)); else if(is_anim) { uiItemS(layout); if(length) { - uiItemBooleanO(layout, "Add Drivers", 0, "ANIM_OT_driver_button_add", "all", 1); - uiItemBooleanO(layout, "Add Single Driver", 0, "ANIM_OT_driver_button_add", "all", 0); + uiItemBooleanO(layout, "Add Drivers", ICON_NULL, "ANIM_OT_driver_button_add", "all", 1); + uiItemBooleanO(layout, "Add Single Driver", ICON_NULL, "ANIM_OT_driver_button_add", "all", 0); } else - uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_driver_button_add", "all", 0); + uiItemBooleanO(layout, "Add Driver", ICON_NULL, "ANIM_OT_driver_button_add", "all", 0); if (ANIM_driver_can_paste()) - uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button"); + uiItemO(layout, "Paste Driver", ICON_NULL, "ANIM_OT_paste_driver_button"); } /* Keying Sets */ @@ -4188,13 +4188,13 @@ static int ui_but_menu(bContext *C, uiBut *but) uiItemS(layout); if(length) { - uiItemBooleanO(layout, "Add All to Keying Set", 0, "ANIM_OT_keyingset_button_add", "all", 1); - uiItemBooleanO(layout, "Add Single to Keying Set", 0, "ANIM_OT_keyingset_button_add", "all", 0); - uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_keyingset_button_remove"); + uiItemBooleanO(layout, "Add All to Keying Set", ICON_NULL, "ANIM_OT_keyingset_button_add", "all", 1); + uiItemBooleanO(layout, "Add Single to Keying Set", ICON_NULL, "ANIM_OT_keyingset_button_add", "all", 0); + uiItemO(layout, "Remove from Keying Set", ICON_NULL, "ANIM_OT_keyingset_button_remove"); } else { - uiItemBooleanO(layout, "Add to Keying Set", 0, "ANIM_OT_keyingset_button_add", "all", 0); - uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_keyingset_button_remove"); + uiItemBooleanO(layout, "Add to Keying Set", ICON_NULL, "ANIM_OT_keyingset_button_add", "all", 0); + uiItemO(layout, "Remove from Keying Set", ICON_NULL, "ANIM_OT_keyingset_button_remove"); } } @@ -4206,14 +4206,14 @@ static int ui_but_menu(bContext *C, uiBut *but) //Paste Property Value if(length) { - uiItemBooleanO(layout, "Reset All to Default Values", 0, "UI_OT_reset_default_button", "all", 1); - uiItemBooleanO(layout, "Reset Single to Default Value", 0, "UI_OT_reset_default_button", "all", 0); + uiItemBooleanO(layout, "Reset All to Default Values", ICON_NULL, "UI_OT_reset_default_button", "all", 1); + uiItemBooleanO(layout, "Reset Single to Default Value", ICON_NULL, "UI_OT_reset_default_button", "all", 0); } else - uiItemO(layout, "Reset to Default Value", 0, "UI_OT_reset_default_button"); + uiItemO(layout, "Reset to Default Value", ICON_NULL, "UI_OT_reset_default_button"); - uiItemO(layout, "Copy Data Path", 0, "UI_OT_copy_data_path_button"); - uiItemO(layout, "Copy To Selected", 0, "UI_OT_copy_to_selected_button"); + uiItemO(layout, "Copy Data Path", ICON_NULL, "UI_OT_copy_data_path_button"); + uiItemO(layout, "Copy To Selected", ICON_NULL, "UI_OT_copy_to_selected_button"); uiItemS(layout); } @@ -4262,28 +4262,28 @@ static int ui_but_menu(bContext *C, uiBut *but) WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); - uiItemFullO(layout, "WM_OT_doc_view", "View Docs", 0, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); + uiItemFullO(layout, "WM_OT_doc_view", "View Docs", ICON_NULL, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit"); RNA_string_set(&ptr_props, "doc_id", buf); RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop)); - uiItemFullO(layout, "WM_OT_doc_edit", "Submit Description", 0, ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); + uiItemFullO(layout, "WM_OT_doc_edit", "Submit Description", ICON_NULL, ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); } else if (but->optype) { WM_operator_py_idname(buf, but->optype->idname); WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); - uiItemFullO(layout, "WM_OT_doc_view", "View Docs", 0, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); + uiItemFullO(layout, "WM_OT_doc_view", "View Docs", ICON_NULL, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit"); RNA_string_set(&ptr_props, "doc_id", buf); RNA_string_set(&ptr_props, "doc_new", but->optype->description); - uiItemFullO(layout, "WM_OT_doc_edit", "Submit Description", 0, ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); + uiItemFullO(layout, "WM_OT_doc_edit", "Submit Description", ICON_NULL, ptr_props.data, WM_OP_INVOKE_DEFAULT, 0); } } @@ -5196,16 +5196,17 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) } else { /* deselect the button when moving the mouse away */ + /* also de-activate for buttons that only show higlights */ if(ui_mouse_inside_button(ar, but, event->x, event->y)) { if(!(but->flag & UI_SELECT)) { - but->flag |= UI_SELECT; + but->flag |= (UI_SELECT|UI_ACTIVE); data->cancel= 0; ED_region_tag_redraw(data->region); } } else { if(but->flag & UI_SELECT) { - but->flag &= ~UI_SELECT; + but->flag &= ~(UI_SELECT|UI_ACTIVE); data->cancel= 1; ED_region_tag_redraw(data->region); } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 566400e98d6..b0ab90279f8 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -748,7 +748,7 @@ int UI_icon_get_width(int icon_id) icon = BKE_icon_get(icon_id); - if (!icon) { + if (icon==ICON_NULL) { if (G.f & G_DEBUG) printf("UI_icon_get_width: Internal error, no icon for icon ID: %d\n", icon_id); return 0; @@ -773,7 +773,7 @@ int UI_icon_get_height(int icon_id) icon = BKE_icon_get(icon_id); - if (!icon) { + if (icon==ICON_NULL) { if (G.f & G_DEBUG) printf("UI_icon_get_height: Internal error, no icon for icon ID: %d\n", icon_id); return 0; @@ -949,7 +949,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al icon = BKE_icon_get(icon_id); - if (!icon) { + if (icon==ICON_NULL) { if (G.f & G_DEBUG) printf("icon_draw_mipmap: Internal error, no icon for icon ID: %d\n", icon_id); return; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a419fcfe40b..46dfd34d2ba 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -406,14 +406,14 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in col= a % dim_size[0]; row= a / dim_size[0]; - but= uiDefAutoButR(block, ptr, prop, a, "", 0, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y); + but= uiDefAutoButR(block, ptr, prop, a, "", ICON_NULL, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y); if(slider && but->type==NUM) but->type= NUMSLI; } } else { if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) - uiDefAutoButR(block, ptr, prop, -1, "", 0, 0, 0, w, UI_UNIT_Y); + uiDefAutoButR(block, ptr, prop, -1, "", ICON_NULL, 0, 0, w, UI_UNIT_Y); if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) { /* layout for known array subtypes */ @@ -752,7 +752,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname block->flag |= UI_BLOCK_NO_FLIP; } - uiItemL(column, (char*)item[i].name, 0); + uiItemL(column, (char*)item[i].name, ICON_NULL); bt= block->buttons.last; bt->flag= UI_TEXT_LEFT; } @@ -877,7 +877,7 @@ static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, Point /* increase height for arrays */ if(index == RNA_NO_INDEX && len > 0) { - if(!name[0] && icon == 0) + if(!name[0] && icon == ICON_NULL) h= 0; if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) @@ -917,7 +917,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index /* set name and icon */ if(!name) name= (char*)RNA_property_ui_name(prop); - if(!icon) + if(icon == ICON_NULL) icon= RNA_property_ui_icon(prop); if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) @@ -1077,7 +1077,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname for(i=0; i<totitem; i++) { if(item[i].identifier[0]) { - uiItemEnumR(column, (char*)item[i].name, 0, ptr, propname, item[i].value); + uiItemEnumR(column, (char*)item[i].name, ICON_NULL, ptr, propname, item[i].value); } else { if(item[i].name) { @@ -1087,7 +1087,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname block->flag |= UI_BLOCK_NO_FLIP; } - uiItemL(column, (char*)item[i].name, 0); + uiItemL(column, (char*)item[i].name, ICON_NULL); bt= block->buttons.last; bt->flag= UI_TEXT_LEFT; } @@ -1264,13 +1264,18 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna searchprop= RNA_struct_find_property(searchptr, searchpropname); - if(!searchprop || RNA_property_type(searchprop) != PROP_COLLECTION) { + + if(!searchprop) { printf("uiItemPointerR: search collection property not found: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname); return; } + else if (RNA_property_type(searchprop) != PROP_COLLECTION) { + printf("uiItemPointerR: search collection property is not a collection type: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname); + return; + } /* get icon & name */ - if(!icon) { + if(icon==ICON_NULL) { if(type == PROP_POINTER) icontype= RNA_property_pointer_type(ptr, prop); else @@ -2674,14 +2679,14 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in } if(flag & UI_LAYOUT_OP_SHOW_TITLE) { - uiItemL(layout, op->type->name, 0); + uiItemL(layout, op->type->name, ICON_NULL); } /* poll() on this operator may still fail, at the moment there is no nice feedback when this happens * just fails silently */ if(!WM_operator_repeat_check(C, op)) { uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo"); - uiItemL(layout, "* Redo Unsupported *", 0); // XXX, could give some nicer feedback or not show redo panel at all? + uiItemL(layout, "* Redo Unsupported *", ICON_NULL); // XXX, could give some nicer feedback or not show redo panel at all? } if(op->type->ui) { @@ -2697,12 +2702,31 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in int empty; RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - + + /* menu */ + if(op->type->flag & OPTYPE_PRESET) { + /* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */ + PointerRNA op_ptr; + uiLayout *row; + + row= uiLayoutRow(layout, TRUE); + uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NULL); + + WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add"); + RNA_string_set(&op_ptr, "operator", op->type->idname); + op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMIN, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0); + + WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add"); + RNA_string_set(&op_ptr, "operator", op->type->idname); + RNA_boolean_set(&op_ptr, "remove_active", 1); + op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0); + } + /* main draw call */ empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) { - uiItemL(layout, "No Properties.", 0); + uiItemL(layout, "No Properties.", ICON_NULL); } } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 2230042fb1f..d22106fc6a1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1487,7 +1487,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a uiItemL(layout, md->title, md->titleicon); } else { - uiItemL(layout, md->title, 0); + uiItemL(layout, md->title, ICON_NULL); bt= block->buttons.last; bt->flag= UI_TEXT_LEFT; } @@ -1887,7 +1887,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR bt= uiDefButR(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, propname, 2, 0.0, 0.0, 0, 3, "Blue"); uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); - // could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", 0); + // could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NULL); // but need to use uiButSetFunc for updating other fake buttons /* HSV values */ @@ -2411,7 +2411,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname) if(mt->poll && mt->poll(C, mt)==0) return; - pup= uiPupMenuBegin(C, mt->label, 0); + pup= uiPupMenuBegin(C, mt->label, ICON_NULL); layout= uiPupMenuLayout(pup); menu.layout= layout; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 14ad579ac6a..665ed433cf7 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -33,6 +33,7 @@ #include "BLI_string.h" +#include "BKE_animsys.h" #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_global.h" @@ -271,6 +272,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) if(id) { /* make copy */ if(id_copy(id, &newid, 0) && newid) { + /* copy animation actions too */ + BKE_copy_animdata_id_action(id); /* us is 1 by convention, but RNA_property_pointer_set will also incremement it, so set it to zero */ newid->us= 0; @@ -289,6 +292,35 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } } +static const char *template_id_browse_tip(StructRNA *type) +{ + if(type) { + switch(RNA_type_to_ID_code(type)) { + case ID_SCE: return "Browse Scene to be linked"; + case ID_OB: return "Browse Object to be linked"; + case ID_ME: return "Browse Mesh Data to be linked"; + case ID_CU: return "Browse Curve Data to be linked"; + case ID_MB: return "Browse MetaBall Data to be linked"; + case ID_MA: return "Browse Material to be linked"; + case ID_TE: return "Browse Texture to be linked"; + case ID_IM: return "Browse Image to be linked"; + case ID_LA: return "Browse Lattice Data to be linked"; + case ID_CA: return "Browse Camera Data to be linked"; + case ID_WO: return "Browse World Settings to be linked"; + case ID_SCR: return "Choose Screen lay-out"; + case ID_TXT: return "Browse Text to be linked"; + case ID_SO: return "Browse Sound to be linked"; + case ID_AR: return "Browse Armature data to be linked"; + case ID_AC: return "Browse Action to be linked"; + case ID_NT: return "Browse Node Tree to be linked"; + case ID_BR: return "Browse Brush to be linked"; + case ID_PA: return "Browse Particle System to be linked"; + case ID_GD: return "Browse Grease Pencil Data to be linked"; + } + } + return "Browse ID data to be linked"; +} + static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop) { uiBut *but; @@ -310,7 +342,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(flag & UI_ID_PREVIEWS) { - but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, "Browse ID data"); + but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, template_id_browse_tip(type)); if(type) { but->icon= RNA_struct_ui_icon(type); if (id) but->icon = ui_id_icon_get(C, id, 1); @@ -324,7 +356,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else if(flag & UI_ID_BROWSE) { - but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, "Browse ID data"); + but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, template_id_browse_tip(type)); if(type) { but->icon= RNA_struct_ui_icon(type); /* default dragging of icon for id browse buttons */ @@ -425,7 +457,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiButSetNFunc(but, NULL, MEM_dupallocN(template), 0); } else { - but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock, Shift + Click to force removal on save"); + but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Unlink datablock. Shift + Click to set users to zero, data gets not saved"); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) @@ -462,7 +494,9 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const flag |= UI_ID_ADD_NEW; if(openop) flag |= UI_ID_OPEN; - + if(unlinkop && strcmp(unlinkop, "None") == 0) + flag &= ~UI_ID_DELETE; + type= RNA_property_pointer_type(ptr, prop); template->idlb= which_libbase(CTX_data_main(C), RNA_type_to_ID_code(type)); @@ -522,16 +556,16 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co /* Label - either use the provided text, or will become "ID-Block:" */ if (text) - uiItemL(row, text, 0); + uiItemL(row, text, ICON_NULL); else - uiItemL(row, "ID-Block:", 0); + uiItemL(row, "ID-Block:", ICON_NULL); /* ID-Type Selector - just have a menu of icons */ // FIXME: the icon-only setting doesn't work when we supply a blank name - uiItemFullR(row, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", 0); + uiItemFullR(row, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NULL); /* ID-Block Selector - just use pointer widget... */ - uiItemFullR(row, ptr, propID, 0, 0, 0, "", 0); + uiItemFullR(row, ptr, propID, 0, 0, 0, "", ICON_NULL); } /********************* RNA Path Builder Template ********************/ @@ -676,14 +710,14 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif uiBlockSetEmboss(block, UI_EMBOSSN); /* Open/Close ................................. */ - uiItemR(row, &ptr, "show_expanded", 0, "", 0); + uiItemR(row, &ptr, "show_expanded", 0, "", ICON_NULL); /* modifier-type icon */ uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); uiBlockSetEmboss(block, UI_EMBOSS); /* modifier name */ - uiItemR(row, &ptr, "name", 0, "", 0); + uiItemR(row, &ptr, "name", 0, "", ICON_NULL); /* mode enabling buttons */ uiBlockBeginAlign(block); @@ -691,11 +725,11 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if ( ((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface) ) { - uiItemR(row, &ptr, "show_render", 0, "", 0); - uiItemR(row, &ptr, "show_viewport", 0, "", 0); + uiItemR(row, &ptr, "show_render", 0, "", ICON_NULL); + uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NULL); if (mti->flags & eModifierTypeFlag_SupportsEditmode) - uiItemR(row, &ptr, "show_in_editmode", 0, "", 0); + uiItemR(row, &ptr, "show_in_editmode", 0, "", ICON_NULL); } if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) { @@ -735,9 +769,9 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) { if(ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) - uiItemO(row, "Convert", 0, "OBJECT_OT_duplicates_make_real"); + uiItemO(row, "Convert", ICON_NULL, "OBJECT_OT_duplicates_make_real"); else if(psys->part->ren_as == PART_DRAW_PATH) - uiItemO(row, "Convert", 0, "OBJECT_OT_modifier_convert"); + uiItemO(row, "Convert", ICON_NULL, "OBJECT_OT_modifier_convert"); } } else { @@ -752,7 +786,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke)) - uiItemO(row, "Copy", 0, "OBJECT_OT_modifier_copy"); + uiItemO(row, "Copy", ICON_NULL, "OBJECT_OT_modifier_copy"); } /* result is the layout block inside the box, that we return so that modifier settings can be drawn */ @@ -910,7 +944,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) /* open/close */ uiBlockSetEmboss(block, UI_EMBOSSN); - uiItemR(row, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(row, &ptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); uiBlockSetEmboss(block, UI_EMBOSS); /* name */ @@ -920,10 +954,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) uiLayoutSetRedAlert(row, 1); if(proxy_protected == 0) { - uiItemR(row, &ptr, "name", 0, "", 0); + uiItemR(row, &ptr, "name", 0, "", ICON_NULL); } else - uiItemL(row, con->name, 0); + uiItemL(row, con->name, ICON_NULL); uiLayoutSetRedAlert(row, 0); @@ -1111,7 +1145,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M col = uiLayoutColumn(row, 1); uiLayoutSetScaleX(col, 1.5); - uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", 0); + uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NULL); } if(pr_texture) { @@ -1131,7 +1165,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M /* Alpha buton for texture preview */ if(*pr_texture!=TEX_PR_OTHER) { row = uiLayoutRow(layout, 0); - uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, 0); + uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NULL); } } } @@ -1246,8 +1280,8 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand PointerRNA ptr; RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr); row= uiLayoutRow(layout, 0); - uiItemR(row, &ptr, "position", 0, "Pos", 0); - uiItemR(row, &ptr, "color", 0, "", 0); + uiItemR(row, &ptr, "position", 0, "Pos", ICON_NULL); + uiItemR(row, &ptr, "color", 0, "", ICON_NULL); } } @@ -1271,7 +1305,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand CBData *cbd= coba->data + coba->cur; PointerRNA ptr; RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr); - uiItemR(layout, &ptr, "color", 0, "", 0); + uiItemR(layout, &ptr, "color", 0, "", ICON_NULL); } bt= uiDefButS(block, MENU, 0, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4", @@ -1750,8 +1784,8 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe /* black/white levels */ if(levels) { split= uiLayoutSplit(layout, 0, 0); - uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, 0); - uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NULL); + uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NULL); uiLayoutRow(layout, 0); bt=uiDefBut(block, BUT, 0, "Reset", 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Reset Black/White point and curves"); @@ -1976,7 +2010,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe /* retrieve icon and name */ icon= list_item_icon_get(C, itemptr, rnaicon); - if(!icon || icon == ICON_DOT) + if(icon == ICON_NULL || icon == ICON_DOT) icon= 0; namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0); @@ -2017,7 +2051,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1)); } else if(ma->use_nodes) { - uiItemL(sub, "Node <none>", 0); + uiItemL(sub, "Node <none>", ICON_NULL); } } } @@ -2030,8 +2064,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiBlockSetEmboss(block, UI_EMBOSSN); row= uiLayoutRow(split, 1); - if(i == 0) uiItemL(row, "", 0); - else uiItemR(row, itemptr, "value", 0, "", 0); + if(i == 0) uiItemL(row, "", ICON_NULL); + else uiItemR(row, itemptr, "value", 0, "", ICON_NULL); if(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) uiLayoutSetActive(row, 0); @@ -2158,7 +2192,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * /* if not found, add in dummy button */ if(i == 0) - uiItemL(row, "", 0); + uiItemL(row, "", ICON_NULL); /* next/prev button */ sprintf(str, "%d :", i); @@ -2211,7 +2245,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * /* add dummy buttons to fill space */ while(i < pa->list_scroll+items) { if(i >= pa->list_scroll) - uiItemL(col, "", 0); + uiItemL(col, "", ICON_NULL); i++; } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index b6afe6f63d4..dbe3697c76a 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -151,26 +151,33 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper if(label_align=='V') { col= uiLayoutColumn(layout, 1); - uiItemL(col, name, 0); + uiItemL(col, name, ICON_NULL); } else if(label_align=='H') { split = uiLayoutSplit(layout, 0.5f, 0); - uiItemL(uiLayoutColumn(split, 0), name, 0); + uiItemL(uiLayoutColumn(split, 0), name, ICON_NULL); col= uiLayoutColumn(split, 0); } else { col= NULL; } - name= ""; /* name is shown above, empty name for button below */ + /* may meed to add more cases here. + * don't override enum flag names */ + if(flag & PROP_ENUM_FLAG) { + name= NULL; + } + else { + name= ""; /* name is shown above, empty name for button below */ + } } else { col= layout; name= NULL; /* no smart label alignment, show default name with button */ } - uiItemFullR(col, ptr, prop, -1, 0, 0, name, 0); + uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NULL); tot++; } RNA_STRUCT_END; @@ -187,7 +194,7 @@ int uiIconFromID(ID *id) short idcode; if(id==NULL) - return 0; + return ICON_NULL; idcode= GS(id->name); @@ -205,5 +212,5 @@ int uiIconFromID(ID *id) will set the right type, also with subclassing */ RNA_id_pointer_create(id, &ptr); - return (ptr.type)? RNA_struct_ui_icon(ptr.type): 0; + return (ptr.type)? RNA_struct_ui_icon(ptr.type) : ICON_NULL; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 319d51cdf75..efdb2ef5f5e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -555,7 +555,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect) /* prepares shade colors */ -static void shadecolors4(char *coltop, char *coldown, char *color, short shadetop, short shadedown) +static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown) { coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255); @@ -569,7 +569,7 @@ static void shadecolors4(char *coltop, char *coldown, char *color, short shadeto coldown[3]= color[3]; } -static void round_box_shade_col4(char *col1, char *col2, float fac) +static void round_box_shade_col4(const char *col1, const char *col2, float fac) { int faci, facm; unsigned char col[4]; @@ -749,7 +749,7 @@ static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha { int w, h, x, y, size; - if(!icon) + if(icon==ICON_NULL) return; w = rect->xmax - rect->xmin; @@ -1431,7 +1431,7 @@ void ui_widget_color_init(ThemeUI *tui) /* ************ button callbacks, state ***************** */ -static void widget_state_blend(char *cp, char *cpstate, float fac) +static void widget_state_blend(char *cp, const char *cpstate, const float fac) { if(fac != 0.0f) { cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]); @@ -1523,9 +1523,9 @@ static void widget_state_label(uiWidgetType *wt, int state) widget_state(wt, state); if(state & UI_SELECT) - UI_GetThemeColor4ubv(TH_TEXT_HI, wt->wcol.text); + UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text); else - UI_GetThemeColor4ubv(TH_TEXT, wt->wcol.text); + UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text); } @@ -2594,7 +2594,7 @@ static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *wt, rcti *rect) { uiWidgetBase wtb; - char col[4]; + unsigned char col[4]; /* state copy! */ wt->wcol= *(wt->wcol_theme); @@ -2607,7 +2607,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * /* make mask to draw over image */ UI_GetThemeColor3ubv(TH_BACK, col); - glColor3ubv((unsigned char*)col); + glColor3ubv(col); round_box__edges(&wtb, 15, rect, 0.0f, 4.0); widgetbase_outline(&wtb); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 2bc72d717c0..fa36eed5911 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -81,14 +81,14 @@ void ui_resources_free(void) /* THEMES */ /* ******************************************************** */ -char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) +const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) { ThemeSpace *ts= NULL; static char error[4]={240, 0, 240, 255}; static char alert[4]={240, 60, 60, 255}; static char headerdesel[4]={0,0,0,255}; - char *cp= error; + const char *cp= error; if(btheme) { @@ -285,6 +285,12 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) cp= ts->face_dot; break; case TH_FACEDOT_SIZE: cp= &ts->facedot_size; break; + case TH_DRAWEXTRA_EDGELEN: + cp= ts->extra_edge_len; break; + case TH_DRAWEXTRA_FACEAREA: + cp= ts->extra_face_area; break; + case TH_DRAWEXTRA_FACEANG: + cp= ts->extra_face_angle; break; case TH_NORMAL: cp= ts->normal; break; case TH_VNORMAL: @@ -402,7 +408,7 @@ char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) } } - return cp; + return (unsigned char *)cp; } #define SETCOLTEST(col, r, g, b, a) if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;} @@ -515,6 +521,11 @@ void ui_theme_init_default(void) SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255); SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255); btheme->tv3d.facedot_size= 4; + + SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255); + SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255); + SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255); + SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255); SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255); @@ -709,20 +720,20 @@ void UI_SetTheme(int spacetype, int regionid) // for space windows only void UI_ThemeColor(int colorid) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); - glColor3ub(cp[0], cp[1], cp[2]); + glColor3ubv(cp); } // plus alpha void UI_ThemeColor4(int colorid) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); - glColor4ub(cp[0], cp[1], cp[2], cp[3]); + glColor4ubv(cp); } @@ -730,7 +741,7 @@ void UI_ThemeColor4(int colorid) void UI_ThemeColorShade(int colorid, int offset) { int r, g, b; - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); r= offset + (int) cp[0]; @@ -745,7 +756,7 @@ void UI_ThemeColorShade(int colorid, int offset) void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) { int r, g, b, a; - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); r= coloffset + (int) cp[0]; @@ -763,7 +774,7 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) { int r, g, b; - char *cp1, *cp2; + const unsigned char *cp1, *cp2; cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -780,7 +791,7 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac) void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) { int r, g, b; - char *cp1, *cp2; + const unsigned char *cp1, *cp2; cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -801,7 +812,7 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset) void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int offset, int alphaoffset) { int r, g, b, a; - char *cp1, *cp2; + const unsigned char *cp1, *cp2; cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1); cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2); @@ -824,7 +835,7 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off // get individual values, not scaled float UI_GetThemeValuef(int colorid) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((float)cp[0]); @@ -834,7 +845,7 @@ float UI_GetThemeValuef(int colorid) // get individual values, not scaled int UI_GetThemeValue(int colorid) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); return ((int) cp[0]); @@ -845,7 +856,7 @@ int UI_GetThemeValue(int colorid) // get the color, range 0.0-1.0 void UI_GetThemeColor3fv(int colorid, float *col) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0]= ((float)cp[0])/255.0; @@ -857,7 +868,7 @@ void UI_GetThemeColor3fv(int colorid, float *col) void UI_GetThemeColorShade3fv(int colorid, int offset, float *col) { int r, g, b; - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); @@ -874,9 +885,9 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float *col) } // get the color, in char pointer -void UI_GetThemeColor3ubv(int colorid, char *col) +void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0]= cp[0]; @@ -885,9 +896,9 @@ void UI_GetThemeColor3ubv(int colorid, char *col) } // get the color, in char pointer -void UI_GetThemeColor4ubv(int colorid, char *col) +void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid); col[0]= cp[0]; @@ -896,9 +907,9 @@ void UI_GetThemeColor4ubv(int colorid, char *col) col[3]= cp[3]; } -void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col) +void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]) { - char *cp; + const unsigned char *cp; cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid); col[0]= cp[0]; @@ -908,7 +919,7 @@ void UI_GetThemeColorType4ubv(int colorid, int spacetype, char *col) } // blends and shades between two char color pointers -void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset) +void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], float fac, int offset) { int r, g, b; @@ -925,7 +936,7 @@ void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset) } // get a 3 byte color, blended and shaded between two other char color pointers -void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset) +void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset) { int r, g, b; @@ -951,24 +962,27 @@ void UI_ThemeClearColor(int colorid) glClearColor(col[0], col[1], col[2], 0.0); } -void UI_make_axis_color(char *src_col, char *dst_col, char axis) +void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis) { switch(axis) { - case 'x': + case 'X': dst_col[0]= src_col[0]>219?255:src_col[0]+36; dst_col[1]= src_col[1]<26?0:src_col[1]-26; dst_col[2]= src_col[2]<26?0:src_col[2]-26; break; - case 'y': + case 'Y': dst_col[0]= src_col[0]<46?0:src_col[0]-36; dst_col[1]= src_col[1]>189?255:src_col[1]+66; dst_col[2]= src_col[2]<46?0:src_col[2]-36; break; - default: + case 'Z': dst_col[0]= src_col[0]<26?0:src_col[0]-26; dst_col[1]= src_col[1]<26?0:src_col[1]-26; dst_col[2]= src_col[2]>209?255:src_col[2]+46; + break; + default: + BKE_assert(!"invalid axis arg"); } } @@ -1488,6 +1502,15 @@ void init_userdef_do_versions(void) btheme->tui.wcol_progress= wcol_progress; } } + + if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) { + bTheme *btheme; + for(btheme= U.themes.first; btheme; btheme= btheme->next) { + SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255); + SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255); + SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255); + } + } /* GL Texture Garbage Collection (variable abused above!) */ if (U.textimeout == 0) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 21146dc8cec..163bd8e7d2f 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1697,10 +1697,10 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v * NOTE: it's assumed that that scrollbar is there if this is involved! */ fac= (grid->starty- v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin); - fac= (vert.ymin + V2D_SCROLL_HEIGHT) + fac*(vert.ymax - vert.ymin - V2D_SCROLL_HEIGHT); + fac= vert.ymin + fac*(vert.ymax - vert.ymin); dfac= (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin); - dfac= dfac * (vert.ymax - vert.ymin - V2D_SCROLL_HEIGHT); + dfac= dfac * (vert.ymax - vert.ymin); /* set starting value, and text color */ UI_ThemeColor(TH_TEXT); @@ -2006,7 +2006,10 @@ static ListBase strings= {NULL, NULL}; typedef struct View2DString { struct View2DString *next, *prev; - GLbyte col[4]; + union { + unsigned char ub[4]; + int pack; + } col; short mval[2]; rcti rect; } View2DString; @@ -2026,9 +2029,9 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co memcpy(v2s_str, str, len); BLI_addtail(&strings, v2s); + v2s->col.pack= *((int *)col); v2s->mval[0]= mval[0]; v2s->mval[1]= mval[1]; - QUATCOPY(v2s->col, col); } } @@ -2043,17 +2046,18 @@ void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const UI_view2d_to_region_no_clip(v2d, rect->xmin, rect->ymin, &v2s->rect.xmin, &v2s->rect.ymin); UI_view2d_to_region_no_clip(v2d, rect->xmax, rect->ymax, &v2s->rect.xmax, &v2s->rect.ymax); + v2s->col.pack= *((int *)col); v2s->mval[0]= v2s->rect.xmin; v2s->mval[1]= v2s->rect.ymin; BLI_addtail(&strings, v2s); - QUATCOPY(v2s->col, col); } void UI_view2d_text_cache_draw(ARegion *ar) { View2DString *v2s; + int col_pack_prev= 0; // glMatrixMode(GL_PROJECTION); // glPushMatrix(); @@ -2068,7 +2072,10 @@ void UI_view2d_text_cache_draw(ARegion *ar) yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28"))); if(yofs<1) yofs= 1; - glColor3bv(v2s->col); + if(col_pack_prev != v2s->col.pack) { + glColor3ubv(v2s->col.ub); + col_pack_prev= v2s->col.pack; + } if(v2s->rect.xmin >= v2s->rect.xmax) BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, 65535); diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 7a15d3a9edb..82d1c7430fc 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -47,4 +47,4 @@ set(SRC mesh_intern.h ) -blenderlib(bf_editor_mesh "${SRC}" "${INC}") +blender_add_lib(bf_editor_mesh "${SRC}" "${INC}") diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index c601a583d02..16f629f0450 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -359,13 +359,13 @@ int make_fgon(EditMesh *em, wmOperator *op, int make) if(eve->f1==1) break; } if(eve) { - BKE_report(op->reports, RPT_ERROR, "Cannot make a polygon with interior vertices"); + BKE_report(op->reports, RPT_WARNING, "Cannot make a polygon with interior vertices"); return 0; } // check for faces if(nor==NULL) { - BKE_report(op->reports, RPT_ERROR, "No faces were selected to make FGon"); + BKE_report(op->reports, RPT_WARNING, "No faces were selected to make FGon"); return 0; } @@ -746,7 +746,7 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) return; } else if(amount<2) { - BKE_report(op->reports, RPT_ERROR, "More vertices are needed to make an edge/face"); + BKE_report(op->reports, RPT_WARNING, "More vertices are needed to make an edge/face"); return; } @@ -758,7 +758,7 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) efa= addfacelist(em, neweve[0], neweve[1], neweve[2], 0, NULL, NULL); EM_select_face(efa, 1); } - else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face"); + else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face"); } else if(amount==4) { /* this test survives when theres 2 triangles */ @@ -810,14 +810,14 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) else if( convex(neweve[0]->co, neweve[3]->co, neweve[1]->co, neweve[2]->co) ) { efa= addfacelist(em, neweve[0], neweve[3], neweve[1], neweve[2], NULL, NULL); } - else BKE_report(op->reports, RPT_ERROR, "cannot find nice quad from concave set of vertices"); + else BKE_report(op->reports, RPT_WARNING, "cannot find nice quad from concave set of vertices"); } } } - else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face"); + else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face"); } - else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face"); + else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face"); } if(efa) { diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index acbd9a3bb3e..e50f65256a7 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -698,7 +698,7 @@ static void check_fgons_selection(EditMesh *em) if(sel) efa->f |= SELECT; else efa->f &= ~SELECT; } - addlisttolist(&em->faces, &lbar[index]); + BLI_movelisttolist(&em->faces, &lbar[index]); } MEM_freeN(lbar); diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 5a2464bb0c6..661539d536b 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1458,7 +1458,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 2: /* copy image */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1479,7 +1479,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) case 3: /* copy UV's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1492,7 +1492,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 4: /* mode's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1505,7 +1505,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 5: /* copy transp's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1519,7 +1519,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) case 6: /* copy vcols's */ if (!mcol_act) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers."); return; } else { /* guess the 4th color if needs be */ @@ -1576,7 +1576,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) case 8: case 9: if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) { - BKE_report(op->reports, RPT_ERROR, "mesh does not have multiple uv/image layers"); + BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple uv/image layers"); return; } else { int layer_orig_idx, layer_idx; @@ -1603,7 +1603,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) case 10: /* select vcol layers - make sure this stays in sync with above code */ if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) { - BKE_report(op->reports, RPT_ERROR, "mesh does not have multiple color layers"); + BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple color layers"); return; } else { int layer_orig_idx, layer_idx; @@ -2853,7 +2853,7 @@ int select_by_number_vertices_exec(bContext *C, wmOperator *op) EM_set_flag_all(em, SELECT); } else if(em->selectmode!=SCE_SELECT_FACE) { - BKE_report(op->reports, RPT_ERROR, "Only works in face selection mode"); + BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode"); return OPERATOR_CANCELLED; } @@ -2949,7 +2949,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ if(em->selectmode==SCE_SELECT_FACE) { - BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode"); + BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -3067,7 +3067,7 @@ static void select_linked_flat_faces(EditMesh *em, wmOperator *op, float sharpne float fsharpness; if(em->selectmode!=SCE_SELECT_FACE) { - BKE_report(op->reports, RPT_ERROR, "Only works in face selection mode"); + BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode"); return; } @@ -3231,7 +3231,7 @@ void select_non_manifold(EditMesh *em, wmOperator *op ) */ if(em->selectmode==SCE_SELECT_FACE) { - BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode"); + BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode"); return; } @@ -4129,7 +4129,7 @@ void faceselect_align_view_to_selected(View3D *v3d, RegionView3D *rv3d, Mesh *me } if (totselected == 0) - BKE_report(op->reports, RPT_ERROR, "No faces selected."); + BKE_report(op->reports, RPT_WARNING, "No faces selected."); else view3d_align_axis_to_vector(v3d, rv3d, axis, norm); } @@ -4161,7 +4161,7 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o float norm[3]={0.0, 0.0, 0.0}; /* used for storing the mesh normal */ if (nselverts==0) { - BKE_report(op->reports, RPT_ERROR, "No faces or vertices selected."); + BKE_report(op->reports, RPT_WARNING, "No faces or vertices selected."); } else if (EM_nfaces_selected(em)) { EditFace *efa; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1ee93adccfc..7c3262f3747 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -495,6 +495,8 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op) void MESH_OT_remove_doubles(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name= "Remove Doubles"; ot->description= "Remove duplicate vertices"; @@ -507,7 +509,8 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_float(ot->srna, "limit", 0.0001f, 0.000001f, 50.0f, "Merge Threshold", "Minimum distance between merged verts", 0.00001f, 2.0f); + prop= RNA_def_float(ot->srna, "limit", 0.0001f, 0.000001f, 50.0f, "Merge Threshold", "Minimum distance between merged verts", 0.00001f, 2.0f); + RNA_def_property_ui_range(prop, 0.000001f, 50.0f, 0.001, 5); } // XXX is this needed? @@ -552,7 +555,7 @@ void xsortvert_flag(bContext *C, int flag) } } - addlisttolist(&vc.em->verts, &tbase); + BLI_movelisttolist(&vc.em->verts, &tbase); MEM_freeN(sortblock); @@ -610,7 +613,7 @@ void hashvert_flag(EditMesh *em, int flag) sb++; } - addlisttolist(&em->verts, &tbase); + BLI_movelisttolist(&em->verts, &tbase); MEM_freeN(sortblock); @@ -632,7 +635,7 @@ static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short typ EM_stats_update(em); if(transmode==0) { - BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude"); + BKE_report(op->reports, RPT_WARNING, "Not a valid selection for extrude"); } else { EM_fgon_flags(em); @@ -988,7 +991,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) ok= spin_mesh(C, op, NULL, RNA_int_get(op->ptr,"steps"), RNA_float_get(op->ptr,"degrees"), RNA_boolean_get(op->ptr,"dupli")); if(ok==0) { - BKE_report(op->reports, RPT_ERROR, "No valid vertices are selected"); + BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected"); return OPERATOR_CANCELLED; } @@ -1074,7 +1077,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) } } if(v1==NULL || v2==NULL) { - BKE_report(op->reports, RPT_ERROR, "You have to select a string of connected vertices too"); + BKE_report(op->reports, RPT_WARNING, "You have to select a string of connected vertices too"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -1100,7 +1103,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } else { - BKE_report(op->reports, RPT_ERROR, "No valid vertices are selected"); + BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -3774,7 +3777,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) } else { - BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces"); + BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -3789,7 +3792,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) } } else { - BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces"); + BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -4201,7 +4204,7 @@ useless: return 0; } - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { if(!(tempsv->up->f & SELECT)) { tempsv->up->f |= SELECT; tempsv->up->f2 |= 16; @@ -4654,7 +4657,7 @@ useless: } - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { look = vertlist; while(look) { tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link); @@ -4875,12 +4878,12 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } if(efa) { - BKE_report(op->reports, RPT_ERROR, "Can't perform ripping with faces selected this way"); + BKE_report(op->reports, RPT_WARNING, "Can't perform ripping with faces selected this way"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } if(sefa==NULL) { - BKE_report(op->reports, RPT_ERROR, "No proper selection or faces included"); + BKE_report(op->reports, RPT_WARNING, "No proper selection or faces included"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -4945,7 +4948,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } if(seed==NULL) { // never happens? - BKE_report(op->reports, RPT_ERROR, "No proper edge found to start"); + BKE_report(op->reports, RPT_WARNING, "No proper edge found to start"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -5075,7 +5078,7 @@ static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op) if(me->key){ ky = me->key; } else { - BKE_report(op->reports, RPT_ERROR, "Object Has No Key"); + BKE_report(op->reports, RPT_WARNING, "Object Has No Key"); return; } @@ -5090,7 +5093,7 @@ static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op) } } } else { - BKE_report(op->reports, RPT_ERROR, "Object Has No Blendshapes"); + BKE_report(op->reports, RPT_WARNING, "Object Has No Blendshapes"); return; } @@ -5855,7 +5858,7 @@ static int merge_exec(bContext *C, wmOperator *op) if(ese && ese->type == EDITVERT) { count = merge_firstlast(em, 0, uvs); } else { - BKE_report(op->reports, RPT_ERROR, "no last selected vertex set"); + BKE_report(op->reports, RPT_WARNING, "no last selected vertex set"); } break; case 6: @@ -5864,7 +5867,7 @@ static int merge_exec(bContext *C, wmOperator *op) count = merge_firstlast(em, 1, uvs); } else { - BKE_report(op->reports, RPT_ERROR, "no last selected vertex set"); + BKE_report(op->reports, RPT_WARNING, "no last selected vertex set"); } break; case 5: @@ -6120,7 +6123,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) } else { BKE_mesh_end_editmesh(obedit->data, em); - BKE_report(op->reports, RPT_ERROR, "Path Selection requires that exactly two vertices be selected"); + BKE_report(op->reports, RPT_WARNING, "Path Selection requires that exactly two vertices be selected"); return OPERATOR_CANCELLED; } @@ -6405,7 +6408,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6479,7 +6482,7 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op) int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6567,7 +6570,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_vertColorCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6624,7 +6627,7 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op) int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_vertColorCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers"); + BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index f39180bbe1b..e808b64aaeb 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -32,11 +32,11 @@ #include <stdio.h> #include "DNA_ID.h" +#include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" -#include "DNA_object_types.h" #include "MEM_guardedalloc.h" @@ -50,8 +50,10 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_depsgraph.h" -#include "BKE_scene.h" #include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_report.h" +#include "BKE_scene.h" #include "BIF_gl.h" #include "BIF_glutil.h" /* for paint cursor */ @@ -381,10 +383,14 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) { + Object *obedit= CTX_data_edit_object(C); tringselOpData *lcd; EditEdge *edge; int dist = 75; + if(modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit)) + BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display"); + view3d_operator_needs_opengl(C); if (!ringsel_init(C, op, 1)) diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 1f3950f561b..6cf0fe0874e 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -105,13 +105,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) CustomData vdata, edata, fdata; if(scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "Cant join while in editmode"); + BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode"); return OPERATOR_CANCELLED; } /* ob is the object we are adding geometry to */ if(!ob || ob->type!=OB_MESH) { - BKE_report(op->reports, RPT_ERROR, "Active object is not a mesh"); + BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh"); return OPERATOR_CANCELLED; } @@ -137,7 +137,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* that way the active object is always selected */ if(ok==0) { - BKE_report(op->reports, RPT_ERROR, "Active object is not a selected mesh"); + BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh"); return OPERATOR_CANCELLED; } @@ -146,12 +146,12 @@ int join_mesh_exec(bContext *C, wmOperator *op) key= me->key; if(totvert==0 || totvert==me->totvert) { - BKE_report(op->reports, RPT_ERROR, "No mesh data to join"); + BKE_report(op->reports, RPT_WARNING, "No mesh data to join"); return OPERATOR_CANCELLED; } if(totvert > MESH_MAX_VERTS) { - BKE_reportf(op->reports, RPT_ERROR, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert); + BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert); return OPERATOR_CANCELLED; } @@ -571,9 +571,9 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) if (!ok) { if (nonequal_verts) - BKE_report(op->reports, RPT_ERROR, "Selected meshes must have equal numbers of vertices."); + BKE_report(op->reports, RPT_WARNING, "Selected meshes must have equal numbers of vertices."); else - BKE_report(op->reports, RPT_ERROR, "No additional selected meshes with equal vertex count to join."); + BKE_report(op->reports, RPT_WARNING, "No additional selected meshes with equal vertex count to join."); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt index f6a58f7812e..249d9daedef 100644 --- a/source/blender/editors/metaball/CMakeLists.txt +++ b/source/blender/editors/metaball/CMakeLists.txt @@ -37,4 +37,4 @@ set(SRC mball_intern.h ) -blenderlib(bf_editor_metaball "${SRC}" "${INC}") +blender_add_lib(bf_editor_metaball "${SRC}" "${INC}") diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 8aad3a1f6db..116cf30f911 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -57,4 +57,4 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_editor_object "${SRC}" "${INC}") +blender_add_lib(bf_editor_object "${SRC}" "${INC}") diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index fb0b18b011c..fdf46ea19a7 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -530,7 +530,7 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUS object_add_generic_invoke_options(C, op); - pup= uiPupMenuBegin(C, op->type->name, 0); + pup= uiPupMenuBegin(C, op->type->name, ICON_NULL); layout= uiPupMenuLayout(pup); if(!obedit || obedit->type == OB_MBALL) uiItemsEnumO(layout, op->type->idname, "type"); @@ -1091,8 +1091,8 @@ static int convert_exec(bContext *C, wmOperator *op) Nurb *nu; MetaBall *mb; Mesh *me; - int target= RNA_enum_get(op->ptr, "target"); - int keep_original= RNA_boolean_get(op->ptr, "keep_original"); + const short target= RNA_enum_get(op->ptr, "target"); + const short keep_original= RNA_boolean_get(op->ptr, "keep_original"); int a, mballConverted= 0; /* don't forget multiple users! */ @@ -1101,13 +1101,18 @@ static int convert_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; ob->flag &= ~OB_DONE; + + /* flag data thats not been edited (only needed for !keep_original) */ + if(ob->data) { + ((ID *)ob->data)->flag |= LIB_DOIT; + } } CTX_DATA_END; CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { ob= base->object; - if(ob->flag & OB_DONE) { + if(ob->flag & OB_DONE || !IS_TAGGED(ob->data)) { if (ob->type != target) { base->flag &= ~SELECT; ob->flag &= ~SELECT; @@ -1243,14 +1248,9 @@ static int convert_exec(bContext *C, wmOperator *op) curvetomesh(scene, newob); } } - else if(ob->type==OB_MBALL) { + else if(ob->type==OB_MBALL && target == OB_MESH) { Object *baseob; - if (target != OB_MESH) { - ob->flag |= OB_DONE; - continue; - } - base->flag &= ~SELECT; ob->flag &= ~SELECT; @@ -1292,11 +1292,12 @@ static int convert_exec(bContext *C, wmOperator *op) mballConverted= 1; } - else - continue; } - else + else { continue; + } + + /* tag obdata if it was been changed */ /* If the original object is active then make this object active */ if(basen) { @@ -1308,8 +1309,9 @@ static int convert_exec(bContext *C, wmOperator *op) basen= NULL; } - if (!keep_original) { + if (!keep_original && (ob->flag & OB_DONE)) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + ((ID *)ob->data)->flag &= ~LIB_DOIT; /* flag not to convert this datablock again */ } /* delete original if needed */ diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 50088e4a889..5afba182cc0 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1298,7 +1298,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase { /* if this constraint is being added to a posechannel, make sure * the constraint gets evaluated in pose-space */ - if (ob->mode & OB_MODE_POSE) { + if (pchan) { con->ownspace = CONSTRAINT_SPACE_POSE; con->flag |= CONSTRAINT_SPACEONCE; } @@ -1506,7 +1506,7 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) } /* prepare popup menu to choose targetting options */ - pup= uiPupMenuBegin(C, "Add IK", 0); + pup= uiPupMenuBegin(C, "Add IK", ICON_NULL); layout= uiPupMenuLayout(pup); /* the type of targets we'll set determines the menu entries to show... */ @@ -1515,14 +1515,14 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) * - the only thing that matters is that we want a target... */ if (tar_pchan) - uiItemBooleanO(layout, "To Active Bone", 0, "POSE_OT_ik_add", "with_targets", 1); + uiItemBooleanO(layout, "To Active Bone", ICON_NULL, "POSE_OT_ik_add", "with_targets", 1); else - uiItemBooleanO(layout, "To Active Object", 0, "POSE_OT_ik_add", "with_targets", 1); + uiItemBooleanO(layout, "To Active Object", ICON_NULL, "POSE_OT_ik_add", "with_targets", 1); } else { /* we have a choice of adding to a new empty, or not setting any target (targetless IK) */ - uiItemBooleanO(layout, "To New Empty Object", 0, "POSE_OT_ik_add", "with_targets", 1); - uiItemBooleanO(layout, "Without Targets", 0, "POSE_OT_ik_add", "with_targets", 0); + uiItemBooleanO(layout, "To New Empty Object", ICON_NULL, "POSE_OT_ik_add", "with_targets", 1); + uiItemBooleanO(layout, "Without Targets", ICON_NULL, "POSE_OT_ik_add", "with_targets", 0); } /* finish building the menu, and process it (should result in calling self again) */ diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index ba1778a6a38..ef6f450f2f4 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -82,14 +82,20 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc { ModifierData *md=NULL, *new_md=NULL; ModifierTypeInfo *mti = modifierType_getInfo(type); - + + /* only geometry objects should be able to get modifiers [#25291] */ + if(!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { + BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name+2); + return NULL; + } + if(mti->flags&eModifierTypeFlag_Single) { if(modifiers_findByType(ob, type)) { BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed."); return NULL; } } - + if(type == eModifierType_ParticleSystem) { /* don't need to worry about the new modifier's name, since that is set to the number * of particle systems which shouldn't have too many duplicates diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 2b45299aefa..63c9e394705 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -282,7 +282,7 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) PointerRNA props_ptr; /* create operator menu item with relevant properties filled in */ - props_ptr= uiItemFullO(layout, op->idname, op->type->name, 0, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, op->idname, op->type->name, ICON_NULL, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); /* present the menu and be done... */ uiPupMenuEnd(C, pup); @@ -687,7 +687,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { Object *ob= ED_object_active_context(C); - uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0); + uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", ICON_NULL); uiLayout *layout= uiPupMenuLayout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); @@ -1444,17 +1444,17 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) if(ob->id.lib==NULL && (base->flag & flag)==flag ) { id= ob->data; - if(id && id->us>1 && id->lib==0) { + if(id && id->us>1 && id->lib==NULL) { ob->recalc= OB_RECALC_DATA; + BKE_copy_animdata_id_action(id); + switch(ob->type) { case OB_LAMP: - if(id && id->us>1 && id->lib==NULL) { - ob->data= la= copy_lamp(ob->data); - for(a=0; a<MAX_MTEX; a++) { - if(la->mtex[a]) { - ID_NEW(la->mtex[a]->object); - } + ob->data= la= copy_lamp(ob->data); + for(a=0; a<MAX_MTEX; a++) { + if(la->mtex[a]) { + ID_NEW(la->mtex[a]->object); } } break; @@ -1495,52 +1495,6 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) } -#if 0 // XXX old animation system - id= (ID *)ob->action; - if (id && id->us>1 && id->lib==NULL){ - if(id->newid){ - ob->action= (bAction *)id->newid; - id_us_plus(id->newid); - } - else { - ob->action= copy_action(ob->action); - id->us--; - id->newid=(ID *)ob->action; - } - } - id= (ID *)ob->ipo; - if(id && id->us>1 && id->lib==NULL) { - if(id->newid) { - ob->ipo= (Ipo *)id->newid; - id_us_plus(id->newid); - } - else { - ob->ipo= copy_ipo(ob->ipo); - id->us--; - id->newid= (ID *)ob->ipo; - } - ipo_idnew(ob->ipo); /* drivers */ - } - /* other ipos */ - switch(ob->type) { - case OB_LAMP: - la= ob->data; - if(la->ipo && la->ipo->id.us>1) { - la->ipo->id.us--; - la->ipo= copy_ipo(la->ipo); - ipo_idnew(la->ipo); /* drivers */ - } - break; - case OB_CAMERA: - cam= ob->data; - if(cam->ipo && cam->ipo->id.us>1) { - cam->ipo->id.us--; - cam->ipo= copy_ipo(cam->ipo); - ipo_idnew(cam->ipo); /* drivers */ - } - break; - } -#endif // XXX old animation system } } @@ -1551,29 +1505,18 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) } } -void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag)) +static void single_object_action_users(Scene *scene, int flag) { -#if 0 // XXX old animation system Object *ob; Base *base; - ID *id; for(base= FIRSTBASE; base; base= base->next) { ob= base->object; if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) { ob->recalc= OB_RECALC_DATA; - - id= (ID *)ob->ipo; - if(id && id->us>1 && id->lib==NULL) { - ob->ipo= copy_ipo(ob->ipo); - id->us--; - ipo_idnew(ob->ipo); /* drivers */ - } + BKE_copy_animdata_id_action(&ob->id); } } -#endif // XXX old animation system - // TODO, something like this but must check users first. - // BKE_copy_animdata_id_action((ID *)obn->data); } static void single_mat_users(Scene *scene, int flag, int do_textures) @@ -1595,17 +1538,11 @@ static void single_mat_users(Scene *scene, int flag, int do_textures) if(ma->id.us>1) { man= copy_material(ma); - + BKE_copy_animdata_id_action(&man->id); + man->id.us= 0; assign_material(ob, man, a); - -#if 0 // XXX old animation system - if(ma->ipo) { - man->ipo= copy_ipo(ma->ipo); - ma->ipo->id.us--; - ipo_idnew(ma->ipo); /* drivers */ - } -#endif // XXX old animation system + if(do_textures) { for(b=0; b<MAX_MTEX; b++) { if(ma->mtex[b] && ma->mtex[b]->tex) { @@ -1638,6 +1575,7 @@ void do_single_tex_user(Tex **from) } else if(tex->id.us>1) { texn= copy_texture(tex); + BKE_copy_animdata_id_action(&texn->id); tex->id.newid= (ID *)texn; tex->id.us--; *from= texn; @@ -1789,6 +1727,16 @@ static int make_local_exec(bContext *C, wmOperator *op) id_make_local(id, 0); adt= BKE_animdata_from_id(id); if(adt) BKE_animdata_make_local(adt); + + /* tag indirect data direct */ + matarar= (Material ***)give_matarar(ob); + if(matarar) { + for(a=0; a<ob->totcol; a++) { + ma= (*matarar)[a]; + if(ma) + id_lib_extern(&ma->id); + } + } } for(psys=ob->particlesystem.first; psys; psys=psys->next) @@ -1878,7 +1826,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) single_mat_users(scene, flag, TRUE); if(RNA_boolean_get(op->ptr, "animation")) - single_ipo_users(scene, flag); + single_object_action_users(scene, flag); clear_id_newpoins(); @@ -1913,7 +1861,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each datablock"); RNA_def_boolean(ot->srna, "texture", 0, "Textures", "Make textures local to each material"); - RNA_def_boolean(ot->srna, "animation", 0, "Animation Data", "Make animation data local to each object"); + RNA_def_boolean(ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object"); } static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event) diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index deda2ce0129..265fd84d6da 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -431,7 +431,7 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in } /* build the menu. */ - pup= uiPupMenuBegin(C, "Select Group", 0); + pup= uiPupMenuBegin(C, "Select Group", ICON_NULL); layout= uiPupMenuLayout(pup); for (i=0; i<group_count; i++) { diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 911d1e90458..76419dbb505 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -49,4 +49,4 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -blenderlib(bf_editor_physics "${SRC}" "${INC}") +blender_add_lib(bf_editor_physics "${SRC}" "${INC}") diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5de915d9a3a..238ace11c0d 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3797,7 +3797,7 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo) pm->index_array = MEM_dupallocN(pm->index_array); - BKE_ptcache_mem_init_pointers(pm); + BKE_ptcache_mem_pointers_init(pm); LOOP_POINTS { LOOP_KEYS { @@ -3808,7 +3808,7 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo) key->time = &key->ftime; } } - BKE_ptcache_mem_incr_pointers(pm); + BKE_ptcache_mem_pointers_incr(pm); } } } @@ -4061,13 +4061,13 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, totframe++; for(pm=cache->mem_cache.first; pm; pm=pm->next) { - BKE_ptcache_mem_init_pointers(pm); + BKE_ptcache_mem_pointers_init(pm); LOOP_POINTS { if(psys) { if(pm->index_array) { if(pm->index_array[p]) - BKE_ptcache_mem_seek_pointers(p, pm); + BKE_ptcache_mem_pointers_seek(p, pm); else continue; } @@ -4075,7 +4075,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, pa = psys->particles + p; if((pm->next && pm->next->frame < pa->time) || (pm->prev && pm->prev->frame >= pa->dietime)) { - BKE_ptcache_mem_incr_pointers(pm); + BKE_ptcache_mem_pointers_incr(pm); continue; } } @@ -4093,7 +4093,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, key->rot = pm->cur[BPHYS_DATA_ROTATION]; key->ftime = (float)pm->frame; key->time = &key->ftime; - BKE_ptcache_mem_incr_pointers(pm); + BKE_ptcache_mem_pointers_incr(pm); point->totkey++; } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 8843cf2849a..e0fc0d7318d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -116,7 +116,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) baker.progresscontext = NULL; } - BKE_ptcache_make_cache(&baker); + BKE_ptcache_bake(&baker); WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, NULL); @@ -218,7 +218,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) baker.progresscontext = NULL; } - BKE_ptcache_make_cache(&baker); + BKE_ptcache_bake(&baker); BLI_freelistN(&pidlist); diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index f32a223c4b1..bfb83d12848 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -55,4 +55,4 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -blenderlib(bf_editor_render "${SRC}" "${INC}") +blender_add_lib(bf_editor_render "${SRC}" "${INC}") diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 339bcf2ab4a..96e48631b09 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -866,23 +866,26 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEv /* determine if render already shows */ if(sa) { - SpaceImage *sima= sa->spacedata.first; - - if(sima->flag & SI_PREVSPACE) { - sima->flag &= ~SI_PREVSPACE; - - if(sima->flag & SI_FULLWINDOW) { - sima->flag &= ~SI_FULLWINDOW; - ED_screen_full_prevspace(C, sa); - } - else if(sima->next) { - /* workaround for case of double prevspace, render window - with a file browser on top of it (same as in ED_area_prevspace) */ - if(sima->next->spacetype == SPACE_FILE && sima->next->next) - ED_area_newspace(C, sa, sima->next->next->spacetype); - else - ED_area_newspace(C, sa, sima->next->spacetype); - ED_area_tag_redraw(sa); + /* but don't close it when rendering */ + if(!G.rendering) { + SpaceImage *sima= sa->spacedata.first; + + if(sima->flag & SI_PREVSPACE) { + sima->flag &= ~SI_PREVSPACE; + + if(sima->flag & SI_FULLWINDOW) { + sima->flag &= ~SI_FULLWINDOW; + ED_screen_full_prevspace(C, sa); + } + else if(sima->next) { + /* workaround for case of double prevspace, render window + with a file browser on top of it (same as in ED_area_prevspace) */ + if(sima->next->spacetype == SPACE_FILE && sima->next->next) + ED_area_newspace(C, sa, sima->next->next->spacetype); + else + ED_area_newspace(C, sa, sima->next->spacetype); + ED_area_tag_redraw(sa); + } } } } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index af210f49553..2eac7c20350 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -49,6 +49,7 @@ #include "DNA_world_types.h" #include "DNA_camera_types.h" #include "DNA_material_types.h" +#include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_lamp_types.h" #include "DNA_space_types.h" @@ -309,6 +310,32 @@ static Object *find_object(ListBase *lb, const char *name) return ob; } +static int preview_mat_has_sss(Material *mat, bNodeTree *ntree) +{ + if(mat) { + if(mat->sss_flag & MA_DIFF_SSS) + return 1; + if(mat->nodetree) + if( preview_mat_has_sss(NULL, mat->nodetree)) + return 1; + } + else if(ntree) { + bNode *node; + for(node= ntree->nodes.first; node; node= node->next) { + if(node->type==NODE_GROUP && node->id) { + if( preview_mat_has_sss(NULL, (bNodeTree *)node->id)) + return 1; + } + else if(node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) { + mat= (Material *)node->id; + if(mat->sss_flag & MA_DIFF_SSS) + return 1; + } + } + } + return 0; +} + /* call this with a pointer to initialize preview scene */ /* call this with NULL to restore assigned ID pointers in preview scene */ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPreview *sp) @@ -343,13 +370,13 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre strcpy(sce->r.engine, scene->r.engine); if(id_type==ID_MA) { - Material *mat= NULL; + Material *mat= NULL, *origmat= (Material *)id; if(id) { /* work on a copy */ - mat= copy_material((Material *)id); + mat= localize_material(origmat); sp->matcopy= mat; - BLI_remlink(&G.main->mat, mat); + BLI_addtail(&pr_main->mat, mat); init_render_material(mat, 0, NULL); /* call that retrieves mode_l */ end_render_material(mat); @@ -361,7 +388,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.mode |= R_RAYTRACE; if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP)) sce->r.mode |= R_RAYTRACE; - if(mat->sss_flag & MA_DIFF_SSS) + if(preview_mat_has_sss(mat, NULL)) sce->r.mode |= R_SSS; /* turn off fake shadows if needed */ @@ -402,16 +429,16 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre } else { sce->lay= 1<<mat->pr_type; - if(mat->nodetree && sp->pr_method==PR_NODE_RENDER) + if(mat->nodetree && sp->pr_method==PR_NODE_RENDER) { + /* two previews, they get copied by wmJob */ ntreeInitPreview(mat->nodetree, sp->sizex, sp->sizey); + ntreeInitPreview(origmat->nodetree, sp->sizex, sp->sizey); + } } } else { sce->r.mode &= ~(R_OSA|R_RAYTRACE|R_SSS); - free_material(sp->matcopy); - MEM_freeN(sp->matcopy); - sp->matcopy= NULL; } for(base= sce->base.first; base; base= base->next) { @@ -915,10 +942,16 @@ static int shader_preview_break(void *spv) } /* outside thread, called before redraw notifiers, it moves finished preview over */ -static void shader_preview_updatejob(void *UNUSED(spv)) +static void shader_preview_updatejob(void *spv) { -// ShaderPreview *sp= spv; + ShaderPreview *sp= spv; + if(sp->id && GS(sp->id->name) == ID_MA) { + Material *mat= (Material *)sp->id; + + if(sp->matcopy && mat->nodetree && sp->matcopy->nodetree) + ntreeLocalSync(sp->matcopy->nodetree, mat->nodetree); + } } static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int first) @@ -982,7 +1015,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex; /* entire cycle for render engine */ - RE_PreviewRender(re, G.main, sce); + RE_PreviewRender(re, pr_main, sce); ((Camera *)sce->camera->data)->lens= oldlens; @@ -1024,6 +1057,16 @@ static void shader_preview_free(void *customdata) { ShaderPreview *sp= customdata; + if(sp->matcopy) { + /* node previews */ + shader_preview_updatejob(sp); + + /* get rid of copied material */ + BLI_remlink(&pr_main->mat, sp->matcopy); + free_material(sp->matcopy); + MEM_freeN(sp->matcopy); + } + MEM_freeN(sp); } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index bde4b56220e..289c1a5d028 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -300,6 +300,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) } object_remove_material_slot(ob); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index 0f81d4fb382..7c43d506a89 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -42,4 +42,4 @@ set(SRC screen_intern.h ) -blenderlib(bf_editor_screen "${SRC}" "${INC}") +blender_add_lib(bf_editor_screen "${SRC}" "${INC}") diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 0c49779cd84..6f6b13a3309 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -54,6 +54,7 @@ #include "WM_types.h" #include "ED_util.h" +#include "ED_image.h" #include "ED_screen.h" #include "ED_object.h" #include "ED_armature.h" @@ -320,23 +321,12 @@ int ED_operator_posemode(bContext *C) return 0; } - +/* wrapper for ED_space_image_show_uvedit */ int ED_operator_uvedit(bContext *C) { + SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); - EditMesh *em= NULL; - - if(obedit && obedit->type==OB_MESH) - em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - if(em && (em->faces.first) && (CustomData_has_layer(&em->fdata, CD_MTFACE))) { - BKE_mesh_end_editmesh(obedit->data, em); - return 1; - } - - if(obedit) - BKE_mesh_end_editmesh(obedit->data, em); - return 0; + return ED_space_image_show_uvedit(sima, obedit); } int ED_operator_uvmap(bContext *C) @@ -1664,6 +1654,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); + bDopeSheet ads= {0}; DLRBT_Tree keys; ActKeyColumn *ak; float cfra= (scene)? (float)(CFRA) : 0.0f; @@ -1678,10 +1669,10 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) BLI_dlrbTree_init(&keys); /* populate tree with keyframe nodes */ - if (scene && scene->adt) - scene_to_keylist(NULL, scene, &keys, NULL); - if (ob && ob->adt) - ob_to_keylist(NULL, ob, &keys, NULL); + if (scene) + scene_to_keylist(&ads, scene, &keys, NULL); + if (ob) + ob_to_keylist(&ads, ob, &keys, NULL); /* build linked-list for searching */ BLI_dlrbTree_linkedlist_sync(&keys); @@ -2141,11 +2132,11 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev if(items==0) return OPERATOR_CANCELLED; - pup= uiPupMenuBegin(C, op->type->name, 0); + pup= uiPupMenuBegin(C, op->type->name, ICON_NULL); layout= uiPupMenuLayout(pup); for (i=items-1, lastop= wm->operators.last; lastop; lastop= lastop->prev, i--) - uiItemIntO(layout, lastop->type->name, 0, op->type->idname, "index", i); + uiItemIntO(layout, lastop->type->name, ICON_NULL, op->type->idname, "index", i); uiPupMenuEnd(C, pup); @@ -2413,23 +2404,23 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U uiPopupMenu *pup; uiLayout *layout; - pup= uiPupMenuBegin(C, "Header", 0); + pup= uiPupMenuBegin(C, "Header", ICON_NULL); layout= uiPupMenuLayout(pup); // XXX SCREEN_OT_region_flip doesn't work - gets wrong context for active region, so added custom operator if (ar->alignment == RGN_ALIGN_TOP) - uiItemO(layout, "Flip to Bottom", 0, "SCREEN_OT_header_flip"); + uiItemO(layout, "Flip to Bottom", ICON_NULL, "SCREEN_OT_header_flip"); else - uiItemO(layout, "Flip to Top", 0, "SCREEN_OT_header_flip"); + uiItemO(layout, "Flip to Top", ICON_NULL, "SCREEN_OT_header_flip"); uiItemS(layout); /* file browser should be fullscreen all the time, but other regions can be maximised/restored... */ if (sa->spacetype != SPACE_FILE) { if (sa->full) - uiItemO(layout, "Tile Area", 0, "SCREEN_OT_screen_full_area"); + uiItemO(layout, "Tile Area", ICON_NULL, "SCREEN_OT_screen_full_area"); else - uiItemO(layout, "Maximize Area", 0, "SCREEN_OT_screen_full_area"); + uiItemO(layout, "Maximize Area", ICON_NULL, "SCREEN_OT_screen_full_area"); } uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index bb6901288ff..fd527dd1ffc 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -46,4 +46,4 @@ set(SRC sculpt_intern.h ) -blenderlib(bf_editor_sculpt_paint "${SRC}" "${INC}") +blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}") diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 46bcd1f1c0d..c4bf3a20235 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -2819,7 +2819,7 @@ static void project_paint_begin(ProjPaintState *ps) /* Workaround for subsurf selection, try the display mesh first */ if (ps->source==PROJ_SRC_IMAGE_CAM) { /* using render mesh, assume only camera was rendered from */ - ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->v3d->customdata_mask | CD_MASK_MTFACE); + ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); ps->dm_release= TRUE; } else if(ps->ob->derivedFinal && CustomData_has_layer( &ps->ob->derivedFinal->faceData, CD_MTFACE)) { @@ -2827,7 +2827,7 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm_release= FALSE; } else { - ps->dm = mesh_get_derived_final(ps->scene, ps->ob, ps->v3d->customdata_mask | CD_MASK_MTFACE); + ps->dm = mesh_get_derived_final(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); ps->dm_release= TRUE; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f29d32131d6..55c7247650a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -411,7 +411,6 @@ static float frontface(Brush *brush, float sculpt_normal[3], short no[3], float else { dot= dot_v3v3(fno, sculpt_normal); } - return dot > 0 ? dot : 0; } else { @@ -1331,9 +1330,14 @@ static void do_grab_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int t int n; float len; - if (brush->normal_weight > 0 || brush->flag & BRUSH_FRONTFACE) + if (brush->normal_weight > 0 || brush->flag & BRUSH_FRONTFACE) { + int cache= 1; + /* grab brush requires to test on original data */ + SWAP(int, ss->cache->original, cache); calc_sculpt_normal(sd, ss, an, nodes, totnode); - + SWAP(int, ss->cache->original, cache); + } + copy_v3_v3(grab_delta, ss->cache->grab_delta_symmetry); len = len_v3(grab_delta); diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 927632f5a98..c8bad32bc35 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -36,4 +36,4 @@ set(SRC sound_intern.h ) -blenderlib(bf_editor_sound "${SRC}" "${INC}") +blender_add_lib(bf_editor_sound "${SRC}" "${INC}") diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 5ee2d1b83d8..80d0b0f8815 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -214,7 +214,7 @@ static void unpack_menu(bContext *C, const char *opname, const char *abs_name, c BLI_splitdirstring(local_name, fi); sprintf(local_name, "//%s/%s", folder, fi); - pup= uiPupMenuBegin(C, "Unpack file", 0); + pup= uiPupMenuBegin(C, "Unpack file", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, opname, "Remove Pack", 0, "method", PF_REMOVE); diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index 5bfd01d461c..e0621a277ae 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -39,4 +39,4 @@ set(SRC action_intern.h ) -blenderlib(bf_editor_space_action "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_action "${SRC}" "${INC}") diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index c1a5453abfe..cf515a25020 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -162,9 +162,9 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) float act_start, act_end, y; int height, items; - char col1[3], col2[3]; - char col1a[3], col2a[3]; - char col1b[3], col2b[3]; + unsigned char col1[3], col2[3]; + unsigned char col1a[3], col2a[3]; + unsigned char col1b[3], col2b[3]; /* get theme colors */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index bb3b40fbf9b..678558e6450 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -425,6 +425,7 @@ static void action_refresh(const bContext *C, ScrArea *sa) if (saction->flag & SACTION_TEMP_NEEDCHANSYNC) { ANIM_sync_animchannels_to_data(C); saction->flag &= ~SACTION_TEMP_NEEDCHANSYNC; + ED_area_tag_redraw(sa); } /* region updates? */ diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt index fc20f8f9895..93f256cf3da 100644 --- a/source/blender/editors/space_api/CMakeLists.txt +++ b/source/blender/editors/space_api/CMakeLists.txt @@ -34,4 +34,4 @@ set(SRC spacetypes.c ) -blenderlib(bf_editor_space_api "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_api "${SRC}" "${INC}") diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index 767536e3814..8a55567c4c0 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -38,4 +38,4 @@ set(SRC buttons_intern.h ) -blenderlib(bf_editor_space_buttons "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}") diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index abb2f689803..18e906e7dc2 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -64,7 +64,7 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr); - pup= uiPupMenuBegin(C, "Align", 0); + pup= uiPupMenuBegin(C, "Align", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemsEnumR(layout, &ptr, "align"); uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt index fe475b88092..d1cb716fa84 100644 --- a/source/blender/editors/space_console/CMakeLists.txt +++ b/source/blender/editors/space_console/CMakeLists.txt @@ -43,4 +43,4 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_editor_space_console "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_console "${SRC}" "${INC}") diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index d4d1429530c..0bb0d78a497 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -59,16 +59,16 @@ static void console_line_color(unsigned char fg[3], int type) { switch(type) { case CONSOLE_LINE_OUTPUT: - UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, (char *)fg); + UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg); break; case CONSOLE_LINE_INPUT: - UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, (char *)fg); + UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg); break; case CONSOLE_LINE_INFO: - UI_GetThemeColor3ubv(TH_CONSOLE_INFO, (char *)fg); + UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg); break; case CONSOLE_LINE_ERROR: - UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, (char *)fg); + UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg); break; } } @@ -171,7 +171,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha } /* cursor */ - UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, (char *)fg); + UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg); glColor3ubv(fg); glRecti( (xy[0] + pen[0]) - 1, diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index b4a70917ca8..d77ed306daf 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -71,4 +71,4 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() -blenderlib(bf_editor_space_file "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_file "${SRC}" "${INC}") diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 4ce49251fdc..4d9bd9bf54a 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -139,7 +139,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa) if(sfile) { row= uiLayoutRow(pa->layout, 0); uiItemO(row, "Add", ICON_ZOOMIN, "file.bookmark_add"); - uiItemL(row, NULL, 0); + uiItemL(row, NULL, ICON_NULL); file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0); } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index b46704c8a6b..12cca144d80 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -327,6 +327,13 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) v2d->scroll = V2D_SCROLL_BOTTOM; v2d->keepofs &= ~V2D_LOCKOFS_X; v2d->keepofs |= V2D_LOCKOFS_Y; + + /* XXX this happens on scaling down Screen (like from startup.blend) */ + /* view2d has no type specific for filewindow case, which doesnt scroll vertically */ + if(v2d->cur.ymax < 0) { + v2d->cur.ymin -= v2d->cur.ymax; + v2d->cur.ymax= 0; + } } /* v2d has initialized flag, so this call will only set the mask correct */ UI_view2d_region_reinit(v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index 248bc9c76c5..e57bf83cb12 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -42,4 +42,4 @@ set(SRC graph_intern.h ) -blenderlib(bf_editor_space_graph "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}") diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index ee66c667932..3274e654c15 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -138,19 +138,19 @@ static void graph_panel_view(const bContext *C, Panel *pa) /* 2D-Cursor */ col= uiLayoutColumn(pa->layout, 0); - uiItemR(col, &spaceptr, "show_cursor", 0, NULL, 0); + uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NULL); subcol= uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); - uiItemO(subcol, "Cursor from Selection", 0, "GRAPH_OT_frame_jump"); + uiItemO(subcol, "Cursor from Selection", ICON_NULL, "GRAPH_OT_frame_jump"); subcol= uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(&spaceptr, "show_cursor")); row= uiLayoutSplit(subcol, 0.7, 1); - uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", 0); + uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", ICON_NULL); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_CFRA); row= uiLayoutSplit(subcol, 0.7, 1); - uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", 0); + uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", ICON_NULL); uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_VALUE); } @@ -186,18 +186,18 @@ static void graph_panel_properties(const bContext *C, Panel *pa) col= uiLayoutColumn(layout, 1); uiLayoutSetEnabled(col, (fcu->flag & FCURVE_DISABLED)!=0); uiItemR(col, &fcu_ptr, "data_path", 0, "", ICON_RNA); - uiItemR(col, &fcu_ptr, "array_index", 0, NULL, 0); + uiItemR(col, &fcu_ptr, "array_index", 0, NULL, ICON_NULL); /* color settings */ col= uiLayoutColumn(layout, 1); - uiItemL(col, "Display Color:", 0); + uiItemL(col, "Display Color:", ICON_NULL); row= uiLayoutRow(col, 1); - uiItemR(row, &fcu_ptr, "color_mode", 0, "", 0); + uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NULL); subrow= uiLayoutRow(row, 1); uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM)); - uiItemR(subrow, &fcu_ptr, "color", 0, "", 0); + uiItemR(subrow, &fcu_ptr, "color", 0, "", ICON_NULL); MEM_freeN(ale); } @@ -263,23 +263,23 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) /* interpolation */ col= uiLayoutColumn(layout, 0); - uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, 0); + uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NULL); /* numerical coordinate editing */ col= uiLayoutColumn(layout, 1); /* keyframe itself */ - uiItemR(col, &bezt_ptr, "co", 0, "Key", 0); + uiItemR(col, &bezt_ptr, "co", 0, "Key", ICON_NULL); /* previous handle - only if previous was Bezier interpolation */ if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) - uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, 0); + uiItemR(col, &bezt_ptr, "handle_left", 0, NULL, ICON_NULL); /* next handle - only if current is Bezier interpolation */ if (bezt->ipo == BEZT_IPO_BEZ) - uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, 0); + uiItemR(col, &bezt_ptr, "handle_right", 0, NULL, ICON_NULL); } else - uiItemL(layout, "No active keyframe on F-Curve", 0); + uiItemL(layout, "No active keyframe on F-Curve", ICON_NULL); MEM_freeN(ale); } @@ -456,7 +456,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 0); + uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NULL); col= uiLayoutColumn(layout, 1); uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); @@ -468,7 +468,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar * uiItemPointerR(col, &dtar2_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA); } - uiItemR(col, &dtar2_ptr, "use_local_space_transform", 0, NULL, 0); + uiItemR(col, &dtar2_ptr, "use_local_space_transform", 0, NULL, ICON_NULL); } /* settings for 'transform channel' driver variable type */ @@ -494,8 +494,8 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar } row= uiLayoutRow(layout, 1); - uiItemR(row, &dtar_ptr, "transform_type", 0, "", 0); - uiItemR(row, &dtar_ptr, "use_local_space_transform", 0, NULL, 0); + uiItemR(row, &dtar_ptr, "transform_type", 0, "", ICON_NULL); + uiItemR(row, &dtar_ptr, "use_local_space_transform", 0, NULL, ICON_NULL); } /* driver settings for active F-Curve (only for 'Drivers' mode) */ @@ -534,12 +534,12 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) col= uiLayoutColumn(pa->layout, 1); block= uiLayoutGetBlock(col); - uiItemR(col, &driver_ptr, "type", 0, NULL, 0); + uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NULL); /* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */ if (driver->type == DRIVER_TYPE_PYTHON) { /* expression */ - uiItemR(col, &driver_ptr, "expression", 0, "Expr", 0); + uiItemR(col, &driver_ptr, "expression", 0, "Expr", ICON_NULL); /* errors? */ if (driver->flag & DRIVER_FLAG_INVALID) @@ -553,17 +553,17 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) col= uiLayoutColumn(pa->layout, 1); /* debug setting */ - uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, 0); + uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, ICON_NULL); /* value of driver */ if (driver->flag & DRIVER_FLAG_SHOWDEBUG) { uiLayout *row= uiLayoutRow(col, 1); char valBuf[32]; - uiItemL(row, "Driver Value:", 0); + uiItemL(row, "Driver Value:", ICON_NULL); sprintf(valBuf, "%.3f", driver->curval); - uiItemL(row, valBuf, 0); + uiItemL(row, valBuf, ICON_NULL); } /* add driver variables */ @@ -588,7 +588,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) row= uiLayoutRow(box, 0); block= uiLayoutGetBlock(row); /* variable name */ - uiItemR(row, &dvar_ptr, "name", 0, "", 0); + uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NULL); /* remove button */ uiBlockSetEmboss(block, UI_EMBOSSN); @@ -598,7 +598,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* variable type */ row= uiLayoutRow(box, 0); - uiItemR(row, &dvar_ptr, "type", 0, "", 0); + uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NULL); /* variable type settings */ box= uiLayoutBox(col); @@ -624,10 +624,10 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) box= uiLayoutBox(col); row= uiLayoutRow(box, 1); - uiItemL(row, "Value:", 0); + uiItemL(row, "Value:", ICON_NULL); sprintf(valBuf, "%.3f", dvar->curval); - uiItemL(row, valBuf, 0); + uiItemL(row, valBuf, ICON_NULL); } } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d875aaafd33..08e3870f8a2 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -346,7 +346,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) BezTriple *bezt=fcu->bezt, *prevbezt=NULL; int basecol= (sel)? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; float *fp; - char col[4]; + unsigned char col[4]; /* if only selected keyframes have handles shown, skip the first round */ if ((sel == 0) && (sipo->flag & SIPO_SELVHANDLESONLY)) diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 1e6443bba32..3602977bfa3 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1922,7 +1922,7 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNU uiLayout *layout; int i; - pup= uiPupMenuBegin(C, "Add F-Curve Modifier", 0); + pup= uiPupMenuBegin(C, "Add F-Curve Modifier", ICON_NULL); layout= uiPupMenuLayout(pup); /* start from 1 to skip the 'Invalid' modifier type */ @@ -1935,7 +1935,7 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNU continue; /* create operator menu item with relevant properties filled in */ - props_ptr= uiItemFullO(layout, "GRAPH_OT_fmodifier_add", fmi->name, 0, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, "GRAPH_OT_fmodifier_add", fmi->name, ICON_NULL, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS); /* the only thing that gets set from the menu is the type of F-Modifier to add */ RNA_enum_set(&props_ptr, "type", i); /* the following properties are just repeats of existing ones... */ diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 31c2e9568ae..c7b0db8fbbc 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -64,4 +64,4 @@ if(WITH_LCMS) add_definitions(-DWITH_LCMS) endif() -blenderlib(bf_editor_space_image "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_image "${SRC}" "${INC}") diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 9a7aab73f69..756be43ccc9 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -717,7 +717,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, if(rr==NULL || iuser==NULL) return; if(rr->layers.first==NULL) { - uiItemL(row, "No Layers in Render Result.", 0); + uiItemL(row, "No Layers in Render Result.", ICON_NULL); return; } @@ -811,8 +811,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char image_info(ima, ibuf, str); BKE_image_release_ibuf(ima, lock); - uiItemL(layout, ima->id.name+2, 0); - uiItemL(layout, str, 0); + uiItemL(layout, ima->id.name+2, ICON_NULL); + uiItemL(layout, str, ICON_NULL); if(ima->type==IMA_TYPE_COMPOSITE) { // XXX not working yet @@ -844,7 +844,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char } else { row= uiLayoutRow(layout, 0); - uiItemR(row, &imaptr, "source", 0, NULL, 0); + uiItemR(row, &imaptr, "source", 0, NULL, ICON_NULL); if(ima->source != IMA_SRC_GENERATED) { row= uiLayoutRow(layout, 1); @@ -858,7 +858,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char row= uiLayoutRow(split, 1); uiLayoutSetEnabled(row, ima->packedfile==NULL); - uiItemR(row, &imaptr, "filepath", 0, "", 0); + uiItemR(row, &imaptr, "filepath", 0, "", ICON_NULL); uiItemO(row, "", ICON_FILE_REFRESH, "image.reload"); } @@ -882,7 +882,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock); image_info(ima, ibuf, str); BKE_image_release_ibuf(ima, lock); - uiItemL(layout, str, 0); + uiItemL(layout, str, ICON_NULL); } } @@ -893,13 +893,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char split= uiLayoutSplit(layout, 0, 0); col= uiLayoutColumn(split, 0); - uiItemR(col, &imaptr, "use_fields", 0, NULL, 0); + uiItemR(col, &imaptr, "use_fields", 0, NULL, ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NULL); uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields")); col= uiLayoutColumn(split, 0); - uiItemR(col, &imaptr, "use_premultiply", 0, NULL, 0); + uiItemR(col, &imaptr, "use_premultiply", 0, NULL, ICON_NULL); } } @@ -912,30 +912,30 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char sprintf(str, "(%d) Frames", iuser->framenr); row= uiLayoutRow(col, 1); - uiItemR(col, userptr, "frame_duration", 0, str, 0); + uiItemR(col, userptr, "frame_duration", 0, str, ICON_NULL); if(ima->anim) { block= uiLayoutGetBlock(row); but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, 0, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence."); uiButSetFunc(but, set_frames_cb, ima, iuser); } - uiItemR(col, userptr, "frame_start", 0, "Start", 0); - uiItemR(col, userptr, "frame_offset", 0, NULL, 0); + uiItemR(col, userptr, "frame_start", 0, "Start", ICON_NULL); + uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NULL); col= uiLayoutColumn(split, 0); - uiItemR(col, userptr, "fields_per_frame", 0, "Fields", 0); - uiItemR(col, userptr, "use_auto_refresh", 0, NULL, 0); - uiItemR(col, userptr, "use_cyclic", 0, NULL, 0); + uiItemR(col, userptr, "fields_per_frame", 0, "Fields", ICON_NULL); + uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NULL); + uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NULL); } else if(ima->source==IMA_SRC_GENERATED) { split= uiLayoutSplit(layout, 0, 0); col= uiLayoutColumn(split, 1); - uiItemR(col, &imaptr, "generated_width", 0, "X", 0); - uiItemR(col, &imaptr, "generated_height", 0, "Y", 0); + uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NULL); + uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NULL); col= uiLayoutColumn(split, 0); - uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(col, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); } } diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 498b3b80bd5..772592875c2 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -63,13 +63,13 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e show_uvedit= ED_space_image_show_uvedit(sima, obedit); - pup= uiPupMenuBegin(C, "Toolbox", 0); + pup= uiPupMenuBegin(C, "Toolbox", ICON_NULL); layout= uiPupMenuLayout(pup); - uiItemM(layout, C, "IMAGE_MT_view", NULL, 0); - if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_select", NULL, 0); - uiItemM(layout, C, "IMAGE_MT_image", NULL, 0); - if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_uvs", NULL, 0); + uiItemM(layout, C, "IMAGE_MT_view", NULL, ICON_NULL); + if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_select", NULL, ICON_NULL); + uiItemM(layout, C, "IMAGE_MT_image", NULL, ICON_NULL); + if(show_uvedit) uiItemM(layout, C, "IMAGE_MT_uvs", NULL, ICON_NULL); uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 594de9b943d..2b6958e436e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1403,7 +1403,7 @@ static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { pup= uiPupMenuBegin(C, "OK", ICON_QUESTION); layout= uiPupMenuLayout(pup); - uiItemBooleanO(layout, "Can't pack edited image from disk. Pack as internal PNG?", 0, op->idname, "as_png", 1); + uiItemBooleanO(layout, "Can't pack edited image from disk. Pack as internal PNG?", ICON_NULL, op->idname, "as_png", 1); uiPupMenuEnd(C, pup); return OPERATOR_CANCELLED; @@ -1445,7 +1445,7 @@ static void unpack_menu(bContext *C, const char *opname, Image *ima, const char BLI_splitdirstring(local_name, fi); sprintf(local_name, "//%s/%s", folder, fi); - pup= uiPupMenuBegin(C, "Unpack file", 0); + pup= uiPupMenuBegin(C, "Unpack file", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, opname, "Remove Pack", 0, "method", PF_REMOVE); @@ -1454,7 +1454,7 @@ static void unpack_menu(bContext *C, const char *opname, Image *ima, const char switch(checkPackedFile(local_name, pf)) { case PF_NOFILE: sprintf(line, "Create %s", local_name); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); @@ -1462,7 +1462,7 @@ static void unpack_menu(bContext *C, const char *opname, Image *ima, const char case PF_EQUAL: sprintf(line, "Use %s (identical)", local_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); @@ -1470,13 +1470,13 @@ static void unpack_menu(bContext *C, const char *opname, Image *ima, const char case PF_DIFFERS: sprintf(line, "Use %s (differs)", local_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_LOCAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL); RNA_string_set(&props_ptr, "image", ima->id.name); sprintf(line, "Overwrite %s", local_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_LOCAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); @@ -1489,27 +1489,27 @@ static void unpack_menu(bContext *C, const char *opname, Image *ima, const char case PF_NOFILE: sprintf(line, "Create %s", abs_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); break; case PF_EQUAL: sprintf(line, "Use %s (identical)", abs_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); break; case PF_DIFFERS: sprintf(line, "Use %s (differs)", local_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_USE_ORIGINAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); sprintf(line, "Overwrite %s", local_name); //uiItemEnumO(layout, opname, line, 0, "method", PF_WRITE_ORIGINAL); - props_ptr= uiItemFullO(layout, opname, line, 0, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + props_ptr= uiItemFullO(layout, opname, line, ICON_NULL, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL); RNA_string_set(&props_ptr, "image", ima->id.name+2); break; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 58ae3d0df87..8b8772c6e28 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -265,11 +265,9 @@ int ED_space_image_show_paint(SpaceImage *sima) int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) { - if(ED_space_image_show_render(sima)) - return 0; - if(ED_space_image_show_paint(sima)) + if(sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima))) return 0; - + if(obedit && obedit->type == OB_MESH) { EditMesh *em = BKE_mesh_get_editmesh(obedit->data); int ret; diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index 69748041996..262882e886f 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -43,4 +43,4 @@ set(SRC textview.h ) -blenderlib(bf_editor_space_info "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_info "${SRC}" "${INC}") diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index a5e47e7bb1d..190814a4da0 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -154,7 +154,7 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event) else sprintf(title, "Unpack %d files", count); - pup= uiPupMenuBegin(C, title, 0); + pup= uiPupMenuBegin(C, title, ICON_NULL); layout= uiPupMenuLayout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index ba417f0e97d..8bfcad4bab7 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -273,7 +273,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } } else { - uiItemL(layout, "No Recent Files", 0); + uiItemL(layout, "No Recent Files", ICON_NULL); } } diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index 18e546a61f5..707f4ab42ed 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -43,4 +43,4 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() -blenderlib(bf_editor_space_logic "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}") diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 068ac016b13..bd97e1e4a81 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3182,19 +3182,19 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo box= uiLayoutBox(layout); row= uiLayoutRow(box, 0); - uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", 0); + uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(row, ptr, "type", 0, "", 0); - uiItemR(row, ptr, "name", 0, "", 0); + uiItemR(row, ptr, "type", 0, "", ICON_NULL); + uiItemR(row, ptr, "name", 0, "", ICON_NULL); } else { - uiItemL(row, sensor_name(sens->type), 0); - uiItemL(row, sens->name, 0); + uiItemL(row, sensor_name(sens->type), ICON_NULL); + uiItemL(row, sens->name, ICON_NULL); } subrow= uiLayoutRow(row, 0); uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", 0); + uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")==0) { subrow= uiLayoutRow(row, 1); @@ -3215,14 +3215,14 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) row= uiLayoutRow(split, 1); uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP); uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN); - uiItemR(row, ptr, "frequency", 0, "Freq", 0); + uiItemR(row, ptr, "frequency", 0, "Freq", ICON_NULL); row= uiLayoutRow(split, 1); - uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row= uiLayoutRow(split, 1); - uiItemR(row, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", 0); + uiItemR(row, ptr, "invert", UI_ITEM_R_TOGGLE, "Invert", ICON_NULL); } /* sensors in alphabetical order */ @@ -3245,7 +3245,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) uiLayout *row; if(ob->type != OB_ARMATURE){ - uiItemL(layout, "Sensor only available for armatures", 0); + uiItemL(layout, "Sensor only available for armatures", ICON_NULL); return; } @@ -3261,8 +3261,8 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); } row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "test_type", 0, NULL, 0); - uiItemR(row, ptr, "value", 0, NULL, 0); + uiItemR(row, ptr, "test_type", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "value", 0, NULL, ICON_NULL); } static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -3274,12 +3274,12 @@ static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C split = uiLayoutSplit(layout, 0.3, 0); row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "use_material")) { case SENS_COLLISION_PROPERTY: - uiItemR(split, ptr, "property", 0, NULL, 0); + uiItemR(split, ptr, "property", 0, NULL, ICON_NULL); break; case SENS_COLLISION_MATERIAL: uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); @@ -3293,48 +3293,48 @@ static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr) row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "delay", 0, NULL, 0); - uiItemR(row, ptr, "duration", 0, NULL, 0); - uiItemR(row, ptr, "use_repeat", 0, NULL, 0); + uiItemR(row, ptr, "delay", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "duration", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_repeat", 0, NULL, ICON_NULL); } static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr) { uiLayout *col, *row; - uiItemR(layout, ptr, "joystick_index", 0, NULL, 0); - uiItemR(layout, ptr, "event_type", 0, NULL, 0); + uiItemR(layout, ptr, "joystick_index", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "event_type", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "event_type")) { case SENS_JOY_BUTTON: - uiItemR(layout, ptr, "use_all_events", 0, NULL, 0); + uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0); - uiItemR(col, ptr, "button_number", 0, NULL, 0); + uiItemR(col, ptr, "button_number", 0, NULL, ICON_NULL); break; case SENS_JOY_AXIS: row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "axis_number", 0, NULL, 0); - uiItemR(row, ptr, "axis_threshold", 0, NULL, 0); + uiItemR(row, ptr, "axis_number", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "use_all_events", 0, NULL, 0); + uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0); - uiItemR(col, ptr, "axis_direction", 0, NULL, 0); + uiItemR(col, ptr, "axis_direction", 0, NULL, ICON_NULL); break; case SENS_JOY_HAT: - uiItemR(layout, ptr, "hat_number", 0, NULL, 0); - uiItemR(layout, ptr, "use_all_events", 0, NULL, 0); + uiItemR(layout, ptr, "hat_number", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events")==0); - uiItemR(col, ptr, "hat_direction", 0, NULL, 0); + uiItemR(col, ptr, "hat_direction", 0, NULL, ICON_NULL); break; case SENS_JOY_AXIS_SINGLE: row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "single_axis_number", 0, NULL, 0); - uiItemR(row, ptr, "axis_threshold", 0, NULL, 0); + uiItemR(row, ptr, "single_axis_number", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NULL); break; } } @@ -3346,47 +3346,47 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) uiLayout *row, *col; row = uiLayoutRow(layout, 0); - uiItemL(row, "Key:", 0); + uiItemL(row, "Key:", ICON_NULL); col = uiLayoutColumn(row, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys")==0); - uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", 0); + uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NULL); col = uiLayoutColumn(row, 0); - uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys")==0); row = uiLayoutRow(col, 0); - uiItemL(row, "First Modifier:", 0); - uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", 0); + uiItemL(row, "First Modifier:", ICON_NULL); + uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NULL); row = uiLayoutRow(col, 0); - uiItemL(row, "Second Modifier:", 0); - uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", 0); + uiItemL(row, "Second Modifier:", ICON_NULL); + uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NULL); RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, 0); - uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, ICON_NULL); + uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, ICON_NULL); } static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "subject", 0, NULL, 0); + uiItemR(layout, ptr, "subject", 0, NULL, ICON_NULL); } static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "mouse_event", 0, NULL, 0); + uiItemR(layout, ptr, "mouse_event", 0, NULL, ICON_NULL); } static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr) { uiLayout *row; - uiItemR(layout, ptr, "property", 0, NULL, 0); + uiItemR(layout, ptr, "property", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "distance", 0, NULL, 0); - uiItemR(row, ptr, "reset_distance", 0, NULL, 0); + uiItemR(row, ptr, "distance", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "reset_distance", 0, NULL, ICON_NULL); } static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr) @@ -3395,22 +3395,22 @@ static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr) PointerRNA settings_ptr; uiLayout *row; - uiItemR(layout, ptr, "evaluation_type", 0, NULL, 0); + uiItemR(layout, ptr, "evaluation_type", 0, NULL, ICON_NULL); RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); switch (RNA_enum_get(ptr, "evaluation_type")) { case SENS_PROP_INTERVAL: row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "value_min", 0, NULL, 0); - uiItemR(row, ptr, "value_max", 0, NULL, 0); + uiItemR(row, ptr, "value_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "value_max", 0, NULL, ICON_NULL); break; case SENS_PROP_EQUAL: - uiItemR(layout, ptr, "value", 0, NULL, 0); + uiItemR(layout, ptr, "value", 0, NULL, ICON_NULL); break; case SENS_PROP_NEQUAL: - uiItemR(layout, ptr, "value", 0, NULL, 0); + uiItemR(layout, ptr, "value", 0, NULL, ICON_NULL); break; case SENS_PROP_CHANGED: break; @@ -3421,17 +3421,17 @@ static void draw_sensor_radar(uiLayout *layout, PointerRNA *ptr) { uiLayout *row; - uiItemR(layout, ptr, "property", 0, NULL, 0); - uiItemR(layout, ptr, "axis", 0, NULL, 0); + uiItemR(layout, ptr, "property", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "axis", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "angle", 0, NULL, 0); - uiItemR(row, ptr, "distance", 0, NULL, 0); + uiItemR(row, ptr, "angle", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "distance", 0, NULL, ICON_NULL); } static void draw_sensor_random(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "seed", 0, NULL, 0); + uiItemR(layout, ptr, "seed", 0, NULL, ICON_NULL); } static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -3441,10 +3441,10 @@ static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C) RNA_main_pointer_create(CTX_data_main(C), &main_ptr); split= uiLayoutSplit(layout, 0.3, 0); - uiItemR(split, ptr, "ray_type", 0, "", 0); + uiItemR(split, ptr, "ray_type", 0, "", ICON_NULL); switch (RNA_enum_get(ptr, "ray_type")) { case SENS_RAY_PROPERTY: - uiItemR(split, ptr, "property", 0, "", 0); + uiItemR(split, ptr, "property", 0, "", ICON_NULL); break; case SENS_RAY_MATERIAL: uiItemPointerR(split, ptr, "material", &main_ptr, "materials", "", ICON_MATERIAL_DATA); @@ -3452,15 +3452,15 @@ static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C) } split= uiLayoutSplit(layout, 0.3, 0); - uiItemR(split, ptr, "axis", 0, "", 0); + uiItemR(split, ptr, "axis", 0, "", ICON_NULL); row= uiLayoutRow(split, 0); - uiItemR(row, ptr, "range", 0, NULL, 0); - uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "range", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); } static void draw_sensor_touch(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "material", 0, NULL, 0); + uiItemR(layout, ptr, "material", 0, NULL, ICON_NULL); } void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -3535,19 +3535,19 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i box= uiLayoutBox(layout); row= uiLayoutRow(box, 0); - uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", 0); + uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(row, ptr, "type", 0, "", 0); - uiItemR(row, ptr, "name", 0, "", 0); + uiItemR(row, ptr, "type", 0, "", ICON_NULL); + uiItemR(row, ptr, "name", 0, "", ICON_NULL); /* XXX provisory for Blender 2.50Beta */ uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, "Set controller state index (from 1 to 30)"); } else { - uiItemL(row, controller_name(cont->type), 0); - uiItemL(row, cont->name, 0); - uiItemL(row, state, 0); + uiItemL(row, controller_name(cont->type), ICON_NULL); + uiItemL(row, cont->name, ICON_NULL); + uiItemL(row, state, ICON_NULL); } - uiItemR(row, ptr, "use_priority", 0, "", 0); + uiItemR(row, ptr, "use_priority", 0, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")==0) { subrow= uiLayoutRow(row, 1); @@ -3559,7 +3559,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "expression", 0, "", 0); + uiItemR(layout, ptr, "expression", 0, "", ICON_NULL); } static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) @@ -3567,14 +3567,14 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) uiLayout *split, *subsplit; split = uiLayoutSplit(layout, 0.3, 1); - uiItemR(split, ptr, "mode", 0, "", 0); + uiItemR(split, ptr, "mode", 0, "", ICON_NULL); if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) { - uiItemR(split, ptr, "text", 0, "", 0); + uiItemR(split, ptr, "text", 0, "", ICON_NULL); } else { subsplit = uiLayoutSplit(split, 0.8, 0); - uiItemR(subsplit, ptr, "module", 0, "", 0); - uiItemR(subsplit, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(subsplit, ptr, "module", 0, "", ICON_NULL); + uiItemR(subsplit, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); } } @@ -3625,19 +3625,19 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA * box= uiLayoutBox(layout); row= uiLayoutRow(box, 0); - uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", 0); + uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(row, ptr, "type", 0, "", 0); - uiItemR(row, ptr, "name", 0, "", 0); + uiItemR(row, ptr, "type", 0, "", ICON_NULL); + uiItemR(row, ptr, "name", 0, "", ICON_NULL); } else { - uiItemL(row, actuator_name(act->type), 0); - uiItemL(row, act->name, 0); + uiItemL(row, actuator_name(act->type), ICON_NULL); + uiItemL(row, act->name, ICON_NULL); } subrow= uiLayoutRow(row, 0); uiLayoutSetActive(subrow, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") && RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin"))); - uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", 0); + uiItemR(subrow, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NULL); if(RNA_boolean_get(ptr, "show_expanded")==0) { subrow= uiLayoutRow(row, 1); @@ -3654,34 +3654,34 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiLayout *row; if(ob->type != OB_ARMATURE){ - uiItemL(layout, "Actuator only available for armatures", 0); + uiItemL(layout, "Actuator only available for armatures", ICON_NULL); return; } RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "play_mode", 0, "", 0); - uiItemR(row, ptr, "action", 0, NULL, 0); - uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, 0); + uiItemR(row, ptr, "play_mode", 0, "", ICON_NULL); + uiItemR(row, ptr, "action", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP)) - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); else { - uiItemR(row, ptr, "frame_start", 0, NULL, 0); - uiItemR(row, ptr, "frame_end", 0, NULL, 0); + uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NULL); } row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "frame_blend_in", 0, NULL, 0); - uiItemR(row, ptr, "priority", 0, NULL, 0); + uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "priority", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); - uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NULL); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(row, "stride_length", 0, NULL, 0); + uiItemR(row, "stride_length", 0, NULL, ICON_NULL); #endif } @@ -3694,7 +3694,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) PropertyRNA *bones_prop; if(ob->type != OB_ARMATURE){ - uiItemL(layout, "Actuator only available for armatures", 0); + uiItemL(layout, "Actuator only available for armatures", ICON_NULL); return; } @@ -3703,7 +3703,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) bones_prop = RNA_struct_find_property(&pose_ptr, "bones"); } - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { @@ -3726,8 +3726,8 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); } - uiItemR(layout, ptr, "target", 0, NULL, 0); - uiItemR(layout, ptr, "secondary_target", 0, NULL, 0); + uiItemR(layout, ptr, "target", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NULL); break; case ACT_ARM_SETWEIGHT: if (ob->pose) { @@ -3737,7 +3737,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); } - uiItemR(layout, ptr, "weight", 0, NULL, 0); + uiItemR(layout, ptr, "weight", 0, NULL, ICON_NULL); break; } } @@ -3745,15 +3745,15 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr) { uiLayout *row; - uiItemR(layout, ptr, "object", 0, NULL, 0); + uiItemR(layout, ptr, "object", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "height", 0, NULL, 0); - uiItemR(row, ptr, "axis", 0, NULL, 0); + uiItemR(row, ptr, "height", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "axis", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "min", 0, NULL, 0); - uiItemR(row, ptr, "max", 0, NULL, 0); + uiItemR(row, ptr, "min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "max", 0, NULL, ICON_NULL); } static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -3763,96 +3763,96 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { case ACT_CONST_TYPE_LOC: - uiItemR(layout, ptr, "limit", 0, NULL, 0); + uiItemR(layout, ptr, "limit", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 1); - uiItemR(row, ptr, "limit_min", 0, NULL, 0); - uiItemR(row, ptr, "limit_max", 0, NULL, 0); + uiItemR(row, ptr, "limit_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "limit_max", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NULL); break; case ACT_CONST_TYPE_DIST: split = uiLayoutSplit(layout, 0.8, 0); - uiItemR(split, ptr, "direction", 0, NULL, 0); + uiItemR(split, ptr, "direction", 0, NULL, ICON_NULL); row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); col = uiLayoutColumn(row, 0); - uiItemL(col, "Range:", 0); - uiItemR(col, ptr, "range", 0, "", 0); + uiItemL(col, "Range:", ICON_NULL); + uiItemR(col, ptr, "range", 0, "", ICON_NULL); col = uiLayoutColumn(row, 1); - uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 0); uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_force_distance")==1); - uiItemR(subcol, ptr, "distance", 0, "", 0); + uiItemR(subcol, ptr, "distance", 0, "", ICON_NULL); - uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0); + uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.15, 0); - uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); if (RNA_boolean_get(ptr, "use_material_detect")) uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); else - uiItemR(split, ptr, "property", 0, NULL, 0); + uiItemR(split, ptr, "property", 0, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.15, 0); - uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "time", 0, NULL, 0); - uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(row, ptr, "time", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); break; case ACT_CONST_TYPE_ORI: - uiItemR(layout, ptr, "direction_axis", 0, NULL, 0); + uiItemR(layout, ptr, "direction_axis", 0, NULL, ICON_NULL); row=uiLayoutRow(layout, 1); - uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, 0); - uiItemR(row, ptr, "time", 0, NULL, 0); + uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NULL); + uiItemR(row, ptr, "time", 0, NULL, ICON_NULL); row=uiLayoutRow(layout, 0); - uiItemR(row, ptr, "rotation_max", 0, NULL, 0); + uiItemR(row, ptr, "rotation_max", 0, NULL, ICON_NULL); row=uiLayoutRow(layout, 1); - uiItemR(row, ptr, "angle_min", 0, NULL, 0); - uiItemR(row, ptr, "angle_max", 0, NULL, 0); + uiItemR(row, ptr, "angle_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "angle_max", 0, NULL, ICON_NULL); break; case ACT_CONST_TYPE_FH: split=uiLayoutSplit(layout, 0.75, 0); row= uiLayoutRow(split, 0); - uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, 0); + uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, ICON_NULL); - uiItemR(row, ptr, "fh_height", 0, NULL, 0); - uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, 0); + uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "direction_axis", 0, NULL, 0); + uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NULL); split = uiLayoutSplit(row, 0.9, 0); - uiItemR(split, ptr, "spring", 0, NULL, 0); - uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE , NULL, 0); + uiItemR(split, ptr, "spring", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE , NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.15, 0); - uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); if (RNA_boolean_get(ptr, "use_material_detect")) uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); else - uiItemR(split, ptr, "property", 0, NULL, 0); + uiItemR(split, ptr, "property", 0, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.15, 0); - uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "time", 0, NULL, 0); - uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(row, ptr, "time", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); break; } } @@ -3861,53 +3861,53 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) { Object *ob = (Object *)ptr->id.data; uiLayout *row, *split, *subsplit; - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { case ACT_EDOB_ADD_OBJECT: row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "object", 0, NULL, 0); - uiItemR(row, ptr, "time", 0, NULL, 0); + uiItemR(row, ptr, "object", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "time", 0, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); - uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); - uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); break; case ACT_EDOB_END_OBJECT: break; case ACT_EDOB_REPLACE_MESH: if(ob->type != OB_MESH) { - uiItemL(layout, "Mode only available for mesh objects", 0); + uiItemL(layout, "Mode only available for mesh objects", ICON_NULL); break; } split = uiLayoutSplit(layout, 0.6, 0); - uiItemR(split, ptr, "mesh", 0, NULL, 0); + uiItemR(split, ptr, "mesh", 0, NULL, ICON_NULL); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); break; case ACT_EDOB_TRACK_TO: split = uiLayoutSplit(layout, 0.5, 0); - uiItemR(split, ptr, "track_object", 0, NULL, 0); + uiItemR(split, ptr, "track_object", 0, NULL, ICON_NULL); subsplit = uiLayoutSplit(split, 0.7, 0); - uiItemR(subsplit, ptr, "time", 0, NULL, 0); - uiItemR(subsplit, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(subsplit, ptr, "time", 0, NULL, ICON_NULL); + uiItemR(subsplit, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); break; case ACT_EDOB_DYNAMICS: if(ob->type != OB_MESH) { - uiItemL(layout, "Mode only available for mesh objects", 0); + uiItemL(layout, "Mode only available for mesh objects", ICON_NULL); break; } - uiItemR(layout, ptr, "dynamic_operation", 0, NULL, 0); + uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "dynamic_operation") == ACT_EDOB_SET_MASS) - uiItemR(layout, ptr, "mass", 0, NULL, 0); + uiItemR(layout, ptr, "mass", 0, NULL, ICON_NULL); break; } } @@ -3916,31 +3916,31 @@ static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr) { uiLayout *row, *split; - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { case ACT_2DFILTER_CUSTOMFILTER: - uiItemR(layout, ptr, "filter_pass", 0, NULL, 0); - uiItemR(layout, ptr, "glsl_shader", 0, NULL, 0); + uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NULL); break; case ACT_2DFILTER_MOTIONBLUR: split=uiLayoutSplit(layout, 0.75, 1); row= uiLayoutRow(split, 0); uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur")==1); - uiItemR(row, ptr, "motion_blur_factor", 0, NULL, 0); - uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "motion_blur_factor", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); break; default: // all other 2D Filters - uiItemR(layout, ptr, "filter_pass", 0, NULL, 0); + uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NULL); break; } } static void draw_actuator_game(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "mode") == ACT_GAME_LOAD) - uiItemR(layout, ptr, "filename", 0, NULL, 0); + uiItemR(layout, ptr, "filename", 0, NULL, ICON_NULL); } static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr) @@ -3953,27 +3953,27 @@ static void draw_actuator_ipo(uiLayout *layout, PointerRNA *ptr) RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "play_type", 0, "", 0); + uiItemR(row, ptr, "play_type", 0, "", ICON_NULL); subrow= uiLayoutRow(row, 1); - uiItemR(subrow, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(subrow, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(subrow, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(subrow, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); col = uiLayoutColumn(subrow, 0); uiLayoutSetActive(col, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); - uiItemR(col, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "play_type") == ACT_IPO_FROM_PROP)) - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); else { - uiItemR(row, ptr, "frame_start", 0, NULL, 0); - uiItemR(row, ptr, "frame_end", 0, NULL, 0); + uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NULL); } - uiItemR(row, ptr, "apply_to_children", 0, NULL, 0); + uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); - uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NULL); } static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -3988,15 +3988,15 @@ static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); uiItemPointerR(layout, ptr, "to_property", &main_ptr, "objects", NULL, ICON_OBJECT_DATA); - uiItemR(layout, ptr, "subject", 0, NULL, 0); + uiItemR(layout, ptr, "subject", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "body_type", 0, NULL, 0); + uiItemR(row, ptr, "body_type", 0, NULL, ICON_NULL); if(RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG) - uiItemR(row, ptr, "body_message", 0, "", 0); + uiItemR(row, ptr, "body_message", 0, "", ICON_NULL); else // mode == ACT_MESG_PROP - uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", 0); + uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", ICON_NULL); } static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) @@ -4010,85 +4010,85 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); physics_type = RNA_enum_get(&settings_ptr, "physics_type"); - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { case ACT_OBJECT_NORMAL: split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "offset_location", 0, NULL, 0); - uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "offset_rotation", 0, NULL, 0); - uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { - uiItemL(layout, "Dynamic Object Settings:", 0); + uiItemL(layout, "Dynamic Object Settings:", ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "force", 0, NULL, 0); - uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "force", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "torque", 0, NULL, 0); - uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "torque", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); + uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NULL); row = uiLayoutRow(split, 1); - uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "angular_velocity", 0, NULL, 0); - uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); - uiItemR(layout, ptr, "damping", 0, NULL, 0); + uiItemR(layout, ptr, "damping", 0, NULL, ICON_NULL); } break; case ACT_OBJECT_SERVO: - uiItemR(layout, ptr, "reference_object", 0, NULL, 0); + uiItemR(layout, ptr, "reference_object", 0, NULL, ICON_NULL); split = uiLayoutSplit(layout, 0.9, 0); row = uiLayoutRow(split, 0); - uiItemR(row, ptr, "linear_velocity", 0, NULL, 0); - uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NULL); + uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); col = uiLayoutColumn(row, 0); - uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_x")==1); - uiItemR(subcol, ptr, "force_max_x", 0, NULL, 0); - uiItemR(subcol, ptr, "force_min_x", 0, NULL, 0); + uiItemR(subcol, ptr, "force_max_x", 0, NULL, ICON_NULL); + uiItemR(subcol, ptr, "force_min_x", 0, NULL, ICON_NULL); col = uiLayoutColumn(row, 0); - uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_y")==1); - uiItemR(subcol, ptr, "force_max_y", 0, NULL, 0); - uiItemR(subcol, ptr, "force_min_y", 0, NULL, 0); + uiItemR(subcol, ptr, "force_max_y", 0, NULL, ICON_NULL); + uiItemR(subcol, ptr, "force_min_y", 0, NULL, ICON_NULL); col = uiLayoutColumn(row, 0); - uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); subcol = uiLayoutColumn(col, 1); uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_servo_limit_z")==1); - uiItemR(subcol, ptr, "force_max_z", 0, NULL, 0); - uiItemR(subcol, ptr, "force_min_z", 0, NULL, 0); + uiItemR(subcol, ptr, "force_max_z", 0, NULL, ICON_NULL); + uiItemR(subcol, ptr, "force_min_z", 0, NULL, ICON_NULL); //XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast) //Layout designers willing to help on that, please compare with 2.49 ui // (since the old code is going to be deleted ... soon) col = uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NULL); break; } } @@ -4097,12 +4097,12 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) { uiLayout *row; - uiItemR(layout, ptr, "mode", 0, NULL, 0); - uiItemR(layout, ptr, "object", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "object", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "use_compound", 0, NULL, 0); - uiItemR(row, ptr, "use_ghost", 0, NULL, 0); + uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_ghost", 0, NULL, ICON_NULL); } static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) @@ -4117,30 +4117,30 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemR(layout, ptr, "mode", 0, NULL, 0); - uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); + uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); switch(RNA_enum_get(ptr, "mode")) { case ACT_PROP_TOGGLE: break; case ACT_PROP_ADD: - uiItemR(layout, ptr, "value", 0, NULL, 0); + uiItemR(layout, ptr, "value", 0, NULL, ICON_NULL); break; case ACT_PROP_ASSIGN: - uiItemR(layout, ptr, "value", 0, NULL, 0); + uiItemR(layout, ptr, "value", 0, NULL, ICON_NULL); break; case ACT_PROP_COPY: row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "object", 0, NULL, 0); + uiItemR(row, ptr, "object", 0, NULL, ICON_NULL); if(ob_from){ RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr); - uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NULL); }else { subrow= uiLayoutRow(row, 0); uiLayoutSetActive(subrow, 0); - uiItemR(subrow, ptr, "object_property", 0, NULL, 0); + uiItemR(subrow, ptr, "object_property", 0, NULL, ICON_NULL); } break; } @@ -4157,72 +4157,72 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr) row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "seed", 0, NULL, 0); - uiItemR(row, ptr, "distribution", 0, NULL, 0); + uiItemR(row, ptr, "seed", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "distribution", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); row = uiLayoutRow(layout, 0); switch (RNA_enum_get(ptr, "distribution")){ case ACT_RANDOM_BOOL_CONST: - uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, 0); + uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); break; case ACT_RANDOM_BOOL_UNIFORM: - uiItemL(row, "Choose between true and false, 50% chance each", 0); + uiItemL(row, "Choose between true and false, 50% chance each", ICON_NULL); break; case ACT_RANDOM_BOOL_BERNOUILLI: - uiItemR(row, ptr, "chance", 0, NULL, 0); + uiItemR(row, ptr, "chance", 0, NULL, ICON_NULL); break; case ACT_RANDOM_INT_CONST: - uiItemR(row, ptr, "int_value", 0, NULL, 0); + uiItemR(row, ptr, "int_value", 0, NULL, ICON_NULL); break; case ACT_RANDOM_INT_UNIFORM: - uiItemR(row, ptr, "int_min", 0, NULL, 0); - uiItemR(row, ptr, "int_max", 0, NULL, 0); + uiItemR(row, ptr, "int_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "int_max", 0, NULL, ICON_NULL); break; case ACT_RANDOM_INT_POISSON: - uiItemR(row, ptr, "int_mean", 0, NULL, 0); + uiItemR(row, ptr, "int_mean", 0, NULL, ICON_NULL); break; case ACT_RANDOM_FLOAT_CONST: - uiItemR(row, ptr, "float_value", 0, NULL, 0); + uiItemR(row, ptr, "float_value", 0, NULL, ICON_NULL); break; case ACT_RANDOM_FLOAT_UNIFORM: - uiItemR(row, ptr, "float_min", 0, NULL, 0); - uiItemR(row, ptr, "float_max", 0, NULL, 0); + uiItemR(row, ptr, "float_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "float_max", 0, NULL, ICON_NULL); break; case ACT_RANDOM_FLOAT_NORMAL: - uiItemR(row, ptr, "float_mean", 0, NULL, 0); - uiItemR(row, ptr, "standard_derivation", 0, NULL, 0); + uiItemR(row, ptr, "float_mean", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "standard_derivation", 0, NULL, ICON_NULL); break; case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL: - uiItemR(row, ptr, "half_life_time", 0, NULL, 0); + uiItemR(row, ptr, "half_life_time", 0, NULL, ICON_NULL); break; } } static void draw_actuator_scene(uiLayout *layout, PointerRNA *ptr) { - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); switch (RNA_enum_get(ptr, "mode")) { case ACT_SCENE_CAMERA: - uiItemR(layout, ptr, "camera", 0, NULL, 0); + uiItemR(layout, ptr, "camera", 0, NULL, ICON_NULL); break; case ACT_SCENE_RESTART: break; default: // ACT_SCENE_SET|ACT_SCENE_ADD_FRONT|ACT_SCENE_ADD_BACK|ACT_SCENE_REMOVE|ACT_SCENE_SUSPEND|ACT_SCENE_RESUME - uiItemR(layout, ptr, "scene", 0, NULL, 0); + uiItemR(layout, ptr, "scene", 0, NULL, ICON_NULL); break; } } @@ -4234,35 +4234,35 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) uiLayout *row; if(ob->type != OB_MESH){ - uiItemL(layout, "Actuator only available for mesh objects", 0); + uiItemL(layout, "Actuator only available for mesh objects", ICON_NULL); return; } RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "mode", 0, "", 0); - uiItemR(row, ptr, "action", 0, NULL, 0); - uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, 0); + uiItemR(row, ptr, "mode", 0, "", ICON_NULL); + uiItemR(row, ptr, "action", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP)) - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NULL); else { - uiItemR(row, ptr, "frame_start", 0, NULL, 0); - uiItemR(row, ptr, "frame_end", 0, NULL, 0); + uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NULL); } row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "frame_blend_in", 0, NULL, 0); - uiItemR(row, ptr, "priority", 0, NULL, 0); + uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "priority", 0, NULL, ICON_NULL); row= uiLayoutRow(layout, 0); - uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, 0); + uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NULL); #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(row, "stride_length", 0, NULL, 0); + uiItemR(row, "stride_length", 0, NULL, ICON_NULL); #endif } @@ -4273,35 +4273,35 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C) uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL); if (!RNA_pointer_get(ptr, "sound").data) { - uiItemL(layout, "Select a sound from the list or load a new one", 0); + uiItemL(layout, "Select a sound from the list or load a new one", ICON_NULL); return; } - uiItemR(layout, ptr, "mode", 0, NULL, 0); + uiItemR(layout, ptr, "mode", 0, NULL, ICON_NULL); row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "volume", 0, NULL, 0); - uiItemR(row, ptr, "pitch", 0, NULL, 0); + uiItemR(row, ptr, "volume", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "pitch", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "use_sound_3d", 0, NULL, 0); + uiItemR(layout, ptr, "use_sound_3d", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d")==1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "gain_3d_min", 0, NULL, 0); - uiItemR(row, ptr, "gain_3d_max", 0, NULL, 0); + uiItemR(row, ptr, "gain_3d_min", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "gain_3d_max", 0, NULL, ICON_NULL); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "distance_3d_reference", 0, NULL, 0); - uiItemR(row, ptr, "distance_3d_max", 0, NULL, 0); + uiItemR(row, ptr, "distance_3d_reference", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "distance_3d_max", 0, NULL, ICON_NULL); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, 0); - uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, 0); + uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, ICON_NULL); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, 0); - uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, 0); + uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, ICON_NULL); } static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr) @@ -4312,7 +4312,7 @@ static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr) RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); split = uiLayoutSplit(layout, 0.35, 0); - uiItemR(split, ptr, "operation", 0, NULL, 0); + uiItemR(split, ptr, "operation", 0, NULL, ICON_NULL); uiTemplateLayers(split, ptr, "states", &settings_ptr, "used_states", 0); } @@ -4322,9 +4322,9 @@ static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr) uiLayout *row; row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "use_visible", 0, NULL, 0); - uiItemR(row, ptr, "use_occlusion", 0, NULL, 0); - uiItemR(row, ptr, "apply_to_children", 0, NULL, 0); + uiItemR(row, ptr, "use_visible", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "use_occlusion", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NULL); } void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C) @@ -4468,9 +4468,9 @@ static void logic_buttons_new(bContext *C, ARegion *ar) uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, "Sel", 0); - uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", 0); - uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", 0); + uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, "Sel", ICON_NULL); + uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NULL); + uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NULL); for(a=0; a<count; a++) { bController *cont; @@ -4493,7 +4493,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) row = uiLayoutRow(split, 1); uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers"); if (ob == act_ob) - uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", 0); + uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NULL); if (RNA_boolean_get(&settings_ptr, "show_state_panel")) { @@ -4501,8 +4501,8 @@ static void logic_buttons_new(bContext *C, ARegion *ar) split= uiLayoutSplit(box, 0.2, 0); col= uiLayoutColumn(split, 0); - uiItemL(col, "Visible", 0); - uiItemL(col, "Initial", 0); + uiItemL(col, "Visible", ICON_NULL); + uiItemL(col, "Initial", ICON_NULL); subsplit= uiLayoutSplit(split, 0.85, 0); col= uiLayoutColumn(subsplit, 0); @@ -4513,8 +4513,8 @@ static void logic_buttons_new(bContext *C, ARegion *ar) uiTemplateLayers(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0); col= uiLayoutColumn(subsplit, 0); - uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(col, &settings_ptr, "show_debug_state", 0, "", 0); + uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, ICON_NULL); + uiItemR(col, &settings_ptr, "show_debug_state", 0, "", ICON_NULL); } /* End of Drawing the Controller Header common to all Selected Objects */ @@ -4571,10 +4571,10 @@ static void logic_buttons_new(bContext *C, ARegion *ar) uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, "Sel", 0); - uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, "Act", 0); - uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", 0); - uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", 0); + uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, "Sel", ICON_NULL); + uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, "Act", ICON_NULL); + uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NULL); + uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NULL); for(a=0; a<count; a++) { bSensor *sens; @@ -4588,7 +4588,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) row = uiLayoutRow(layout, 1); uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors"); if (ob == act_ob) - uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", 0); + uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NULL); if ((ob->scaflag & OB_SHOWSENS) == 0) continue; @@ -4637,10 +4637,10 @@ static void logic_buttons_new(bContext *C, ARegion *ar) uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, "Sel", 0); - uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, "Act", 0); - uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", 0); - uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", 0); + uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, "Sel", ICON_NULL); + uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, "Act", ICON_NULL); + uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NULL); + uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NULL); for(a=0; a<count; a++) { bActuator *act; @@ -4654,7 +4654,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) row = uiLayoutRow(layout, 1); uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators"); if (ob == act_ob) - uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", 0); + uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NULL); if ((ob->scaflag & OB_SHOWACT) == 0) continue; diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index dcb09a1a654..3f194bc0438 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -41,4 +41,4 @@ set(SRC nla_intern.h ) -blenderlib(bf_editor_space_nla "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}") diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 5d5b6660d00..8d5b981df1a 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -231,15 +231,15 @@ static void nla_panel_animdata (const bContext *C, Panel *pa) /* extrapolation */ row= uiLayoutRow(layout, 1); - uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, 0); + uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NULL); /* blending */ row= uiLayoutRow(layout, 1); - uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, 0); + uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NULL); /* influence */ row= uiLayoutRow(layout, 1); - uiItemR(row, &adt_ptr, "action_influence", 0, NULL, 0); + uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NULL); } /* active NLA-Track */ @@ -280,40 +280,40 @@ static void nla_panel_properties(const bContext *C, Panel *pa) /* strip type */ row= uiLayoutColumn(layout, 1); uiItemR(row, &strip_ptr, "name", 0, NULL, ICON_NLA); // XXX icon? - uiItemR(row, &strip_ptr, "type", 0, NULL, 0); + uiItemR(row, &strip_ptr, "type", 0, NULL, ICON_NULL); /* strip extents */ column= uiLayoutColumn(layout, 1); - uiItemL(column, "Strip Extents:", 0); - uiItemR(column, &strip_ptr, "frame_start", 0, NULL, 0); - uiItemR(column, &strip_ptr, "frame_end", 0, NULL, 0); + uiItemL(column, "Strip Extents:", ICON_NULL); + uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NULL); + uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NULL); /* extrapolation */ row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, 0); + uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NULL); /* blending */ row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "blend_type", 0, NULL, 0); + uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NULL); /* blend in/out + autoblending * - blend in/out can only be set when autoblending is off */ column= uiLayoutColumn(layout, 1); uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); - uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, 0); // XXX as toggle? + uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NULL); // XXX as toggle? subcol= uiLayoutColumn(column, 1); uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); - uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, 0); - uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, 0); + uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NULL); + uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NULL); /* settings */ column= uiLayoutColumn(layout, 1); uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time"))); - uiItemL(column, "Playback Settings:", 0); - uiItemR(column, &strip_ptr, "mute", 0, NULL, 0); - uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, 0); + uiItemL(column, "Playback Settings:", ICON_NULL); + uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NULL); + uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NULL); } @@ -340,17 +340,17 @@ static void nla_panel_actclip(const bContext *C, Panel *pa) /* action extents */ // XXX custom names were used here (to avoid the prefixes)... probably not necessary in future? column= uiLayoutColumn(layout, 1); - uiItemL(column, "Action Extents:", 0); - uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", 0); - uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", 0); - uiItemO(column, NULL, 0, "NLA_OT_action_sync_length"); + uiItemL(column, "Action Extents:", ICON_NULL); + uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", ICON_NULL); + uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", ICON_NULL); + uiItemO(column, NULL, ICON_NULL, "NLA_OT_action_sync_length"); /* action usage */ column= uiLayoutColumn(layout, 1); uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time")==0); - uiItemL(column, "Playback Settings:", 0); - uiItemR(column, &strip_ptr, "scale", 0, NULL, 0); - uiItemR(column, &strip_ptr, "repeat", 0, NULL, 0); + uiItemL(column, "Playback Settings:", ICON_NULL); + uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NULL); + uiItemR(column, &strip_ptr, "repeat", 0, NULL, ICON_NULL); } /* evaluation settings for active NLA-Strip */ @@ -369,22 +369,22 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa) uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL); column= uiLayoutColumn(layout, 1); - uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, 0); + uiItemR(column, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NULL); subcolumn= uiLayoutColumn(column, 1); uiLayoutSetEnabled(subcolumn, RNA_boolean_get(&strip_ptr, "use_animated_influence")); - uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, 0); + uiItemR(subcolumn, &strip_ptr, "influence", 0, NULL, ICON_NULL); column= uiLayoutColumn(layout, 1); subrow= uiLayoutRow(column, 0); - uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, 0); - uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, 0); + uiItemR(subrow, &strip_ptr, "use_animated_time", 0, NULL, ICON_NULL); + uiItemR(subrow, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NULL); subcolumn= uiLayoutColumn(column, 1); subrow= uiLayoutRow(subcolumn, 0); uiLayoutSetEnabled(subrow, RNA_boolean_get(&strip_ptr, "use_animated_time")); - uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, 0); + uiItemR(subcolumn, &strip_ptr, "strip_time", 0, NULL, ICON_NULL); } /* F-Modifiers for active NLA-Strip */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index ca2e3e6b6d5..cdc51215d85 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -456,6 +456,12 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op)) NlaTrack *nlt= (NlaTrack *)ale->data; AnimData *adt= ale->adt; + /* if track is currently 'solo', then AnimData should have its + * 'has solo' flag disabled + */ + if (nlt->flag & NLATRACK_SOLO) + adt->flag &= ~ADT_NLA_SOLO_TRACK; + /* call delete on this track - deletes all strips too */ free_nlatrack(&adt->nla_tracks, nlt); } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 279c8c59c28..e04ef99e6fe 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1549,7 +1549,7 @@ static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEven uiLayout *layout; int i; - pup= uiPupMenuBegin(C, "Add F-Modifier", 0); + pup= uiPupMenuBegin(C, "Add F-Modifier", ICON_NULL); layout= uiPupMenuLayout(pup); /* start from 1 to skip the 'Invalid' modifier type */ diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 45b4341c99d..6ade219583a 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -47,4 +47,4 @@ set(SRC node_intern.h ) -blenderlib(bf_editor_space_node "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_node "${SRC}" "${INC}") diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 75eaa1d4988..5ee2b172c7c 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -88,7 +88,7 @@ static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *p prop = RNA_struct_find_property(ptr, "outputs"); RNA_property_collection_lookup_int(ptr, prop, 0, &sockptr); - uiItemR(layout, &sockptr, "default_value", 0, "", 0); + uiItemR(layout, &sockptr, "default_value", 0, "", ICON_NULL); } static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -103,7 +103,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr col = uiLayoutColumn(layout, 0); uiTemplateColorWheel(col, &sockptr, "default_value", 1, 0, 0, 0); - uiItemR(col, &sockptr, "default_value", 0, "", 0); + uiItemR(col, &sockptr, "default_value", 0, "", ICON_NULL); } static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -113,7 +113,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA bNodeTree *ntree= (bNodeTree*)ptr->id.data; row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "blend_type", 0, "", 0); + uiItemR(row, ptr, "blend_type", 0, "", ICON_NULL); if(ntree->type == NTREE_COMPOSIT) uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA); } @@ -136,8 +136,8 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt uiTemplateCurveMapping(layout, ptr, "curve", 's', 0, 0); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "frame_start", 0, "Sta", 0); - uiItemR(row, ptr, "frame_end", 0, "End", 0); + uiItemR(row, ptr, "frame_start", 0, "Sta", ICON_NULL); + uiItemR(row, ptr, "frame_end", 0, "End", ICON_NULL); } static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -268,17 +268,17 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA (node->type != TEX_NODE_TEXTURE) ); - uiItemR(layout, ptr, "texture", 0, "", 0); + uiItemR(layout, ptr, "texture", 0, "", ICON_NULL); if(multi) { /* Number Drawing not optimal here, better have a list*/ - uiItemR(layout, ptr, "node_output", 0, "", 0); + uiItemR(layout, ptr, "node_output", 0, "", ICON_NULL); } } static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "operation", 0, "", 0); + uiItemR(layout, ptr, "operation", 0, "", ICON_NULL); } /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */ @@ -320,40 +320,40 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA if(!node->id) return; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "use_diffuse", 0, NULL, 0); - uiItemR(col, ptr, "use_specular", 0, NULL, 0); - uiItemR(col, ptr, "invert_normal", 0, NULL, 0); + uiItemR(col, ptr, "use_diffuse", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "use_specular", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "invert_normal", 0, NULL, ICON_NULL); } static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; - uiItemL(layout, "Location:", 0); + uiItemL(layout, "Location:", ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "location", 0, "", 0); + uiItemR(row, ptr, "location", 0, "", ICON_NULL); - uiItemL(layout, "Rotation:", 0); + uiItemL(layout, "Rotation:", ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "rotation", 0, "", 0); + uiItemR(row, ptr, "rotation", 0, "", ICON_NULL); - uiItemL(layout, "Scale:", 0); + uiItemL(layout, "Scale:", ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "scale", 0, "", 0); + uiItemR(row, ptr, "scale", 0, "", ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "use_min", 0, "Min", 0); - uiItemR(row, ptr, "min", 0, "", 0); + uiItemR(row, ptr, "use_min", 0, "Min", ICON_NULL); + uiItemR(row, ptr, "min", 0, "", ICON_NULL); row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "use_max", 0, "Max", 0); - uiItemR(row, ptr, "max", 0, "", 0); + uiItemR(row, ptr, "use_max", 0, "Max", ICON_NULL); + uiItemR(row, ptr, "max", 0, "", ICON_NULL); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "operation", 0, "", 0); + uiItemR(layout, ptr, "operation", 0, "", ICON_NULL); } static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -366,12 +366,12 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA if(obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { PointerRNA dataptr= RNA_pointer_get(&obptr, "data"); - uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", 0); - uiItemPointerR(col, ptr, "color_layer", &dataptr, "vertex_colors", "", 0); + uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", ICON_NULL); + uiItemPointerR(col, ptr, "color_layer", &dataptr, "vertex_colors", "", ICON_NULL); } else { - uiItemR(col, ptr, "uv_layer", 0, "UV", 0); - uiItemR(col, ptr, "color_layer", 0, "VCol", 0); + uiItemR(col, ptr, "uv_layer", 0, "UV", ICON_NULL); + uiItemR(col, ptr, "color_layer", 0, "VCol", ICON_NULL); } } @@ -487,21 +487,21 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * col= uiLayoutColumn(layout, 0); - uiItemR(col, &imaptr, "source", 0, NULL, 0); + uiItemR(col, &imaptr, "source", 0, NULL, ICON_NULL); if (ELEM(RNA_enum_get(&imaptr, "source"), IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "frame_duration", 0, NULL, 0); - uiItemR(col, ptr, "frame_start", 0, NULL, 0); - uiItemR(col, ptr, "frame_offset", 0, NULL, 0); - uiItemR(col, ptr, "use_cyclic", 0, NULL, 0); - uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, 0); + uiItemR(col, ptr, "frame_duration", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "frame_start", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "use_cyclic", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NULL); } col= uiLayoutColumn(layout, 0); if (RNA_enum_get(&imaptr, "type")== IMA_TYPE_MULTILAYER) - uiItemR(col, ptr, "layer", 0, NULL, 0); + uiItemR(col, ptr, "layer", 0, NULL, ICON_NULL); } static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -520,7 +520,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point col= uiLayoutColumn(layout, 0); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "layer", 0, "", 0); + uiItemR(row, ptr, "layer", 0, "", ICON_NULL); prop = RNA_struct_find_property(ptr, "layer"); if (!(RNA_property_enum_identifier(C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name))) @@ -543,21 +543,21 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "filter_type", 0, "", 0); + uiItemR(col, ptr, "filter_type", 0, "", ICON_NULL); if (RNA_enum_get(ptr, "filter_type")!= R_FILTER_FAST_GAUSS) { - uiItemR(col, ptr, "use_bokeh", 0, NULL, 0); - uiItemR(col, ptr, "use_gamma_correction", 0, NULL, 0); + uiItemR(col, ptr, "use_bokeh", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "use_gamma_correction", 0, NULL, ICON_NULL); } - uiItemR(col, ptr, "use_relative", 0, NULL, 0); + uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NULL); col= uiLayoutColumn(layout, 1); if (RNA_boolean_get(ptr, "use_relative")) { - uiItemR(col, ptr, "factor_x", 0, "X", 0); - uiItemR(col, ptr, "factor_y", 0, "Y", 0); + uiItemR(col, ptr, "factor_x", 0, "X", ICON_NULL); + uiItemR(col, ptr, "factor_y", 0, "Y", ICON_NULL); } else { - uiItemR(col, ptr, "size_x", 0, "X", 0); - uiItemR(col, ptr, "size_y", 0, "Y", 0); + uiItemR(col, ptr, "size_x", 0, "X", ICON_NULL); + uiItemR(col, ptr, "size_y", 0, "Y", ICON_NULL); } } @@ -565,24 +565,24 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), Poin { uiLayout *col; - uiItemR(layout, ptr, "iterations", 0, NULL, 0); - uiItemR(layout, ptr, "use_wrap", 0, NULL, 0); + uiItemR(layout, ptr, "iterations", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "use_wrap", 0, NULL, ICON_NULL); col= uiLayoutColumn(layout, 1); - uiItemL(col, "Center:", 0); - uiItemR(col, ptr, "center_x", 0, "X", 0); - uiItemR(col, ptr, "center_y", 0, "Y", 0); + uiItemL(col, "Center:", ICON_NULL); + uiItemR(col, ptr, "center_x", 0, "X", ICON_NULL); + uiItemR(col, ptr, "center_y", 0, "Y", ICON_NULL); uiItemS(layout); col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "distance", 0, NULL, 0); - uiItemR(col, ptr, "angle", 0, NULL, 0); + uiItemR(col, ptr, "distance", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "angle", 0, NULL, ICON_NULL); uiItemS(layout); - uiItemR(layout, ptr, "spin", 0, NULL, 0); - uiItemR(layout, ptr, "zoom", 0, NULL, 0); + uiItemR(layout, ptr, "spin", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "zoom", 0, NULL, ICON_NULL); } static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -590,9 +590,9 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED( uiLayout *col; col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "iterations", 0, NULL, 0); - uiItemR(col, ptr, "sigma_color", 0, NULL, 0); - uiItemR(col, ptr, "sigma_space", 0, NULL, 0); + uiItemR(col, ptr, "iterations", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "sigma_color", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "sigma_space", 0, NULL, ICON_NULL); } static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -600,60 +600,60 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *sub, *col; col= uiLayoutColumn(layout, 0); - uiItemL(col, "Bokeh Type:", 0); - uiItemR(col, ptr, "bokeh", 0, "", 0); - uiItemR(col, ptr, "angle", 0, NULL, 0); + uiItemL(col, "Bokeh Type:", ICON_NULL); + uiItemR(col, ptr, "bokeh", 0, "", ICON_NULL); + uiItemR(col, ptr, "angle", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "use_gamma_correction", 0, NULL, 0); + uiItemR(layout, ptr, "use_gamma_correction", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_zbuffer")==1); - uiItemR(col, ptr, "f_stop", 0, NULL, 0); + uiItemR(col, ptr, "f_stop", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "blur_max", 0, NULL, 0); - uiItemR(layout, ptr, "threshold", 0, NULL, 0); + uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "use_preview", 0, NULL, 0); + uiItemR(col, ptr, "use_preview", 0, NULL, ICON_NULL); sub = uiLayoutColumn(col, 0); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_preview")); - uiItemR(sub, ptr, "samples", 0, NULL, 0); + uiItemR(sub, ptr, "samples", 0, NULL, ICON_NULL); col = uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "use_zbuffer", 0, NULL, 0); + uiItemR(col, ptr, "use_zbuffer", 0, NULL, ICON_NULL); sub = uiLayoutColumn(col, 0); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_zbuffer")==0); - uiItemR(sub, ptr, "z_scale", 0, NULL, 0); + uiItemR(sub, ptr, "z_scale", 0, NULL, ICON_NULL); } /* qdn: glare node */ static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "glare_type", 0, "", 0); - uiItemR(layout, ptr, "quality", 0, "", 0); + uiItemR(layout, ptr, "glare_type", 0, "", ICON_NULL); + uiItemR(layout, ptr, "quality", 0, "", ICON_NULL); if (RNA_enum_get(ptr, "glare_type")!= 1) { - uiItemR(layout, ptr, "iterations", 0, NULL, 0); + uiItemR(layout, ptr, "iterations", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "glare_type")!= 0) - uiItemR(layout, ptr, "color_modulation", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(layout, ptr, "color_modulation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } - uiItemR(layout, ptr, "mix", 0, NULL, 0); - uiItemR(layout, ptr, "threshold", 0, NULL, 0); + uiItemR(layout, ptr, "mix", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "glare_type")== 2) { - uiItemR(layout, ptr, "streaks", 0, NULL, 0); - uiItemR(layout, ptr, "angle_offset", 0, NULL, 0); + uiItemR(layout, ptr, "streaks", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "angle_offset", 0, NULL, ICON_NULL); } if (RNA_enum_get(ptr, "glare_type")== 0 || RNA_enum_get(ptr, "glare_type")== 2) { - uiItemR(layout, ptr, "fade", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(layout, ptr, "fade", UI_ITEM_R_SLIDER, NULL, ICON_NULL); if (RNA_enum_get(ptr, "glare_type")== 0) - uiItemR(layout, ptr, "use_rotate_45", 0, NULL, 0); + uiItemR(layout, ptr, "use_rotate_45", 0, NULL, ICON_NULL); } if (RNA_enum_get(ptr, "glare_type")== 1) { - uiItemR(layout, ptr, "size", 0, NULL, 0); + uiItemR(layout, ptr, "size", 0, NULL, ICON_NULL); } } @@ -662,17 +662,17 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *col; col = uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "tonemap_type", 0, "", 0); + uiItemR(col, ptr, "tonemap_type", 0, "", ICON_NULL); if (RNA_enum_get(ptr, "tonemap_type")== 0) { - uiItemR(col, ptr, "key", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "offset", 0, NULL, 0); - uiItemR(col, ptr, "gamma", 0, NULL, 0); + uiItemR(col, ptr, "key", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "offset", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "gamma", 0, NULL, ICON_NULL); } else { - uiItemR(col, ptr, "intensity", 0, NULL, 0); - uiItemR(col, ptr, "contrast", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "adaptation", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "correction", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "intensity", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "contrast", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "adaptation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "correction", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } } @@ -681,12 +681,12 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), P uiLayout *col; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "use_projector", 0, NULL, 0); + uiItemR(col, ptr, "use_projector", 0, NULL, ICON_NULL); col = uiLayoutColumn(col, 0); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector")==0); - uiItemR(col, ptr, "use_jitter", 0, NULL, 0); - uiItemR(col, ptr, "use_fit", 0, NULL, 0); + uiItemR(col, ptr, "use_jitter", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "use_fit", 0, NULL, ICON_NULL); } static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -694,45 +694,45 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *col; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "samples", 0, NULL, 0); - uiItemR(col, ptr, "factor", 0, "Blur", 0); + uiItemR(col, ptr, "samples", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "factor", 0, "Blur", ICON_NULL); col= uiLayoutColumn(layout, 1); - uiItemL(col, "Speed:", 0); - uiItemR(col, ptr, "speed_min", 0, "Min", 0); - uiItemR(col, ptr, "speed_max", 0, "Max", 0); + uiItemL(col, "Speed:", ICON_NULL); + uiItemR(col, ptr, "speed_min", 0, "Min", ICON_NULL); + uiItemR(col, ptr, "speed_max", 0, "Max", ICON_NULL); - uiItemR(layout, ptr, "use_curved", 0, NULL, 0); + uiItemR(layout, ptr, "use_curved", 0, NULL, ICON_NULL); } static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "filter_type", 0, "", 0); + uiItemR(layout, ptr, "filter_type", 0, "", ICON_NULL); } static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "axis", 0, "", 0); + uiItemR(layout, ptr, "axis", 0, "", ICON_NULL); } static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; - uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0); - uiItemR(layout, ptr, "relative", 0, NULL, 0); + uiItemR(layout, ptr, "use_crop_size", 0, NULL, ICON_NULL); + uiItemR(layout, ptr, "relative", 0, NULL, ICON_NULL); col= uiLayoutColumn(layout, 1); if (RNA_boolean_get(ptr, "relative")){ - uiItemR(col, ptr, "rel_min_x", 0, "Left", 0); - uiItemR(col, ptr, "rel_max_x", 0, "Right", 0); - uiItemR(col, ptr, "rel_min_y", 0, "Up", 0); - uiItemR(col, ptr, "rel_max_y", 0, "Down", 0); + uiItemR(col, ptr, "rel_min_x", 0, "Left", ICON_NULL); + uiItemR(col, ptr, "rel_max_x", 0, "Right", ICON_NULL); + uiItemR(col, ptr, "rel_min_y", 0, "Up", ICON_NULL); + uiItemR(col, ptr, "rel_max_y", 0, "Down", ICON_NULL); } else { - uiItemR(col, ptr, "min_x", 0, "Left", 0); - uiItemR(col, ptr, "max_x", 0, "Right", 0); - uiItemR(col, ptr, "min_y", 0, "Up", 0); - uiItemR(col, ptr, "max_y", 0, "Down", 0); + uiItemR(col, ptr, "min_x", 0, "Left", ICON_NULL); + uiItemR(col, ptr, "max_x", 0, "Right", ICON_NULL); + uiItemR(col, ptr, "min_y", 0, "Up", ICON_NULL); + uiItemR(col, ptr, "max_y", 0, "Down", ICON_NULL); } } @@ -742,8 +742,8 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C) col= uiLayoutColumn(layout, 0); row= uiLayoutRow(col, 0); - uiItemR(row, ptr, "axis", UI_ITEM_R_EXPAND, NULL, 0); - uiItemR(col, ptr, "factor", 0, NULL, 0); + uiItemR(row, ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NULL); + uiItemR(col, ptr, "factor", 0, NULL, ICON_NULL); } static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -751,20 +751,20 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), uiLayout *sub, *col; col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "offset", 0, NULL, 0); - uiItemR(col, ptr, "size", 0, NULL, 0); + uiItemR(col, ptr, "offset", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "size", 0, NULL, ICON_NULL); col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "use_min", 0, NULL, 0); + uiItemR(col, ptr, "use_min", 0, NULL, ICON_NULL); sub =uiLayoutColumn(col, 0); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min")); - uiItemR(sub, ptr, "min", 0, "", 0); + uiItemR(sub, ptr, "min", 0, "", ICON_NULL); col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "use_max", 0, NULL, 0); + uiItemR(col, ptr, "use_max", 0, NULL, ICON_NULL); sub =uiLayoutColumn(col, 0); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); - uiItemR(sub, ptr, "max", 0, "", 0); + uiItemR(sub, ptr, "max", 0, "", ICON_NULL); } static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -772,8 +772,8 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "use_premultiply", 0, NULL, 0); - uiItemR(col, ptr, "premul", 0, NULL, 0); + uiItemR(col, ptr, "use_premultiply", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "premul", 0, NULL, ICON_NULL); } static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -781,7 +781,7 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P uiLayout *col; col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "use_alpha", 0, NULL, 0); + uiItemR(col, ptr, "use_alpha", 0, NULL, ICON_NULL); } @@ -790,14 +790,14 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *col; col =uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "distance", 0, NULL, 0); + uiItemR(layout, ptr, "distance", 0, NULL, ICON_NULL); } static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -805,8 +805,8 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -814,33 +814,33 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED uiLayout *col; col =uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; - uiItemL(layout, "Despill Channel:", 0); + uiItemL(layout, "Despill Channel:", ICON_NULL); row =uiLayoutRow(layout,0); - uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NULL); col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "limit_method", 0, NULL, 0); + uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NULL); if(RNA_enum_get(ptr, "limit_method")==0) { - uiItemL(col, "Limiting Channel:", 0); + uiItemL(col, "Limiting Channel:", ICON_NULL); row=uiLayoutRow(col,0); - uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NULL); } - uiItemR(col, ptr, "ratio", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "use_unspill", 0, NULL, 0); + uiItemR(col, ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "use_unspill", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "use_unspill")== 1) { - uiItemR(col, ptr, "unspill_red", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "unspill_green", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "unspill_blue", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "unspill_red", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "unspill_green", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "unspill_blue", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } } @@ -849,13 +849,13 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C uiLayout *col; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "tolerance", 0, NULL, 0); - uiItemR(col, ptr, "threshold", 0, NULL, 0); + uiItemR(col, ptr, "tolerance", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "threshold", 0, NULL, ICON_NULL); col= uiLayoutColumn(layout, 1); - /*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, NULL, 0); Removed for now */ - uiItemR(col, ptr, "gain", UI_ITEM_R_SLIDER, NULL, 0); - /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, 0); Removed for now*/ + /*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, NULL, ICON_NULL); Removed for now */ + uiItemR(col, ptr, "gain", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, ICON_NULL); Removed for now*/ } static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -863,35 +863,35 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C) uiLayout *col; col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; - uiItemL(layout, "Color Space:", 0); + uiItemL(layout, "Color Space:", ICON_NULL); row= uiLayoutRow(layout, 0); - uiItemR(row, ptr, "color_space", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "color_space", UI_ITEM_R_EXPAND, NULL, ICON_NULL); col=uiLayoutColumn(layout, 0); - uiItemL(col, "Key Channel:", 0); + uiItemL(col, "Key Channel:", ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, ptr, "matte_channel", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "matte_channel", UI_ITEM_R_EXPAND, NULL, ICON_NULL); col =uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "limit_method", 0, NULL, 0); + uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NULL); if(RNA_enum_get(ptr, "limit_method")==0) { - uiItemL(col, "Limiting Channel:", 0); + uiItemL(col, "Limiting Channel:", ICON_NULL); row=uiLayoutRow(col,0); - uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NULL); } - uiItemR(col, ptr, "limit_max", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "limit_max", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -899,18 +899,18 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "limit_max", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "limit_max", UI_ITEM_R_SLIDER, NULL, ICON_NULL); + uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, ICON_NULL); } static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "alpha", 0, NULL, 0); + uiItemR(layout, ptr, "alpha", 0, NULL, ICON_NULL); } static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "index", 0, NULL, 0); + uiItemR(layout, ptr, "index", 0, NULL, ICON_NULL); } static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -918,34 +918,34 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C) uiLayout *col, *row; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "filepath", 0, "", 0); - uiItemR(col, ptr, "image_type", 0, "", 0); + uiItemR(col, ptr, "filepath", 0, "", ICON_NULL); + uiItemR(col, ptr, "image_type", 0, "", ICON_NULL); row= uiLayoutRow(layout, 0); if (RNA_enum_get(ptr, "image_type")== R_OPENEXR) { - uiItemR(row, ptr, "use_exr_half", 0, NULL, 0); - uiItemR(row, ptr, "exr_codec", 0, "", 0); + uiItemR(row, ptr, "use_exr_half", 0, NULL, ICON_NULL); + uiItemR(row, ptr, "exr_codec", 0, "", ICON_NULL); } else if (RNA_enum_get(ptr, "image_type")== R_JPEG90) { - uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Quality", 0); + uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Quality", ICON_NULL); } else if (RNA_enum_get(ptr, "image_type")== R_PNG) { - uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Compression", 0); + uiItemR(row, ptr, "quality", UI_ITEM_R_SLIDER, "Compression", ICON_NULL); } row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "frame_start", 0, "Start", 0); - uiItemR(row, ptr, "frame_end", 0, "End", 0); + uiItemR(row, ptr, "frame_start", 0, "Start", ICON_NULL); + uiItemR(row, ptr, "frame_end", 0, "End", ICON_NULL); } static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "space", 0, "", 0); + uiItemR(layout, ptr, "space", 0, "", ICON_NULL); } static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "filter_type", 0, "", 0); + uiItemR(layout, ptr, "filter_type", 0, "", ICON_NULL); } static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -953,25 +953,25 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), Poi uiLayout *col; col= uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "invert_rgb", 0, NULL, 0); - uiItemR(col, ptr, "invert_alpha", 0, NULL, 0); + uiItemR(col, ptr, "invert_rgb", 0, NULL, ICON_NULL); + uiItemR(col, ptr, "invert_alpha", 0, NULL, ICON_NULL); } static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "mapping", 0, "", 0); + uiItemR(layout, ptr, "mapping", 0, "", ICON_NULL); } static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NULL); } static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *split, *col, *row; - uiItemR(layout, ptr, "correction_method", 0, NULL, 0); + uiItemR(layout, ptr, "correction_method", 0, NULL, ICON_NULL); if (RNA_enum_get(ptr, "correction_method")== 0) { @@ -979,17 +979,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "lift", 1, 1, 0, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "lift", 0, NULL, 0); + uiItemR(row, ptr, "lift", 0, NULL, ICON_NULL); col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "gamma", 1, 1, 1, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "gamma", 0, NULL, 0); + uiItemR(row, ptr, "gamma", 0, NULL, ICON_NULL); col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "gain", 1, 1, 1, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "gain", 0, NULL, 0); + uiItemR(row, ptr, "gain", 0, NULL, ICON_NULL); } else { @@ -997,17 +997,17 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "offset", 1, 1, 0, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "offset", 0, NULL, 0); + uiItemR(row, ptr, "offset", 0, NULL, ICON_NULL); col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "power", 1, 1, 0, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "power", 0, NULL, 0); + uiItemR(row, ptr, "power", 0, NULL, ICON_NULL); col = uiLayoutColumn(split, 0); uiTemplateColorWheel(col, ptr, "slope", 1, 1, 0, 1); row = uiLayoutRow(col, 0); - uiItemR(row, ptr, "slope", 0, NULL, 0); + uiItemR(row, ptr, "slope", 0, NULL, ICON_NULL); } } @@ -1019,7 +1019,7 @@ static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "mode", 0, "", 0); + uiItemR(layout, ptr, "mode", 0, "", ICON_NULL); } /* only once called */ @@ -1182,12 +1182,12 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), Poin uiLayout *col; col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "offset", 0, "Offset", 0); - uiItemR(col, ptr, "offset_frequency", 0, "Frequency", 0); + uiItemR(col, ptr, "offset", 0, "Offset", ICON_NULL); + uiItemR(col, ptr, "offset_frequency", 0, "Frequency", ICON_NULL); col= uiLayoutColumn(layout, 1); - uiItemR(col, ptr, "squash", 0, "Squash", 0); - uiItemR(col, ptr, "squash_frequency", 0, "Frequency", 0); + uiItemR(col, ptr, "squash", 0, "Squash", ICON_NULL); + uiItemR(col, ptr, "squash_frequency", 0, "Frequency", ICON_NULL); } static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1204,42 +1204,42 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe switch( tex->type ) { case TEX_BLEND: - uiItemR(col, &tex_ptr, "progression", 0, "", 0); + uiItemR(col, &tex_ptr, "progression", 0, "", ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "use_flip_axis", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "use_flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NULL); break; case TEX_MARBLE: row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "marble_type", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "marble_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "noisebasis_2", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "noisebasis_2", UI_ITEM_R_EXPAND, NULL, ICON_NULL); break; case TEX_WOOD: - uiItemR(col, &tex_ptr, "noise_basis", 0, "", 0); - uiItemR(col, &tex_ptr, "wood_type", 0, "", 0); + uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NULL); + uiItemR(col, &tex_ptr, "wood_type", 0, "", ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "noisebasis_2", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "noisebasis_2", UI_ITEM_R_EXPAND, NULL, ICON_NULL); row= uiLayoutRow(col, 0); uiLayoutSetActive(row, !(RNA_enum_get(&tex_ptr, "wood_type")==TEX_BAND || RNA_enum_get(&tex_ptr, "wood_type")==TEX_RING)); - uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); break; case TEX_CLOUDS: - uiItemR(col, &tex_ptr, "noise_basis", 0, "", 0); + uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "cloud_type", UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, &tex_ptr, "cloud_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); row= uiLayoutRow(col, 0); - uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, 0); - uiItemR(col, &tex_ptr, "noise_depth", UI_ITEM_R_EXPAND, "Depth", 0); + uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NULL); + uiItemR(col, &tex_ptr, "noise_depth", UI_ITEM_R_EXPAND, "Depth", ICON_NULL); break; case TEX_DISTNOISE: - uiItemR(col, &tex_ptr, "noise_basis", 0, "", 0); - uiItemR(col, &tex_ptr, "noise_distortion", 0, "", 0); + uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NULL); + uiItemR(col, &tex_ptr, "noise_distortion", 0, "", ICON_NULL); break; } } @@ -1251,7 +1251,7 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "filepath", 0, "", 0); + uiItemR(layout, ptr, "filepath", 0, "", ICON_NULL); } /* only once called */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 4b703e60358..0e7fb90a115 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -570,7 +570,7 @@ static uiBlock *socket_vector_menu(bContext *C, ARegion *ar, void *socket_v) layout= uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, sock->locx, sock->locy-8, 140, 20, U.uistyles.first), 0); - uiItemR(layout, &ptr, "default_value", UI_ITEM_R_EXPAND, "", 0); + uiItemR(layout, &ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NULL); return block; } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 5dd4b9891a1..c0125f67d87 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -433,11 +433,25 @@ void node_set_active(SpaceNode *snode, bNode *node) nodeSetActive(snode->edittree, node); if(node->type!=NODE_GROUP) { + int was_output= (node->flag & NODE_DO_OUTPUT); + /* tree specific activate calls */ if(snode->treetype==NTREE_SHADER) { /* when we select a material, active texture is cleared, for buttons */ if(node->id && GS(node->id->name)==ID_MA) nodeClearActiveID(snode->edittree, ID_TE); + + if(node->type==SH_NODE_OUTPUT) { + bNode *tnode; + + for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + if( tnode->type==SH_NODE_OUTPUT) + tnode->flag &= ~NODE_DO_OUTPUT; + + node->flag |= NODE_DO_OUTPUT; + if(was_output==0) + ED_node_changed_update(snode->id, node); + } // XXX #if 0 @@ -454,7 +468,7 @@ void node_set_active(SpaceNode *snode, bNode *node) /* make active viewer, currently only 1 supported... */ if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { bNode *tnode; - int was_output= (node->flag & NODE_DO_OUTPUT); + for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) @@ -482,6 +496,16 @@ void node_set_active(SpaceNode *snode, bNode *node) scene->r.actlay= node->custom1; } } + else if(node->type==CMP_NODE_COMPOSITE) { + bNode *tnode; + + for(tnode= snode->edittree->nodes.first; tnode; tnode= tnode->next) + if( tnode->type==CMP_NODE_COMPOSITE) + tnode->flag &= ~NODE_DO_OUTPUT; + + node->flag |= NODE_DO_OUTPUT; + ED_node_changed_update(snode->id, node); + } } else if(snode->treetype==NTREE_TEXTURE) { // XXX @@ -607,11 +631,11 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(gnode->type!=NODE_GROUP) { - BKE_report(op->reports, RPT_ERROR, "Not a group"); + BKE_report(op->reports, RPT_WARNING, "Not a group"); return OPERATOR_CANCELLED; } else if(!nodeGroupUnGroup(snode->edittree, gnode)) { - BKE_report(op->reports, RPT_ERROR, "Can't ungroup"); + BKE_report(op->reports, RPT_WARNING, "Can't ungroup"); return OPERATOR_CANCELLED; } @@ -1944,7 +1968,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) bNode *gnode; if(snode->edittree!=snode->nodetree) { - BKE_report(op->reports, RPT_ERROR, "Can not add a new Group in a Group"); + BKE_report(op->reports, RPT_WARNING, "Can not add a new Group in a Group"); return OPERATOR_CANCELLED; } @@ -1957,7 +1981,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) } if(gnode) { - BKE_report(op->reports, RPT_ERROR, "Can not add RenderLayer in a Group"); + BKE_report(op->reports, RPT_WARNING, "Can not add RenderLayer in a Group"); return OPERATOR_CANCELLED; } } @@ -1966,7 +1990,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) gnode= nodeMakeGroupFromSelected(snode->nodetree); if(gnode==NULL) { - BKE_report(op->reports, RPT_ERROR, "Can not make Group"); + BKE_report(op->reports, RPT_WARNING, "Can not make Group"); return OPERATOR_CANCELLED; } else { @@ -2296,7 +2320,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) node = node_add_node(snode, scene, ntype, snode->mx, snode->my); if (!node) { - BKE_report(op->reports, RPT_ERROR, "Could not add an image node."); + BKE_report(op->reports, RPT_WARNING, "Could not add an image node."); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 64e4bc4cbc8..1ad5954b56e 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -126,7 +126,7 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas for(tot=0, a=0; ngroup; ngroup= ngroup->id.next, tot++) { if(ngroup->type==ntree->type) { - uiItemV(layout, ngroup->id.name+2, 0, NODE_GROUP_MENU+tot); + uiItemV(layout, ngroup->id.name+2, ICON_NULL, NODE_GROUP_MENU+tot); a++; } } @@ -138,11 +138,11 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas for(a=0, type= ntree->alltypes.first; type; type=type->next) { if(type->nclass == nodeclass && type->name) { if(type->type == NODE_DYNAMIC) { - uiItemV(layout, type->name, 0, NODE_DYNAMIC_MENU+script); + uiItemV(layout, type->name, ICON_NULL, NODE_DYNAMIC_MENU+script); script++; } else - uiItemV(layout, type->name, 0, type->type); + uiItemV(layout, type->name, ICON_NULL, type->type); a++; } diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index dc8e944dbca..6f3cafd81f8 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -39,4 +39,4 @@ set(SRC outliner_intern.h ) -blenderlib(bf_editor_space_outliner "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}") diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 5a8ae079730..295bf15f840 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -2715,7 +2715,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) if(tselem->type==0) { if(tselem->id==id) return te; /* only deeper on scene or object */ - if( te->idcode==ID_OB || te->idcode==ID_SCE) { + if( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) { tes= outliner_find_id(soops, &te->subtree, id); if(tes) return tes; } @@ -2770,8 +2770,6 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) /* callbacks */ ot->exec= outliner_show_active_exec; ot->poll= ED_operator_outliner_active; - - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } /* tse is not in the treestore, we use its contents to find a match */ @@ -4556,6 +4554,21 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa } +/* closed tree element */ +static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) +{ + TreeElement *ten; + + /* store coord and continue, we need coordinates for elements outside view too */ + te->xs= (float)startx; + te->ys= (float)(*starty); + + for(ten= te->subtree.first; ten; ten= ten->next) { + outliner_set_coord_tree_element(soops, ten, startx+OL_X, starty); + } +} + + static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int startx, int *starty) { TreeElement *ten; @@ -4710,13 +4723,18 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene te->ys= (float)*starty; te->xend= startx+offsx; - *starty-= OL_H; - if((tselem->flag & TSE_CLOSED)==0) { - for(ten= te->subtree.first; ten; ten= ten->next) { + *starty-= OL_H; + + for(ten= te->subtree.first; ten; ten= ten->next) outliner_draw_tree_element(C, block, scene, ar, soops, ten, startx+OL_X, starty); - } } + else { + for(ten= te->subtree.first; ten; ten= ten->next) + outliner_set_coord_tree_element(soops, te, startx, starty); + + *starty-= OL_H; + } } static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx, int *starty) @@ -5300,13 +5318,13 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa prop= te->directdata; if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0)) - uiDefAutoButR(block, ptr, prop, -1, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); + uiDefAutoButR(block, ptr, prop, -1, "", ICON_NULL, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); } else if(tselem->type == TSE_RNA_ARRAY_ELEM) { ptr= &te->rnaptr; prop= te->directdata; - uiDefAutoButR(block, ptr, prop, te->index, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); + uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NULL, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1); } } diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index 849c4ee4dcd..ddfd3a69d9e 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -43,4 +43,4 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_editor_space_script "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_script "${SRC}" "${INC}") diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index 721d19a37cf..9772361e367 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -44,4 +44,4 @@ set(SRC sequencer_intern.h ) -blenderlib(bf_editor_space_sequencer "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}") diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 087b0b7dcd7..3cf747a0779 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -71,11 +71,11 @@ /* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */ int no_rightbox=0, no_leftbox= 0; -static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2); +static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2); -static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col) +static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[3]) { - char blendcol[3]; + unsigned char blendcol[3]; SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; switch(seq->type) { @@ -212,7 +212,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, /* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks) * so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */ Sequence *seq; - char col[4]; + unsigned char col[4]; int chan_min= MAXSEQ; int chan_max= 0; @@ -248,7 +248,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, get_seq_color3ubv(scene, seq, col); - glColor4ubv((GLubyte *)col); + glColor4ubv(col); /* clamp within parent sequence strip bounds */ if(x1_chan < x1) x1_chan= x1; @@ -260,7 +260,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, glRectf(x1_chan, y1_chan, x2_chan, y2_chan); UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30); - glColor4ubv((GLubyte *)col); + glColor4ubv(col); fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan); if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE)) @@ -360,7 +360,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) { float x1, x2, y1, y2, pixely, a; - char col[3], blendcol[3]; + unsigned char col[3], blendcol[3]; View2D *v2d= &ar->v2d; if(seq->type >= SEQ_EFFECT) return; @@ -462,7 +462,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) } /* draw info text on a sequence strip */ -static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, char *background_col) +static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3]) { rctf rect; char str[32 + FILE_MAXDIR+FILE_MAXFILE]; @@ -528,7 +528,7 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float } /* draws a shaded strip, made from gradient + flat color + gradient */ -static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2) +static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2) { float ymid1, ymid2; @@ -546,7 +546,7 @@ static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -50); else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 0); - glColor3ubv((GLubyte *)col); + glColor3ubv(col); glVertex2f(x1,y1); glVertex2f(x2,y1); @@ -592,7 +592,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline { View2D *v2d= &ar->v2d; float x1, x2, y1, y2; - char col[3], background_col[3], is_single_image; + unsigned char col[3], background_col[3], is_single_image; /* we need to know if this is a single image/color or not for drawing */ is_single_image = (char)seq_single_check(seq); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a5361ec676f..d98513e5509 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1564,7 +1564,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) if (newlist.first) { /* got new strips ? */ Sequence *seq; - addlisttolist(ed->seqbasep, &newlist); + BLI_movelisttolist(ed->seqbasep, &newlist); if (cut_side != SEQ_SIDE_BOTH) { SEQP_BEGIN(ed, seq) { @@ -1658,7 +1658,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) if(nseqbase.first) { Sequence * seq= nseqbase.first; /* rely on the nseqbase list being added at the end */ - addlisttolist(ed->seqbasep, &nseqbase); + BLI_movelisttolist(ed->seqbasep, &nseqbase); for( ; seq; seq= seq->next) seq_recursive_apply(seq, apply_unique_name_cb, scene); @@ -2029,7 +2029,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) if(last_seq==NULL || last_seq->type!=SEQ_META) return OPERATOR_CANCELLED; - addlisttolist(ed->seqbasep, &last_seq->seqbase); + BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase); last_seq->seqbase.first= 0; last_seq->seqbase.last= 0; @@ -2701,7 +2701,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) } } - addlisttolist(ed->seqbasep, &nseqbase); + BLI_movelisttolist(ed->seqbasep, &nseqbase); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt index bd60c0feb01..df148e0fd91 100644 --- a/source/blender/editors/space_sound/CMakeLists.txt +++ b/source/blender/editors/space_sound/CMakeLists.txt @@ -36,4 +36,4 @@ set(SRC sound_intern.h ) -blenderlib(bf_editor_space_sound "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_sound "${SRC}" "${INC}") diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index 86e2f3f3ac5..800a18b95e1 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -45,4 +45,4 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_editor_text "${SRC}" "${INC}") +blender_add_lib(bf_editor_text "${SRC}" "${INC}") diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 06346bc89ed..0acdbfb9ccc 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -407,7 +407,7 @@ static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) - if(ELEM(drag->icon, 0, ICON_FILE_BLANK)) /* rule might not work? */ + if(ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_BLANK)) /* rule might not work? */ return 1; return 0; } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 93581056c98..4307945129b 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1173,7 +1173,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll) { bTheme *btheme= U.themes.first; uiWidgetColors wcol= btheme->tui.wcol_scroll; - char col[3]; + unsigned char col[4]; float rad; uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0); @@ -1181,7 +1181,8 @@ static void draw_textscroll(SpaceText *st, rcti *scroll) uiSetRoundBox(15); rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin); UI_GetThemeColor3ubv(TH_HILITE, col); - glColor4ub(col[0], col[1], col[2], 48); + col[3]= 48; + glColor4ubv(col); glEnable(GL_BLEND); uiRoundBox(st->txtscroll.xmin+1, st->txtscroll.ymin, st->txtscroll.xmax-1, st->txtscroll.ymax, rad); glDisable(GL_BLEND); @@ -1228,7 +1229,7 @@ static void draw_markers(SpaceText *st, ARegion *ar) /* invisible part of line (before top, after last visible line) */ if(y2 < 0 || y1 > st->top+st->viewlines) continue; - glColor3ub(marker->color[0], marker->color[1], marker->color[2]); + glColor3ubv(marker->color); x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; y= ar->winy-3; diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index b7bf61497bd..8ad4d6fa890 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -133,23 +133,23 @@ void TEXT_OT_properties(wmOperatorType *ot) uiPopupMenu *pup; if(text) { - pup= uiPupMenuBegin(C, "Text", 0); + pup= uiPupMenuBegin(C, "Text", ICON_NULL); if(txt_has_sel(text)) { - uiItemO(layout, NULL, 0, "TEXT_OT_cut"); - uiItemO(layout, NULL, 0, "TEXT_OT_copy"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_cut"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_copy"); } - uiItemO(layout, NULL, 0, "TEXT_OT_paste"); - uiItemO(layout, NULL, 0, "TEXT_OT_new"); - uiItemO(layout, NULL, 0, "TEXT_OT_open"); - uiItemO(layout, NULL, 0, "TEXT_OT_save"); - uiItemO(layout, NULL, 0, "TEXT_OT_save_as"); - uiItemO(layout, NULL, 0, "TEXT_OT_run_script"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_paste"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_new"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_open"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_save"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_save_as"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_run_script"); uiPupMenuEnd(C, pup); } else { - pup= uiPupMenuBegin(C, "File", 0); - uiItemO(layout, NULL, 0, "TEXT_OT_new"); - uiItemO(layout, NULL, 0, "TEXT_OT_open"); + pup= uiPupMenuBegin(C, "File", ICON_NULL); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_new"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_open"); uiPupMenuEnd(C, pup); } } @@ -159,10 +159,10 @@ void TEXT_OT_properties(wmOperatorType *ot) uiPopupMenu *pup; - pup= uiPupMenuBegin(C, "Edit", 0); - uiItemO(layout, NULL, 0, "TEXT_OT_cut"); - uiItemO(layout, NULL, 0, "TEXT_OT_copy"); - uiItemO(layout, NULL, 0, "TEXT_OT_paste"); + pup= uiPupMenuBegin(C, "Edit", ICON_NULL); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_cut"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_copy"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_paste"); uiPupMenuEnd(C, pup); } @@ -172,18 +172,18 @@ void TEXT_OT_properties(wmOperatorType *ot) uiPopupMenu *pup; if(text) { - pup= uiPupMenuBegin(C, "Text", 0); - uiItemO(layout, NULL, 0, "TEXT_OT_new"); - uiItemO(layout, NULL, 0, "TEXT_OT_open"); - uiItemO(layout, NULL, 0, "TEXT_OT_save"); - uiItemO(layout, NULL, 0, "TEXT_OT_save_as"); - uiItemO(layout, NULL, 0, "TEXT_OT_run_script"); + pup= uiPupMenuBegin(C, "Text", ICON_NULL); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_new"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_open"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_save"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_save_as"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_run_script"); uiPupMenuEnd(C, pup); } else { - pup= uiPupMenuBegin(C, "File", 0); - uiItemO(layout, NULL, 0, "TEXT_OT_new"); - uiItemO(layout, NULL, 0, "TEXT_OT_open"); + pup= uiPupMenuBegin(C, "File", ICON_NULL); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_new"); + uiItemO(layout, NULL, ICON_NULL, "TEXT_OT_open"); uiPupMenuEnd(C, pup); } } @@ -193,7 +193,7 @@ void TEXT_OT_properties(wmOperatorType *ot) uiPopupMenu *pup; - pup= uiPupMenuBegin(C, "Text", 0); + pup= uiPupMenuBegin(C, "Text", ICON_NULL); uiItemEnumO(layout, "TEXT_OT_move", "Top of File", 0, "type", FILE_TOP); uiItemEnumO(layout, "TEXT_OT_move", "Bottom of File", 0, "type", FILE_BOTTOM); uiItemEnumO(layout, "TEXT_OT_move", "Page Up", 0, "type", PREV_PAGE); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index bcfcfd09fed..8dc67ca4774 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2688,7 +2688,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) text_drawcache_tag_update(CTX_wm_space_text(C), 1); } else if(mode==TEXT_MARK_ALL) { - char color[4]; + unsigned char color[4]; UI_GetThemeColor4ubv(TH_SHADE2, color); if(txt_find_marker(text, text->curl, text->selc, TMARK_GRP_FINDALL, 0)) { @@ -2939,7 +2939,7 @@ static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( case 1: if(text->flags & TXT_ISDIRTY) { /* modified locally and externally, ahhh. offer more possibilites. */ - pup= uiPupMenuBegin(C, "File Modified Outside and Inside Blender", 0); + pup= uiPupMenuBegin(C, "File Modified Outside and Inside Blender", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, op->type->idname, "Reload from disk (ignore local changes)", 0, "resolution", RESOLVE_RELOAD); uiItemEnumO(layout, op->type->idname, "Save to disk (ignore outside changes)", 0, "resolution", RESOLVE_SAVE); @@ -2947,7 +2947,7 @@ static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( uiPupMenuEnd(C, pup); } else { - pup= uiPupMenuBegin(C, "File Modified Outside Blender", 0); + pup= uiPupMenuBegin(C, "File Modified Outside Blender", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, op->type->idname, "Reload from disk", 0, "resolution", RESOLVE_RELOAD); uiItemEnumO(layout, op->type->idname, "Make text internal (separate copy)", 0, "resolution", RESOLVE_MAKE_INTERNAL); @@ -2956,7 +2956,7 @@ static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( } break; case 2: - pup= uiPupMenuBegin(C, "File Deleted Outside Blender", 0); + pup= uiPupMenuBegin(C, "File Deleted Outside Blender", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemEnumO(layout, op->type->idname, "Make text internal", 0, "resolution", RESOLVE_MAKE_INTERNAL); uiItemEnumO(layout, op->type->idname, "Recreate file", 0, "resolution", RESOLVE_SAVE); diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt index cbfce4c5cc2..d3f0fccd19a 100644 --- a/source/blender/editors/space_time/CMakeLists.txt +++ b/source/blender/editors/space_time/CMakeLists.txt @@ -36,4 +36,4 @@ set(SRC time_intern.h ) -blenderlib(bf_editor_space_time "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_time "${SRC}" "${INC}") diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 1de7704c3f0..6fd0b414c08 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -92,10 +92,35 @@ static void time_draw_cache(SpaceTime *stime) return; for (stc= stime->caches.first; stc; stc=stc->next) { - float col[4]; - - if (!stc->array || !stc->ok) - continue; + float col[4], *fp; + int i, sta = stc->cache->startframe, end = stc->cache->endframe; + int len = (end - sta + 1)*4; + + if(!stc->array || MEM_allocN_len(stc->array) != len*2*sizeof(float)) { + stc->len = len; + stc->array = MEM_callocN(stc->len*2*sizeof(float), "SpaceTimeCache array"); + } + + /* fill the vertex array with a quad for each cached frame */ + for (i=sta, fp=stc->array; i<=end; i++) { + if (stc->cache->cached_frames[i-sta]) { + fp[0] = (float)i-0.5f; + fp[1] = 0.0; + fp+=2; + + fp[0] = (float)i-0.5f; + fp[1] = 1.0; + fp+=2; + + fp[0] = (float)i+0.5f; + fp[1] = 1.0; + fp+=2; + + fp[0] = (float)i+0.5f; + fp[1] = 0.0; + fp+=2; + } + } glPushMatrix(); glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT+yoffs, 0.0); @@ -124,17 +149,17 @@ static void time_draw_cache(SpaceTime *stime) glEnable(GL_BLEND); - glRectf((float)stc->startframe, 0.0, (float)stc->endframe, 1.0); + glRectf((float)sta, 0.0, (float)end, 1.0); col[3] = 0.4; - if (stc->flag & PTCACHE_BAKED) { + if (stc->cache->flag & PTCACHE_BAKED) { col[0] -= 0.4; col[1] -= 0.4; col[2] -= 0.4; } glColor4fv(col); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, stc->array); - glDrawArrays(GL_QUADS, 0, stc->len); + glDrawArrays(GL_QUADS, 0, (fp-stc->array)/2); glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_BLEND); @@ -176,9 +201,6 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime) * add spacetimecache and vertex array for each */ for(pid=pidlist.first; pid; pid=pid->next) { SpaceTimeCache *stc; - float *fp, *array; - int i, len; - int sta, end; switch(pid->type) { case PTCACHE_TYPE_SOFTBODY: @@ -196,7 +218,7 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime) break; } - BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, &sta, &end, NULL); + BKE_ptcache_id_time(pid, CTX_data_scene(C), 0, NULL, NULL, NULL); if(pid->cache->cached_frames==NULL) continue; @@ -204,48 +226,8 @@ static void time_cache_refresh(const bContext *C, SpaceTime *stime) stc= MEM_callocN(sizeof(SpaceTimeCache), "spacetimecache"); stc->type = pid->type; - - if (pid->cache->flag & PTCACHE_BAKED) - stc->flag |= PTCACHE_BAKED; - if (pid->cache->flag & PTCACHE_DISK_CACHE) - stc->flag |= PTCACHE_DISK_CACHE; - - /* first allocate with maximum number of frames needed */ - stc->startframe = sta; - stc->endframe = end; - len = (end - sta + 1)*4; - fp = array = MEM_callocN(len*2*sizeof(float), "temporary timeline cache array"); - - /* fill the vertex array with a quad for each cached frame */ - for (i=sta; i<=end; i++) { - - if (pid->cache->cached_frames[i-sta]) { - fp[0] = (float)i; - fp[1] = 0.0; - fp+=2; - - fp[0] = (float)i; - fp[1] = 1.0; - fp+=2; - - fp[0] = (float)(i+1); - fp[1] = 1.0; - fp+=2; - - fp[0] = (float)(i+1); - fp[1] = 0.0; - fp+=2; - } - } - /* update with final number of frames */ - stc->len = (i-stc->startframe)*4; - stc->array = MEM_mallocN(stc->len*2*sizeof(float), "SpaceTimeCache array"); - memcpy(stc->array, array, stc->len*2*sizeof(float)); - - MEM_freeN(array); - array = NULL; - - stc->ok = 1; + stc->cache = pid->cache; + stc->len = 0; BLI_addtail(&stime->caches, stc); } @@ -401,6 +383,8 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_BONE_ACTIVE: case ND_POINTCACHE: + case ND_MODIFIER: + case ND_PARTICLE: ED_area_tag_refresh(sa); ED_area_tag_redraw(sa); break; @@ -433,6 +417,12 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); break; } + case NC_WM: + switch (wmn->data) { + case ND_FILEREAD: + ED_area_tag_refresh(sa); + break; + } } } diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt index 15ae90056b1..1ea1806fb95 100644 --- a/source/blender/editors/space_userpref/CMakeLists.txt +++ b/source/blender/editors/space_userpref/CMakeLists.txt @@ -36,4 +36,4 @@ set(SRC userpref_intern.h ) -blenderlib(bf_editor_space_userpref "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_userpref "${SRC}" "${INC}") diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 0e4c9ca6aa3..1f47a25ad92 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -62,4 +62,4 @@ endif() add_definitions(-DGLEW_STATIC) -blenderlib(bf_editor_space_view3d "${SRC}" "${INC}") +blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}") diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 7035006ea70..7c07f99b8ea 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -206,6 +206,10 @@ void draw_motion_path_instance(Scene *scene, /* Draw frame numbers at each framestep value */ if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) { + unsigned char col[4]; + UI_GetThemeColor3ubv(TH_TEXT_HI, col); + col[3]= 255; + for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) { char str[32]; float co[3]; @@ -214,7 +218,7 @@ void draw_motion_path_instance(Scene *scene, if (i == 0) { sprintf(str, "%d", (i+sfra)); mul_v3_m4v3(co, ob->imat, mpv->co); - view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col); } else if ((i > stepsize) && (i < len-stepsize)) { bMotionPathVert *mpvP = (mpv - stepsize); @@ -223,7 +227,7 @@ void draw_motion_path_instance(Scene *scene, if ((equals_v3v3(mpv->co, mpvP->co)==0) || (equals_v3v3(mpv->co, mpvN->co)==0)) { sprintf(str, "%d", (sfra+i)); mul_v3_m4v3(co, ob->imat, mpv->co); - view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col); } } } @@ -231,6 +235,8 @@ void draw_motion_path_instance(Scene *scene, /* Keyframes - dots and numbers */ if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) { + unsigned char col[4]; + AnimData *adt= BKE_animdata_from_id(&ob->id); DLRBT_Tree keys; @@ -256,8 +262,11 @@ void draw_motion_path_instance(Scene *scene, } /* Draw slightly-larger yellow dots at each keyframe */ - UI_ThemeColor(TH_VERTEX_SELECT); + UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col); + col[3]= 255; + glPointSize(4.0f); // XXX perhaps a bit too big + glColor3ubv(col); glBegin(GL_POINTS); for (i=0, mpv=mpv_start; i < len; i++, mpv++) { @@ -281,7 +290,7 @@ void draw_motion_path_instance(Scene *scene, sprintf(str, "%d", (sfra+i)); mul_v3_m4v3(co, ob->imat, mpv->co); - view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col); } } } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 89da66e269a..27cb305f78f 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1886,6 +1886,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ if ((G.f & G_PICKSEL) == 0) { float vec[3]; + + unsigned char col[4]; + float col_f[3]; + glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */ + rgb_float_to_byte(col_f, col); + col[3]= 255; if (v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -1894,17 +1900,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (pchan->bone->layer & arm->layer) { if (arm->flag & (ARM_EDITMODE|ARM_POSEMODE)) { bone= pchan->bone; - - if (bone->flag & BONE_SELECTED) UI_ThemeColor(TH_TEXT_HI); - else UI_ThemeColor(TH_TEXT); + UI_GetThemeColor3ubv((bone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col); } - else if (dt > OB_WIRE) - UI_ThemeColor(TH_TEXT); - + else if (dt > OB_WIRE) { + UI_GetThemeColor3ubv(TH_TEXT, col); + } + /* Draw names of bone */ if (arm->flag & ARM_DRAWNAMES) { mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail); - view3d_cached_text_draw_add(vec, pchan->name, 10, 0); + view3d_cached_text_draw_add(vec, pchan->name, 10, 0, col); } /* Draw additional axes on the bone tail */ @@ -1913,7 +1918,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, copy_m4_m4(bmat, pchan->pose_mat); bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - + + glColor3ubv(col); drawaxes(pchan->bone->length*0.25f, OB_ARROWS); glPopMatrix(); @@ -2088,21 +2094,22 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) // patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing if ((G.f & G_PICKSEL) == 0) { float vec[3]; + unsigned char col[4]; + col[3]= 255; if (v3d->zbuf) glDisable(GL_DEPTH_TEST); for (eBone=arm->edbo->first; eBone; eBone=eBone->next) { if(eBone->layer & arm->layer) { if ((eBone->flag & BONE_HIDDEN_A)==0) { - - if (eBone->flag & BONE_SELECTED) UI_ThemeColor(TH_TEXT_HI); - else UI_ThemeColor(TH_TEXT); - + + UI_GetThemeColor3ubv((eBone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col); + /* Draw name */ if (arm->flag & ARM_DRAWNAMES) { mid_v3_v3v3(vec, eBone->head, eBone->tail); glRasterPos3fv(vec); - view3d_cached_text_draw_add(vec, eBone->name, 10, 0); + view3d_cached_text_draw_add(vec, eBone->name, 10, 0, col); } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { @@ -2110,7 +2117,8 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) get_matrix_editbone(eBone, bmat); bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - + + glColor3ubv(col); drawaxes(eBone->length*0.25f, OB_ARROWS); glPopMatrix(); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 055a12348c9..1f1acef02db 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -561,7 +561,11 @@ static int CachedTextLevel= 0; typedef struct ViewCachedString { struct ViewCachedString *next, *prev; - float vec[3], col[4]; + float vec[3]; + union { + unsigned char ub[4]; + int pack; + } col; short mval[2]; short xoffs; short flag; @@ -575,7 +579,7 @@ void view3d_cached_text_draw_begin() CachedTextLevel++; } -void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag) +void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]) { int alloc_len= strlen(str) + 1; ListBase *strings= &CachedText[CachedTextLevel-1]; @@ -583,7 +587,7 @@ void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs BLI_addtail(strings, vos); copy_v3_v3(vos->vec, co); - glGetFloatv(GL_CURRENT_COLOR, vos->col); + vos->col.pack= *((int *)col); vos->xoffs= xoffs; vos->flag= flag; @@ -608,6 +612,8 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa } if(tot) { + int col_pack_prev= 0; + #if 0 bglMats mats; /* ZBuffer depth vars */ double ux, uy, uz; @@ -643,7 +649,11 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa #endif if(vos->mval[0]!=IS_CLIPPED) { const char *str= (char *)(vos+1); - glColor3fv(vos->col); + + if(col_pack_prev != vos->col.pack) { + glColor3ubv(vos->col.ub); + col_pack_prev= vos->col.pack; + } if(vos->flag & V3D_CACHE_TEXT_ASCII) { BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */ } @@ -908,7 +918,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, float vec[3], lvec[3], vvec[3], circrad, x,y,z; float lampsize; float imat[4][4], curcol[4]; - char col[4]; + unsigned char col[4]; int drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && la->type == LA_SPOT && (la->mode & LA_SHOW_CONE)); /* cone can't be drawn for duplicated lamps, because duplilist would be freed to */ @@ -1166,7 +1176,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } UI_GetThemeColor4ubv(TH_LAMP, col); - glColor4ub(col[0], col[1], col[2], col[3]); + glColor4ubv(col); glEnable(GL_BLEND); @@ -1987,7 +1997,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv if(v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select for (sel=0; sel<2; sel++) { - char col[4], fcol[4]; + unsigned char col[4], fcol[4]; int pass; UI_GetThemeColor3ubv(sel?TH_VERTEX_SELECT:TH_VERTEX, col); @@ -2015,13 +2025,13 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, Deriv if(ts->selectmode & SCE_SELECT_VERTEX) { glPointSize(size); - glColor4ubv((GLubyte *)col); + glColor4ubv(col); draw_dm_verts(cageDM, sel, eve_act); } if(check_ob_drawface_dot(scene, v3d, obedit->dt)) { glPointSize(fsize); - glColor4ubv((GLubyte *)fcol); + glColor4ubv(fcol); draw_dm_face_centers(cageDM, sel); } @@ -2043,9 +2053,9 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh unsigned char wireCol[4], selCol[4], actCol[4]; /* since this function does transparant... */ - UI_GetThemeColor4ubv(TH_EDGE_SELECT, (char *)selCol); - UI_GetThemeColor4ubv(TH_WIRE, (char *)wireCol); - UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)actCol); + UI_GetThemeColor4ubv(TH_EDGE_SELECT, selCol); + UI_GetThemeColor4ubv(TH_WIRE, wireCol); + UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol); /* when sel only is used, dont render wire, only selected, this is used for * textured draw mode when the 'edges' option is disabled */ @@ -2102,42 +2112,30 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E float v1[3], v2[3], v3[3], v4[3], vmid[3]; float fvec[3]; char val[32]; /* Stores the measurement display text here */ - char conv_float[5]; /* Use a float conversion matching the grid size */ - float area, col[3]; /* area of the face, color of the text to draw */ + const char *conv_float; /* Use a float conversion matching the grid size */ + unsigned char col[3]; /* color of the text to draw */ + float area; /* area of the face */ float grid= unit->system ? unit->scale_length : v3d->grid; const int do_split= unit->flag & USER_UNIT_OPT_SPLIT; const int do_global= v3d->flag & V3D_GLOBAL_STATS; const int do_moving= G.moving; - if(v3d->flag2 & V3D_RENDER_OVERRIDE) - return; - /* make the precision of the pronted value proportionate to the gridsize */ - if (grid < 0.01f) - strcpy(conv_float, "%.6f"); - else if (grid < 0.1f) - strcpy(conv_float, "%.5f"); - else if (grid < 1.0f) - strcpy(conv_float, "%.4f"); - else if (grid < 10.0f) - strcpy(conv_float, "%.3f"); - else - strcpy(conv_float, "%.2f"); - - + if (grid < 0.01f) conv_float= "%.6g"; + else if (grid < 0.1f) conv_float= "%.5g"; + else if (grid < 1.0f) conv_float= "%.4g"; + else if (grid < 10.0f) conv_float= "%.3g"; + else conv_float= "%.2g"; + if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0) glDisable(GL_DEPTH_TEST); if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f); - if(me->drawflag & ME_DRAW_EDGELEN) { - UI_GetThemeColor3fv(TH_TEXT, col); - /* make color a bit more red */ - if(col[0]> 0.5f) {col[1]*=0.7f; col[2]*= 0.7f;} - else col[0]= col[0]*0.7f + 0.3f; - glColor3fv(col); - + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { + UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col); + for(eed= em->edges.first; eed; eed= eed->next) { /* draw non fgon edges, or selected edges, or edges next to selected verts while draging */ if((eed->h != EM_FGON) && ((eed->f & SELECT) || (do_moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) { @@ -2155,19 +2153,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else sprintf(val, conv_float, len_v3v3(v1, v2)); - view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col); } } } - if(me->drawflag & ME_DRAW_FACEAREA) { + if(me->drawflag & ME_DRAWEXTRA_FACEAREA) { // XXX extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now? - - UI_GetThemeColor3fv(TH_TEXT, col); - /* make color a bit more green */ - if(col[1]> 0.5f) {col[0]*=0.7f; col[2]*= 0.7f;} - else col[1]= col[1]*0.7f + 0.3f; - glColor3fv(col); + UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col); for(efa= em->faces.first; efa; efa= efa->next) { if((efa->f & SELECT)) { // XXX || (do_moving && faceselectedOR(efa, SELECT)) ) { @@ -2194,20 +2187,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else sprintf(val, conv_float, area); - view3d_cached_text_draw_add(efa->cent, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(efa->cent, val, 0, V3D_CACHE_TEXT_ASCII, col); } } } - if(me->drawflag & ME_DRAW_EDGEANG) { + if(me->drawflag & ME_DRAWEXTRA_FACEANG) { EditEdge *e1, *e2, *e3, *e4; - - UI_GetThemeColor3fv(TH_TEXT, col); - /* make color a bit more blue */ - if(col[2]> 0.5f) {col[0]*=0.7f; col[1]*= 0.7f;} - else col[2]= col[2]*0.7f + 0.3f; - glColor3fv(col); - + UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); for(efa= em->faces.first; efa; efa= efa->next) { copy_v3_v3(v1, efa->v1->co); copy_v3_v3(v2, efa->v2->co); @@ -2234,31 +2221,31 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) { /* Vec 1 */ - sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v4, v1, v2))); + sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v4, v1, v2))); interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f); - view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col); } if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) { /* Vec 2 */ - sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v1, v2, v3))); + sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v1, v2, v3))); interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f); - view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col); } if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) { /* Vec 3 */ if(efa->v4) - sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v4))); + sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v4))); else - sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v1))); + sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v1))); interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f); - view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col); } /* Vec 4 */ if(efa->v4) { if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) { - sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v3, v4, v1))); + sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v3, v4, v1))); interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f); - view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col); } } } @@ -2355,9 +2342,9 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(me->drawflag & ME_DRAWFACES) { /* transp faces */ unsigned char col1[4], col2[4], col3[4]; - UI_GetThemeColor4ubv(TH_FACE, (char *)col1); - UI_GetThemeColor4ubv(TH_FACE_SELECT, (char *)col2); - UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3); + UI_GetThemeColor4ubv(TH_FACE, col1); + UI_GetThemeColor4ubv(TH_FACE_SELECT, col2); + UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3); glEnable(GL_BLEND); glDepthMask(0); // disable write in zbuffer, needed for nice transp @@ -2376,7 +2363,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object * */ unsigned char col1[4], col2[4], col3[4]; col1[3] = col2[3] = 0; /* dont draw */ - UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, (char *)col3); + UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3); glEnable(GL_BLEND); glDepthMask(0); // disable write in zbuffer, needed for nice transp @@ -2439,7 +2426,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_dm_vert_normals(scene, cageDM); } - if(me->drawflag & (ME_DRAW_EDGELEN|ME_DRAW_FACEAREA|ME_DRAW_EDGEANG)) + if(me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG) && !((v3d->flag2 & V3D_RENDER_OVERRIDE))) draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit); } @@ -2494,7 +2481,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D int draw_wire = 0; int totvert, totedge, totface; DispList *dl; - DerivedMesh *dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask); + DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask); if(!dm) return; @@ -2669,7 +2656,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D dm->release(dm); shadeDispList(scene, base); dl = find_displist(&ob->disp, DL_VERTCOL); - dm= mesh_get_derived_final(scene, ob, v3d->customdata_mask); + dm= mesh_get_derived_final(scene, ob, scene->customdata_mask); } if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire) { @@ -2778,7 +2765,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D finalDM = cageDM = editmesh_get_derived_base(ob, em); else cageDM = editmesh_get_derived_cage_and_final(scene, ob, em, &finalDM, - v3d->customdata_mask); + scene->customdata_mask); if(dt>OB_WIRE) { // no transp in editmode, the fancy draw over goes bad then @@ -3474,6 +3461,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv int select=ob->flag&SELECT, create_cdata=0, need_v=0; GLint polygonmode[2]; char val[32]; + unsigned char tcol[4]= {0, 0, 0, 255}; /* 1. */ if(psys==0) @@ -3531,14 +3519,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if(v3d->zbuf) glDepthMask(1); if((ma) && (part->draw&PART_DRAW_MAT_COL)) { - glColor3f(ma->r,ma->g,ma->b); + rgb_float_to_byte(&(ma->r), tcol); ma_r = ma->r; ma_g = ma->g; ma_b = ma->b; } - else - cpack(0); + + glColor3ubv(tcol); timestep= psys_get_timestep(&sim); @@ -3889,7 +3877,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* in path drawing state.co is the end point */ /* use worldspace beause object matrix is already applied */ mul_v3_m4v3(vec_txt, ob->imat, state.co); - view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol); } } } @@ -3981,7 +3969,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv sprintf(val, "%i", a); /* use worldspace beause object matrix is already applied */ mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co); - view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol); } } } @@ -5561,6 +5549,13 @@ void drawRBpivot(bRigidBodyJointConstraint *data) int axis; float mat[4][4]; + /* color */ + float curcol[4]; + unsigned char tcol[4]; + glGetFloatv(GL_CURRENT_COLOR, curcol); + rgb_float_to_byte(curcol, tcol); + tcol[3]= 255; + eul_to_mat4(mat,&data->axX); glLineWidth (4.0f); setlinestyle(2); @@ -5578,11 +5573,11 @@ void drawRBpivot(bRigidBodyJointConstraint *data) glVertex3fv(v); glEnd(); if (axis==0) - view3d_cached_text_draw_add(v, "px", 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(v, "px", 0, V3D_CACHE_TEXT_ASCII, tcol); else if (axis==1) - view3d_cached_text_draw_add(v, "py", 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(v, "py", 0, V3D_CACHE_TEXT_ASCII, tcol); else - view3d_cached_text_draw_add(v, "pz", 0, V3D_CACHE_TEXT_ASCII); + view3d_cached_text_draw_add(v, "pz", 0, V3D_CACHE_TEXT_ASCII, tcol); } glLineWidth (1.0f); setlinestyle(0); @@ -6212,7 +6207,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* but, we also dont draw names for sets or duplicators */ if(flag == 0) { float zero[3]= {0,0,0}; - view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0); + float curcol[4]; + unsigned char tcol[4]; + glGetFloatv(GL_CURRENT_COLOR, curcol); + rgb_float_to_byte(curcol, tcol); + tcol[3]= 255; + view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0, tcol); } } /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ @@ -6293,15 +6293,16 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* Drawing the constraint lines */ - list = &ob->constraints; - if (list) { + if (ob->constraints.first) { bConstraint *curcon; bConstraintOb *cob; - char col1[4], col2[4]; + unsigned char col1[4], col2[4]; + + list = &ob->constraints; UI_GetThemeColor3ubv(TH_GRID, col1); - UI_make_axis_color(col1, col2, 'z'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col1, col2, 'Z'); + glColor3ubv(col2); cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); @@ -6440,9 +6441,9 @@ static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUS } } -static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob) +static void bbs_mesh_solid(Scene *scene, Object *ob) { - DerivedMesh *dm = mesh_get_derived_final(scene, ob, v3d->customdata_mask); + DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); Mesh *me = (Mesh*)ob->data; glColor3ub(0, 0, 0); @@ -6498,7 +6499,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec EM_free_index_arrays(); } - else bbs_mesh_solid(scene, v3d, ob); + else bbs_mesh_solid(scene, ob); } break; case OB_CURVE: diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 9450a3f223a..85900435112 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -303,15 +303,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiButSetUnitType(but, PROP_UNIT_LENGTH); if(totw==1) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); uiBlockBeginAlign(block); uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 0, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, ""); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); } else { uiBlockBeginAlign(block); @@ -334,7 +334,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 70, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, ""); uiButSetUnitType(but, PROP_UNIT_LENGTH); if(totw==tot) { - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 50, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, ""); uiBlockEndAlign(block); uiBlockBeginAlign(block); uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 25, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values"); @@ -352,17 +352,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values"); uiBlockEndAlign(block); if(totweight) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal"); if(totradius) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs"); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 0, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs"); uiBlockEndAlign(block); } } if(totedge==1) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); else if(totedge>1) - uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 10, 3, ""); + uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:", 0, 20, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, ""); } else { // apply @@ -784,57 +784,57 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) uiLayoutSetActive(split, !(bone->parent && bone->flag & BONE_CONNECTED)); } colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "location", 0, "Location", 0); + uiItemR(colsub, ptr, "location", 0, "Location", ICON_NULL); colsub = uiLayoutColumn(split, 1); - uiItemL(colsub, "", 0); - uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemL(colsub, "", ICON_NULL); + uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); split = uiLayoutSplit(layout, 0.8, 0); switch(RNA_enum_get(ptr, "rotation_mode")) { case ROT_MODE_QUAT: /* quaternion */ colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "rotation_quaternion", 0, "Rotation", 0); + uiItemR(colsub, ptr, "rotation_quaternion", 0, "Rotation", ICON_NULL); colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", 0); + uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NULL); if (RNA_boolean_get(ptr, "lock_rotations_4d")) - uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); else - uiItemL(colsub, "", 0); - uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemL(colsub, "", ICON_NULL); + uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); break; case ROT_MODE_AXISANGLE: /* axis angle */ colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "rotation_axis_angle", 0, "Rotation", 0); + uiItemR(colsub, ptr, "rotation_axis_angle", 0, "Rotation", ICON_NULL); colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", 0); + uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NULL); if (RNA_boolean_get(ptr, "lock_rotations_4d")) - uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); else - uiItemL(colsub, "", 0); - uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemL(colsub, "", ICON_NULL); + uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); break; default: /* euler rotations */ colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "rotation_euler", 0, "Rotation", 0); + uiItemR(colsub, ptr, "rotation_euler", 0, "Rotation", ICON_NULL); colsub = uiLayoutColumn(split, 1); - uiItemL(colsub, "", 0); - uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemL(colsub, "", ICON_NULL); + uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); break; } - uiItemR(layout, ptr, "rotation_mode", 0, "", 0); + uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NULL); split = uiLayoutSplit(layout, 0.8, 0); colsub = uiLayoutColumn(split, 1); - uiItemR(colsub, ptr, "scale", 0, "Scale", 0); + uiItemR(colsub, ptr, "scale", 0, "Scale", ICON_NULL); colsub = uiLayoutColumn(split, 1); - uiItemL(colsub, "", 0); - uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", 0); + uiItemL(colsub, "", ICON_NULL); + uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL); if (ptr->type == &RNA_Object) { Object *ob = ptr->data; if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) - uiItemR(layout, ptr, "dimensions", 0, "Dimensions", 0); + uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NULL); } } @@ -854,7 +854,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) // row= uiLayoutRow(layout, 0); if (!pchan) { - uiItemL(layout, "No Bone Active", 0); + uiItemL(layout, "No Bone Active", ICON_NULL); return; } @@ -965,18 +965,18 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob) col= uiLayoutColumn(layout, 0); - uiItemR(col, &eboneptr, "head", 0, "Head", 0); + uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NULL); if (ebone->parent && ebone->flag & BONE_CONNECTED ) { PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent"); - uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", 0); + uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NULL); } else { - uiItemR(col, &eboneptr, "head_radius", 0, "Radius", 0); + uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NULL); } - uiItemR(col, &eboneptr, "tail", 0, "Tail", 0); - uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", 0); + uiItemR(col, &eboneptr, "tail", 0, "Tail", ICON_NULL); + uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NULL); - uiItemR(col, &eboneptr, "roll", 0, "Roll", 0); + uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NULL); } static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) @@ -995,37 +995,37 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr); col= uiLayoutColumn(layout, 0); - uiItemR(col, &ptr, "co", 0, "Location", 0); + uiItemR(col, &ptr, "co", 0, "Location", ICON_NULL); - uiItemR(col, &ptr, "radius", 0, "Radius", 0); - uiItemR(col, &ptr, "stiffness", 0, "Stiffness", 0); + uiItemR(col, &ptr, "radius", 0, "Radius", ICON_NULL); + uiItemR(col, &ptr, "stiffness", 0, "Stiffness", ICON_NULL); - uiItemR(col, &ptr, "type", 0, "Type", 0); + uiItemR(col, &ptr, "type", 0, "Type", ICON_NULL); col= uiLayoutColumn(layout, 1); switch (RNA_enum_get(&ptr, "type")) { case MB_BALL: break; case MB_CUBE: - uiItemL(col, "Size:", 0); - uiItemR(col, &ptr, "size_x", 0, "X", 0); - uiItemR(col, &ptr, "size_y", 0, "Y", 0); - uiItemR(col, &ptr, "size_z", 0, "Z", 0); + uiItemL(col, "Size:", ICON_NULL); + uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL); + uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL); + uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NULL); break; case MB_TUBE: - uiItemL(col, "Size:", 0); - uiItemR(col, &ptr, "size_x", 0, "X", 0); + uiItemL(col, "Size:", ICON_NULL); + uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL); break; case MB_PLANE: - uiItemL(col, "Size:", 0); - uiItemR(col, &ptr, "size_x", 0, "X", 0); - uiItemR(col, &ptr, "size_y", 0, "Y", 0); + uiItemL(col, "Size:", ICON_NULL); + uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL); + uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL); break; case MB_ELIPSOID: - uiItemL(col, "Size:", 0); - uiItemR(col, &ptr, "size_x", 0, "X", 0); - uiItemR(col, &ptr, "size_y", 0, "Y", 0); - uiItemR(col, &ptr, "size_z", 0, "Z", 0); + uiItemL(col, "Size:", ICON_NULL); + uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL); + uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL); + uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NULL); break; } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6bf87e1964b..c2928614d27 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -249,7 +249,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** RegionView3D *rv3d= ar->regiondata; float wx, wy, x, y, fw, fx, fy, dx; float vec4[4]; - char col[3], col2[3]; + unsigned char col[3], col2[3]; vec4[0]=vec4[1]=vec4[2]=0.0; vec4[3]= 1.0; @@ -397,17 +397,19 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** setlinestyle(0); /* center cross */ + /* horizontal line */ if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) - UI_make_axis_color(col, col2, 'y'); - else UI_make_axis_color(col, col2, 'x'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'Y'); + else UI_make_axis_color(col, col2, 'X'); + glColor3ubv(col2); fdrawline(0.0, y, (float)ar->winx, y); + /* vertical line */ if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) - UI_make_axis_color(col, col2, 'y'); - else UI_make_axis_color(col, col2, 'z'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'Y'); + else UI_make_axis_color(col, col2, 'Z'); + glColor3ubv(col2); fdrawline(x, 0.0, x, (float)ar->winy); @@ -419,7 +421,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) { float vert[3], grid, grid_scale; int a, gridlines, emphasise; - char col[3], col2[3]; + unsigned char col[3], col2[3]; short draw_line = 0; vert[2]= 0.0; @@ -462,8 +464,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) if(a==0) { /* check for the 'show Y axis' preference */ if (v3d->gridflag & V3D_SHOW_Y) { - UI_make_axis_color(col, col2, 'y'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'Y'); + glColor3ubv(col2); draw_line = 1; } else if (v3d->gridflag & V3D_SHOW_FLOOR) { @@ -501,8 +503,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) if(a==0) { /* check for the 'show X axis' preference */ if (v3d->gridflag & V3D_SHOW_X) { - UI_make_axis_color(col, col2, 'x'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'X'); + glColor3ubv(col2); draw_line = 1; } else if (v3d->gridflag & V3D_SHOW_FLOOR) { @@ -538,8 +540,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) /* draw the Z axis line */ /* check for the 'show Z axis' preference */ if (v3d->gridflag & V3D_SHOW_Z) { - UI_make_axis_color(col, col2, 'z'); - glColor3ubv((GLubyte *)col2); + UI_make_axis_color(col, col2, 'Z'); + glColor3ubv(col2); glBegin(GL_LINE_STRIP); vert[0]= 0; @@ -1948,8 +1950,10 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) /* *********************** customdata **************** */ /* goes over all modes and view3d settings */ -static CustomDataMask get_viewedit_datamask(bScreen *screen, Scene *scene, Object *ob) +CustomDataMask ED_viewedit_datamask(bScreen *screen) { + Scene *scene= screen->scene; + Object *ob= scene->basact ? scene->basact->object : NULL; CustomDataMask mask = CD_MASK_BAREMESH; ScrArea *sa; @@ -2299,12 +2303,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) Object *ob; float backcol[3]; unsigned int lay_used; - Object *obact = OBACT; const char *grid_unit= NULL; - /* from now on all object derived meshes check this */ - v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact); - /* shadow buffers, before we setup matrices */ if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype)) gpu_update_lamps_shadows(scene, v3d); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index cfe4dc55d17..8dfbe982ede 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -690,6 +690,9 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) vod->oldx= x; vod->oldy= y; + /* avoid precission loss over time */ + normalize_qt(rv3d->viewquat); + ED_region_tag_redraw(vod->ar); } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 213b48931b9..0f2f182e951 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -450,7 +450,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockEndAlign(block); /* Draw type */ - uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) { /* Manipulators aren't used in weight paint mode */ @@ -458,13 +458,13 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) PointerRNA meshptr; RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr); - uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); } else { const char *str_menu; row= uiLayoutRow(layout, 1); - uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", 0); - uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); + uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); /* NDOF */ /* Not implemented yet @@ -479,7 +479,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* Transform widget / manipulators */ row= uiLayoutRow(layout, 1); - uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { @@ -507,7 +507,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiTemplateLayers(layout, &v3dptr, "layers", &v3dptr, "layers_used", ob_lay); /* Scene lock */ - uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", 0); + uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NULL); } /* selection modus, dont use python for this since it cant do the toggle buttons with shift+click as well as clicking to set one. */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 83ef57cfd0f..06d457778b2 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -114,7 +114,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struc void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); -void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag); +void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag, const unsigned char col[4]); void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4]); #define V3D_CACHE_TEXT_ZBUF (1<<0) #define V3D_CACHE_TEXT_WORLDSPACE (1<<1) diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index d7f2f14d650..bbb26ad09a4 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -995,7 +995,7 @@ static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffe } else { /* UI */ - uiPopupMenu *pup= uiPupMenuBegin(C, "Select Object", 0); + uiPopupMenu *pup= uiPupMenuBegin(C, "Select Object", ICON_NULL); uiLayout *layout= uiPupMenuLayout(pup); uiLayout *split= uiLayoutSplit(layout, 0, 0); uiLayout *column= uiLayoutColumn(split, 0); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index beb6170e0dc..64aa21d6ad8 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -510,7 +510,12 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) armature_loc_pose_to_bone(pchan, vec, vecN); /* adjust location */ - VECCOPY(pchan->loc, vecN); + if ((pchan->protectflag & OB_LOCK_LOCX)==0) + pchan->loc[0]= vecN[0]; + if ((pchan->protectflag & OB_LOCK_LOCY)==0) + pchan->loc[0]= vecN[1]; + if ((pchan->protectflag & OB_LOCK_LOCZ)==0) + pchan->loc[0]= vecN[2]; } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -536,16 +541,14 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); - ob->loc[0]+= vec[0]; - ob->loc[1]+= vec[1]; - ob->loc[2]+= vec[2]; } - else { + if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]+= vec[0]; + if ((ob->protectflag & OB_LOCK_LOCY)==0) ob->loc[1]+= vec[1]; + if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]+= vec[2]; - } - + /* auto-keyframing */ // XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); } @@ -633,8 +636,13 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) /* get location of cursor in bone-space */ armature_loc_pose_to_bone(pchan, cursp, curspn); - /* calculate new position */ - VECCOPY(pchan->loc, curspn); + /* copy new position */ + if ((pchan->protectflag & OB_LOCK_LOCX)==0) + pchan->loc[0]= curspn[0]; + if ((pchan->protectflag & OB_LOCK_LOCY)==0) + pchan->loc[1]= curspn[1]; + if ((pchan->protectflag & OB_LOCK_LOCZ)==0) + pchan->loc[2]= curspn[2]; } /* if the bone has a parent and is connected to the parent, * don't do anything - will break chain unless we do auto-ik. @@ -660,15 +668,14 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); - ob->loc[0]+= vec[0]; - ob->loc[1]+= vec[1]; - ob->loc[2]+= vec[2]; } - else { + if ((ob->protectflag & OB_LOCK_LOCX)==0) ob->loc[0]+= vec[0]; + if ((ob->protectflag & OB_LOCK_LOCY)==0) ob->loc[1]+= vec[1]; + if ((ob->protectflag & OB_LOCK_LOCZ)==0) ob->loc[2]+= vec[2]; - } + /* auto-keyframing */ // XXX autokeyframe_ob_cb_func(ob, TFM_TRANSLATION); } diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 56ca1ce8280..c87eecb4220 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -93,7 +93,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm { if(op->type->flag & OPTYPE_MACRO) { for(op= op->macro.first; op; op= op->next) { - uiItemL(pa->layout, op->type->name, 0); + uiItemL(pa->layout, op->type->name, ICON_NULL); view3d_panel_operator_redo_operator(C, pa, op); } } @@ -210,7 +210,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) for(ct= st->toolshelf.first; ct; ct= ct->next) { if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) { col= uiLayoutColumn(pa->layout, 1); - uiItemFullO(col, ct->opname, NULL, 0, NULL, WM_OP_INVOKE_REGION_WIN, 0); + uiItemFullO(col, ct->opname, NULL, ICON_NULL, NULL, WM_OP_INVOKE_REGION_WIN, 0); } } } diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 5e759bf1ee0..c68b758527b 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -44,4 +44,4 @@ set(SRC transform.h ) -blenderlib(bf_editor_transform "${SRC}" "${INC}") +blender_add_lib(bf_editor_transform "${SRC}" "${INC}") diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8ba332570ba..e7f02de2645 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -103,6 +103,7 @@ #include "transform.h" void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg); +int doEdgeSlide(TransInfo *t, float perc); /* ************************** SPACE DEPENDANT CODE **************************** */ @@ -1330,20 +1331,20 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } case HLP_TRACKBALL: { - char col[3], col2[3]; + unsigned char col[3], col2[3]; UI_GetThemeColor3ubv(TH_GRID, col); glTranslatef(mval[0], mval[1], 0); glLineWidth(3.0); - UI_make_axis_color(col, col2, 'x'); + UI_make_axis_color(col, col2, 'X'); glColor3ubv((GLubyte *)col2); drawArrow(RIGHT, 5, 10, 5); drawArrow(LEFT, 5, 10, 5); - UI_make_axis_color(col, col2, 'y'); + UI_make_axis_color(col, col2, 'Y'); glColor3ubv((GLubyte *)col2); drawArrow(UP, 5, 10, 5); @@ -1785,6 +1786,10 @@ int transformEnd(bContext *C, TransInfo *t) /* handle restoring objects */ if(t->state == TRANS_CANCEL) { + /* exception, edge slide transformed UVs too */ + if(t->mode==TFM_EDGE_SLIDE) + doEdgeSlide(t, 0.0f); + exit_code = OPERATOR_CANCELLED; restoreTransObjects(t); // calls recalcData() } @@ -4508,7 +4513,7 @@ static int createSlideVerts(TransInfo *t) look = look->next; } - // make sure the UPs nad DOWNs are 'faceloops' + // make sure the UPs and DOWNs are 'faceloops' // Also find the nearest slidevert to the cursor look = vertlist; @@ -4525,7 +4530,7 @@ static int createSlideVerts(TransInfo *t) return 0; } - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { if(!(tempsv->up->f & SELECT)) { tempsv->up->f |= SELECT; tempsv->up->f2 |= 16; @@ -4664,7 +4669,7 @@ static int createSlideVerts(TransInfo *t) uv_new = tf->uv[k]; if (ev->tmp.l) { - if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001 || fabs(suv->origuv[1]-uv_new[1])) { + if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { ev->tmp.l = -1; /* Tag as invalid */ BLI_linklist_free(suv->fuv_list,NULL); suv->fuv_list = NULL; @@ -4739,7 +4744,7 @@ void freeSlideVerts(TransInfo *t) Mesh *me = t->obedit->data; int uvlay_idx; - if(me->drawflag & ME_DRAW_EDGELEN) { + if(me->drawflag & ME_DRAWEXTRA_EDGELEN) { TransDataSlideVert *tempsv; LinkNode *look = sld->vertlist; GHash *vertgh = sld->vhash; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 60df20998e2..32792754434 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -624,9 +624,9 @@ void drawConstraint(TransInfo *t) convertViewVec(t, vec, (short)(t->mval[0] - t->con.imval[0]), (short)(t->mval[1] - t->con.imval[1])); add_v3_v3(vec, tc->center); - drawLine(t, tc->center, tc->mtx[0], 'x', 0); - drawLine(t, tc->center, tc->mtx[1], 'y', 0); - drawLine(t, tc->center, tc->mtx[2], 'z', 0); + drawLine(t, tc->center, tc->mtx[0], 'X', 0); + drawLine(t, tc->center, tc->mtx[1], 'Y', 0); + drawLine(t, tc->center, tc->mtx[2], 'Z', 0); glColor3ubv((GLubyte *)col2); @@ -646,13 +646,13 @@ void drawConstraint(TransInfo *t) } if (tc->mode & CON_AXIS0) { - drawLine(t, tc->center, tc->mtx[0], 'x', DRAWLIGHT); + drawLine(t, tc->center, tc->mtx[0], 'X', DRAWLIGHT); } if (tc->mode & CON_AXIS1) { - drawLine(t, tc->center, tc->mtx[1], 'y', DRAWLIGHT); + drawLine(t, tc->center, tc->mtx[1], 'Y', DRAWLIGHT); } if (tc->mode & CON_AXIS2) { - drawLine(t, tc->center, tc->mtx[2], 'z', DRAWLIGHT); + drawLine(t, tc->center, tc->mtx[2], 'Z', DRAWLIGHT); } } } @@ -713,26 +713,26 @@ static void drawObjectConstraint(TransInfo *t) { Without drawing the first light, users have little clue what they are doing. */ if (t->con.mode & CON_AXIS0) { - drawLine(t, td->ob->obmat[3], td->axismtx[0], 'x', DRAWLIGHT); + drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', DRAWLIGHT); } if (t->con.mode & CON_AXIS1) { - drawLine(t, td->ob->obmat[3], td->axismtx[1], 'y', DRAWLIGHT); + drawLine(t, td->ob->obmat[3], td->axismtx[1], 'Y', DRAWLIGHT); } if (t->con.mode & CON_AXIS2) { - drawLine(t, td->ob->obmat[3], td->axismtx[2], 'z', DRAWLIGHT); + drawLine(t, td->ob->obmat[3], td->axismtx[2], 'Z', DRAWLIGHT); } td++; for(i=1;i<t->total;i++,td++) { if (t->con.mode & CON_AXIS0) { - drawLine(t, td->ob->obmat[3], td->axismtx[0], 'x', 0); + drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0); } if (t->con.mode & CON_AXIS1) { - drawLine(t, td->ob->obmat[3], td->axismtx[1], 'y', 0); + drawLine(t, td->ob->obmat[3], td->axismtx[1], 'Y', 0); } if (t->con.mode & CON_AXIS2) { - drawLine(t, td->ob->obmat[3], td->axismtx[2], 'z', 0); + drawLine(t, td->ob->obmat[3], td->axismtx[2], 'Z', 0); } } } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0dbcfd76ecc..90a275883ae 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2444,7 +2444,7 @@ static void createTransUVs(bContext *C, TransInfo *t) EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; EditFace *efa; - if(!ED_uvedit_test(t->obedit)) return; + if(!ED_space_image_show_uvedit(sima, t->obedit)) return; /* count */ for (efa= em->faces.first; efa; efa= efa->next) { @@ -5391,6 +5391,13 @@ void createTransData(bContext *C, TransInfo *t) sort_trans_data_dist(t); } } + else if (ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_TEXTURE_PAINT))) { + /* sculpt mode and project paint have own undo stack + * transform ops redo clears sculpt/project undo stack. + * + * Could use 'OB_MODE_ALL_PAINT' since there are key conflicts, + * transform + paint isnt well supported. */ + } else { createTransObject(C, t); t->flag |= T_OBJECT; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 7dbc0b9c633..83b85ce257c 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -836,7 +836,7 @@ void recalcData(TransInfo *t) void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) { float v1[3], v2[3], v3[3]; - char col[3], col2[3]; + unsigned char col[3], col2[3]; if (t->spacetype == SPACE_VIEW3D) { @@ -860,7 +860,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options) UI_GetThemeColor3ubv(TH_GRID, col); } UI_make_axis_color(col, col2, axis); - glColor3ubv((GLubyte *)col2); + glColor3ubv(col2); setlinestyle(0); glBegin(GL_LINE_STRIP); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index ce8a484eb88..ca106c0e88a 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -695,20 +695,20 @@ static char axisBlendAngle(float angle) moving: in transform theme color else the red/green/blue */ -static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha) +static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha) { - char col[4]; + unsigned char col[4]= {0}; + col[3]= alpha; if(colcode==MAN_GHOST) { - glColor4ub(0, 0, 0, 70); + col[3]= 70; } else if(colcode==MAN_MOVECOL) { UI_GetThemeColor3ubv(TH_TRANSFORM, col); - glColor4ub(col[0], col[1], col[2], alpha); } else { switch(axis) { - case 'c': + case 'C': UI_GetThemeColor3ubv(TH_TRANSFORM, col); if(v3d->twmode == V3D_MANIP_LOCAL) { col[0]= col[0]>200?255:col[0]+55; @@ -720,19 +720,24 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, char alpha col[1]= col[1]<55?0:col[1]-55; col[2]= col[2]<55?0:col[2]-55; } - glColor4ub(col[0], col[1], col[2], alpha); break; - case 'x': - glColor4ub(220, 0, 0, alpha); + case 'X': + col[0]= 220; break; - case 'y': - glColor4ub(0, 220, 0, alpha); + case 'Y': + col[1]= 220; break; - case 'z': - glColor4ub(30, 30, 220, alpha); + case 'Z': + col[0]= 30; + col[1]= 30; + col[2]= 220; break; + default: + BKE_assert(!"invalid axis arg"); } } + + glColor4ubv(col); } /* viewmatrix should have been set OK, also no shademode! */ @@ -741,7 +746,7 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode, /* axes */ if(flagx) { - manipulator_setcolor(v3d, 'x', colcode, axisBlendAngle(rv3d->twangle[0])); + manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0])); if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X); else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X); glBegin(GL_LINES); @@ -752,7 +757,7 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode, if(flagy) { if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y); else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y); - manipulator_setcolor(v3d, 'y', colcode, axisBlendAngle(rv3d->twangle[1])); + manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1])); glBegin(GL_LINES); glVertex3f(0.0f, 0.2f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); @@ -761,7 +766,7 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode, if(flagz) { if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z); else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z); - manipulator_setcolor(v3d, 'z', colcode, axisBlendAngle(rv3d->twangle[2])); + manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2])); glBegin(GL_LINES); glVertex3f(0.0f, 0.0f, 0.2f); glVertex3f(0.0f, 0.0f, 1.0f); @@ -890,7 +895,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, /* axis */ if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) { preOrthoFront(ortho, rv3d->twmat, 2); - manipulator_setcolor(v3d, 'x', colcode, 255); + manipulator_setcolor(v3d, 'X', colcode, 255); glBegin(GL_LINES); glVertex3f(0.2f, 0.0f, 0.0f); glVertex3f(1.0f, 0.0f, 0.0f); @@ -899,7 +904,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, } if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) { preOrthoFront(ortho, rv3d->twmat, 0); - manipulator_setcolor(v3d, 'y', colcode, 255); + manipulator_setcolor(v3d, 'Y', colcode, 255); glBegin(GL_LINES); glVertex3f(0.0f, 0.2f, 0.0f); glVertex3f(0.0f, 1.0f, 0.0f); @@ -908,7 +913,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, } if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) { preOrthoFront(ortho, rv3d->twmat, 1); - manipulator_setcolor(v3d, 'z', colcode, 255); + manipulator_setcolor(v3d, 'Z', colcode, 255); glBegin(GL_LINES); glVertex3f(0.0f, 0.0f, 0.2f); glVertex3f(0.0f, 0.0f, 1.0f); @@ -925,7 +930,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, if(drawflags & MAN_ROT_Z) { preOrthoFront(ortho, matt, 2); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor(v3d, 'z', colcode, 255); + manipulator_setcolor(v3d, 'Z', colcode, 255); drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); postOrtho(ortho); } @@ -934,7 +939,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, matt, 0); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor(v3d, 'x', colcode, 255); + manipulator_setcolor(v3d, 'X', colcode, 255); drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); glRotatef(-90.0, 0.0, 1.0, 0.0); postOrtho(ortho); @@ -944,7 +949,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, matt, 1); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor(v3d, 'y', colcode, 255); + manipulator_setcolor(v3d, 'Y', colcode, 255); drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat); glRotatef(90.0, 1.0, 0.0, 0.0); postOrtho(ortho); @@ -960,7 +965,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, if(drawflags & MAN_ROT_Z) { preOrthoFront(ortho, rv3d->twmat, 2); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor(v3d, 'z', colcode, 255); + manipulator_setcolor(v3d, 'Z', colcode, 255); partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); postOrtho(ortho); } @@ -969,7 +974,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, rv3d->twmat, 0); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor(v3d, 'x', colcode, 255); + manipulator_setcolor(v3d, 'X', colcode, 255); partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); glRotatef(-90.0, 0.0, 1.0, 0.0); postOrtho(ortho); @@ -979,7 +984,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, rv3d->twmat, 1); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor(v3d, 'y', colcode, 255); + manipulator_setcolor(v3d, 'Y', colcode, 255); partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48); glRotatef(90.0, 1.0, 0.0, 0.0); postOrtho(ortho); @@ -995,7 +1000,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, rv3d->twmat, 2); glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor(v3d, 'z', colcode, 255); + manipulator_setcolor(v3d, 'Z', colcode, 255); partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64); @@ -1008,7 +1013,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, rv3d->twmat, 1); glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); - manipulator_setcolor(v3d, 'y', colcode, 255); + manipulator_setcolor(v3d, 'Y', colcode, 255); glRotatef(90.0, 1.0, 0.0, 0.0); glRotatef(90.0, 0.0, 0.0, 1.0); @@ -1023,7 +1028,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, preOrthoFront(ortho, rv3d->twmat, 0); glPushMatrix(); if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); - manipulator_setcolor(v3d, 'x', colcode, 255); + manipulator_setcolor(v3d, 'X', colcode, 255); glRotatef(-90.0, 0.0, 1.0, 0.0); glRotatef(90.0, 0.0, 0.0, 1.0); @@ -1122,7 +1127,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, /* center circle, do not add to selection when shift is pressed (planar constraint) */ if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C); - manipulator_setcolor(v3d, 'c', colcode, 255); + manipulator_setcolor(v3d, 'C', colcode, 255); glPushMatrix(); size= screen_aligned(rv3d, rv3d->twmat); unit_m4(unitmat); @@ -1155,21 +1160,21 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, glTranslatef(0.0, 0.0, dz); if(drawflags & MAN_SCALE_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z); - manipulator_setcolor(v3d, 'z', colcode, axisBlendAngle(rv3d->twangle[2])); + manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2])); drawsolidcube(cusize); } /* X cube */ glTranslatef(dz, 0.0, -dz); if(drawflags & MAN_SCALE_X) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X); - manipulator_setcolor(v3d, 'x', colcode, axisBlendAngle(rv3d->twangle[0])); + manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0])); drawsolidcube(cusize); } /* Y cube */ glTranslatef(-dz, dz, 0.0); if(drawflags & MAN_SCALE_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y); - manipulator_setcolor(v3d, 'y', colcode, axisBlendAngle(rv3d->twangle[1])); + manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1])); drawsolidcube(cusize); } @@ -1240,7 +1245,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS /* center circle, do not add to selection when shift is pressed (planar constraint) */ if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C); - manipulator_setcolor(v3d, 'c', colcode, 255); + manipulator_setcolor(v3d, 'C', colcode, 255); glPushMatrix(); size= screen_aligned(rv3d, rv3d->twmat); unit_m4(unitmat); @@ -1267,7 +1272,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS glTranslatef(0.0, 0.0, dz); if(drawflags & MAN_TRANS_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z); - manipulator_setcolor(v3d, 'z', colcode, axisBlendAngle(rv3d->twangle[2])); + manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2])); draw_cone(qobj, cylen, cywid); } /* X Cone */ @@ -1275,7 +1280,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS if(drawflags & MAN_TRANS_X) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor(v3d, 'x', colcode, axisBlendAngle(rv3d->twangle[0])); + manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0])); draw_cone(qobj, cylen, cywid); glRotatef(-90.0, 0.0, 1.0, 0.0); } @@ -1284,7 +1289,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS if(drawflags & MAN_TRANS_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor(v3d, 'y', colcode, axisBlendAngle(rv3d->twangle[1])); + manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1])); draw_cone(qobj, cylen, cywid); } @@ -1366,7 +1371,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov glTranslatef(0.0, 0.0, 1.0); if(drawflags & MAN_ROT_Z) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z); - manipulator_setcolor(v3d, 'z', colcode, 255); + manipulator_setcolor(v3d, 'Z', colcode, 255); draw_cylinder(qobj, cylen, cywid); } /* X cyl */ @@ -1374,7 +1379,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov if(drawflags & MAN_ROT_X) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X); glRotatef(90.0, 0.0, 1.0, 0.0); - manipulator_setcolor(v3d, 'x', colcode, 255); + manipulator_setcolor(v3d, 'X', colcode, 255); draw_cylinder(qobj, cylen, cywid); glRotatef(-90.0, 0.0, 1.0, 0.0); } @@ -1383,7 +1388,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov if(drawflags & MAN_ROT_Y) { if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y); glRotatef(-90.0, 1.0, 0.0, 0.0); - manipulator_setcolor(v3d, 'y', colcode, 255); + manipulator_setcolor(v3d, 'Y', colcode, 255); draw_cylinder(qobj, cylen, cywid); } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 5f5eb2f1964..322bb7cb7db 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -150,7 +150,7 @@ static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEven uiPopupMenu *pup; uiLayout *layout; - pup= uiPupMenuBegin(C, "Orientation", 0); + pup= uiPupMenuBegin(C, "Orientation", ICON_NULL); layout= uiPupMenuLayout(pup); uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation"); uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 3cc50109778..0828ceeaa52 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -133,9 +133,10 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (validSnap(t) && activeSnap(t)) { - char col[4] = {1, 0, 1}; + unsigned char col[4]; UI_GetThemeColor3ubv(TH_TRANSFORM, col); - glColor4ub(col[0], col[1], col[2], 128); + col[3]= 128; + glColor4ubv(col); if (t->spacetype == SPACE_VIEW3D) { TransSnapPoint *p; diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 61ba1bb6c74..0b5c563a741 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -82,4 +82,4 @@ set(SRC ../include/UI_view2d.h ) -blenderlib(bf_editor_util "${SRC}" "${INC}") +blender_add_lib(bf_editor_util "${SRC}" "${INC}") diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 92ee3bea8d5..6333eded12e 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -40,4 +40,4 @@ set(SRC uvedit_parametrizer.h ) -blenderlib(bf_editor_uvedit "${SRC}" "${INC}") +blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}") diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 64ce31f2ac2..209b1d7e066 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -423,7 +423,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) EditFace *efa, *efa_act; MTFace *tf, *activetf = NULL; DerivedMesh *finaldm, *cagedm; - char col1[4], col2[4]; + unsigned char col1[4], col2[4]; float pointsize; int drawfaces, interpedges, lastsel, sel; Image *ima= sima->image; diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index 05f7fb63218..3b051f3804a 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -24,9 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB_RECURSE SRC *.cpp *.h) +file(GLOB_RECURSE SRC *.cpp *.h) -SET(INC +set(INC ../blenkernel ../blenloader ../blenlib ../imbuf ../makesdna ../makesrna ../python ../python/intern ../render/extern/include ../render/intern/include ../include ../src @@ -35,8 +35,8 @@ SET(INC ${PNG_INC} ) -IF(WIN32) - SET(INC ${INC} ${PTHREADS_INC}) -ENDIF(WIN32) +if(WIN32) + set(INC ${INC} ${PTHREADS_INC}) +endif(WIN32) -BLENDERLIB(bf_freestyle "${SRC}" "${INC}") +blender_add_lib(bf_freestyle "${SRC}" "${INC}") diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 54257af6ea9..ce1c9c86780 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -54,5 +54,5 @@ set(SRC add_definitions(-DGLEW_STATIC) -blenderlib(bf_gpu "${SRC}" "${INC}") +blender_add_lib(bf_gpu "${SRC}" "${INC}") diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt index 78f362be117..47c773756a9 100644 --- a/source/blender/ikplugin/CMakeLists.txt +++ b/source/blender/ikplugin/CMakeLists.txt @@ -52,4 +52,4 @@ if(WITH_IK_ITASC) ) endif() -blenderlib(bf_ikplugin "${SRC}" "${INC}") +blender_add_lib(bf_ikplugin "${SRC}" "${INC}") diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 866a702e43f..c86e786ba1e 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -140,4 +140,4 @@ if(WITH_IMAGE_HDR) add_definitions(-DWITH_HDR) endif() -blenderlib(bf_imbuf "${SRC}" "${INC}") +blender_add_lib(bf_imbuf "${SRC}" "${INC}") diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt index d9cfc04cf8d..a7660af1714 100644 --- a/source/blender/imbuf/intern/cineon/CMakeLists.txt +++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt @@ -43,4 +43,4 @@ set(SRC logmemfile.c ) -blenderlib(bf_imbuf_cineon "${SRC}" "${INC}") +blender_add_lib(bf_imbuf_cineon "${SRC}" "${INC}") diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt index 44341c7e861..2ab92bee3e5 100644 --- a/source/blender/imbuf/intern/dds/CMakeLists.txt +++ b/source/blender/imbuf/intern/dds/CMakeLists.txt @@ -48,4 +48,4 @@ if(WITH_IMAGE_DDS) add_definitions(-DWITH_DDS) endif() -blenderlib(bf_imbuf_dds "${SRC}" "${INC}") +blender_add_lib(bf_imbuf_dds "${SRC}" "${INC}") diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index 958abc4d1f6..58edd53139a 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -44,4 +44,4 @@ if(WITH_IMAGE_OPENEXR) add_definitions(-DWITH_OPENEXR) endif() -blenderlib(bf_imbuf_openexr "${SRC}" "${INC}") +blender_add_lib(bf_imbuf_openexr "${SRC}" "${INC}") diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index 61acdd79da4..de6416e4488 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -155,10 +155,6 @@ typedef struct EditNurb { /* base of nurbs' list (old Curve->editnurb) */ ListBase nurbs; - /* copy of animation curves to keep them in consistent state */ - /* when changing curve topology */ - ListBase fcurves; - /* index data for shape keys */ struct GHash *keyindex; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 4e41309cff4..853c123e5d7 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -153,9 +153,9 @@ typedef struct TFace { #define ME_DRAWSHARP (1 << 8) #define ME_DRAWBWEIGHTS (1 << 9) -#define ME_DRAW_EDGELEN (1 << 10) -#define ME_DRAW_FACEAREA (1 << 11) -#define ME_DRAW_EDGEANG (1 << 12) +#define ME_DRAWEXTRA_EDGELEN (1 << 10) +#define ME_DRAWEXTRA_FACEAREA (1 << 11) +#define ME_DRAWEXTRA_FACEANG (1 << 12) /* old global flags: #define G_DRAWEDGES (1 << 18) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a61f37ce918..3a8dd13a941 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -778,7 +778,7 @@ typedef struct Scene { unsigned int lay; /* bitflags for layer visibility */ int layact; /* active layer */ - int pad1; + unsigned int customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */ short flag; /* various settings */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 132dd21913d..2d3af55ca78 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -189,15 +189,16 @@ typedef struct ARegion { #define HEADERTOP 2 /* screen->full */ -#define SCREENNORMAL 0 -#define SCREENFULL 1 +#define SCREENNORMAL 0 +#define SCREENFULL 1 +#define SCREENFULLTEMP 2 /* Panel->snap - for snapping to screen edges */ #define PNL_SNAP_NONE 0 #define PNL_SNAP_TOP 1 #define PNL_SNAP_RIGHT 2 -#define PNL_SNAP_BOTTOM 4 +#define PNL_SNAP_BOTTOM 4 #define PNL_SNAP_LEFT 8 #define PNL_SNAP_DIST 9.0 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 190cea4f81b..4fb00a1988b 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -240,9 +240,8 @@ typedef struct SpaceOops { /* search stuff */ char search_string[32]; struct TreeStoreElem search_tse; - int search_flags, do_; - - short flag, outlinevis, storeflag, pad; + + short flag, outlinevis, storeflag, search_flags; } SpaceOops; typedef struct SpaceImage { @@ -360,13 +359,11 @@ typedef struct SpaceScript { typedef struct SpaceTimeCache { struct SpaceTimeCache *next, *prev; - int type; - int flag; - + + struct PointCache *cache; float *array; - int len; - int startframe, endframe; - int ok; + + int type, len; } SpaceTimeCache; typedef struct SpaceTime { diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index d89d15fa302..82de3fc1833 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -48,7 +48,7 @@ typedef struct TextMarker { int lineno, start, end, pad1; /* line number and start/end character indices */ int group, flags; /* see BKE_text.h for flag defines */ - char color[4], pad[4]; /* draw color of the marker */ + unsigned char color[4], pad[4]; /* draw color of the marker */ } TextMarker; typedef struct Text { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 5290a353580..f9ba1c2a471 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -88,6 +88,7 @@ typedef struct uiFontStyle { /* this is fed to the layout engine and widget code */ + typedef struct uiStyle { struct uiStyle *next, *prev; @@ -158,13 +159,13 @@ typedef struct ThemeSpace { /* main window colors */ char back[4]; char title[4]; - char text[4]; + char text[4]; char text_hi[4]; /* header colors */ char header[4]; char header_title[4]; - char header_text[4]; + char header_text[4]; char header_text_hi[4]; /* button/tool regions */ @@ -176,7 +177,7 @@ typedef struct ThemeSpace { /* listview regions */ char list[4]; char list_title[4]; - char list_text[4]; + char list_text[4]; char list_text_hi[4]; /* float panel */ @@ -199,6 +200,7 @@ typedef struct ThemeSpace { char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4]; char face[4], face_select[4]; // solid faces char face_dot[4]; // selected color + char extra_edge_len[4], extra_face_angle[4], extra_face_area[4], pad3[4]; char normal[4]; char vertex_normal[4]; char bone_solid[4], bone_pose[4]; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 00e5db0a639..24427195888 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -89,11 +89,13 @@ typedef struct RegionView3D { /* transform widget matrix */ float twmat[4][4]; - - float viewquat[4], dist, zfac; /* zfac is initgrabz() result */ - float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ - float pixsize; - float ofs[3]; + + float viewquat[4]; /* view rotation, must be kept normalized */ + float dist; /* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */ + float zfac; /* initgrabz() result */ + float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ + float pixsize; /* runtime only */ + float ofs[3]; /* view center & orbit pivot, negative of worldspace location */ short camzoom; short twdrawflag; int pad; @@ -168,7 +170,7 @@ typedef struct View3D { float lens, grid; float gridview; /* XXX deprecated, now in RegionView3D */ - float padf, near, far; + float near, far; float ofs[3]; /* XXX deprecated */ float cursor[3]; @@ -182,9 +184,6 @@ typedef struct View3D { short twtype, twmode, twflag; short twdrawflag; /* XXX deprecated */ - /* customdata flags from modes */ - unsigned int customdata_mask; - /* afterdraw, for xray & transparent */ struct ListBase afterdraw_transp; struct ListBase afterdraw_xray; diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index b6b2d2d2a13..ce41a83ddd2 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -26,7 +27,7 @@ # message(STATUS "Configuring makesdna") -include_directories(../../../../intern/guardedalloc ..) +blender_include_dirs(../../../../intern/guardedalloc ../) # Build makesdna executable set(SRC @@ -116,4 +117,4 @@ set(SRC ${SRC_DNA_INC} ) -blenderlib(bf_dna "${SRC}" "${INC}") +blender_add_lib(bf_dna "${SRC}" "${INC}") diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 87c762269ce..5041b815bda 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -936,8 +936,8 @@ void RNA_parameter_list_end(ParameterIterator *iter); void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value); void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **value); -void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, void *value); -void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, void *value); +void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *value); +void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value); int RNA_parameter_length_get(ParameterList *parms, PropertyRNA *parm); int RNA_parameter_length_get_data(ParameterList *parms, PropertyRNA *parm, void *data); void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int length); diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 5414c411fca..6e31f874283 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id: CMakeLists.txt 17433 2008-11-12 21:16:53Z blendix $ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -47,7 +48,7 @@ set(SRC ../../../../intern/guardedalloc/intern/mmap_win.c ) -include_directories( +blender_include_dirs( ../../../../intern/audaspace/intern ../../../../intern/guardedalloc ../../../../intern/memutil @@ -167,4 +168,4 @@ set(SRC rna_nodetree_types.h ) -blenderlib(bf_rna "${SRC}" "${INC}") +blender_add_lib(bf_rna "${SRC}" "${INC}") diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5d784890385..5f2e21ab56a 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -27,6 +27,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include "MEM_guardedalloc.h" @@ -53,12 +54,14 @@ static int file_older(const char *file1, const char *file2) { struct stat st1, st2; + // printf("compare: %s %s\n", file1, file2); if(stat(file1, &st1)) return 0; if(stat(file2, &st2)) return 0; return (st1.st_mtime < st2.st_mtime); } +const char *makesrna_path= NULL; static int replace_if_different(char *tmpfile, const char *dep_files[]) { @@ -67,7 +70,7 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) #define REN_IF_DIFF \ remove(orgfile); \ if(rename(tmpfile, orgfile) != 0) { \ - fprintf(stderr, "%s:%d, rename error: \"%s\" -> \"%s\"\n", __FILE__, __LINE__, tmpfile, orgfile); \ + fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \ return -1; \ } \ remove(tmpfile); \ @@ -102,6 +105,10 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) REN_IF_DIFF; } + if(file_older(orgfile, makesrna_path)) { + REN_IF_DIFF; + } + /* now check if any files we depend on are newer then any generated files */ if(dep_files) { int pass; @@ -2784,6 +2791,7 @@ int main(int argc, char **argv) } else { printf("Running makesrna, program versions %s\n", RNA_VERSION_DATE); + makesrna_path= argv[0]; return_status= rna_preprocess(argv[1]); } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 1678dc6d520..8d596ac5025 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -3287,6 +3287,136 @@ char *RNA_path_back(const char *path) return result; } +/* generic path search func + * if its needed this could also reference the IDProperty direct */ +typedef struct IDP_Chain { + struct IDP_Chain *up; /* parent member, reverse and set to child for path conversion. */ + + const char *name; + int index; + +} IDP_Chain; + +static char *rna_idp_path_create(IDP_Chain *child_link) +{ + DynStr *dynstr= BLI_dynstr_new(); + char *path; + short first= TRUE; + + int tot= 0; + IDP_Chain *link= child_link; + + /* reverse the list */ + IDP_Chain *link_prev; + link_prev= NULL; + while(link) { + IDP_Chain *link_next= link->up; + link->up= link_prev; + link_prev= link; + link= link_next; + tot++; + } + + for(link= link_prev; link; link= link->up) { + /* pass */ + if(link->index >= 0) { + BLI_dynstr_appendf(dynstr, first ? "%s[%d]" : ".%s[%d]", link->name, link->index); + } + else { + BLI_dynstr_appendf(dynstr, first ? "%s" : ".%s", link->name); + } + + first= FALSE; + } + + path= BLI_dynstr_get_cstring(dynstr); + BLI_dynstr_free(dynstr); + + if(*path=='\0') { + MEM_freeN(path); + path= NULL; + } + + return path; +} + +static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *needle, IDP_Chain *parent_link) +{ + char *path= NULL; + IDP_Chain link; + + IDProperty *iter; + int i; + + BKE_assert(haystack->type == IDP_GROUP); + + link.up= parent_link; + link.name= NULL; + link.index= -1; + + for (i=0, iter= haystack->data.group.first; iter; iter= iter->next, i++) { + if(needle == iter) { /* found! */ + link.name= iter->name; + path= rna_idp_path_create(&link); + break; + } + else { + if(iter->type == IDP_GROUP) { + /* ensure this is RNA */ + PointerRNA child_ptr= RNA_pointer_get(ptr, iter->name); + if(child_ptr.type) { + link.name= iter->name; + if((path= rna_idp_path(&child_ptr, iter, needle, &link))) { + break; + } + } + } + else if (iter->type == IDP_IDPARRAY) { + PropertyRNA *prop= RNA_struct_find_property(ptr, iter->name); + if(prop && prop->type == PROP_COLLECTION) { + IDProperty *array= IDP_IDPArray(iter); + if(needle >= array && needle < (iter->len + array)) { /* found! */ + link.name= iter->name; + link.index= (int)(needle - array); + path= rna_idp_path_create(&link); + break; + } + else { + int i; + link.name= iter->name; + for(i= 0; i < iter->len; i++, array++) { + PointerRNA child_ptr; + if(RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) { + link.index= i; + if((path= rna_idp_path(&child_ptr, array, needle, &link))) { + break; + } + } + } + } + } + } + } + } + + return path; +} + +static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr) +{ + PointerRNA id_ptr; + IDProperty *haystack; + IDProperty *needle; + + BKE_assert(ptr->id.data != NULL); + RNA_id_pointer_create(ptr->id.data, &id_ptr); + + haystack= RNA_struct_idprops(&id_ptr, FALSE); + needle= ptr->data; + + return rna_idp_path(&id_ptr, haystack, needle, NULL); +} + char *RNA_path_from_ID_to_struct(PointerRNA *ptr) { char *ptrpath=NULL; @@ -3314,6 +3444,10 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) else return NULL; // can't do anything about this case yet... } + else if (RNA_struct_is_a(ptr->type, &RNA_IDPropertyGroup)) { + /* special case, easier to deal with here then in ptr->type->path() */ + return rna_path_from_ID_to_idpgroup(ptr); + } else return NULL; } @@ -4122,7 +4256,7 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void RNA_parameter_get(parms, parm, value); } -void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, void *value) +void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *value) { ParameterIterator iter; @@ -4138,7 +4272,7 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, void *value) RNA_parameter_list_end(&iter); } -void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, void *value) +void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value) { PropertyRNA *parm; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 8e606e7acea..81b4b75aa03 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -266,7 +266,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse fluid frames"); RNA_def_property_update(prop, 0, "rna_fluid_find_enframe"); - prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in"); @@ -503,7 +503,7 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna) RNA_def_property_range(prop, 0.0, 2.0); RNA_def_property_ui_text(prop, "Alpha Influence", "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full. (large particles get lower alphas, smaller ones higher values)"); - prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_maxlength(prop, 240); RNA_def_property_string_sdna(prop, NULL, "surfdataPath"); RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from"); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 13c35f46e87..cc3c25fdb0e 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -275,7 +275,7 @@ static void rna_def_imageuser(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie"); + RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index c9d65a5fcd1..2a2e4de9032 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -88,7 +88,7 @@ Tex *rna_Main_add_texture(Main *bmain, const char *name) Camera *rna_Main_cameras_new(Main *bmain, const char *name) { ID *id= add_camera(name); - id->us--; + id_us_min(id); return (Camera *)id; } void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera) @@ -163,11 +163,11 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, } } - data->us++; + id_us_plus(data); } ob= add_only_object(type, name); - ob->id.us--; + id_us_min(&ob->id); ob->data= data; test_object_materials(ob->data); @@ -189,7 +189,7 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob struct Material *rna_Main_materials_new(Main *bmain, const char *name) { ID *id= (ID *)add_material(name); - id->us--; + id_us_min(id); return (Material *)id; } void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material) @@ -208,7 +208,7 @@ struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type) ntreeMakeOwnType(tree); - tree->id.us--; + id_us_min(&tree->id); return tree; } void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree) @@ -224,7 +224,7 @@ void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree Mesh *rna_Main_meshes_new(Main *bmain, const char *name) { Mesh *me= add_mesh(name); - me->id.us--; + id_us_min(&me->id); return me; } void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) @@ -240,7 +240,7 @@ void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) Lamp *rna_Main_lamps_new(Main *bmain, const char *name) { Lamp *lamp= add_lamp(name); - lamp->id.us--; + id_us_min(&lamp->id); return lamp; } void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) @@ -257,7 +257,7 @@ Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, { float color[4]= {0.0, 0.0, 0.0, 1.0}; Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color); - image->id.us--; + id_us_min(&image->id); return image; } Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath) @@ -285,7 +285,7 @@ void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) Lattice *rna_Main_lattices_new(Main *bmain, const char *name) { Lattice *lt= add_lattice(name); - lt->id.us--; + id_us_min(<->id); return lt; } void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt) @@ -299,7 +299,7 @@ void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice * Curve *rna_Main_curves_new(Main *bmain, const char *name, int type) { Curve *cu= add_curve(name, type); - cu->id.us--; + id_us_min(&cu->id); return cu; } void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) @@ -313,7 +313,7 @@ void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name) { MetaBall *mb= add_mball(name); - mb->id.us--; + id_us_min(&mb->id); return mb; } void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb) @@ -351,7 +351,7 @@ Tex *rna_Main_textures_new(Main *bmain, const char *name, int type) { Tex *tex= add_texture(name); tex_set_type(tex, type); - tex->id.us--; + id_us_min(&tex->id); return tex; } void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) @@ -365,7 +365,7 @@ void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) Brush *rna_Main_brushes_new(Main *bmain, const char *name) { Brush *brush = add_brush(name); - brush->id.us--; + id_us_min(&brush->id); return brush; } void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush) @@ -379,7 +379,7 @@ void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *bru World *rna_Main_worlds_new(Main *bmain, const char *name) { World *world = add_world(name); - world->id.us--; + id_us_min(&world->id); return world; } void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world) @@ -428,7 +428,7 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath bArmature *rna_Main_armatures_new(Main *bmain, const char *name) { bArmature *arm= add_armature(name); - arm->id.us--; + id_us_min(&arm->id); return arm; } void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) @@ -444,7 +444,7 @@ void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) bAction *rna_Main_actions_new(Main *bmain, const char *name) { bAction *act= add_empty_action(name); - act->id.us--; + id_us_min(&act->id); act->id.flag &= ~LIB_FAKEUSER; return act; } @@ -461,7 +461,7 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) { ParticleSettings *part = psys_new_settings(name, bmain); - part->id.us--; + id_us_min(&part->id); return part; } void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d9f6e0886bd..c9a11753154 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1978,17 +1978,17 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGELEN); + RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN); RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGEANG); + RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG); RNA_def_property_ui_text(prop, "Edge Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FACEAREA); + RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA); RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b846e0bd07f..ba73d617c9d 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -248,11 +248,11 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) { psys = psmd->psys; part = psys->part; - part->flag |= PART_UNBORN; part->lifetime = 1.0f; part->sta = 1.0f; part->end = 250.0f; part->ren_as = PART_DRAW_NOT; + part->draw_as = PART_DRAW_DOT; sprintf(psys->name, "SmokeParticles"); psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS); DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6d87d30ea5c..3429a195e1a 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1297,7 +1297,7 @@ static void def_cmp_output_file(StructRNA *srna) RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage"); - prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Path", "Output path for the image, same functionality as render output."); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 5d2b2e5f178..6dbf6fca108 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -34,6 +34,7 @@ #include "DNA_action_types.h" #include "DNA_customdata_types.h" #include "DNA_controller_types.h" +#include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_object_force.h" @@ -42,6 +43,8 @@ #include "DNA_scene_types.h" #include "DNA_meta_types.h" +#include "BKE_group.h" /* needed for object_in_group() */ + #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */ #include "ED_mesh.h" @@ -426,6 +429,20 @@ static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value) ED_object_parent(ob, ob->parent, ob->partype, value); } +static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value) +{ + Object *ob= (Object *)ptr->data; + Group *grp = (Group *)value.data; + + /* must not let this be set if the object belongs in this group already, + * thus causing a cycle/infinite-recursion leading to crashes on load [#25298] + */ + if (object_in_group(ob, grp) == 0) + ob->dup_group = grp; + else + BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle"); +} + static int rna_VertexGroup_index_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -570,11 +587,12 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in *max= MAX2(ob->totcol-1, 0); } +/* returns active base material */ static PointerRNA rna_Object_active_material_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; Material *ma; - + ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL; return rna_pointer_inherit_refine(ptr, &RNA_Material, ma); } @@ -1091,7 +1109,7 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) memcpy(values, bb->vec, sizeof(bb->vec)); } else { - memset(values, -1.0f, sizeof(bb->vec)); + fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f); } } @@ -1696,7 +1714,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_multi_array(prop, 2, boundbox_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates"); + RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates, all values are -1.0 when not available."); /* parent */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); @@ -2043,6 +2061,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL); RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index a1b9af78983..b0e487fa89c 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1550,20 +1550,20 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Damp", "Edge spring friction"); RNA_def_property_update(prop, 0, "rna_softbody_update"); - prop= RNA_def_property(srna, "spring_length", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "springpreload"); + prop= RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "springpreload"); RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable"); RNA_def_property_update(prop, 0, "rna_softbody_update"); - prop= RNA_def_property(srna, "aero", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "aeroedge"); + prop= RNA_def_property(srna, "aero", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "aeroedge"); RNA_def_property_range(prop, 0.0f, 30000.0f); RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'"); RNA_def_property_update(prop, 0, "rna_softbody_update"); - prop= RNA_def_property(srna, "plastic", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "plastic"); + prop= RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "plastic"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Plastic", "Permanent deform"); RNA_def_property_update(prop, 0, "rna_softbody_update"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 3b0d3e1eb1e..51a44c027e4 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -283,6 +283,21 @@ static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Itasc_update(bmain, scene, ptr); } +static void rna_PoseChannel_bone_custom_set(PointerRNA *ptr, PointerRNA value) +{ + bPoseChannel *pchan = (bPoseChannel*)ptr->data; + + + if (pchan->custom) { + id_us_min(&pchan->custom->id); + pchan->custom = NULL; + } + + pchan->custom = value.data; + + id_us_plus(&pchan->custom->id); +} + static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -956,6 +971,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "custom"); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_bone_custom_set", NULL, NULL); RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 3152fc04b0d..9e04132eaba 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -474,6 +474,12 @@ static int rna_Property_is_never_none_get(PointerRNA *ptr) return prop->flag & PROP_NEVER_NULL ? 1:0; } +static int rna_Property_is_hidden_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + return prop->flag & PROP_HIDDEN ? 1:0; +} + static int rna_Property_array_length_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -1011,6 +1017,11 @@ static void rna_def_property(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL); RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None"); + prop= RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL); + RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden"); + prop= RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3ed3024f352..0cdc8f23560 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3014,7 +3014,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "pic"); RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index a8c96e93448..a9e43d35f32 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -83,7 +83,7 @@ static int rna_Screen_is_animation_playing_get(PointerRNA *ptr) static int rna_Screen_fullscreen_get(PointerRNA *ptr) { bScreen *sc= (bScreen*)ptr->data; - return (sc->full == SCREENFULL); + return (sc->full != 0); } static void rna_Area_type_set(PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7900c2a5994..536d30d0958 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -921,6 +921,21 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) rna_def_userdef_theme_spaces_face(srna); rna_def_userdef_theme_spaces_curves(srna, 1); + prop= RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Edge Length Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Face Angle Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Face Area Text", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop= RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", ""); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index b6b73b9885d..a7870243afc 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -265,6 +265,7 @@ EnumPropertyItem operator_flag_items[] = { {OPTYPE_BLOCKING, "BLOCKING", 0, "Finished", ""}, {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, + {OPTYPE_PRESET, "PRESET", 0, "Preset", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_return_items[] = { diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 5948c0cca91..727d2289354 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -98,4 +98,4 @@ if(NOT WITH_MOD_FLUID) add_definitions(-DDISABLE_ELBEEM) endif() -blenderlib(bf_modifiers "${SRC}" "${INC}") +blender_add_lib(bf_modifiers "${SRC}" "${INC}") diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 8d420fcb3b7..874aefbaa22 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -21,4 +21,4 @@ if env['BF_NO_ELBEEM']: env.BlenderLib ( libname = 'bf_modifiers', sources = sources, includes = Split(incs), defines=defs, - libtype=['core','player'], priority = [180, 20] ) + libtype=['core','player'], priority = [180, 40] ) diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 57c8f7bcad4..ad9f9ed426c 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -153,5 +153,5 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -blenderlib(bf_nodes "${SRC}" "${INC}") +blender_add_lib(bf_nodes "${SRC}" "${INC}") diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index e8a7a7149db..aef2438c961 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -57,4 +57,4 @@ set(SRC py_capi_utils.h ) -blenderlib(bf_python_ext "${SRC}" "${INC}") +blender_add_lib(bf_python_ext "${SRC}" "${INC}") diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 95030631d03..989821510de 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -213,7 +213,7 @@ static int Color_ass_item(ColorObject * self, int i, PyObject * value) //sequence slice (get) static PyObject *Color_slice(ColorObject * self, int begin, int end) { - PyObject *list = NULL; + PyObject *tuple; int count; if(!BaseMath_ReadCallback(self)) @@ -222,14 +222,14 @@ static PyObject *Color_slice(ColorObject * self, int begin, int end) CLAMP(begin, 0, COLOR_SIZE); if (end<0) end= (COLOR_SIZE + 1) + end; CLAMP(end, 0, COLOR_SIZE); - begin = MIN2(begin,end); + begin= MIN2(begin, end); - list = PyList_New(end - begin); + tuple= PyTuple_New(end - begin); for(count= begin; count < end; count++) { - PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->col[count])); + PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->col[count])); } - return list; + return tuple; } //----------------------------object[z:y]------------------------ //sequence slice (set) diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index 8699c476c0c..0474d30d29f 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -443,7 +443,7 @@ static int Euler_ass_item(EulerObject * self, int i, PyObject *value) //sequence slice (get) static PyObject *Euler_slice(EulerObject * self, int begin, int end) { - PyObject *list = NULL; + PyObject *tuple; int count; if(!BaseMath_ReadCallback(self)) @@ -452,14 +452,14 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end) CLAMP(begin, 0, EULER_SIZE); if (end<0) end= (EULER_SIZE + 1) + end; CLAMP(end, 0, EULER_SIZE); - begin = MIN2(begin,end); + begin= MIN2(begin, end); - list = PyList_New(end - begin); + tuple= PyTuple_New(end - begin); for(count = begin; count < end; count++) { - PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->eul[count])); + PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->eul[count])); } - return list; + return tuple; } //----------------------------object[z:y]------------------------ //sequence slice (set) diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index e75f888bc03..8b8e68b798c 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -1398,7 +1398,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob) static PyObject *Matrix_slice(MatrixObject * self, int begin, int end) { - PyObject *list = NULL; + PyObject *tuple; int count; if(!BaseMath_ReadCallback(self)) @@ -1406,16 +1406,16 @@ static PyObject *Matrix_slice(MatrixObject * self, int begin, int end) CLAMP(begin, 0, self->rowSize); CLAMP(end, 0, self->rowSize); - begin = MIN2(begin,end); + begin= MIN2(begin,end); - list = PyList_New(end - begin); - for(count = begin; count < end; count++) { - PyList_SET_ITEM(list, count - begin, + tuple= PyTuple_New(end - begin); + for(count= begin; count < end; count++) { + PyTuple_SET_ITEM(tuple, count - begin, newVectorObject_cb((PyObject *)self, self->colSize, mathutils_matrix_vector_cb_index, count)); } - return list; + return tuple; } /*----------------------------object[z:y]------------------------ sequence slice (set)*/ diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 733e2b902c4..4dced9aaad1 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -480,7 +480,7 @@ static int Quaternion_ass_item(QuaternionObject * self, int i, PyObject * ob) //sequence slice (get) static PyObject *Quaternion_slice(QuaternionObject * self, int begin, int end) { - PyObject *list = NULL; + PyObject *tuple; int count; if(!BaseMath_ReadCallback(self)) @@ -489,14 +489,14 @@ static PyObject *Quaternion_slice(QuaternionObject * self, int begin, int end) CLAMP(begin, 0, QUAT_SIZE); if (end<0) end= (QUAT_SIZE + 1) + end; CLAMP(end, 0, QUAT_SIZE); - begin = MIN2(begin,end); + begin= MIN2(begin, end); - list = PyList_New(end - begin); - for(count = begin; count < end; count++) { - PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->quat[count])); + tuple= PyTuple_New(end - begin); + for(count= begin; count < end; count++) { + PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count])); } - return list; + return tuple; } //----------------------------object[z:y]------------------------ //sequence slice (set) diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index f64c591faca..7bf8eebb12d 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -807,7 +807,7 @@ static int Vector_ass_item(VectorObject *self, int i, PyObject * ob) sequence slice (get) */ static PyObject *Vector_slice(VectorObject *self, int begin, int end) { - PyObject *list = NULL; + PyObject *tuple; int count; if(!BaseMath_ReadCallback(self)) @@ -816,14 +816,14 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end) CLAMP(begin, 0, self->size); if (end<0) end= self->size+end+1; CLAMP(end, 0, self->size); - begin = MIN2(begin,end); + begin= MIN2(begin, end); - list = PyList_New(end - begin); + tuple= PyTuple_New(end - begin); for(count = begin; count < end; count++) { - PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->vec[count])); + PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count])); } - return list; + return tuple; } /*----------------------------object[z:y]------------------------ sequence slice (set) */ diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 8dfc1ec72b4..3fc1ec140c6 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -75,7 +75,7 @@ void PyC_FileAndNum(const char **filename, int *lineno) /* when executing a script */ if (filename) { - co_filename= PyC_Object_GetAttrStringArgs(frame, 1, "f_code", "co_filename"); + co_filename= PyC_Object_GetAttrStringArgs(frame, 2, "f_code", "co_filename"); if (co_filename==NULL) { PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_code.co_filename"); Py_DECREF(frame); diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 61d09007b8d..87e35811034 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -67,4 +67,4 @@ if(WITH_BUILDINFO) add_definitions(-DBUILD_DATE) endif() -blenderlib(bf_python "${SRC}" "${INC}") +blender_add_lib(bf_python "${SRC}" "${INC}") diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 7b31f77a0c9..2c615a52860 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -252,11 +252,24 @@ void BPY_start_python( int argc, char **argv ) { /* our own import and reload functions */ PyObject *item; + PyObject *mod; //PyObject *m = PyImport_AddModule("__builtin__"); //PyObject *d = PyModule_GetDict(m); PyObject *d = PyEval_GetBuiltins( ); - PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item); +// PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item); PyDict_SetItemString(d, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item); + + /* move reload here + * XXX, use import hooks */ + mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0); + if(mod) { + PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item); + Py_DECREF(mod); + } + else { + BKE_assert(!"unable to load 'imp' module."); + } + } pyrna_alloc_types(); diff --git a/source/blender/quicktime/CMakeLists.txt b/source/blender/quicktime/CMakeLists.txt index f5565153a01..7e7f61036c6 100644 --- a/source/blender/quicktime/CMakeLists.txt +++ b/source/blender/quicktime/CMakeLists.txt @@ -63,4 +63,4 @@ set(INC add_definitions(-DWITH_QUICKTIME) -blenderlib(bf_quicktime "${SRC}" "${INC}") +blender_add_lib(bf_quicktime "${SRC}" "${INC}") diff --git a/source/blender/readblenfile/CMakeLists.txt b/source/blender/readblenfile/CMakeLists.txt index b6549338fbb..8d3633b4918 100644 --- a/source/blender/readblenfile/CMakeLists.txt +++ b/source/blender/readblenfile/CMakeLists.txt @@ -40,4 +40,4 @@ set(SRC BLO_readblenfile.h ) -blenderlib(bf_readblenfile "${SRC}" "${INC}") +blender_add_lib(bf_readblenfile "${SRC}" "${INC}") diff --git a/source/blender/readblenfile/SConscript b/source/blender/readblenfile/SConscript index 57ee1866263..6d8749df1e2 100644 --- a/source/blender/readblenfile/SConscript +++ b/source/blender/readblenfile/SConscript @@ -5,4 +5,4 @@ sources = env.Glob('intern/*.c') incs = '. ../blenloader ../blenloader/intern ../blenkernel ../blenlib ../makesdna ../../kernel/gen_messaging' -env.BlenderLib ( 'bf_readblenfile', sources, Split(incs), [], libtype=['core','player'], priority = [0,195] ) +env.BlenderLib ( 'bf_readblenfile', sources, Split(incs), [], libtype=['core','player'], priority = [0,5] ) diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 82e5b7511a4..ddb7d56ca71 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -128,4 +128,4 @@ if(APPLE) endif() endif() -blenderlib_nolist(bf_render "${SRC}" "${INC}") +blender_add_lib_nolist(bf_render "${SRC}" "${INC}") diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 8bdfab607f0..1de918de749 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -435,7 +435,9 @@ typedef struct StrandBuffer { int overrideuv; int flag, maxdepth; float adaptcos, minwidth, widthfade; - + + float maxwidth; /* for cliptest of strands in blender unit */ + float winmat[4][4]; int winx, winy; } StrandBuffer; diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h index 66a5a7d1a0f..ffb2b8aa809 100644 --- a/source/blender/render/intern/include/strand.h +++ b/source/blender/render/intern/include/strand.h @@ -90,7 +90,7 @@ typedef struct StrandShadeCache StrandShadeCache; void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint); void render_strand_segment(struct Render *re, float winmat[][4], struct StrandPart *spart, struct ZSpan *zspan, int totzspan, StrandSegment *sseg); -void strand_minmax(struct StrandRen *strand, float *min, float *max); +void strand_minmax(struct StrandRen *strand, float *min, float *max, float width); struct StrandSurface *cache_strand_surface(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, float mat[][4], int timeoffset); void free_strand_surface(struct Render *re); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index b851728653a..adb386f80fb 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -924,7 +924,7 @@ static Material *give_render_material(Render *re, Object *ob, int nr) if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) re->flag |= R_ZTRA; - /* for light groups */ + /* for light groups and SSS */ ma->flag |= MA_IS_USED; if(ma->nodetree && ma->use_nodes) @@ -2380,7 +2380,10 @@ static void init_render_mball(Render *re, ObjectRen *obr) normalize_v3(ver->n); //if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n); - if(need_orco) ver->orco= orco+=3; + if(need_orco) { + ver->orco= orco; + orco+=3; + } } index= dl->index; @@ -4173,13 +4176,23 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset) } if(obr->strandbuf) { + float width; + + /* compute average bounding box of strandpoint itself (width) */ + if(obr->strandbuf->flag & R_STRAND_B_UNITS) + obr->strandbuf->maxwidth= MAX2(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end); + else + obr->strandbuf->maxwidth= 0.0f; + + width= obr->strandbuf->maxwidth; sbound= obr->strandbuf->bound; for(b=0; b<obr->strandbuf->totbound; b++, sbound++) { + INIT_MINMAX(smin, smax); for(a=sbound->start; a<sbound->end; a++) { strand= RE_findOrAddStrand(obr, a); - strand_minmax(strand, smin, smax); + strand_minmax(strand, smin, smax, width); } VECCOPY(sbound->boundbox[0], smin); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 1c0ce7de5d7..8af3c49213d 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2061,7 +2061,7 @@ static void load_backbuffer(Render *re) char name[256]; strcpy(name, re->r.backbuf); - BLI_path_abs(name, G.main->name); + BLI_path_abs(name, re->main->name); BLI_path_frame(name, re->r.cfra, 0); if(re->backbuf) { @@ -2870,7 +2870,7 @@ static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init) baker.break_data = re->tbh; baker.progressbar = NULL; - BKE_ptcache_make_cache(&baker); + BKE_ptcache_bake(&baker); } /* evaluating scene options for general Blender render */ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index db8b0b2c1fd..2da2f3633c3 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1398,19 +1398,21 @@ int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4]) fl= 0; if(bounds) { - if(vec[0] > bounds[1]*vec[3]) fl |= 1; - if(vec[0]< bounds[0]*vec[3]) fl |= 2; + if(vec[0] < bounds[0]*vec[3]) fl |= 1; + else if(vec[0] > bounds[1]*vec[3]) fl |= 2; + if(vec[1] > bounds[3]*vec[3]) fl |= 4; - if(vec[1]< bounds[2]*vec[3]) fl |= 8; + else if(vec[1]< bounds[2]*vec[3]) fl |= 8; } else { if(vec[0] < -vec[3]) fl |= 1; - if(vec[0] > vec[3]) fl |= 2; - if(vec[1] < -vec[3]) fl |= 4; - if(vec[1] > vec[3]) fl |= 8; + else if(vec[0] > vec[3]) fl |= 2; + + if(vec[1] > vec[3]) fl |= 4; + else if(vec[1] < -vec[3]) fl |= 8; } if(vec[2] < -vec[3]) fl |= 16; - if(vec[2] > vec[3]) fl |= 32; + else if(vec[2] > vec[3]) fl |= 32; flag &= fl; if(flag==0) return 0; diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 1e8709d09f7..4bccb46d3d8 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -56,6 +56,7 @@ #include "DNA_material_types.h" #include "BKE_colortools.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -995,6 +996,15 @@ void make_sss_tree(Render *re) for(mat= re->main->mat.first; mat; mat= mat->id.next) if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS)) sss_create_tree_mat(re, mat); + + /* XXX preview exception */ + /* localizing preview render data is not fun for node trees :( */ + if(re->main!=G.main) { + for(mat= G.main->mat.first; mat; mat= mat->id.next) + if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS)) + sss_create_tree_mat(re, mat); + } + } void free_sss(Render *re) diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index be17d640b66..fbbeceeea2c 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -578,7 +578,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float } } -static int strand_test_clip(float winmat[][4], ZSpan *zspan, float *bounds, float *co, float *zcomp) +/* width is calculated in hoco space, to ensure strands are visible */ +static int strand_test_clip(float winmat[][4], ZSpan *zspan, float *bounds, float *co, float *zcomp, float widthx, float widthy) { float hoco[4]; int clipflag= 0; @@ -588,10 +589,11 @@ static int strand_test_clip(float winmat[][4], ZSpan *zspan, float *bounds, floa /* we compare z without perspective division for segment sorting */ *zcomp= hoco[2]; - if(hoco[0] > bounds[1]*hoco[3]) clipflag |= 1; - else if(hoco[0]< bounds[0]*hoco[3]) clipflag |= 2; - else if(hoco[1] > bounds[3]*hoco[3]) clipflag |= 4; - else if(hoco[1]< bounds[2]*hoco[3]) clipflag |= 8; + if(hoco[0]+widthx < bounds[0]*hoco[3]) clipflag |= 1; + else if(hoco[0]-widthx > bounds[1]*hoco[3]) clipflag |= 2; + + if(hoco[1]-widthy > bounds[3]*hoco[3]) clipflag |= 4; + else if(hoco[1]+widthy < bounds[2]*hoco[3]) clipflag |= 8; clipflag |= testclip(hoco); @@ -826,6 +828,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa /* for all object instances */ for(obi=re->instancetable.first, i=0; obi; obi=obi->next, i++) { Material *ma; + float widthx, widthy; obr= obi->obr; @@ -848,6 +851,9 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa if(clip_render_object(obi->obr->boundbox, bounds, winmat)) continue; + + widthx= obr->strandbuf->maxwidth*obwinmat[0][0]; + widthy= obr->strandbuf->maxwidth*obwinmat[1][1]; /* for each bounding box containing a number of strands */ sbound= obr->strandbuf->bound; @@ -861,14 +867,14 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa svert= strand->vert; /* keep clipping and z depth for 4 control points */ - clip[1]= strand_test_clip(obwinmat, &zspan, bounds, svert->co, &z[1]); - clip[2]= strand_test_clip(obwinmat, &zspan, bounds, (svert+1)->co, &z[2]); + clip[1]= strand_test_clip(obwinmat, &zspan, bounds, svert->co, &z[1], widthx, widthy); + clip[2]= strand_test_clip(obwinmat, &zspan, bounds, (svert+1)->co, &z[2], widthx, widthy); clip[0]= clip[1]; z[0]= z[1]; for(b=0; b<strand->totvert-1; b++, svert++) { /* compute 4th point clipping and z depth */ if(b < strand->totvert-2) { - clip[3]= strand_test_clip(obwinmat, &zspan, bounds, (svert+2)->co, &z[3]); + clip[3]= strand_test_clip(obwinmat, &zspan, bounds, (svert+2)->co, &z[3], widthx, widthy); } else { clip[3]= clip[2]; z[3]= z[2]; @@ -1025,12 +1031,22 @@ void free_strand_surface(Render *re) BLI_freelistN(&re->strandsurface); } -void strand_minmax(StrandRen *strand, float *min, float *max) +void strand_minmax(StrandRen *strand, float *min, float *max, float width) { StrandVert *svert; + float vec[3], width2= 2.0f*width; int a; - for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) - DO_MINMAX(svert->co, min, max) + for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) { + VECCOPY(vec, svert->co); + DO_MINMAX(vec, min, max); + + if(width!=0.0f) { + vec[0]+= width; vec[1]+= width; vec[2]+= width; + DO_MINMAX(vec, min, max); + vec[0]-= width2; vec[1]-= width2; vec[2]-= width2; + DO_MINMAX(vec, min, max); + } + } } diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 1a52bc36482..1cdb93f0c1f 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -243,14 +243,14 @@ int testclip(float *v) prevents issues with vertices lying exact on borders */ abs4= fabs(v[3]) + FLT_EPSILON; - if(v[2]< -abs4) c=16; /* this used to be " if(v[2]<0) ", see clippz() */ - else if(v[2]> abs4) c+= 32; + if( v[0] < -abs4) c+=1; + else if( v[0] > abs4) c+=2; - if( v[0]>abs4) c+=2; - else if( v[0]< -abs4) c+=1; + if( v[1] > abs4) c+=4; + else if( v[1] < -abs4) c+=8; - if( v[1]>abs4) c+=4; - else if( v[1]< -abs4) c+=8; + if(v[2] < -abs4) c+=16; /* this used to be " if(v[2]<0) ", see clippz() */ + else if(v[2]> abs4) c+= 32; return c; } @@ -1782,10 +1782,10 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][ projectvert(co, winmat, ho); wco= ho[3]; - if(ho[0] > bounds[1]*wco) clipflag |= 1; - else if(ho[0]< bounds[0]*wco) clipflag |= 2; + if(ho[0] < bounds[0]*wco) clipflag |= 1; + else if(ho[0] > bounds[1]*wco) clipflag |= 2; if(ho[1] > bounds[3]*wco) clipflag |= 4; - else if(ho[1]< bounds[2]*wco) clipflag |= 8; + else if(ho[1] < bounds[2]*wco) clipflag |= 8; QUATCOPY(cache[cindex].ho, ho); cache[cindex].clip= clipflag; diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 8f91011b210..ecd7f3be12c 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -112,4 +112,4 @@ if(WITH_BUILDINFO) add_definitions(-DNAN_BUILDINFO) endif() -blenderlib_nolist(bf_windowmanager "${SRC}" "${INC}") +blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}") diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0ca8c5e7f4f..bbd22cae0f3 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -55,6 +55,7 @@ struct ImBuf; #define OPTYPE_BLOCKING 4 /* let blender grab all input from the WM (X11) */ #define OPTYPE_MACRO 8 #define OPTYPE_GRAB_POINTER 16 /* */ +#define OPTYPE_PRESET 32 /* show preset menu */ /* context to call operator in for WM_operator_name_call */ /* rna_ui.c contains EnumPropertyItem's of these, keep in sync */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 9c8bd3f4fec..dc944b71843 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -56,6 +56,7 @@ #include "ED_fileselect.h" #include "ED_info.h" #include "ED_screen.h" +#include "ED_view3d.h" #include "ED_util.h" #include "RNA_access.h" @@ -294,9 +295,14 @@ void wm_event_do_notifiers(bContext *C) } /* XXX make lock in future, or separated derivedmesh users in scene */ - if(!G.rendering) + if(!G.rendering) { /* depsgraph & animation: update tagged datablocks */ + + /* copied to set's in scene_update_tagged_recursive() */ + win->screen->scene->customdata_mask= ED_viewedit_datamask(win->screen); + scene_update_tagged(CTX_data_main(C), win->screen->scene); + } } CTX_wm_window_set(C, NULL); @@ -440,7 +446,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop ReportTimerInfo *rti; /* add reports to the global list, otherwise they are not seen */ - addlisttolist(&CTX_wm_reports(C)->list, &op->reports->list); + BLI_movelisttolist(&CTX_wm_reports(C)->list, &op->reports->list); /* After adding reports to the global list, reset the report timer. */ WM_event_remove_timer(wm, NULL, reports->reporttimer); @@ -1345,7 +1351,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa /* XXX - copied from 'wm_operator_finished()' */ /* add reports to the global list, otherwise they are not seen */ - addlisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list); + BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list); CTX_wm_window_set(C, win_prev); } diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index c1e28654f73..8d873709212 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -325,8 +325,8 @@ void wm_gesture_draw(wmWindow *win) if(gt->type==WM_GESTURE_RECT) wm_gesture_draw_rect(gt); - else if(gt->type==WM_GESTURE_TWEAK) - wm_gesture_draw_line(gt); +// else if(gt->type==WM_GESTURE_TWEAK) +// wm_gesture_draw_line(gt); else if(gt->type==WM_GESTURE_CIRCLE) wm_gesture_draw_circle(gt); else if(gt->type==WM_GESTURE_CROSS_RECT) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index d1fe841d467..181ae62af17 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -275,12 +275,16 @@ int WM_init_game(bContext *C) if(scene->gm.fullscreen) { WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL); wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax); + ar->winx = ar->winrct.xmax + 1; + ar->winy = ar->winrct.ymax + 1; } else { GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin); ar->winrct.ymax = GHOST_GetHeightRectangle(rect); ar->winrct.xmax = GHOST_GetWidthRectangle(rect); + ar->winx = ar->winrct.xmax + 1; + ar->winy = ar->winrct.ymax + 1; GHOST_DisposeRectangle(rect); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index cfd8a9256be..aff58b99e51 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -229,6 +229,8 @@ int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, wmOper else if(opm->type->exec) retval= opm->type->exec(C, opm); + BLI_movelisttolist(&op->reports->list, &opm->reports->list); + if (retval & OPERATOR_FINISHED) { MacroData *md = op->customdata; md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */ @@ -643,7 +645,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) return op->type->exec(C, op); } else { - pup= uiPupMenuBegin(C, op->type->name, 0); + pup= uiPupMenuBegin(C, op->type->name, ICON_NULL); layout= uiPupMenuLayout(pup); uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); @@ -752,7 +754,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION); layout= uiPupMenuLayout(pup); - uiItemFullO(layout, op->type->idname, message, 0, properties, WM_OP_EXEC_REGION_WIN, 0); + uiItemFullO(layout, op->type->idname, message, ICON_NULL, properties, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); return OPERATOR_CANCELLED; @@ -1136,7 +1138,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar mt->draw(C, &menu); // wmWindowManager *wm= CTX_wm_manager(C); -// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, 0); +// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NULL); } uiBlockSetEmboss(block, UI_EMBOSSP); @@ -1144,7 +1146,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0, 0); col = uiLayoutColumn(split, 0); - uiItemL(col, "Links", 0); + uiItemL(col, "Links", ICON_NULL); uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-254-beta/"); uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:Manual"); @@ -1152,16 +1154,16 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); uiItemStringO(col, "Python API Reference", ICON_URL, "WM_OT_url_open", "url", url); - uiItemL(col, "", 0); + uiItemL(col, "", ICON_NULL); col = uiLayoutColumn(split, 0); - uiItemL(col, "Recent", 0); + uiItemL(col, "Recent", ICON_NULL); for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) { uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } uiItemS(col); uiItemO(col, NULL, ICON_RECOVER_LAST, "WM_OT_recover_last_session"); - uiItemL(col, "", 0); + uiItemL(col, "", ICON_NULL); uiCenteredBoundsBlock(block, 0.0f); uiEndBlock(C, block); diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index eecb67e8882..5950753164b 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -34,7 +35,7 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") add_definitions(-DWITH_BINRELOC) - include_directories(${BINRELOC_INC}) + blender_include_dirs(${BINRELOC_INC}) endif() add_custom_command( diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 0974438c272..55f354a57a8 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -55,4 +55,4 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_FREETYPE2) endif() -blenderlib_nolist(blenkernel_blc "${SRC}" "${INC}") +blender_add_lib_nolist(blenkernel_blc "${SRC}" "${INC}") diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index e5993024fba..bca42fc39b7 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -29,7 +30,7 @@ cmake_policy(SET CMP0005 NEW) setup_libdirs() -include_directories( +blender_include_dirs( ../../intern/guardedalloc ../blender/blenlib ../blender/blenkernel @@ -68,12 +69,12 @@ if(WITH_IMAGE_HDR) endif() if(WITH_PYTHON) - include_directories(../blender/python) + blender_include_dirs(../blender/python) add_definitions(-DWITH_PYTHON) endif() if(WITH_GAMEENGINE) - include_directories( + blender_include_dirs( ../kernel/gen_messaging ../kernel/gen_system ) @@ -87,7 +88,7 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") add_definitions(-DWITH_BINRELOC) - include_directories(${BINRELOC_INC}) + blender_include_dirs(${BINRELOC_INC}) endif() # Setup the exe sources and buildinfo @@ -314,8 +315,8 @@ if(WITH_INSTALL) COMMAND if \"$(ConfigurationName)\" == \"\" xcopy /E /Y \"${LIBDIR}\\release\\python31\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\python\\lib\\\" COMMAND if \"$(ConfigurationName)\" == \"Debug\" copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\" COMMAND if \"$(ConfigurationName)\" == \"Debug\" xcopy /E /Y \"${LIBDIR}\\release\\python31_d\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\python\\lib\\\" - COMMAND if \"$(ConfigurationName)\" == \"RelWithDebInfo\" copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\" - COMMAND if \"$(ConfigurationName)\" == \"RelWithDebInfo\" xcopy /E /Y \"${LIBDIR}\\release\\python31_d\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\python\\lib\\\" + COMMAND if \"$(ConfigurationName)\" == \"RelWithDebInfo\" copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\" + COMMAND if \"$(ConfigurationName)\" == \"RelWithDebInfo\" xcopy /E /Y \"${LIBDIR}\\release\\python31\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\python\\lib\\\" COMMAND if \"$(ConfigurationName)\" == \"Release\" copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\" COMMAND if \"$(ConfigurationName)\" == \"Release\" xcopy /E /Y \"${LIBDIR}\\release\\python31\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\python\\lib\\\" COMMAND if \"$(ConfigurationName)\" == \"MinSizeRel\" copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\" diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 098cf71ac9f..81db7da5cee 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -57,4 +57,4 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -blenderlib(ge_blen_routines "${SRC}" "${INC}") +blender_add_lib(ge_blen_routines "${SRC}" "${INC}") diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt index 686cb7cc8fa..53688ab3218 100644 --- a/source/gameengine/CMakeLists.txt +++ b/source/gameengine/CMakeLists.txt @@ -1,3 +1,4 @@ +# -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -26,7 +27,7 @@ # there are too many inter-includes so best define here if(WITH_PYTHON) - include_directories(${PYTHON_INC}) + blender_include_dirs(${PYTHON_INC}) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index efffd5d2e99..147c8b791ee 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -109,4 +109,4 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -blenderlib(ge_converter "${SRC}" "${INC}") +blender_add_lib(ge_converter "${SRC}" "${INC}") diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 5a445bc1f82..c593c690614 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -78,4 +78,4 @@ set(SRC VoidValue.h ) -blenderlib(ge_logic_expressions "${SRC}" "${INC}") +blender_add_lib(ge_logic_expressions "${SRC}" "${INC}") diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index d2c6731d530..793b8e7eed8 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -129,4 +129,4 @@ else() add_definitions(-DDISABLE_SDL) endif() -blenderlib(ge_logic "${SRC}" "${INC}") +blender_add_lib(ge_logic "${SRC}" "${INC}") diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index 43952a15431..9bab870ccd5 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -82,4 +82,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blenderlib_nolist(ge_player_common "${SRC}" "${INC}") +blender_add_lib_nolist(ge_player_common "${SRC}" "${INC}") diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 7078296ac32..e72f2d53f77 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -76,4 +76,4 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -blenderlib_nolist(ge_player_ghost "${SRC}" "${INC}") +blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 197e31af188..d1dee052173 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -802,7 +802,6 @@ void GPG_Application::exitEngine() m_canvas = 0; } - IMB_exit(); GPU_extensions_exit(); m_exitRequested = 0; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index d9aaa56b19e..b7f4cacf5ab 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -943,7 +943,12 @@ int main(int argc, char** argv) } } - free_nodesystem(); + // Cleanup + RNA_exit(); + BLF_exit(); + free_blender(); + + SYS_DeleteSystem(syshandle); return error ? -1 : 0; } diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 912794d9f75..67ac8a02255 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -221,4 +221,4 @@ if(WITH_BULLET) list(APPEND INC ../../../source/gameengine/Physics/Bullet ) endif() -blenderlib(ge_logic_ketsji "${SRC}" "${INC}") +blender_add_lib(ge_logic_ketsji "${SRC}" "${INC}") diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index a88fe0c5252..5f251c832ee 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -50,4 +50,4 @@ set(SRC KX_NetworkObjectSensor.h ) -blenderlib(ge_logic_network "${SRC}" "${INC}") +blender_add_lib(ge_logic_network "${SRC}" "${INC}") diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index dd64f0e8437..6a2b5fe841e 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -42,4 +42,4 @@ set(SRC NG_NetworkScene.h ) -blenderlib(ge_logic_ngnetwork "${SRC}" "${INC}") +blender_add_lib(ge_logic_ngnetwork "${SRC}" "${INC}") diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt index b26a87666dc..4cf43a1fc93 100644 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt @@ -37,4 +37,4 @@ set(SRC NG_LoopBackNetworkDeviceInterface.h ) -blenderlib(ge_logic_loopbacknetwork "${SRC}" "${INC}") +blender_add_lib(ge_logic_loopbacknetwork "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index da585803783..8dab5194619 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -61,4 +61,4 @@ if(WITH_BULLET) add_definitions(-DUSE_BULLET) endif() -blenderlib(ge_phys_bullet "${SRC}" "${INC}") +blender_add_lib(ge_phys_bullet "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index ab633b807e0..fd7f37897eb 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -35,4 +35,4 @@ set(SRC DummyPhysicsEnvironment.h ) -blenderlib(ge_phys_dummy "${SRC}" "${INC}") +blender_add_lib(ge_phys_dummy "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt index bc095822936..50aa9083089 100644 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ b/source/gameengine/Physics/common/CMakeLists.txt @@ -47,4 +47,4 @@ set(SRC PHY_Pro.h ) -blenderlib(ge_phys_common "${SRC}" "${INC}") +blender_add_lib(ge_phys_common "${SRC}" "${INC}") diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index 6971c74b55a..b18020ab17e 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -81,4 +81,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blenderlib(ge_rasterizer "${SRC}" "${INC}") +blender_add_lib(ge_rasterizer "${SRC}" "${INC}") diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index ebdfb667443..d47f19eda90 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -53,4 +53,4 @@ set(SRC add_definitions(-DGLEW_STATIC) -blenderlib(ge_oglrasterizer "${SRC}" "${INC}") +blender_add_lib(ge_oglrasterizer "${SRC}" "${INC}") diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt index 6c133af09f7..a054252ea0b 100644 --- a/source/gameengine/SceneGraph/CMakeLists.txt +++ b/source/gameengine/SceneGraph/CMakeLists.txt @@ -48,4 +48,4 @@ set(SRC SG_Tree.h ) -blenderlib(ge_scenegraph "${SRC}" "${INC}") +blender_add_lib(ge_scenegraph "${SRC}" "${INC}") diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index fff9ff95c25..acab8de8d38 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -91,4 +91,4 @@ if(WITH_CODEC_FFMPEG) add_definitions(-D__STDC_CONSTANT_MACROS) endif() -blenderlib(ge_videotex "${SRC}" "${INC}") +blender_add_lib(ge_videotex "${SRC}" "${INC}") diff --git a/source/gameengine/VideoTexture/PyTypeList.cpp b/source/gameengine/VideoTexture/PyTypeList.cpp index 2d571675dbd..c374348da26 100644 --- a/source/gameengine/VideoTexture/PyTypeList.cpp +++ b/source/gameengine/VideoTexture/PyTypeList.cpp @@ -28,6 +28,14 @@ http://www.gnu.org/copyleft/lesser.txt. #include <PyObjectPlus.h> +/// destructor +PyTypeList::~PyTypeList() +{ + // if list exists + if (m_list.get() != NULL) + for (PyTypeListType::iterator it = m_list->begin(); it != m_list->end(); ++it) + delete *it; +} /// check, if type is in list bool PyTypeList::in (PyTypeObject * type) diff --git a/source/gameengine/VideoTexture/PyTypeList.h b/source/gameengine/VideoTexture/PyTypeList.h index 4daf88bfa19..8ca1e976de7 100644 --- a/source/gameengine/VideoTexture/PyTypeList.h +++ b/source/gameengine/VideoTexture/PyTypeList.h @@ -41,6 +41,9 @@ typedef std::vector<PyTypeListItem*> PyTypeListType; class PyTypeList { public: + /// destructor + ~PyTypeList(); + /// check, if type is in list bool in (PyTypeObject * type); diff --git a/source/kernel/CMakeLists.txt b/source/kernel/CMakeLists.txt index de97d425720..bcf967cff12 100644 --- a/source/kernel/CMakeLists.txt +++ b/source/kernel/CMakeLists.txt @@ -45,4 +45,4 @@ set(SRC gen_system/SYS_System.h ) -blenderlib(bf_gen_system "${SRC}" "${INC}") +blender_add_lib(bf_gen_system "${SRC}" "${INC}") |