diff options
191 files changed, 2172 insertions, 1310 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1898c239956..b23959e5661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1006,7 +1006,7 @@ elseif(APPLE) mark_as_advanced(SYSTEMSTUBS_LIBRARY) if(SYSTEMSTUBS_LIBRARY) set(PLATFORM_LINKLIBS stdc++ SystemStubs) - else() + else() set(PLATFORM_LINKLIBS stdc++) endif() @@ -1153,14 +1153,19 @@ endif() # set the endian define -include(TestBigEndian) -test_big_endian(_SYSTEM_BIG_ENDIAN) -if(_SYSTEM_BIG_ENDIAN) - add_definitions(-D__BIG_ENDIAN__) -else() +if(MSVC) + # for some reason this fails on msvc add_definitions(-D__LITTLE_ENDIAN__) +else() + include(TestBigEndian) + test_big_endian(_SYSTEM_BIG_ENDIAN) + if(_SYSTEM_BIG_ENDIAN) + add_definitions(-D__BIG_ENDIAN__) + else() + add_definitions(-D__LITTLE_ENDIAN__) + endif() + unset(_SYSTEM_BIG_ENDIAN) endif() -unset(_SYSTEM_BIG_ENDIAN) if(WITH_IMAGE_OPENJPEG) @@ -1269,7 +1274,10 @@ if(CMAKE_COMPILER_IS_GNUCC) 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_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef) + + # # this causes too many warnings, disable + # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef) + # disable because it gives warnings for printf() & friends. # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable) @@ -1277,7 +1285,9 @@ if(CMAKE_COMPILER_IS_GNUCC) 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) - ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef) + + # # this causes too many warnings, disable + # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef) elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py index fdd380c5b4d..1c8d619a513 100644 --- a/build_files/cmake/cmake_static_check_cppcheck.py +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -58,8 +58,8 @@ def main(): check_commands.append((c, cmd)) - process_functions = [] + def my_process(i, c, cmd): percent = 100.0 * (i / (len(check_commands) - 1)) percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index aec7a9fd96c..ef4edca1b22 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -482,7 +482,7 @@ macro(get_blender_version) if(${_out_version_char_empty}) set(BLENDER_VERSION_CHAR_INDEX "0") else() - set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w q y z) + set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z) list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index) math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1") unset(_char_ls) diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index 83e4e05dc0f..c636d778aaa 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -161,8 +161,6 @@ def queue_processes(process_funcs, job_total=-1): del multiprocessing if job_total == 1: - import os - import sys for func, args in process_funcs: sys.stdout.flush() sys.stderr.flush() @@ -171,14 +169,13 @@ def queue_processes(process_funcs, job_total=-1): process.wait() else: import time - import subprocess processes = [] for func, args in process_funcs: # wait until a thread is free while 1: processes[:] = [p for p in processes if p.poll() is None] - + if len(processes) <= job_total: break else: diff --git a/doc/python_api/rst/change_log.rst b/doc/python_api/rst/change_log.rst index e7db5df4a1f..b9c154bb9d0 100644 --- a/doc/python_api/rst/change_log.rst +++ b/doc/python_api/rst/change_log.rst @@ -909,3 +909,498 @@ Added * :class:`bpy.types.SceneGameData.use_glsl_color_management` +bpy.types.RenderSettings +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.RenderSettings.ffmpeg_audio_channels` + +bpy.types.DriverTarget +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.DriverTarget.transform_space` + +Removed +^^^^^^^ + +* **use_local_space_transform** + +bpy.types.Sound +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Sound.factory` +* :class:`bpy.types.Sound.mono` + +bpy.types.Scene +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Scene.audio_volume` + +bpy.types.KeyingSet +------------------- + +Added +^^^^^ + +* :class:`bpy.types.KeyingSet.refresh` + +bpy.types.Armature +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Armature.vert_deformer` + +bpy.types.GameObjectSettings +---------------------------- + +Added +^^^^^ + +* :class:`bpy.types.GameObjectSettings.create_obstacle` +* :class:`bpy.types.GameObjectSettings.obstacle_radius` + +bpy.types.BlendData +------------------- + +Added +^^^^^ + +* :class:`bpy.types.BlendData.speakers` + +bpy.types.SolidifyModifier +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SolidifyModifier.thickness_vertex_group` + +bpy.types.ThemeGraphEditor +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ThemeGraphEditor.handle_auto_clamped` +* :class:`bpy.types.ThemeGraphEditor.handle_sel_auto_clamped` + +bpy.types.MultiresModifier +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.MultiresModifier.use_subsurf_uv` + +bpy.types.Node +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Node.parent` + +bpy.types.KeyMap +---------------- + +Removed +^^^^^^^ + +* **copy_to_user** + +Renamed +^^^^^^^ + +* **is_user_defined** -> :class:`bpy.types.KeyMap.is_user_modified` + +bpy.types.SceneRenderLayer +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SceneRenderLayer.use_pass_material_index` + +bpy.types.Texture +----------------- + +Added +^^^^^ + +* :class:`bpy.types.Texture.evaluate` + +bpy.types.ToolSettings +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.ToolSettings.use_multipaint` + +Renamed +^^^^^^^ + +* **use_snap_project_self** -> :class:`bpy.types.ToolSettings.use_snap_self` + +bpy.types.RenderEngine +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.RenderEngine.report` + +bpy.types.UserPreferencesInput +------------------------------ + +Added +^^^^^ + +* :class:`bpy.types.UserPreferencesInput.ndof_fly_helicopter` +* :class:`bpy.types.UserPreferencesInput.ndof_lock_horizon` +* :class:`bpy.types.UserPreferencesInput.ndof_orbit_invert_axes` +* :class:`bpy.types.UserPreferencesInput.ndof_panx_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_pany_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_panz_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_roll_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_rotate_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_sensitivity` +* :class:`bpy.types.UserPreferencesInput.ndof_show_guide` +* :class:`bpy.types.UserPreferencesInput.ndof_tilt_invert_axis` +* :class:`bpy.types.UserPreferencesInput.ndof_zoom_invert` +* :class:`bpy.types.UserPreferencesInput.ndof_zoom_updown` + +Removed +^^^^^^^ + +* **edited_keymaps** +* **ndof_pan_speed** +* **ndof_rotate_speed** + +bpy.types.LockedTrackConstraint +------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.LockedTrackConstraint.head_tail` + +bpy.types.SpaceGraphEditor +-------------------------- + +Renamed +^^^^^^^ + +* **use_fancy_drawing** -> :class:`bpy.types.SpaceGraphEditor.use_beauty_drawing` + +bpy.types.Mesh +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Mesh.use_paint_mask_vertex` + +bpy.types.FCurve +---------------- + +Removed +^^^^^^^ + +* **use_auto_handle_clamp** + +bpy.types.DampedTrackConstraint +------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.DampedTrackConstraint.head_tail` + +bpy.types.ImageTexture +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.ImageTexture.use_derivative_map` + +bpy.types.SoundSequence +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SoundSequence.pan` +* :class:`bpy.types.SoundSequence.pitch` + +Removed +^^^^^^^ + +* **attenuation** + +bpy.types.FModifier +------------------- + +Added +^^^^^ + +* :class:`bpy.types.FModifier.blend_in` +* :class:`bpy.types.FModifier.blend_out` +* :class:`bpy.types.FModifier.frame_end` +* :class:`bpy.types.FModifier.frame_start` +* :class:`bpy.types.FModifier.influence` +* :class:`bpy.types.FModifier.use_influence` +* :class:`bpy.types.FModifier.use_restricted_range` + +bpy.types.EnvironmentMap +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.EnvironmentMap.clear` +* :class:`bpy.types.EnvironmentMap.is_valid` +* :class:`bpy.types.EnvironmentMap.save` + +bpy.types.IDMaterials +--------------------- + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.IDMaterials.save` (index, update_data), *was (index)* + +bpy.types.UserPreferencesSystem +------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.UserPreferencesSystem.use_translate_interface` + +Removed +^^^^^^^ + +* **use_translate_buttons** +* **use_translate_toolbox** + +bpy.types.LimitDistanceConstraint +--------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.LimitDistanceConstraint.head_tail` +* :class:`bpy.types.LimitDistanceConstraint.use_transform_limit` + +bpy.types.MovieSequence +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.MovieSequence.streamindex` + +bpy.types.Material +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Material.game_settings` +* :class:`bpy.types.Material.pass_index` + +bpy.types.RenderLayer +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.RenderLayer.use_pass_material_index` + +bpy.types.Object +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Object.closest_point_on_mesh` +* :class:`bpy.types.Object.matrix_parent_inverse` + +bpy.types.ThemeNodeEditor +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ThemeNodeEditor.noodle_curving` + +bpy.types.SequenceProxy +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SequenceProxy.build_100` +* :class:`bpy.types.SequenceProxy.build_25` +* :class:`bpy.types.SequenceProxy.build_50` +* :class:`bpy.types.SequenceProxy.build_75` +* :class:`bpy.types.SequenceProxy.build_free_run` +* :class:`bpy.types.SequenceProxy.build_free_run_rec_date` +* :class:`bpy.types.SequenceProxy.build_record_run` +* :class:`bpy.types.SequenceProxy.quality` +* :class:`bpy.types.SequenceProxy.timecode` + +bpy.types.SpaceUVEditor +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceUVEditor.show_faces` + +bpy.types.Sequence +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Sequence.waveform` + +bpy.types.ChildOfConstraint +--------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ChildOfConstraint.inverse_matrix` + +bpy.types.DopeSheet +------------------- + +Added +^^^^^ + +* :class:`bpy.types.DopeSheet.show_datablock_filters` +* :class:`bpy.types.DopeSheet.show_speakers` + +bpy.types.ActionActuator +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.ActionActuator.apply_to_children` +* :class:`bpy.types.ActionActuator.layer` +* :class:`bpy.types.ActionActuator.layer_weight` +* :class:`bpy.types.ActionActuator.use_additive` +* :class:`bpy.types.ActionActuator.use_force` +* :class:`bpy.types.ActionActuator.use_local` + +bpy.types.KeyConfigurations +--------------------------- + +Added +^^^^^ + +* :class:`bpy.types.KeyConfigurations.addon` +* :class:`bpy.types.KeyConfigurations.user` + +bpy.types.VertexGroup +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.VertexGroup.lock_weight` + +bpy.types.ThemeView3D +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.ThemeView3D.speaker` + +bpy.types.Image +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Image.pack` +* :class:`bpy.types.Image.unpack` +* :class:`bpy.types.Image.use_generated_float` + +bpy.types.Curve +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Curve.fill_mode` + +Removed +^^^^^^^ + +* **use_fill_back** +* **use_fill_front** + +bpy.types.KeyMapItem +-------------------- + +Added +^^^^^ + +* :class:`bpy.types.KeyMapItem.is_user_modified` + +bpy.types.SceneGameData +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SceneGameData.level_height` +* :class:`bpy.types.SceneGameData.obstacle_simulation` +* :class:`bpy.types.SceneGameData.recast_data` +* :class:`bpy.types.SceneGameData.restrict_animation_updates` +* :class:`bpy.types.SceneGameData.show_obstacle_simulation` + +bpy.types.MeshTextureFace +------------------------- + +Removed +^^^^^^^ + +* **use_image** +* **use_object_color** +* **use_blend_shared** + +Moved +^^^^^ + +* **hide** -> :class:`bpy.types.Material.game_settings.invisible` +* **use_collision** -> :class:`bpy.types.Material.game_settings.physics` +* **use_light** -> :class:`bpy.types.Material.game_settings.use_shadeless` +* **use_twoside** -> :class:`bpy.types.Material.game_settings.backface_culling` +* **use_bitmap_text** -> :class:`bpy.types.Material.game_settings.text` +* **blend_type** -> :class:`bpy.types.Material.game_settings.alpha_blend` +* **use_alpha_sort** -> :class:`bpy.types.Material.game_settings.alpha_blend` +* **use_billboard** -> :class:`bpy.types.Material.game_settings.face_orientation` +* **use_halo** -> :class:`bpy.types.Material.game_settings.face_orientation` +* **use_shadow_cast** -> :class:`bpy.types.Material.game_settings.face_orientation` + diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index 7a56e73b7ad..bc1619ba7bb 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -39,6 +39,9 @@ python doc/python_api/sphinx_changelog_gen.py \ --api_to blender_api_2_57.py \ --api_out changes.rst +# Save the latest API dump in this folder, renaming it with its revision. +# This way the next person updating it doesn't need to build an old Blender only for that + """ # format diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index d8172902a4c..a23dd22f932 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -25,6 +25,15 @@ #include <libavformat/avformat.h> + + +/* check our ffmpeg is new enough, avoids user complaints */ +#if (LIBAVFORMAT_VERSION_MAJOR < 52) || ((LIBAVFORMAT_VERSION_MAJOR == 52) && (LIBAVFORMAT_VERSION_MINOR <= 64)) +# error "FFmpeg 0.7 or newer is needed, Upgrade you're FFmpeg or disable it" +#endif +/* end sanity check */ + + #include <libavcodec/avcodec.h> #include <libavutil/rational.h> diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.h b/intern/ghost/intern/GHOST_DropTargetWin32.h index 980e9f9fe9b..7179c295a98 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.h +++ b/intern/ghost/intern/GHOST_DropTargetWin32.h @@ -53,7 +53,7 @@ public: ULONG __stdcall Release (void); /* IDropTarget implementation - + The IDropTarget interface is one of the interfaces you implement to + + The IDropTarget interface is one of the interfaces you implement to provide drag-and-drop operations in your application. It contains methods used in any application that can be a target for data during a drag-and-drop operation. A drop-target application is responsible for: diff --git a/intern/ghost/intern/GHOST_EventManager.h b/intern/ghost/intern/GHOST_EventManager.h index 9e68a13fd74..3dc751507d6 100644 --- a/intern/ghost/intern/GHOST_EventManager.h +++ b/intern/ghost/intern/GHOST_EventManager.h @@ -127,9 +127,9 @@ public: * Removes all events for a window from the stack. * @param window The window to remove events for. */ - virtual void - removeWindowEvents( - GHOST_IWindow* window + virtual void + removeWindowEvents( + GHOST_IWindow* window ); /** diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index c1e70916be6..e5ec8681de1 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -250,7 +250,7 @@ public: virtual inline GHOST_WindowManager* getWindowManager() const; #ifdef WITH_INPUT_NDOF - /** + /** * Returns a pointer to our n-degree of freedeom manager. * @return A pointer to our n-degree of freedeom manager. */ diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index e02e569cc6e..02ff5c0f559 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -394,7 +394,7 @@ GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays() const void GHOST_SystemCarbon::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const { BitMap screenBits; - Rect bnds = GetQDGlobalsScreenBits(&screenBits)->bounds; + Rect bnds = GetQDGlobalsScreenBits(&screenBits)->bounds; width = bnds.right - bnds.left; height = bnds.bottom - bnds.top; } @@ -413,28 +413,28 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow( const GHOST_TEmbedderWindowID parentWindow ) { - GHOST_IWindow* window = 0; + GHOST_IWindow* window = 0; window = new GHOST_WindowCarbon (title, left, top, width, height, state, type); - if (window) { - if (window->getValid()) { - // Store the pointer to the window - GHOST_ASSERT(m_windowManager, "m_windowManager not initialized"); - m_windowManager->addWindow(window); - m_windowManager->setActiveWindow(window); - pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window)); - } - else { + if (window) { + if (window->getValid()) { + // Store the pointer to the window + GHOST_ASSERT(m_windowManager, "m_windowManager not initialized"); + m_windowManager->addWindow(window); + m_windowManager->setActiveWindow(window); + pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window)); + } + else { GHOST_PRINT("GHOST_SystemCarbon::createWindow(): window invalid\n"); - delete window; - window = 0; - } - } + delete window; + window = 0; + } + } else { GHOST_PRINT("GHOST_SystemCarbon::createWindow(): could not create window\n"); } - return window; + return window; } GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual) @@ -522,19 +522,19 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent) } } while (waitForEvent && !anyProcessed); - return anyProcessed; + return anyProcessed; } GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const { - Point mouseLoc; - // Get the position of the mouse in the active port - ::GetGlobalMouse(&mouseLoc); - // Convert the coordinates to screen coordinates - x = (GHOST_TInt32)mouseLoc.h; - y = (GHOST_TInt32)mouseLoc.v; - return GHOST_kSuccess; + Point mouseLoc; + // Get the position of the mouse in the active port + ::GetGlobalMouse(&mouseLoc); + // Convert the coordinates to screen coordinates + x = (GHOST_TInt32)mouseLoc.h; + y = (GHOST_TInt32)mouseLoc.v; + return GHOST_kSuccess; } @@ -552,29 +552,29 @@ GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt3 // this call below sends event, but empties other events (like shift) // CGPostMouseEvent(CGPointMake(xf, yf), TRUE, 1, FALSE, 0); - return GHOST_kSuccess; + return GHOST_kSuccess; } GHOST_TSuccess GHOST_SystemCarbon::getModifierKeys(GHOST_ModifierKeys& keys) const { - UInt32 modifiers = ::GetCurrentKeyModifiers(); + UInt32 modifiers = ::GetCurrentKeyModifiers(); - keys.set(GHOST_kModifierKeyOS, (modifiers & cmdKey) ? true : false); - keys.set(GHOST_kModifierKeyLeftAlt, (modifiers & optionKey) ? true : false); - keys.set(GHOST_kModifierKeyLeftShift, (modifiers & shiftKey) ? true : false); - keys.set(GHOST_kModifierKeyLeftControl, (modifiers & controlKey) ? true : false); + keys.set(GHOST_kModifierKeyOS, (modifiers & cmdKey) ? true : false); + keys.set(GHOST_kModifierKeyLeftAlt, (modifiers & optionKey) ? true : false); + keys.set(GHOST_kModifierKeyLeftShift, (modifiers & shiftKey) ? true : false); + keys.set(GHOST_kModifierKeyLeftControl, (modifiers & controlKey) ? true : false); - return GHOST_kSuccess; + return GHOST_kSuccess; } - /* XXX, incorrect for multibutton mice */ +/* XXX, incorrect for multibutton mice */ GHOST_TSuccess GHOST_SystemCarbon::getButtons(GHOST_Buttons& buttons) const { - Boolean theOnlyButtonIsDown = ::Button(); - buttons.clear(); - buttons.set(GHOST_kButtonMaskLeft, theOnlyButtonIsDown); - return GHOST_kSuccess; + Boolean theOnlyButtonIsDown = ::Button(); + buttons.clear(); + buttons.set(GHOST_kButtonMaskLeft, theOnlyButtonIsDown); + return GHOST_kSuccess; } #define FIRSTFILEBUFLG 512 @@ -659,35 +659,35 @@ OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *re GHOST_TSuccess GHOST_SystemCarbon::init() { - - GHOST_TSuccess success = GHOST_System::init(); - if (success) { + + GHOST_TSuccess success = GHOST_System::init(); + if (success) { /* - * Initialize the cursor to the standard arrow shape (so that we can change it later on). - * This initializes the cursor's visibility counter to 0. - */ - ::InitCursor(); + * Initialize the cursor to the standard arrow shape (so that we can change it later on). + * This initializes the cursor's visibility counter to 0. + */ + ::InitCursor(); MenuRef windMenu; ::CreateStandardWindowMenu(0, &windMenu); ::InsertMenu(windMenu, 0); ::DrawMenuBar(); - ::InstallApplicationEventHandler(sEventHandlerProc, GetEventTypeCount(kEvents), kEvents, this, &m_handler); + ::InstallApplicationEventHandler(sEventHandlerProc, GetEventTypeCount(kEvents), kEvents, this, &m_handler); ::AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, sAEHandlerLaunch, (SInt32) this, false); ::AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, sAEHandlerOpenDocs, (SInt32) this, false); ::AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, sAEHandlerPrintDocs, (SInt32) this, false); ::AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, sAEHandlerQuit, (SInt32) this, false); - } - return success; + } + return success; } GHOST_TSuccess GHOST_SystemCarbon::exit() { - return GHOST_System::exit(); + return GHOST_System::exit(); } @@ -847,11 +847,11 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) err = noErr; } } - break; + break; case kEventMouseMoved: case kEventMouseDragged: { - Point mousePos; + Point mousePos; if (window) { //handle any tablet events that may have come with the mouse event (optional) @@ -860,7 +860,7 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) ::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos); pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v)); err = noErr; - } + } break; } case kEventMouseWheelMoved: @@ -1094,38 +1094,38 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult) } ::HiliteMenu(0); - return handled; + return handled; } OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData) { GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData; - OSStatus err = eventNotHandledErr; + OSStatus err = eventNotHandledErr; GHOST_IWindow* window; #ifdef WITH_INPUT_NDOF GHOST_TEventNDOFData data; #endif UInt32 kind; - switch (::GetEventClass(event)) - { + switch (::GetEventClass(event)) + { case kEventClassAppleEvent: EventRecord eventrec; if (ConvertEventRefToEventRecord(event, &eventrec)) { err = AEProcessAppleEvent(&eventrec); } break; - case kEventClassMouse: - err = sys->handleMouseEvent(event); - break; + case kEventClassMouse: + err = sys->handleMouseEvent(event); + break; case kEventClassWindow: err = sys->handleWindowEvent(event); break; case kEventClassKeyboard: err = sys->handleKeyEvent(event); break; - case kEventClassBlender : + case kEventClassBlender : #ifdef WITH_INPUT_NDOF window = sys->m_windowManager->getActiveWindow(); sys->m_ndofManager->GHOST_NDOFGetDatas(data); @@ -1146,11 +1146,11 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even err = noErr; break; default : - ; + ; break; - } + } - return err; + return err; } GHOST_TUns8* GHOST_SystemCarbon::getClipboard(bool selection) const diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 63bfa9619e4..27a61cf57fc 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1018,18 +1018,18 @@ convertXKey(KeySym key) GXMAP(type,XK_bracketright, GHOST_kKeyRightBracket); GXMAP(type,XK_Pause, GHOST_kKeyPause); - GXMAP(type,XK_Shift_L, GHOST_kKeyLeftShift); - GXMAP(type,XK_Shift_R, GHOST_kKeyRightShift); + GXMAP(type,XK_Shift_L, GHOST_kKeyLeftShift); + GXMAP(type,XK_Shift_R, GHOST_kKeyRightShift); GXMAP(type,XK_Control_L, GHOST_kKeyLeftControl); GXMAP(type,XK_Control_R, GHOST_kKeyRightControl); - GXMAP(type,XK_Alt_L, GHOST_kKeyLeftAlt); - GXMAP(type,XK_Alt_R, GHOST_kKeyRightAlt); + GXMAP(type,XK_Alt_L, GHOST_kKeyLeftAlt); + GXMAP(type,XK_Alt_R, GHOST_kKeyRightAlt); GXMAP(type,XK_Super_L, GHOST_kKeyOS); GXMAP(type,XK_Super_R, GHOST_kKeyOS); - GXMAP(type,XK_Insert, GHOST_kKeyInsert); - GXMAP(type,XK_Delete, GHOST_kKeyDelete); - GXMAP(type,XK_Home, GHOST_kKeyHome); + GXMAP(type,XK_Insert, GHOST_kKeyInsert); + GXMAP(type,XK_Delete, GHOST_kKeyDelete); + GXMAP(type,XK_Home, GHOST_kKeyHome); GXMAP(type,XK_End, GHOST_kKeyEnd); GXMAP(type,XK_Page_Up, GHOST_kKeyUpPage); GXMAP(type,XK_Page_Down, GHOST_kKeyDownPage); @@ -1045,27 +1045,27 @@ convertXKey(KeySym key) /* keypad events */ - GXMAP(type,XK_KP_0, GHOST_kKeyNumpad0); - GXMAP(type,XK_KP_1, GHOST_kKeyNumpad1); - GXMAP(type,XK_KP_2, GHOST_kKeyNumpad2); - GXMAP(type,XK_KP_3, GHOST_kKeyNumpad3); - GXMAP(type,XK_KP_4, GHOST_kKeyNumpad4); - GXMAP(type,XK_KP_5, GHOST_kKeyNumpad5); - GXMAP(type,XK_KP_6, GHOST_kKeyNumpad6); - GXMAP(type,XK_KP_7, GHOST_kKeyNumpad7); - GXMAP(type,XK_KP_8, GHOST_kKeyNumpad8); - GXMAP(type,XK_KP_9, GHOST_kKeyNumpad9); + GXMAP(type,XK_KP_0, GHOST_kKeyNumpad0); + GXMAP(type,XK_KP_1, GHOST_kKeyNumpad1); + GXMAP(type,XK_KP_2, GHOST_kKeyNumpad2); + GXMAP(type,XK_KP_3, GHOST_kKeyNumpad3); + GXMAP(type,XK_KP_4, GHOST_kKeyNumpad4); + GXMAP(type,XK_KP_5, GHOST_kKeyNumpad5); + GXMAP(type,XK_KP_6, GHOST_kKeyNumpad6); + GXMAP(type,XK_KP_7, GHOST_kKeyNumpad7); + GXMAP(type,XK_KP_8, GHOST_kKeyNumpad8); + GXMAP(type,XK_KP_9, GHOST_kKeyNumpad9); GXMAP(type,XK_KP_Decimal, GHOST_kKeyNumpadPeriod); GXMAP(type,XK_KP_Insert, GHOST_kKeyNumpad0); - GXMAP(type,XK_KP_End, GHOST_kKeyNumpad1); - GXMAP(type,XK_KP_Down, GHOST_kKeyNumpad2); + GXMAP(type,XK_KP_End, GHOST_kKeyNumpad1); + GXMAP(type,XK_KP_Down, GHOST_kKeyNumpad2); GXMAP(type,XK_KP_Page_Down, GHOST_kKeyNumpad3); - GXMAP(type,XK_KP_Left, GHOST_kKeyNumpad4); - GXMAP(type,XK_KP_Begin, GHOST_kKeyNumpad5); + GXMAP(type,XK_KP_Left, GHOST_kKeyNumpad4); + GXMAP(type,XK_KP_Begin, GHOST_kKeyNumpad5); GXMAP(type,XK_KP_Right, GHOST_kKeyNumpad6); - GXMAP(type,XK_KP_Home, GHOST_kKeyNumpad7); - GXMAP(type,XK_KP_Up, GHOST_kKeyNumpad8); + GXMAP(type,XK_KP_Home, GHOST_kKeyNumpad7); + GXMAP(type,XK_KP_Up, GHOST_kKeyNumpad8); GXMAP(type,XK_KP_Page_Up, GHOST_kKeyNumpad9); GXMAP(type,XK_KP_Delete, GHOST_kKeyNumpadPeriod); diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 845243f92e5..b43d955d156 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -285,7 +285,7 @@ private : void processEvent( XEvent *xe - ); + ); Time lastEventTime( @@ -294,7 +294,7 @@ private : bool generateWindowExposeEvents( - ); + ); }; #endif diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index ce28f8c4538..a5f195153dd 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.h +++ b/intern/ghost/intern/GHOST_WindowCocoa.h @@ -305,13 +305,13 @@ protected: int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color); virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); - - /** The window containing the OpenGL view */ - CocoaWindow *m_window; + + /** The window containing the OpenGL view */ + CocoaWindow *m_window; /** The openGL view */ CocoaOpenGLView *m_openGLView; - + /** The opgnGL drawing context */ NSOpenGLContext *m_openGLContext; diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 937dffe9fba..faae903827d 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -1009,7 +1009,7 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp switch (type) { case GHOST_kDrawingContextTypeOpenGL: if (!getValid()) break; - + pixelFormat = [m_openGLView pixelFormat]; tmpOpenGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:s_firstOpenGLcontext]; @@ -1332,7 +1332,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap cursorImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil - pixelsWide:sizex + pixelsWide:sizex pixelsHigh:sizey bitsPerSample:1 samplesPerPixel:2 diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index d9a495ad0f4..fbab3df1351 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -255,7 +255,7 @@ GHOST_WindowWin32::GHOST_WindowWin32( title, // pointer to window name WS_POPUP | WS_MAXIMIZE, // window style left, // horizontal position of window - top, // vertical position of window + top, // vertical position of window width, // window width height, // window height HWND_DESKTOP, // handle to parent or owner window @@ -633,7 +633,7 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) break; } SetWindowPos(m_hWnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); /*Clears window cache for SetWindowLongPtr */ - return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure; + return ::SetWindowPlacement(m_hWnd, &wp) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index de725151607..160980b6331 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -614,7 +614,7 @@ void GHOST_WindowX11::initXInputDevices() ici = (XAnyClassPtr)(((char *)ici) + ici->length); } } else { - m_xtablet.StylusID= 0; + m_xtablet.StylusID= 0; } } else if(m_xtablet.EraserDevice==NULL && is_eraser(device_info[i].name, device_type)) { @@ -1216,11 +1216,11 @@ activateDrawingContext( return GHOST_kFailure; } - GHOST_TSuccess + GHOST_TSuccess GHOST_WindowX11:: invalidate( ){ - + // So the idea of this function is to generate an expose event // for the window. // Unfortunately X does not handle expose events for you and diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 3614445ad27..cedaf53a4bb 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -711,6 +711,10 @@ static void rem_memblock(MemHead *memh) static void MemorY_ErroR(const char *block, const char *error) { print_error("Memoryblock %s: %s\n",block, error); + +#ifdef WITH_ASSERT_ABORT + abort(); +#endif } static const char *check_memlist(MemHead *memh) diff --git a/intern/smoke/intern/MERSENNETWISTER.h b/intern/smoke/intern/MERSENNETWISTER.h index e976560bf17..116568c2834 100644 --- a/intern/smoke/intern/MERSENNETWISTER.h +++ b/intern/smoke/intern/MERSENNETWISTER.h @@ -132,7 +132,7 @@ protected: uint32 mixBits( const uint32& u, const uint32& v ) const { return hiBit(u) | loBits(v); } uint32 twist( const uint32& m, const uint32& s0, const uint32& s1 ) const - { return m ^ (mixBits(s0,s1)>>1) ^ (-loBit(s1) & 0x9908b0dfUL); } + { return m ^ (mixBits(s0,s1)>>1) ^ ((~loBit(s1) + 1) & 0x9908b0dfUL); } static uint32 hash( time_t t, clock_t c ); }; diff --git a/intern/string/STR_HashedString.h b/intern/string/STR_HashedString.h index bc4ca9e3d73..3565e622977 100644 --- a/intern/string/STR_HashedString.h +++ b/intern/string/STR_HashedString.h @@ -79,7 +79,7 @@ static inline dword STR_gHash(dword inDWord) key ^= (key >> 13); key += ~(key << 9); key ^= (key >> 17); - return key; + return key; } enum { GOLDEN_RATIO = 0x9e3779b9 }; // arbitrary value to initialize hash funtion, well not so arbitrary diff --git a/release/scripts/modules/bpy_extras/__init__.py b/release/scripts/modules/bpy_extras/__init__.py index fd653a4129c..7d74bc32f91 100644 --- a/release/scripts/modules/bpy_extras/__init__.py +++ b/release/scripts/modules/bpy_extras/__init__.py @@ -27,6 +27,7 @@ __all__ = ( "object_utils", "io_utils", "image_utils", + "keyconfig_utils", "mesh_utils", "view3d_utils", ) diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index 9482dc3e1c9..9848586a144 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -59,7 +59,7 @@ def bake_action(frame_start, :arg action: An action to bake the data into, or None for a new action to be created. :type action: :class:`bpy.types.Action` or None - + :return: an action or None :rtype: :class:`bpy.types.Action` """ @@ -115,7 +115,6 @@ def bake_action(frame_start, return info - def obj_frame_info(obj): info = {} # parent = obj.parent @@ -183,7 +182,8 @@ def bake_action(frame_start, pbone.constraints.remove(pbone.constraints[0]) for f in frame_range: - matrix = pose_info[(f - frame_start) // frame_step][name]["matrix_key"] + f_step = (f - frame_start) // frame_step + matrix = pose_info[f_step][name]["matrix_key"] # pbone.location = matrix.to_translation() # pbone.rotation_quaternion = matrix.to_quaternion() diff --git a/release/scripts/modules/bpy_extras/keyconfig_utils.py b/release/scripts/modules/bpy_extras/keyconfig_utils.py new file mode 100644 index 00000000000..e87db659918 --- /dev/null +++ b/release/scripts/modules/bpy_extras/keyconfig_utils.py @@ -0,0 +1,303 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +KM_HIERARCHY = [ + ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit + ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot + ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners + ]), + + ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) + ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation + ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region) + ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region) + + ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) + ('Object Mode', 'EMPTY', 'WINDOW', []), + ('Mesh', 'EMPTY', 'WINDOW', []), + ('Curve', 'EMPTY', 'WINDOW', []), + ('Armature', 'EMPTY', 'WINDOW', []), + ('Metaball', 'EMPTY', 'WINDOW', []), + ('Lattice', 'EMPTY', 'WINDOW', []), + ('Font', 'EMPTY', 'WINDOW', []), + + ('Pose', 'EMPTY', 'WINDOW', []), + + ('Vertex Paint', 'EMPTY', 'WINDOW', []), + ('Weight Paint', 'EMPTY', 'WINDOW', []), + ('Face Mask', 'EMPTY', 'WINDOW', []), + ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d + ('Sculpt', 'EMPTY', 'WINDOW', []), + + ('Armature Sketch', 'EMPTY', 'WINDOW', []), + ('Particle', 'EMPTY', 'WINDOW', []), + + ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change + + ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties + ]), + + ('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region) + ('Markers', 'EMPTY', 'WINDOW', []), # markers (per region) + ('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region) + ('Animation Channels', 'EMPTY', 'WINDOW', []), + ('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [ + ('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', []) + ]), + ('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', []), + ('NLA Editor', 'NLA_EDITOR', 'WINDOW', [ + ('NLA Channels', 'NLA_EDITOR', 'WINDOW', []), + ('NLA Generic', 'NLA_EDITOR', 'WINDOW', []) + ]), + + ('Image', 'IMAGE_EDITOR', 'WINDOW', [ + ('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image + ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d + ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', []) + ]), + + ('Timeline', 'TIMELINE', 'WINDOW', []), + ('Outliner', 'OUTLINER', 'WINDOW', []), + + ('Node Editor', 'NODE_EDITOR', 'WINDOW', [ + ('Node Generic', 'NODE_EDITOR', 'WINDOW', []) + ]), + ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []), + ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []), + + ('File Browser', 'FILE_BROWSER', 'WINDOW', [ + ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []), + ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', []) + ]), + + ('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu + + ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []), + ('Text', 'TEXT_EDITOR', 'WINDOW', []), + ('Console', 'CONSOLE', 'WINDOW', []), + + ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []), + ('Gesture Border', 'EMPTY', 'WINDOW', []), + ('Standard Modal Map', 'EMPTY', 'WINDOW', []), + ('Transform Modal Map', 'EMPTY', 'WINDOW', []), + ('View3D Fly Modal', 'EMPTY', 'WINDOW', []), + ('View3D Rotate Modal', 'EMPTY', 'WINDOW', []), + ('View3D Move Modal', 'EMPTY', 'WINDOW', []), + ('View3D Zoom Modal', 'EMPTY', 'WINDOW', []), + ] + + +# ----------------------------------------------------------------------------- +# Utility functions + +def km_exists_in(km, export_keymaps): + for km2, kc in export_keymaps: + if km2.name == km.name: + return True + return False + + +def keyconfig_merge(kc1, kc2): + """ note: kc1 takes priority over kc2 + """ + merged_keymaps = [(km, kc1) for km in kc1.keymaps] + if kc1 != kc2: + merged_keymaps.extend((km, kc2) for km in kc2.keymaps if not _km_exists_in(km, merged_keymaps)) + + return merged_keymaps + + +def keyconfig_export(wm, kc, filepath): + from bpy.types import OperatorProperties + + def string_value(value): + if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int): + result = repr(value) + elif getattr(value, '__len__', False): + return repr(list(value)) + else: + print("Export key configuration: can't write ", value) + + return result + + def export_properties(prefix, properties, lines=None): + if lines is None: + lines = [] + + for pname in properties.bl_rna.properties.keys(): + if pname != "rna_type" and not properties.is_property_hidden(pname): + value = getattr(properties, pname) + if isinstance(value, OperatorProperties): + export_properties(prefix + "." + pname, value, lines) + elif properties.is_property_set(pname): + value = string_value(value) + if value != "": + lines.append("%s.%s = %s\n" % (prefix, pname, value)) + return lines + + f = open(filepath, "w") + + f.write("import bpy\n") + f.write("import os\n\n") + f.write("wm = bpy.context.window_manager\n") + f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller + + # Generate a list of keymaps to export: + # + # First add all user_modified keymaps (found in keyconfigs.user.keymaps list), + # then add all remaining keymaps from the currently active custom keyconfig. + # + # This will create a final list of keymaps that can be used as a 'diff' against + # the default blender keyconfig, recreating the current setup from a fresh blender + # without needing to export keymaps which haven't been edited. + + class FakeKeyConfig(): + keymaps = [] + edited_kc = FakeKeyConfig() + for km in wm.keyconfigs.user.keymaps: + if km.is_user_modified: + edited_kc.keymaps.append(km) + # merge edited keymaps with non-default keyconfig, if it exists + if kc != wm.keyconfigs.default: + export_keymaps = keyconfig_merge(edited_kc, kc) + else: + export_keymaps = keyconfig_merge(edited_kc, edited_kc) + + for km, kc_x in export_keymaps: + + km = km.active() + + f.write("# Map %s\n" % km.name) + f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal)) + for kmi in km.keymap_items: + if km.is_modal: + f.write("kmi = km.keymap_items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value)) + else: + f.write("kmi = km.keymap_items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value)) + if kmi.any: + f.write(", any=True") + else: + if kmi.shift: + f.write(", shift=True") + if kmi.ctrl: + f.write(", ctrl=True") + if kmi.alt: + f.write(", alt=True") + if kmi.oskey: + f.write(", oskey=True") + if kmi.key_modifier and kmi.key_modifier != 'NONE': + f.write(", key_modifier='%s'" % kmi.key_modifier) + f.write(")\n") + + props = kmi.properties + + if props is not None: + f.write("".join(export_properties("kmi.properties", props))) + + f.write("\n") + + f.close() + + +def keyconfig_test(kc): + + def testEntry(kc, entry, src=None, parent=None): + result = False + + def kmistr(kmi): + if km.is_modal: + s = ["kmi = km.keymap_items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)] + else: + s = ["kmi = km.keymap_items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)] + + if kmi.any: + s.append(", any=True") + else: + if kmi.shift: + s.append(", shift=True") + if kmi.ctrl: + s.append(", ctrl=True") + if kmi.alt: + s.append(", alt=True") + if kmi.oskey: + s.append(", oskey=True") + if kmi.key_modifier and kmi.key_modifier != 'NONE': + s.append(", key_modifier=\'%s\'" % kmi.key_modifier) + + s.append(")\n") + + props = kmi.properties + + if props is not None: + export_properties("kmi.properties", props, s) + + return "".join(s).strip() + + idname, spaceid, regionid, children = entry + + km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) + + if km: + km = km.active() + + if src: + for item in km.keymap_items: + if src.compare(item): + print("===========") + print(parent.name) + print(kmistr(src)) + print(km.name) + print(kmistr(item)) + result = True + + for child in children: + if testEntry(kc, child, src, parent): + result = True + else: + for i in range(len(km.keymap_items)): + src = km.keymap_items[i] + + for child in children: + if testEntry(kc, child, src, km): + result = True + + for j in range(len(km.keymap_items) - i - 1): + item = km.keymap_items[j + i + 1] + if src.compare(item): + print("===========") + print(km.name) + print(kmistr(src)) + print(kmistr(item)) + result = True + + for child in children: + if testEntry(kc, child): + result = True + + return result + + # ------------------------------------------------------------------------- + # Function body + + result = False + for entry in KM_HIERARCHY: + if testEntry(kc, entry): + result = True + return result diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py index de953630f00..109ca758ea8 100644 --- a/release/scripts/startup/bl_operators/console.py +++ b/release/scripts/startup/bl_operators/console.py @@ -37,12 +37,14 @@ class ConsoleExec(Operator): if execute: return execute(context) else: - print("Error: bpy.ops.console.execute_" + sc.language + " - not found") + print("Error: bpy.ops.console.execute_%s - not found" % + sc.language) return {'FINISHED'} class ConsoleAutocomplete(Operator): - '''Evaluate the namespace up until the cursor and give a list of options or complete the name if there is only one''' + """Evaluate the namespace up until the cursor and give a list of """ \ + """options or complete the name if there is only one""" bl_idname = "console.autocomplete" bl_label = "Console Autocomplete" @@ -54,7 +56,8 @@ class ConsoleAutocomplete(Operator): if autocomplete: return autocomplete(context) else: - print("Error: bpy.ops.console.autocomplete_" + sc.language + " - not found") + print("Error: bpy.ops.console.autocomplete_%s - not found" % + sc.language) return {'FINISHED'} @@ -76,7 +79,8 @@ class ConsoleBanner(Operator): if banner: return banner(context) else: - print("Error: bpy.ops.console.banner_" + sc.language + " - not found") + print("Error: bpy.ops.console.banner_%s - not found" % + sc.language) return {'FINISHED'} @@ -103,4 +107,3 @@ class ConsoleLanguage(Operator): remove_duplicates=True) return {'FINISHED'} - diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py index 805f2b5105b..05b53219119 100644 --- a/release/scripts/startup/bl_operators/view3d.py +++ b/release/scripts/startup/bl_operators/view3d.py @@ -36,7 +36,10 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator): # totvert = mesh.total_vert_sel if select_mode[2] and totface == 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', + TRANSFORM_OT_translate={ + "constraint_orientation": 'NORMAL', + "constraint_axis": (False, False, True)}) elif select_mode[2] and totface > 1: bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN') elif select_mode[1] and totedge >= 1: @@ -44,7 +47,8 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator): else: bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN') - # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + # ignore return from operators above because they are 'RUNNING_MODAL', + # and cause this one not to be freed. [#24671] return {'FINISHED'} def invoke(self, context, event): @@ -64,13 +68,20 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator): # totvert = mesh.total_vert_sel if totface >= 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', + TRANSFORM_OT_translate={ + "constraint_orientation": 'NORMAL', + "constraint_axis": (False, False, True)}) elif totedge == 1: - bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)}) + bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', + TRANSFORM_OT_translate={ + "constraint_orientation": 'NORMAL', + "constraint_axis": (True, True, False)}) else: bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN') - # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671] + # ignore return from operators above because they are 'RUNNING_MODAL', + # and cause this one not to be freed. [#24671] return {'FINISHED'} def invoke(self, context, event): diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index fd2b14658ad..85e79914ce3 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1180,115 +1180,24 @@ class WM_OT_copy_prev_settings(Operator): return {'CANCELLED'} - + class WM_OT_keyconfig_test(Operator): "Test keyconfig for conflicts" bl_idname = "wm.keyconfig_test" bl_label = "Test Key Configuration for Conflicts" - def testEntry(self, kc, entry, src=None, parent=None): - result = False - - def kmistr(kmi): - if km.is_modal: - s = ["kmi = km.keymap_items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)] - else: - s = ["kmi = km.keymap_items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)] - - if kmi.any: - s.append(", any=True") - else: - if kmi.shift: - s.append(", shift=True") - if kmi.ctrl: - s.append(", ctrl=True") - if kmi.alt: - s.append(", alt=True") - if kmi.oskey: - s.append(", oskey=True") - if kmi.key_modifier and kmi.key_modifier != 'NONE': - s.append(", key_modifier=\'%s\'" % kmi.key_modifier) - - s.append(")\n") - - props = kmi.properties - - if props is not None: - export_properties("kmi.properties", props, s) - - return "".join(s).strip() - - idname, spaceid, regionid, children = entry - - km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) - - if km: - km = km.active() - - if src: - for item in km.keymap_items: - if src.compare(item): - print("===========") - print(parent.name) - print(kmistr(src)) - print(km.name) - print(kmistr(item)) - result = True - - for child in children: - if self.testEntry(kc, child, src, parent): - result = True - else: - for i in range(len(km.keymap_items)): - src = km.keymap_items[i] - - for child in children: - if self.testEntry(kc, child, src, km): - result = True - - for j in range(len(km.keymap_items) - i - 1): - item = km.keymap_items[j + i + 1] - if src.compare(item): - print("===========") - print(km.name) - print(kmistr(src)) - print(kmistr(item)) - result = True - - for child in children: - if self.testEntry(kc, child): - result = True - - return result - - def testConfig(self, kc): - result = False - for entry in KM_HIERARCHY: - if self.testEntry(kc, entry): - result = True - return result - def execute(self, context): + from bpy_extras import keyconfig_utils + wm = context.window_manager kc = wm.keyconfigs.default - if self.testConfig(kc): + if keyconfig_utils.keyconfig_test(kc): print("CONFLICT") return {'FINISHED'} -def _string_value(value): - if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int): - result = repr(value) - elif getattr(value, '__len__', False): - return repr(list(value)) - else: - print("Export key configuration: can't write ", value) - - return result - - class WM_OT_keyconfig_import(Operator): "Import key configuration from a python script" bl_idname = "wm.keyconfig_import" @@ -1321,6 +1230,7 @@ class WM_OT_keyconfig_import(Operator): ) def execute(self, context): + import os from os.path import basename import shutil @@ -1382,79 +1292,20 @@ class WM_OT_keyconfig_export(Operator): ) def execute(self, context): + from bpy_extras import keyconfig_utils + if not self.filepath: raise Exception("Filepath not set") if not self.filepath.endswith('.py'): self.filepath += '.py' - f = open(self.filepath, "w") - if not f: - raise Exception("Could not open file") - wm = context.window_manager - kc = wm.keyconfigs.active - - f.write("import bpy\n") - f.write("import os\n\n") - f.write("wm = bpy.context.window_manager\n") - f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller - - # Generate a list of keymaps to export: - # - # First add all user_modified keymaps (found in keyconfigs.user.keymaps list), - # then add all remaining keymaps from the currently active custom keyconfig. - # - # This will create a final list of keymaps that can be used as a 'diff' against - # the default blender keyconfig, recreating the current setup from a fresh blender - # without needing to export keymaps which haven't been edited. - - class FakeKeyConfig(): - keymaps = [] - edited_kc = FakeKeyConfig() - for km in wm.keyconfigs.user.keymaps: - if km.is_user_modified: - edited_kc.keymaps.append(km) - # merge edited keymaps with non-default keyconfig, if it exists - if kc != wm.keyconfigs.default: - export_keymaps = _merge_keymaps(edited_kc, kc) - else: - export_keymaps = _merge_keymaps(edited_kc, edited_kc) - - for km, kc_x in export_keymaps: - - km = km.active() - - f.write("# Map %s\n" % km.name) - f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal)) - for kmi in km.keymap_items: - if km.is_modal: - f.write("kmi = km.keymap_items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value)) - else: - f.write("kmi = km.keymap_items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value)) - if kmi.any: - f.write(", any=True") - else: - if kmi.shift: - f.write(", shift=True") - if kmi.ctrl: - f.write(", ctrl=True") - if kmi.alt: - f.write(", alt=True") - if kmi.oskey: - f.write(", oskey=True") - if kmi.key_modifier and kmi.key_modifier != 'NONE': - f.write(", key_modifier='%s'" % kmi.key_modifier) - f.write(")\n") - - props = kmi.properties - - if props is not None: - f.write("".join(export_properties("kmi.properties", props))) - f.write("\n") - - f.close() + keyconfig_utils.keyconfig_export(wm, + wm.keyconfigs.active, + self.filepath, + ) return {'FINISHED'} @@ -1596,8 +1447,8 @@ class WM_OT_operator_cheat_sheet(Operator): textblock.write('\n'.join(op_strings)) self.report({'INFO'}, "See OperatorList.txt textblock") return {'FINISHED'} - - + + class WM_OT_addon_enable(Operator): "Enable an addon" bl_idname = "wm.addon_enable" @@ -1683,6 +1534,7 @@ class WM_OT_addon_install(Operator): @staticmethod def _module_remove(path_addons, module): + import os module = os.path.splitext(module)[0] for f in os.listdir(path_addons): f_base = os.path.splitext(f)[0] @@ -1699,6 +1551,7 @@ class WM_OT_addon_install(Operator): import traceback import zipfile import shutil + import os pyfile = self.filepath @@ -1824,6 +1677,7 @@ class WM_OT_addon_remove(Operator): @staticmethod def path_from_addon(module): + import os import addon_utils for mod in addon_utils.modules(addon_utils.addons_fake_modules): @@ -1838,6 +1692,7 @@ class WM_OT_addon_remove(Operator): def execute(self, context): import addon_utils + import os path, isdir = WM_OT_addon_remove.path_from_addon(self.module) if path is None: diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 61093abe814..e4744fdb04f 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -72,7 +72,7 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel): flow.prop(arm, "use_deform_preserve_volume", text="Quaternion") if context.scene.render.engine == "BLENDER_GAME": - layout.row().prop(arm, "vert_deformer", expand=True) + layout.row().prop(arm, "deform_method", expand=True) class DATA_PT_display(ArmatureButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 26b95484b28..8cb73d2449b 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -204,19 +204,19 @@ class PHYSICS_PT_game_obstacles(PhysicsButtonsPanel, Panel): def poll(cls, context): game = context.object.game rd = context.scene.render - return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in cls.COMPAT_ENGINES) + return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES) def draw_header(self, context): game = context.active_object.game - self.layout.prop(game, "create_obstacle", text="") + self.layout.prop(game, "use_obstacle_create", text="") def draw(self, context): layout = self.layout game = context.active_object.game - layout.active = game.create_obstacle + layout.active = game.use_obstacle_create row = layout.row() row.prop(game, "obstacle_radius", text="Radius") diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py index 1c9ff6dda0e..5b00402520e 100644 --- a/release/scripts/startup/bl_ui/properties_material.py +++ b/release/scripts/startup/bl_ui/properties_material.py @@ -625,7 +625,7 @@ class MATERIAL_PT_game_settings(MaterialButtonsPanel, bpy.types.Panel): game = context.material.game_settings # dont use node material row = layout.row() - row.prop(game, "back_culling") + row.prop(game, "use_backface_culling") row.prop(game, "invisible") row.prop(game, "text") diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index d4378b0d094..eceefc70b5c 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -476,7 +476,12 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel): col.label(text="Integration:") col.prop(part, "integrator", text="") col.prop(part, "timestep") - col.prop(part, "subframes") + sub = col.row() + if part.adaptive_subframes: + sub.prop(part, "courant_target", text="Threshold") + else: + sub.prop(part, "subframes") + sub.prop(part, "adaptive_subframes", text="") row = layout.row() row.prop(part, "use_size_deflect") @@ -983,7 +988,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): col.label(text="Color:") col.prop(part, "draw_color", text="") sub = col.row() - sub.active = part.draw_color in ('VELOCITY', 'ACCELERATION') + sub.active = (part.draw_color in {'VELOCITY', 'ACCELERATION'}) sub.prop(part, "color_maximum", text="Max") if (path): diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index d711c37b8b5..cabd8356ad0 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -584,7 +584,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel): col = split.column() col.prop(strip, "filepath", text="") col.prop(strip, "mpeg_preseek", text="MPEG Preseek") - col.prop(strip, "streamindex", text="Stream Index") + col.prop(strip, "stream_index", text="Stream Index") # TODO, sound??? # end drawing filename diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index d0a3a53aa85..c3b2e30cb12 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -66,9 +66,11 @@ class TEXT_HT_header(Header): row = layout.row() if text.filepath: if text.is_dirty: - row.label(text="File" + ": *%r " % text.filepath + "(unsaved)") + row.label(text="File" + ": *%r " % + text.filepath + "(unsaved)") else: - row.label(text="File" + ": %r" % text.filepath) + row.label(text="File" + ": %r" % + text.filepath) else: row.label(text="Text: External" if text.library diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index dcf9a7d2d7f..79b13e3bec0 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -22,109 +22,6 @@ from bpy.types import Menu, OperatorProperties import os -KM_HIERARCHY = [ - ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit - ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot - ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners - ]), - - ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region) - ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation - ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region) - ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region) - - ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform) - ('Object Mode', 'EMPTY', 'WINDOW', []), - ('Mesh', 'EMPTY', 'WINDOW', []), - ('Curve', 'EMPTY', 'WINDOW', []), - ('Armature', 'EMPTY', 'WINDOW', []), - ('Metaball', 'EMPTY', 'WINDOW', []), - ('Lattice', 'EMPTY', 'WINDOW', []), - ('Font', 'EMPTY', 'WINDOW', []), - - ('Pose', 'EMPTY', 'WINDOW', []), - - ('Vertex Paint', 'EMPTY', 'WINDOW', []), - ('Weight Paint', 'EMPTY', 'WINDOW', []), - ('Face Mask', 'EMPTY', 'WINDOW', []), - ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d - ('Sculpt', 'EMPTY', 'WINDOW', []), - - ('Armature Sketch', 'EMPTY', 'WINDOW', []), - ('Particle', 'EMPTY', 'WINDOW', []), - - ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change - - ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties - ]), - - ('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region) - ('Markers', 'EMPTY', 'WINDOW', []), # markers (per region) - ('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region) - ('Animation Channels', 'EMPTY', 'WINDOW', []), - ('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [ - ('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', []) - ]), - ('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', []), - ('NLA Editor', 'NLA_EDITOR', 'WINDOW', [ - ('NLA Channels', 'NLA_EDITOR', 'WINDOW', []), - ('NLA Generic', 'NLA_EDITOR', 'WINDOW', []) - ]), - - ('Image', 'IMAGE_EDITOR', 'WINDOW', [ - ('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image - ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d - ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', []) - ]), - - ('Timeline', 'TIMELINE', 'WINDOW', []), - ('Outliner', 'OUTLINER', 'WINDOW', []), - - ('Node Editor', 'NODE_EDITOR', 'WINDOW', [ - ('Node Generic', 'NODE_EDITOR', 'WINDOW', []) - ]), - ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []), - ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []), - - ('File Browser', 'FILE_BROWSER', 'WINDOW', [ - ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []), - ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', []) - ]), - - ('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu - - ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []), - ('Text', 'TEXT_EDITOR', 'WINDOW', []), - ('Console', 'CONSOLE', 'WINDOW', []), - - ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []), - ('Gesture Border', 'EMPTY', 'WINDOW', []), - ('Standard Modal Map', 'EMPTY', 'WINDOW', []), - ('Transform Modal Map', 'EMPTY', 'WINDOW', []), - ('View3D Fly Modal', 'EMPTY', 'WINDOW', []), - ('View3D Rotate Modal', 'EMPTY', 'WINDOW', []), - ('View3D Move Modal', 'EMPTY', 'WINDOW', []), - ('View3D Zoom Modal', 'EMPTY', 'WINDOW', []), - ] - - -def _km_exists_in(km, export_keymaps): - for km2, kc in export_keymaps: - if km2.name == km.name: - return True - return False - - -def _merge_keymaps(kc1, kc2): - """ note: kc1 takes priority over kc2 - """ - merged_keymaps = [(km, kc1) for km in kc1.keymaps] - if kc1 != kc2: - merged_keymaps.extend((km, kc2) for km in kc2.keymaps if not _km_exists_in(km, merged_keymaps)) - - return merged_keymaps - - class USERPREF_MT_keyconfigs(Menu): bl_label = "KeyPresets" preset_subdir = "keyconfig" @@ -363,10 +260,13 @@ class InputKeyMapPanel: subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') def draw_hierarchy(self, display_keymaps, layout): - for entry in KM_HIERARCHY: + from bpy_extras import keyconfig_utils + for entry in keyconfig_utils.KM_HIERARCHY: self.draw_entry(display_keymaps, entry, layout) def draw_keymaps(self, context, layout): + from bpy_extras import keyconfig_utils + wm = context.window_manager kc = wm.keyconfigs.user @@ -393,7 +293,7 @@ class InputKeyMapPanel: col.separator() - display_keymaps = _merge_keymaps(kc, kc) + display_keymaps = keyconfig_utils.keyconfig_merge(kc, kc) if context.space_data.filter_text != "": filter_text = context.space_data.filter_text.lower() self.draw_filtered(display_keymaps, filter_text, col) @@ -401,20 +301,5 @@ class InputKeyMapPanel: self.draw_hierarchy(display_keymaps, col) -def export_properties(prefix, properties, lines=None): - if lines is None: - lines = [] - - for pname in properties.bl_rna.properties.keys(): - if pname != "rna_type" and not properties.is_property_hidden(pname): - value = getattr(properties, pname) - if isinstance(value, OperatorProperties): - export_properties(prefix + "." + pname, value, lines) - elif properties.is_property_set(pname): - value = _string_value(value) - if value != "": - lines.append("%s.%s = %s\n" % (prefix, pname, value)) - return lines - if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 96c62843436..8993c1ef96a 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -46,6 +46,7 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { int i; + int useconds; (void)stream; /* unused */ @@ -100,8 +101,9 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, break; case AVI_OPTION_FRAMERATE: - if (1000000/(*((double *) opt_data))) - movie->header->MicroSecPerFrame = 1000000/(*((double *) opt_data)); + useconds = (int)(1000000/(*((double *) opt_data))); + if (useconds) + movie->header->MicroSecPerFrame = useconds; for (i=0; i < movie->header->Streams; i++) { if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) { diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 4377d391354..1c36f3e1504 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -37,7 +37,7 @@ /* blf_translation.c */ -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL unsigned char *BLF_get_unifont(int *unifont_size); void BLF_free_unifont(void); #endif diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index b87a3b88f07..838a36d9fe2 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -55,7 +55,7 @@ if(WITH_INTERNATIONAL) list(APPEND INC_SYS ${GETTEXT_INC} ) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 45a55793856..1a86d0ad671 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -15,6 +15,6 @@ if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': defs.append('_WIN32') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_blenfont', sources, Split(incs), Split(defs), libtype=['core','player'], priority=[210,210] ) diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index b0b06bf059b..0a102884969 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -36,7 +36,7 @@ #include "BLF_api.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include <locale.h> @@ -158,7 +158,7 @@ void BLF_lang_set(const char *str) char *s; /* store defaul locale */ - strncpy(default_locale, env_language, sizeof(default_locale)); + BLI_strncpy(default_locale, env_language, sizeof(default_locale)); /* use first language as default */ s= strchr(default_locale, ':'); @@ -209,7 +209,7 @@ void BLF_lang_encoding(const char *str) /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } -#else /* ! INTERNATIONAL */ +#else /* ! WITH_INTERNATIONAL */ void BLF_lang_init(void) { @@ -228,4 +228,4 @@ void BLF_lang_set(const char *str) return; } -#endif /* INTERNATIONAL */ +#endif /* WITH_INTERNATIONAL */ diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index b53f4cf7609..8c0a26df4c2 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -32,7 +32,7 @@ #include <stdlib.h> -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include <libintl.h> #endif @@ -45,7 +45,7 @@ #include "BLF_translation.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL const char unifont_filename[]="droidsans.ttf.gz"; static unsigned char *unifont_ttf= NULL; static int unifont_size= 0; @@ -76,7 +76,7 @@ void BLF_free_unifont(void) const char* BLF_gettext(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if( msgid[0] ) return gettext( msgid ); return ""; diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 5b565223ece..c417b1efe4f 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -80,6 +80,10 @@ typedef struct ParticleSimulationData { struct ParticleSystem *psys; struct ParticleSystemModifierData *psmd; struct ListBase *colliders; + /* Courant number. This is used to implement an adaptive time step. Only the + maximum value per time step is important. Only sph_integrate makes use of + this at the moment. Other solvers could, too. */ + float courant_num; } ParticleSimulationData; typedef struct ParticleTexture{ diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index ac7e7de8f2a..e5a5818e0e8 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -354,7 +354,7 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { BME_TransData *vtd; - EditVert *eve1, *eve2, *eve3, *eve4, **evlist; + EditVert *eve1, /* *eve2, *eve3, *eve4, */ /* UNUSED */ **evlist; EditEdge *eed; EditFace *efa; @@ -411,14 +411,14 @@ void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) { len = BME_cycle_length(f->loopbase); if (len==3 || len==4) { eve1= evlist[f->loopbase->v->tflag1]; - eve2= evlist[f->loopbase->next->v->tflag1]; - eve3= evlist[f->loopbase->next->next->v->tflag1]; - if (len == 4) { + /* eve2= evlist[f->loopbase->next->v->tflag1]; */ /* UNUSED */ + /* eve3= evlist[f->loopbase->next->next->v->tflag1]; */ /* UNUSED */ + /* if (len == 4) { eve4= evlist[f->loopbase->prev->v->tflag1]; } else { eve4= NULL; - } + } */ /* UNUSED */ efa = NULL; //XXX addfacelist(eve1, eve2, eve3, eve4, NULL, NULL); efa->mat_nr = (unsigned char)f->mat_nr; @@ -540,7 +540,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) MEdge *medge, *me; MVert *mvert, *mv; int *origindex; - int totface,totedge,totvert,i,bmeshok,len, numTex, numCol; + int totface, totedge, totvert, i, /* bmeshok, */ /* UNUSED */ len, numTex, numCol; BME_Vert *v1=NULL; BME_Edge *e=NULL, *oe=NULL; @@ -568,7 +568,7 @@ DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm) /*count quads and tris*/ totface = 0; - bmeshok = 1; + /* bmeshok = 1; */ /* UNUSED */ for(f=bm->polys.first;f;f=f->next){ len = BME_cycle_length(f->loopbase); if(len == 3 || len == 4) totface++; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 73ddcbecf94..8d18a1c27e7 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -270,7 +270,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[]) /* make it selected, with default name */ agrp->flag = AGRP_SELECTED; - strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); + BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); /* add to action, and validate */ BLI_addtail(&act->groups, agrp); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 22278fe29ba..63c6d35a1d8 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -518,7 +518,7 @@ void BKE_write_undo(bContext *C, const char *name) /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); /* and limit amount to the maximum */ diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 099661f7914..295669c98c0 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1827,7 +1827,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float return 1; } int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors) -{ +{ unsigned int i=0; float step=0.0f, tf=clmd->sim_parms->timescale; Cloth *cloth = clmd->clothObject; @@ -1981,7 +1981,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase } void implicit_set_positions (ClothModifierData *clmd) -{ +{ Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; unsigned int numverts = cloth->numverts, i; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5acd6c169a0..b885e608b15 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -317,7 +317,7 @@ static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index) /* ShapeKey types * NOTE: as we don't have access to the keyblock where the data comes from (for now), - * we'll just use numerical indices for now... + * we'll just use numerical indices for now... */ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { @@ -1103,7 +1103,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c agrp->flag = AGRP_SELECTED; if (muteipo) agrp->flag |= AGRP_MUTED; - strncpy(agrp->name, grpname, sizeof(agrp->name)); + BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); BLI_addtail(&tmp_act.groups, agrp); BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 7d0525dc903..3ec47f344c5 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1493,10 +1493,10 @@ KeyBlock *add_keyblock(Key *key, const char *name) tot= BLI_countlist(&key->block); if(name) { - strncpy(kb->name, name, sizeof(kb->name)); + BLI_strncpy(kb->name, name, sizeof(kb->name)); } else { - if(tot==1) strcpy(kb->name, "Basis"); - else sprintf(kb->name, "Key %d", tot-1); + if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name)); + else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1); } BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f5df6efd622..a25da56d573 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -193,7 +193,7 @@ void init_material(Material *ma) ma->vol.ms_diff = 1.f; ma->vol.ms_intensity = 1.f; - ma->game.flag=0; + ma->game.flag = GEMAT_BACKCULL; ma->game.alpha_blend=0; ma->game.face_orientation=0; @@ -1283,7 +1283,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, const float c *g=1.0f; else *g = tmp; - + tmp = facm + fac*col[2]; if(tmp <= 0.0f) *b = 0.0f; @@ -1772,7 +1772,7 @@ int do_version_tface(Main *main, int fileload) int flag; int index; - /* sometimes mesh has no materials but will need a new one. In those + /* sometimes mesh has no materials but will need a new one. In those * cases we need to ignore the mf->mat_nr and only look at the face * mode because it can be zero as uninitialized or the 1st created material */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 524a63a8a95..f0be3c99f13 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1682,7 +1682,7 @@ void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwid void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *)) { if (storagename) - strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); + BLI_strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); else ntype->storagename[0] = '\0'; ntype->copystoragefunc = copystoragefunc; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ad870bb0bb8..7abdf6d1daa 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3490,6 +3490,7 @@ static void default_particle_settings(ParticleSettings *part) part->totpart= 1000; part->grid_res= 10; part->timetweak= 1.0; + part->courant_target = 0.2; part->integrator= PART_INT_MIDPOINT; part->phystype= PART_PHYS_NEWTON; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 8bb783abb80..3264614fff9 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -26,6 +26,9 @@ * * Contributor(s): Raul Fernandez Hernandez (Farsthary), Stephen Swhitehorn. * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -2321,6 +2324,10 @@ typedef struct SPHRangeData float massfac; int use_size; + + /* Same as SPHData::element_size */ + float element_size; + float flow[3]; } SPHRangeData; typedef struct SPHData { ParticleSystem *psys[10]; @@ -2328,12 +2335,17 @@ typedef struct SPHData { float mass; EdgeHash *eh; float *gravity; + /* Average distance to neighbours (other particles in the support domain), + for calculating the Courant number (adaptive time step). */ + float element_size; + float flow[3]; }SPHData; static void sph_density_accum_cb(void *userdata, int index, float squared_dist) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; float q; + float dist; if(npa == pfr->pa || squared_dist < FLT_EPSILON) return; @@ -2344,12 +2356,16 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist) */ if(pfr->tot_neighbors >= 128) return; - + pfr->neighbors[pfr->tot_neighbors].index = index; pfr->neighbors[pfr->tot_neighbors].psys = pfr->npsys; pfr->tot_neighbors++; - q = (1.f - sqrtf(squared_dist)/pfr->h) * pfr->massfac; + dist = sqrtf(squared_dist); + q = (1.f - dist/pfr->h) * pfr->massfac; + + add_v3_v3(pfr->flow, npa->state.vel); + pfr->element_size += dist; if(pfr->use_size) q *= npa->size; @@ -2397,6 +2413,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa pfr.density = pfr.near_density = 0.f; pfr.h = h; pfr.pa = pa; + pfr.element_size = fluid->radius; + pfr.flow[0] = pfr.flow[1] = pfr.flow[2] = 0.0f; for(i=0; i<10 && psys[i]; i++) { pfr.npsys = psys[i]; @@ -2405,6 +2423,14 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa BLI_bvhtree_range_query(psys[i]->bvhtree, state->co, h, sph_density_accum_cb, &pfr); } + if (pfr.tot_neighbors > 0) { + pfr.element_size /= pfr.tot_neighbors; + mul_v3_fl(pfr.flow, 1.0f / pfr.tot_neighbors); + } else { + pfr.element_size = MAXFLOAT; + } + sphdata->element_size = pfr.element_size; + VECCOPY(sphdata->flow, pfr.flow); pressure = stiffness * (pfr.density - rest_density); near_pressure = stiffness_near_fac * pfr.near_density; @@ -2471,7 +2497,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa madd_v3_v3fl(force, gravity, fluid->buoyancy * (pfr.density-rest_density)); } -static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash){ +static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash, float *element_size, float flow[3]) { ParticleTarget *pt; int i; @@ -2491,6 +2517,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d sphdata.gravity = gravity; sphdata.mass = pa_mass; sphdata.eh = springhash; + //sphdata.element_size and sphdata.flow are set in the callback. /* restore previous state and treat gravity & effectors as external acceleration*/ sub_v3_v3v3(effector_acceleration, pa->state.vel, pa->prev_state.vel); @@ -2499,6 +2526,8 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d copy_particle_key(&pa->state, &pa->prev_state, 0); integrate_particle(part, pa, dtime, effector_acceleration, sph_force_cb, &sphdata); + *element_size = sphdata.element_size; + VECCOPY(flow, sphdata.flow); } /************************************************/ @@ -3582,6 +3611,49 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ root->co[0] = root->co[1] = root->co[2] = 0.0f; } } + +/* Code for an adaptive time step based on the Courant-Friedrichs-Lewy + condition. */ +#define MIN_TIMESTEP 1.0f / 101.0f +/* Tolerance of 1.5 means the last subframe neither favours growing nor + shrinking (e.g if it were 1.3, the last subframe would tend to be too + small). */ +#define TIMESTEP_EXPANSION_TOLERANCE 1.5f + +/* Calculate the speed of the particle relative to the local scale of the + simulation. This should be called once per particle during a simulation + step, after the velocity has been updated. element_size defines the scale of + the simulation, and is typically the distance to neighbourning particles. */ +void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, + float dtime, float element_size, float flow[3]) +{ + float relative_vel[3]; + float speed; + + sub_v3_v3v3(relative_vel, pa->state.vel, flow); + speed = len_v3(relative_vel); + if (sim->courant_num < speed * dtime / element_size) + sim->courant_num = speed * dtime / element_size; +} +/* Update time step size to suit current conditions. */ +float update_timestep(ParticleSystem *psys, ParticleSimulationData *sim, + float t_frac) +{ + if (sim->courant_num == 0.0f) + psys->dt_frac = 1.0f; + else + psys->dt_frac *= (psys->part->courant_target / sim->courant_num); + CLAMP(psys->dt_frac, MIN_TIMESTEP, 1.0f); + + /* Sync with frame end if it's close. */ + if (t_frac == 1.0f) + return psys->dt_frac; + else if (t_frac + (psys->dt_frac * TIMESTEP_EXPANSION_TOLERANCE) >= 1.0f) + return 1.0f - t_frac; + else + return psys->dt_frac; +} + /************************************************/ /* System Core */ /************************************************/ @@ -3597,7 +3669,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) /* frame & time changes */ float dfra, dtime; float birthtime, dietime; - + /* where have we gone in time since last time */ dfra= cfra - psys->cfra; @@ -3735,6 +3807,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { EdgeHash *springhash = sph_springhash_build(psys); float *gravity = NULL; + float element_size, flow[3]; if(psys_uses_gravity(sim)) gravity = sim->scene->physics_settings.gravity; @@ -3744,13 +3817,17 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) basic_integrate(sim, p, pa->state.time, cfra); /* actual fluids calculations */ - sph_integrate(sim, pa, pa->state.time, gravity, springhash); + sph_integrate(sim, pa, pa->state.time, gravity, springhash, + &element_size, flow); if(sim->colliders) collision_check(sim, p, pa->state.time, cfra); /* SPH particles are not physical particles, just interpolation particles, thus rotation has not a direct sense for them */ basic_rotate(part, pa, pa->state.time, timestep); + + if (part->time_flag & PART_TIME_AUTOSF) + update_courant_num(sim, pa, dtime, element_size, flow); } sph_springs_modify(psys, timestep); @@ -3952,6 +4029,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU return totpart - oldtotpart; } + /* Calculates the next state for all particles of the system * In particles code most fra-ending are frames, time-ending are fra*timestep (seconds) * 1. Emit particles @@ -4057,23 +4135,39 @@ static void system_step(ParticleSimulationData *sim, float cfra) } if(psys->totpart) { - int dframe, subframe = 0, totframesback = 0, totsubframe = part->subframes+1; - float fraction; - + int dframe, totframesback = 0; + float t_frac, dt_frac; + /* handle negative frame start at the first frame by doing * all the steps before the first frame */ if((int)cfra == startframe && part->sta < startframe) totframesback = (startframe - (int)part->sta); - + + if (!(part->time_flag & PART_TIME_AUTOSF)) { + /* Constant time step */ + psys->dt_frac = 1.0f / (float) (part->subframes + 1); + } else if ((int)cfra == startframe) { + /* Variable time step; use a very conservative value at the start. + * If it doesn't need to be so small, it will quickly grow. */ + psys->dt_frac = 1.0; + } else if (psys->dt_frac < MIN_TIMESTEP) { + psys->dt_frac = MIN_TIMESTEP; + } + for(dframe=-totframesback; dframe<=0; dframe++) { - /* ok now we're all set so let's go */ - for (subframe = 1; subframe <= totsubframe; subframe++) { - fraction = (float)subframe/(float)totsubframe; - dynamics_step(sim, cfra+dframe+fraction - 1.f); - psys->cfra = cfra+dframe+fraction - 1.f; + /* simulate each subframe */ + dt_frac = psys->dt_frac; + for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) { + sim->courant_num = 0.0f; + dynamics_step(sim, cfra+dframe+t_frac - 1.f); + psys->cfra = cfra+dframe+t_frac - 1.f; +#if 0 + printf("%f,%f,%f,%f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num); +#endif + if (part->time_flag & PART_TIME_AUTOSF) + dt_frac = update_timestep(psys, sim, t_frac); } } - } /* 4. only write cache starting from second frame */ diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 1454b3f0ce3..6741ff2d018 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -428,7 +428,7 @@ Scene *add_scene(const char *name) sce->toolsettings->skgen_resolution = 100; sce->toolsettings->skgen_threshold_internal = 0.01f; sce->toolsettings->skgen_threshold_external = 0.01f; - sce->toolsettings->skgen_angle_limit = 45.0f; + sce->toolsettings->skgen_angle_limit = 45.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index e5d74177c91..70b44792b30 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -41,6 +41,7 @@ #include "BLI_math.h" /* windows needs for M_PI */ #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -177,7 +178,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) MEM_freeN(info); cp= BLI_dynlib_find_symbol(pis->handle, "seqname"); - if(cp) strncpy(cp, seqname, 21); + if(cp) BLI_strncpy(cp, seqname, 21); } else { printf ("Plugin returned unrecognized version number\n"); return; @@ -203,7 +204,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname) pis= MEM_callocN(sizeof(PluginSeq), "PluginSeq"); - strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(pis->name, str, FILE_MAX); open_plugin_seq(pis, seqname); if(pis->doit==NULL) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a3237da6234..743111b925f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3653,7 +3653,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo calc_sequence_disp(scene, seq); /* last active name */ - strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, strip->dir, FILE_MAXDIR); seq_load_apply(scene, seq, seq_load); diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d13d15d1269..15cb3b66db7 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -257,7 +257,11 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) struct timeval tv; struct sockaddr_in addr; int len, rval; +#ifdef FREE_WINDOWS + int socklen; +#else unsigned int socklen; +#endif char buf[4096]; if (connsock != -1) { diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 32ac5359721..8654975a0e8 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -346,7 +346,7 @@ static int map_insert_vert(PBVH *bvh, GHash *map, if(!BLI_ghash_haskey(map, key)) { if(BLI_bitmap_get(bvh->vert_bitmap, vertex)) { - value = SET_INT_IN_POINTER(-(*face_verts) - 1); + value = SET_INT_IN_POINTER(~(*face_verts)); ++(*face_verts); } else { diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 04a6d15a0ea..8be86a4b407 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -478,17 +478,17 @@ LinkNode *BLI_read_file_as_lines(const char *name) FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; char *buf; - int64_t size; + size_t size; if (!fp) return NULL; fseek(fp, 0, SEEK_END); - size= ftell(fp); + size= (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); buf= MEM_mallocN(size, "file_as_lines"); if (buf) { - int i, last= 0; + size_t i, last= 0; /* * size = because on win32 reading diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 66080ed2a85..bf816a91fb3 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -301,7 +301,7 @@ char* dirname(char *path) { char *p; if( path == NULL || *path == '\0' ) - return "."; + return "."; p = path + strlen(path) - 1; while( *p == '/' ) { if( p == path ) @@ -309,11 +309,11 @@ char* dirname(char *path) *p-- = '\0'; } while( p >= path && *p != '/' ) - p--; + p--; return - p < path ? "." : - p == path ? "/" : - (*p = '\0', path); + p < path ? "." : + p == path ? "/" : + (*p = '\0', path); } /* End of copied part */ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index fcb05bf2eef..829e1ddcc76 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -518,7 +518,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat BLI_addtail(mainlist, m); lib= alloc_libblock(&m->library, ID_LI, "lib"); - strncpy(lib->name, filepath, sizeof(lib->name)-1); + BLI_strncpy(lib->name, filepath, sizeof(lib->name)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); m->curlib= lib; @@ -5680,7 +5680,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) * link into an unsaved blend file. See [#27405]. * The remap relative option will make it relative again on save - campbell */ if (strncmp(lib->name, "//", 2)==0) { - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); } } } @@ -5689,7 +5689,7 @@ static void fix_relpaths_library(const char *basepath, Main *main) /* Libraries store both relative and abs paths, recreate relative paths, * relative to the blend file since indirectly linked libs will be relative to their direct linked library */ if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */ - strncpy(lib->name, lib->filepath, sizeof(lib->name)); + BLI_strncpy(lib->name, lib->filepath, sizeof(lib->name)); BLI_path_rel(lib->name, basepath); } } @@ -10051,7 +10051,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) sce->toolsettings->skgen_resolution = 250; sce->toolsettings->skgen_threshold_internal = 0.1f; sce->toolsettings->skgen_threshold_external = 0.1f; - sce->toolsettings->skgen_angle_limit = 30.0f; + sce->toolsettings->skgen_angle_limit = 30.0f; sce->toolsettings->skgen_length_ratio = 1.3f; sce->toolsettings->skgen_length_limit = 1.5f; sce->toolsettings->skgen_correlation_limit = 0.98f; @@ -12132,7 +12132,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { - + { + /* Adaptive time step for particle systems */ + ParticleSettings *part; + for (part = main->particle.first; part; part = part->id.next) { + part->courant_target = 0.2f; + part->time_flag &= ~PART_TIME_AUTOSF; + } + } } //set defaults for obstacle avoidance, recast data @@ -12148,7 +12155,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(sce->gm.recastData.cellheight == 0.0f) sce->gm.recastData.cellheight = 0.2f; if(sce->gm.recastData.agentmaxslope == 0.0f) - sce->gm.recastData.agentmaxslope = M_PI/4; + sce->gm.recastData.agentmaxslope = (float)M_PI/4; if(sce->gm.recastData.agentmaxclimb == 0.0f) sce->gm.recastData.agentmaxclimb = 0.9f; if(sce->gm.recastData.agentheight == 0.0f) @@ -12299,7 +12306,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1); + BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); while(bhead) { switch(bhead->code) { diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index a176b6eb4cd..9d96814c403 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -603,7 +603,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { FCurve * fcu = *iter; BLI_addtail(AnimCurves, fcu); - } + } } @@ -621,16 +621,16 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list //all the curves belonging to the current binding std::vector<FCurve*> animcurves; for (unsigned int j = 0; j < bindings.getCount(); j++) { - animcurves = curve_map[bindings[j].animation]; - - BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); - modify_fcurve(&animcurves, rna_path, 0 ); - std::vector<FCurve*>::iterator iter; - //Add the curves of the current animation to the object - for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { - FCurve * fcu = *iter; - BLI_addtail(AnimCurves, fcu); - } + animcurves = curve_map[bindings[j].animation]; + + BLI_strncpy(rna_path, anim_type , sizeof(rna_path)); + modify_fcurve(&animcurves, rna_path, 0 ); + std::vector<FCurve*>::iterator iter; + //Add the curves of the current animation to the object + for (iter = animcurves.begin(); iter != animcurves.end(); iter++) { + FCurve * fcu = *iter; + BLI_addtail(AnimCurves, fcu); + } } } diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2f5d9e54e50..a6757329ea1 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -466,7 +466,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T if (has_normals && mp->getPositionIndices().getCount() != mp->getNormalIndices().getCount()) { fprintf(stderr, "Warning: Number of normals is different from the number of vertcies, skipping normals\n"); - has_normals = false; + has_normals = false; } unsigned int j, k; diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 373d351fb6c..e8af5a8f290 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3051,7 +3051,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi /* Draw a widget for some setting */ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting) { - short negflag, ptrsize, enabled, butType; + short negflag, ptrsize /* , enabled */ /* UNUSED */, butType; int flag, icon; void *ptr; const char *tooltip; @@ -3060,7 +3060,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan /* get the flag and the pointer to that flag */ flag= acf->setting_flag(ac, setting, &negflag); ptr= acf->setting_ptr(ale, setting, &ptrsize); - enabled= ANIM_channel_setting_get(ac, ale, setting); + /* enabled= ANIM_channel_setting_get(ac, ale, setting); */ /* UNUSED */ /* get the base icon for the setting */ switch (setting) { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index d58d51c8e08..7f05a7c2b1a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -366,7 +366,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 77c67fc4af0..d329874e1ba 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -112,7 +112,7 @@ static void delete_fmodifier_cb (bContext *C, void *fmods_v, void *fcm_v) static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width) { FMod_Generator *data= (FMod_Generator *)fcm->data; - uiLayout *col, *row; + uiLayout /* *col, */ /* UNUSED */ *row; uiBlock *block; uiBut *but; PointerRNA ptr; @@ -121,7 +121,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr); /* basic settings (backdrop + mode selector + some padding) */ - col= uiLayoutColumn(layout, 1); + /* col= uiLayoutColumn(layout, 1); */ /* UNUSED */ block= uiLayoutGetBlock(layout); uiBlockBeginAlign(block); but= uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width-30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL); @@ -521,7 +521,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* draw settings for limits modifier */ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { - uiLayout *split, *col, *row; + uiLayout *split, *col /* , *row */ /* UNUSED */; PointerRNA ptr; /* init the RNA-pointer */ @@ -529,7 +529,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 1: minimum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); @@ -547,7 +547,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* row 2: maximum */ { - row= uiLayoutRow(layout, 0); + /* row= uiLayoutRow(layout, 0); */ /* UNUSED */ /* split into 2 columns */ split= uiLayoutSplit(layout, 0.5f, 0); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 58e1549c0ed..b52550832c3 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -540,8 +540,8 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop) /* get first constraint and determine type of keyframe constraints to check for * - constraints can be on either Objects or PoseChannels, so we only check if the - * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for - * those structs, allowing us to identify the owner of the data + * ptr->type is RNA_Object or RNA_PoseBone, which are the RNA wrapping-info for + * those structs, allowing us to identify the owner of the data */ if (ptr->type == &RNA_Object) { /* Object */ diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b750bd5ef1c..14891826260 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1889,7 +1889,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) RigEdge *edge; int large_angle = 0; float avg_angle = 0; - float avg_length = 0; + /* float avg_length = 0; */ /* UNUSED */ int nb_edges = 0; @@ -1901,7 +1901,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) avg_angle /= nb_edges - 1; /* -1 because last edge doesn't have an angle */ - avg_length = iarc->length / nb_edges; + /* avg_length = iarc->length / nb_edges; */ /* UNUSED */ if (nb_edges > 2) @@ -2202,7 +2202,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, float angle_weight = 1.0; // GET FROM CONTEXT float length_weight = 1.0; float distance_weight = 1.0; +#ifndef USE_THREADS float min_cost = FLT_MAX; +#endif float *vec0, *vec1; int *best_positions; int nb_edges = BLI_countlist(&iarc->edges); @@ -2245,7 +2247,9 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, int nb_positions = earc->bcount; int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1); MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table"); +#ifndef USE_THREADS MemoNode *result; +#endif float **positions_cache = MEM_callocN(sizeof(float*) * (nb_positions + 2), "positions cache"); int i; @@ -2260,11 +2264,15 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, positions_cache[i] = bucket->p; } +#ifndef USE_THREADS result = solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); - min_cost = result->weight; +#else + solveJoints(table, iter, positions_cache, nb_joints, earc->bcount, 0, 0, iarc->edges.first, nb_joints, angle_weight, length_weight, distance_weight); +#endif + copyMemoPositions(best_positions, table, earc->bcount, nb_joints); - + MEM_freeN(table); MEM_freeN(positions_cache); } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 8a7d837d2a8..bf2e17c4e87 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -993,7 +993,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) memcpy(&tempstr[index+1], &pld->searchstr[index], 64-index); } else { - strncpy(tempstr, pld->searchstr, 64); + BLI_strncpy(tempstr, pld->searchstr, sizeof(tempstr)); } /* get marker name */ diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 0522b24ae91..c60ea467f8c 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -1354,11 +1354,11 @@ static int joinSubgraphsEnds(ReebGraph *rg, float threshold, int nb_subgraphs) if (end_node && start_node) { - ReebArc *start_arc, *end_arc; + ReebArc *start_arc /* , *end_arc */ /* UNUSED */; int merging = 0; start_arc = start_node->arcs[0]; - end_arc = end_node->arcs[0]; + /* end_arc = end_node->arcs[0]; */ /* UNUSED */ if (start_arc->tail == start_node) { diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index b730913a368..3c810f7da2d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -426,7 +426,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, /* Flush visibility (for Graph Editor) changes up/down hierarchy for changes in the given setting * - anim_data: list of the all the anim channels that can be chosen * -> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too, - * then the channels under closed expanders get ignored... + * then the channels under closed expanders get ignored... * - ale_setting: the anim channel (not in the anim_data list directly, though occuring there) * with the new state of the setting that we want flushed up/down the hierarchy * - setting: type of setting to set diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index f5abebbebd5..4a895472b33 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -34,6 +34,7 @@ #ifndef UI_INTERFACE_H #define UI_INTERFACE_H +#include "BLO_sys_types.h" /* size_t */ #include "RNA_types.h" #include "DNA_userdef_types.h" @@ -576,7 +577,7 @@ void uiButSetFocusOnEnter (struct wmWindow *win, uiBut *but); typedef struct AutoComplete AutoComplete; -AutoComplete *autocomplete_begin(const char *startname, int maxlen); +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen); void autocomplete_do_name(AutoComplete *autocpl, const char *name); void autocomplete_end(AutoComplete *autocpl, char *autoname); diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index b6837a4b3c9..54400accbc2 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -50,8 +50,8 @@ typedef struct IconFile { #define ICON_DEFAULT_HEIGHT 16 #define ICON_DEFAULT_WIDTH 16 -#define ICON_DEFAULT_HEIGHT_SCALE (UI_UNIT_Y * 0.8f) -#define ICON_DEFAULT_WIDTH_SCALE (UI_UNIT_X * 0.8f) +#define ICON_DEFAULT_HEIGHT_SCALE ((int)(UI_UNIT_Y * 0.8f)) +#define ICON_DEFAULT_WIDTH_SCALE ((int)(UI_UNIT_X * 0.8f)) #define PREVIEW_DEFAULT_HEIGHT 96 diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index cc4c1eaa21c..678be82f160 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -60,7 +60,7 @@ set(SRC ) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_HEADLESS) diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index 54390baadb9..2d6d5cd235e 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -14,7 +14,7 @@ incs += ' ../../python/' # python button eval defs = [] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 32fe0fb86f9..aad67b6b0be 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -96,7 +96,7 @@ static void ui_free_but(const bContext *C, uiBut *but); int UI_translate_iface(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_IFACE); #else return 0; @@ -105,7 +105,7 @@ int UI_translate_iface(void) int UI_translate_tooltips(void) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL return (U.transopts & USER_DOTRANSLATE) && (U.transopts & USER_TR_TOOLTIPS); #else return 0; @@ -114,7 +114,7 @@ int UI_translate_tooltips(void) const char *UI_translate_do_iface(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_iface()) return BLF_gettext(msgid); else @@ -126,7 +126,7 @@ const char *UI_translate_do_iface(const char *msgid) const char *UI_translate_do_tooltip(const char *msgid) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) return BLF_gettext(msgid); else @@ -1528,7 +1528,7 @@ static double ui_get_but_scale_unit(uiBut *but, double value) } /* str will be overwritten */ -void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) +void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen) { if(ui_is_but_unit(but)) { UnitSettings *unit= but->block->unit; @@ -1576,7 +1576,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default) } -void ui_get_but_string(uiBut *but, char *str, int maxlen) +void ui_get_but_string(uiBut *but, char *str, size_t maxlen) { if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { PropertyType type; @@ -2143,8 +2143,8 @@ void ui_check_but(uiBut *but) UI_GET_BUT_VALUE_INIT(but, value) if(ui_is_but_float(but)) { - if(value == (double) FLT_MAX) sprintf(but->drawstr, "%sinf", but->str); - else if(value == (double) -FLT_MAX) sprintf(but->drawstr, "%s-inf", but->str); + if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); + else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); /* support length type buttons */ else if(ui_is_but_unit(but)) { char new_str[sizeof(but->drawstr)]; @@ -2157,7 +2157,7 @@ void ui_check_but(uiBut *but) } } else { - sprintf(but->drawstr, "%s%d", but->str, (int)value); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value); } if(but->rnaprop) { @@ -2176,7 +2176,7 @@ void ui_check_but(uiBut *but) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); } else { - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } break; @@ -2194,7 +2194,7 @@ void ui_check_but(uiBut *but) break; case KEYEVT: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); if (but->flag & UI_SELECT) { strcat(but->drawstr, "Press a key"); } @@ -2226,15 +2226,15 @@ void ui_check_but(uiBut *but) strcat(but->drawstr, "Press a key "); } else - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); break; case BUT_TOGDUAL: /* trying to get the dual-icon to left of text... not very nice */ if(but->str[0]) { - strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); - strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); + BLI_strncpy(but->drawstr, " ", UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2); } break; @@ -2242,13 +2242,13 @@ void ui_check_but(uiBut *but) case HSVCIRCLE: break; default: - strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); } /* if we are doing text editing, this will override the drawstr */ if(but->editstr) - strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); + BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR); /* text clipping moved to widget drawing code itself */ } @@ -2741,7 +2741,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, if ((!tip || tip[0]=='\0') && ot && ot->description) { tip= ot->description; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(UI_translate_tooltips()) tip= BLF_gettext(tip); #endif @@ -2822,12 +2822,12 @@ static int findBitIndex(unsigned int x) { /* autocomplete helper functions */ struct AutoComplete { - int maxlen; + size_t maxlen; char *truncate; const char *startname; }; -AutoComplete *autocomplete_begin(const char *startname, int maxlen) +AutoComplete *autocomplete_begin(const char *startname, size_t maxlen) { AutoComplete *autocpl; diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 1113f90a652..c35996701ee 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -83,7 +83,7 @@ void ui_but_anim_flag(uiBut *but, float cfra) } } -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen) +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen) { FCurve *fcu; ChannelDriver *driver; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a1275e237c1..b65be48f7ee 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_colortools.h" @@ -500,7 +501,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w } #if 0 -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_draw_but_CHARTAB(uiBut *but) { /* XXX 2.50 bad global access */ @@ -670,7 +671,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) } } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL #endif static void draw_scope_end(rctf *rect, GLint *scissor) @@ -835,7 +836,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* draw grid lines here */ for (i=0; i<6; i++) { char str[4]; - sprintf(str,"%-3d",i*20); + BLI_snprintf(str, sizeof(str), "%-3d",i*20); str[3]='\0'; fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h); BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 125928c136b..568eaf358e5 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -631,7 +631,7 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat data->applied= 1; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data) { ui_apply_but_func(C, but); @@ -1023,7 +1023,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case IDPOIN: ui_apply_but_IDPOIN(C, but, data); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: ui_apply_but_CHARTAB(C, but, data); break; @@ -1113,9 +1113,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if(but->poin==NULL && but->rnapoin.data==NULL); else if(mode=='c') { if(ui_is_but_float(but)) - sprintf(buf, "%f", ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%f", ui_get_but_val(but)); else - sprintf(buf, "%d", (int)ui_get_but_val(but)); + BLI_snprintf(buf, sizeof(buf), "%d", (int)ui_get_but_val(but)); WM_clipboard_text_set(buf, 0); } @@ -1136,7 +1136,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, else if(mode=='c') { ui_get_but_vectorf(but, rgb); - sprintf(buf, "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); + BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]); WM_clipboard_text_set(buf, 0); } @@ -3924,7 +3924,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand return WM_UI_HANDLER_CONTINUE; } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ @@ -4367,7 +4367,7 @@ static int ui_but_menu(bContext *C, uiBut *but) PointerRNA ptr_props; if(but->rnapoin.data && but->rnaprop) { - sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); WM_operator_properties_create(&ptr_props, "WM_OT_doc_view"); RNA_string_set(&ptr_props, "doc_id", buf); @@ -4584,7 +4584,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) case HSVCIRCLE: retval= ui_do_but_HSVCIRCLE(C, block, but, data, event); break; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL case CHARTAB: retval= ui_do_but_CHARTAB(C, block, but, data, event); break; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 72eb869dea0..94eb180bd06 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -364,8 +364,8 @@ extern void ui_set_but_vectorf(uiBut *but, float *vec); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); -extern void ui_get_but_string(uiBut *but, char *str, int maxlen); -extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen); +extern void ui_get_but_string(uiBut *but, char *str, size_t maxlen); +extern void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen); extern int ui_set_but_string(struct bContext *C, uiBut *but, const char *str); extern int ui_get_but_string_max_length(uiBut *but); @@ -517,7 +517,7 @@ void ui_but_anim_copy_driver(struct bContext *C); void ui_but_anim_paste_driver(struct bContext *C); void ui_but_anim_add_keyingset(struct bContext *C); void ui_but_anim_remove_keyingset(struct bContext *C); -int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen); +int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen); int ui_but_anim_expression_set(uiBut *but, const char *str); int ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3c02f7d4bd2..ab07cb4bbf6 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -639,7 +639,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i if(!name) { name= ot->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } @@ -1219,7 +1219,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s #if 0 /* this name is used for a string comparison and can't be modified, TODO */ name_uiprefix_id(name_ui, id); #else - strcpy(name_ui, id->name+2); + BLI_strncpy(name_ui, id->name+2, sizeof(name_ui)); #endif name= BLI_strdup(name_ui); iconid= ui_id_icon_get((bContext*)C, id, 1); @@ -1432,7 +1432,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const if(!name) { name= mt->label; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL name= UI_translate_do_iface(name); #endif } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ec7456eebdc..c25e7f23c04 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -444,7 +444,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r int pnl_icons; const char *activename= panel->drawname[0]?panel->drawname:panel->panelname; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL activename= UI_translate_do_iface(activename); #endif diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 4221f7c30ff..4a9eb8113fe 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -84,7 +84,7 @@ typedef struct MenuEntry { } MenuEntry; typedef struct MenuData { - char *instr; + const char *instr; const char *title; int titleicon; @@ -92,7 +92,7 @@ typedef struct MenuData { int nitems, itemssize; } MenuData; -static MenuData *menudata_new(char *instr) +static MenuData *menudata_new(const char *instr) { MenuData *md= MEM_mallocN(sizeof(*md), "MenuData"); @@ -137,7 +137,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico static void menudata_free(MenuData *md) { - MEM_freeN(md->instr); + MEM_freeN((void *)md->instr); if (md->items) MEM_freeN(md->items); MEM_freeN(md); @@ -156,7 +156,7 @@ static void menudata_free(MenuData *md) * @param str String to be parsed. * @retval new menudata structure, free with menudata_free() */ -static MenuData *decompose_menu_string(char *str) +static MenuData *decompose_menu_string(const char *str) { char *instr= BLI_strdup(str); MenuData *md= menudata_new(instr); @@ -230,9 +230,11 @@ void ui_set_name_menu(uiBut *but, int value) int i; md= decompose_menu_string(but->str); - for (i=0; i<md->nitems; i++) - if (md->items[i].retval==value) - strcpy(but->drawstr, md->items[i].str); + for (i=0; i<md->nitems; i++) { + if (md->items[i].retval==value) { + BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr)); + } + } menudata_free(md); } @@ -1611,7 +1613,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a uiBut *bt; MenuData *md; MenuEntry *entry; - char *instr= arg_str; + const char *instr= arg_str; int columns, rows, a, b; uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); @@ -1798,7 +1800,7 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(col, sizeof(col), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -1986,10 +1988,10 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* existence of profile means storage is in linear color space, with display correction */ if (block->color_profile == BLI_PR_NONE) { - sprintf(tip, "Value in Display Color Space"); + BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip)); copy_v3_v3(rgb_gamma, rgb); } else { - sprintf(tip, "Value in Linear RGB Color Space"); + BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip)); /* make an sRGB version, for Hex code */ linearrgb_to_srgb_v3_v3(rgb_gamma, rgb); } @@ -2058,7 +2060,7 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); + BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); @@ -2152,7 +2154,7 @@ static int ui_popup_string_hash(char *str) return hash; } -static int ui_popup_menu_hash(char *str) +static int ui_popup_menu_hash(const char *str) { return BLI_ghashutil_strhash(str); } @@ -2202,8 +2204,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi { uiBlock *block; uiBut *bt; - ScrArea *sa; - ARegion *ar; uiPopupMenu *pup= arg_pup; int offset[2], direction, minwidth, width, height, flip; @@ -2275,10 +2275,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi else { /* for a header menu we set the direction automatic */ if(!pup->slideout && flip) { - sa= CTX_wm_area(C); - ar= CTX_wm_region(C); - + ScrArea *sa= CTX_wm_area(C); if(sa && sa->headertype==HEADERDOWN) { + ARegion *ar= CTX_wm_region(C); if(ar && ar->regiontype == RGN_TYPE_HEADER) { uiBlockSetDirection(block, UI_TOP); uiBlockFlipOrder(block); @@ -2369,7 +2368,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) char titlestr[256]; if(icon) { - sprintf(titlestr, " %s", title); + BLI_snprintf(titlestr, sizeof(titlestr), " %s", title); uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } else { @@ -2467,7 +2466,7 @@ void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...) va_list ap; char titlestr[256]; - sprintf(titlestr, "OK? %%i%d", ICON_QUESTION); + BLI_snprintf(titlestr, sizeof(titlestr), "OK? %%i%d", ICON_QUESTION); va_start(ap, str); vconfirm_opname(C, opname, titlestr, str, ap); @@ -2507,9 +2506,9 @@ void uiPupMenuError(bContext *C, const char *str, ...) char nfmt[256]; char titlestr[256]; - sprintf(titlestr, "Error %%i%d", ICON_ERROR); + BLI_snprintf(titlestr, sizeof(titlestr), "Error %%i%d", ICON_ERROR); - sprintf(nfmt, "%s", str); + BLI_strncpy(nfmt, str, sizeof(nfmt)); va_start(ap, str); vconfirm_opname(C, NULL, titlestr, nfmt, ap); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 3a9879384a3..3009d4fea09 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -315,14 +315,14 @@ void uiStyleInit(void) font= MEM_callocN(sizeof(uiFont), "ui font"); BLI_addtail(&U.uifonts, font); - strcpy(font->filename, "default"); + BLI_strncpy(font->filename, "default", sizeof(font->filename)); font->uifont_id= UIFONT_DEFAULT; } for(font= U.uifonts.first; font; font= font->next) { if(font->uifont_id==UIFONT_DEFAULT) { -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL int font_size= datatoc_bfont_ttf_size; unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf; static int last_font_size = 0; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index bec9e6a7664..a4622f50725 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -412,7 +412,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(id->us > 1) { char str[32]; - sprintf(str, "%d", id->us); + BLI_snprintf(str, sizeof(str), "%d", id->us); but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(_("Displays number of users of this data. Click to make a single-user copy"))); @@ -724,7 +724,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif block= uiLayoutGetBlock(row); /* VIRTUAL MODIFIER */ // XXX this is not used now, since these cannot be accessed via RNA - sprintf(str, "%s parent deform", md->name); + BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, @@ -959,13 +959,10 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) cti= constraint_get_typeinfo(con); if (cti == NULL) { /* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ - if (con->type == CONSTRAINT_TYPE_NULL) - strcpy(typestr, "Null"); - else - strcpy(typestr, "Unknown"); + BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr)); } else - strcpy(typestr, cti->name); + BLI_strncpy(typestr, cti->name, sizeof(typestr)); /* determine whether constraint is proxy protected or not */ if (proxylocked_constraints_owner(ob, pchan)) @@ -2112,7 +2109,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe manode= give_node_material(ma); if(manode) { char str[MAX_ID_NAME + 12]; - sprintf(str, "Node %s", manode->id.name+2); + BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2); uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1)); } else if(ma->use_nodes) { @@ -2281,7 +2278,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * uiItemL(row, "", ICON_NONE); /* next/prev button */ - sprintf(str, "%d :", i); + BLI_snprintf(str, sizeof(str), "%d :", i); but= uiDefIconTextButR_prop(block, NUM, 0, 0, str, 0,0,UI_UNIT_X*5,UI_UNIT_Y, activeptr, activeprop, 0, 0, 0, 0, 0, ""); if(i == 0) uiButSetFlag(but, UI_BUT_DISABLED); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index a49060eaca2..206ecbad1d0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLF_translation.h" @@ -116,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind } case PROP_COLLECTION: { char text[256]; - sprintf(text, UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); + BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); uiButSetFlag(but, UI_BUT_DISABLED); break; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 45829646145..0215cc05d36 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -574,7 +574,7 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect) /* prepares shade colors */ -static void shadecolors4(char *coltop, char *coldown, const char *color, short shadetop, short shadedown) +static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown) { coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255); @@ -889,7 +889,7 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect UI_icon_draw_aspect(xs, ys, icon, aspect, alpha); } - if(but->flag & UI_ICON_SUBMENU) { + if((but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP)) { xs= rect->xmax-17; ys= (rect->ymin+rect->ymax- height)/2; @@ -1493,7 +1493,7 @@ void ui_widget_color_init(ThemeUI *tui) /* ************ button callbacks, state ***************** */ -static void widget_state_blend(char *cp, const char *cpstate, const float fac) +static void widget_state_blend(char cp[3], const char cpstate[3], const float fac) { if(fac != 0.0f) { cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 0aaf6fe3bc6..30ae69b71b8 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -785,7 +785,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot) } /* ********************************************************* */ -/* DRAG-ZOOM OPERATOR */ +/* DRAG-ZOOM OPERATOR */ /* MMB Drag - allows non-uniform scaling by dragging mouse * diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5aff7edd6d0..866a0c1c495 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -941,7 +941,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in int totweight = dvert->totweight; float oldw = 0; float oldPos[3] = {0}; - float vc, hc, dist; + float vc, hc, dist = 0.0f /* Not necessary, but quites down gcc warnings! */; int i, k; float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange"); float *dists = MEM_mallocN(sizeof(float)*totweight, "distance"); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 8a572ddbcd5..6b1176a04d5 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3919,7 +3919,7 @@ void PE_undo_push(Scene *scene, const char *str) /* make new */ edit->curundo= undo= MEM_callocN(sizeof(PTCacheUndo), "particle undo file"); - strncpy(undo->name, str, 64-1); + BLI_strncpy(undo->name, str, sizeof(undo->name)); BLI_addtail(&edit->undo, undo); /* and limit amount to the maximum */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 8951df9221e..041cb9091d9 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1375,9 +1375,9 @@ static const char *editortype_pup(void) "|Outliner %x3" "|User Preferences %x19" "|Info%x7" - + "|%l" - + "|File Browser %x5" "|%l" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 63804b9fbc2..354e81cb52c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3706,7 +3706,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo if(use_color_correction){ srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb); } - else { + else { VECCOPY(rgba, ps->brush->rgb); } rgba[3] = 1.0; diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index ba0c2c8be92..345cda63f5a 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -34,6 +34,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "DNA_userdef_types.h" @@ -106,7 +107,7 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor BLI_addtail(&stack->elems, uel); /* name can be a dynamic string */ - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); /* limit amount to the maximum amount*/ nr= 0; diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 5a965fc076b..1b9e3fdfb4a 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -138,7 +138,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; - const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ + const float prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index b2b734159ff..f7abb01546f 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -520,7 +520,7 @@ void file_draw_list(const bContext *C, ARegion *ar) file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE)); } else { - file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_WIDTH_SCALE); + file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE); sx += ICON_DEFAULT_WIDTH_SCALE + 4; } diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 3121ddaa3b4..126d75e76cb 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -87,7 +87,7 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo if (bool) { bg[0]=220; bg[1]=128; bg[2]=96; } else { bg[0]=214; bg[1]=122; bg[2]=90; } } -#if 0 // XXX: this looks like the selected colour, so don't use this +#if 0 // XXX: this looks like the selected color, so don't use this else if (report->type & RPT_OPERATOR_ALL) { if (bool) { bg[0]=96; bg[1]=128; bg[2]=255; } else { bg[0]=90; bg[1]=122; bg[2]=249; } diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 3751d8efae8..8bc0ae51415 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -33,6 +33,7 @@ #ifndef ED_NODE_INTERN_H #define ED_NODE_INTERN_H +#include <stddef.h> /* for size_t */ #include "UI_interface.h" /* internal exports only */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 65ce2e71d8d..10ca482ae0e 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1248,7 +1248,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene if ( (SEARCHING_OUTLINER(soops) || (soops->outlinevis==SO_DATABLOCKS && soops->search_string[0]!=0)) && (tselem->flag & TSE_SEARCHMATCH)) { - /* TODO - add search highlight colour to theme? */ + /* TODO - add search highlight color to theme? */ glColor4f(0.2f, 0.5f, 0.2f, 0.3f); glRecti(startx, *starty+1, ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1); } diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a6cc65017bb..c0919ef3043 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -169,11 +169,11 @@ static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) { if(seq->strip) - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } else if(seq->type==SEQ_SOUND) { if(seq->strip) - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } seq->flag|= SELECT; recurs_sel_seq(seq); @@ -389,12 +389,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event) if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) { if(seq->strip) { - strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR); } } else if (seq->type == SEQ_SOUND) { if(seq->strip) { - strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1); + BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR); } } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 4c617115a3d..10d355bd0c3 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1421,8 +1421,7 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar) y -= st->lheight; - strncpy(str, item->name, SUGG_LIST_WIDTH); - str[SUGG_LIST_WIDTH] = '\0'; + BLI_strncpy(str, item->name, SUGG_LIST_WIDTH); w = text_font_width(st, str); diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 51b4b838171..08008f455e6 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -51,7 +51,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) { - SuggItem *item, *first, *last, *sel; + SuggItem *item, *first, *last /* , *sel */ /* UNUSED */; TextLine *tmp; int l, x, y, w, h, i; int tgti, *top; @@ -62,7 +62,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) first = texttool_suggest_first(); last = texttool_suggest_last(); - sel = texttool_suggest_selected(); + /* sel = texttool_suggest_selected(); */ /* UNUSED */ top = texttool_suggest_top(); if(!last || !first) diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fc35ab93f70..3f45e32937d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -146,7 +146,7 @@ static void cp_shade_color3ub (unsigned char cp[3], const int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, short constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -697,13 +697,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -715,13 +711,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0]; vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1]; vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2]; - - vec1[0]= tailvec[0] + tail*vec[0]; - vec1[1]= tailvec[1] + tail*vec[1]; - vec1[2]= tailvec[2] + tail*vec[2]; - vec2[0]= tailvec[0] + (tail+dist)*vec[0]; - vec2[1]= tailvec[1] + (tail+dist)*vec[1]; - vec2[2]= tailvec[2] + (tail+dist)*vec[2]; + + madd_v3_v3v3fl(vec1, tailvec, vec, tail); + madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist); //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); @@ -733,14 +725,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0]; vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1]; vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2]; - - vec1[0]= headvec[0] + head*vec[0]; - vec1[1]= headvec[1] + head*vec[1]; - vec1[2]= headvec[2] + head*vec[2]; - vec2[0]= headvec[0] + (head+dist)*vec[0]; - vec2[1]= headvec[1] + (head+dist)*vec[1]; - vec2[2]= headvec[2] + (head+dist)*vec[2]; - + + madd_v3_v3v3fl(vec1, headvec, vec, head); + madd_v3_v3v3fl(vec2, headvec, vec, head + dist); + //glColor4ub(255, 255, 255, 50); glVertex3fv(vec1); //glColor4ub(255, 255, 255, 0); @@ -752,7 +740,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float head, tail /*, length*/; float *headvec, *tailvec, dirvec[3]; @@ -839,21 +827,17 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, glLoadName(id | BONESEL_BONE); glBegin(GL_LINES); - vec[0]= headvec[0] + norvech[0]; - vec[1]= headvec[1] + norvech[1]; - vec[2]= headvec[2] + norvech[2]; + + add_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] + norvect[0]; - vec[1]= tailvec[1] + norvect[1]; - vec[2]= tailvec[2] + norvect[2]; + + add_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); - vec[0]= headvec[0] - norvech[0]; - vec[1]= headvec[1] - norvech[1]; - vec[2]= headvec[2] - norvech[2]; + + sub_v3_v3v3(vec, headvec, norvech); glVertex3fv(vec); - vec[0]= tailvec[0] - norvect[0]; - vec[1]= tailvec[1] - norvect[1]; - vec[2]= tailvec[2] - norvect[2]; + + sub_v3_v3v3(vec, tailvec, norvect); glVertex3fv(vec); glEnd(); @@ -861,7 +845,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, } /* does wire only for outline selecting */ -static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { GLUquadricObj *qobj; float head, tail, length; @@ -991,7 +975,7 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0}; static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; -static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float length; @@ -1125,7 +1109,7 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l } } -static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { float xwidth, length, zwidth; @@ -1238,7 +1222,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len } } -static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) +static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { Mat4 *bbones = NULL; int segments = 0; @@ -1288,7 +1272,7 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, uns draw_wire_bone_segments(pchan, bbones, length, segments); } -static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length) +static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length) { /* Draw a 3d octahedral bone, we use normalized space based on length, @@ -1659,7 +1643,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, float smat[4][4], imat[4][4], bmat[4][4]; int index= -1; short do_dashed= 3, draw_wire= 0; - short flag, constflag; + int flag; /* being set below */ arm->layer_used= 0; @@ -1880,6 +1864,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) { if (bone->layer & arm->layer) { + const short constflag= pchan->constflag; if ((do_dashed & 1) && (pchan->parent)) { /* Draw a line from our root to the parent's tip * - only if V3D_HIDE_HELPLINES is enabled... @@ -1901,16 +1886,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, * - only if temporary chain (i.e. "autoik") */ if (arm->flag & ARM_POSEMODE) { - if (pchan->constflag & PCHAN_HAS_IK) { + if (constflag & PCHAN_HAS_IK) { if (bone->flag & BONE_SELECTED) { - if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); + if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0); else glColor3ub(200, 200, 50); // add theme! glLoadName(index & 0xFFFF); pchan_draw_IK_root_lines(pchan, !(do_dashed & 2)); } } - else if (pchan->constflag & PCHAN_HAS_SPLINEIK) { + else if (constflag & PCHAN_HAS_SPLINEIK) { if (bone->flag & BONE_SELECTED) { glColor3ub(150, 200, 50); // add theme! @@ -1935,7 +1920,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, flag |= BONE_DRAW_ACTIVE; /* extra draw service for pose mode */ - constflag= pchan->constflag; /* set color-set to use */ set_pchan_colorset(ob, pchan); diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index db009e92be0..877bd4bc939 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -544,10 +544,8 @@ static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmoot { Mesh *me = (Mesh*)userData; - if (me->mface) { - short matnr= me->mface[index].mat_nr; - Material *ma= me->mat[matnr]; - + if (me->mat && me->mface) { + Material *ma= me->mat[me->mface[index].mat_nr]; if (ma && (ma->game.flag & GEMAT_INVISIBLE)) { return 0; } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index d2cb2a6c46f..a949c6a2aa4 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -999,6 +999,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob) uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE); uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE); + uiItemR(col, &eboneptr, "envelope_distance", 0, "Envelope", ICON_NONE); } static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 30d1a508888..02a6cee5140 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -35,6 +35,7 @@ #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "DNA_camera_types.h" #include "MEM_guardedalloc.h" @@ -62,49 +63,57 @@ #include "view3d_intern.h" // own include /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -#define FLY_MODAL_CANCEL 1 -#define FLY_MODAL_CONFIRM 2 -#define FLY_MODAL_ACCELERATE 3 -#define FLY_MODAL_DECELERATE 4 -#define FLY_MODAL_PAN_ENABLE 5 -#define FLY_MODAL_PAN_DISABLE 6 -#define FLY_MODAL_DIR_FORWARD 7 -#define FLY_MODAL_DIR_BACKWARD 8 -#define FLY_MODAL_DIR_LEFT 9 -#define FLY_MODAL_DIR_RIGHT 10 -#define FLY_MODAL_DIR_UP 11 -#define FLY_MODAL_DIR_DOWN 12 -#define FLY_MODAL_AXIS_LOCK_X 13 -#define FLY_MODAL_AXIS_LOCK_Z 14 -#define FLY_MODAL_PRECISION_ENABLE 15 -#define FLY_MODAL_PRECISION_DISABLE 16 +enum { + FLY_MODAL_CANCEL= 1, + FLY_MODAL_CONFIRM, + FLY_MODAL_ACCELERATE, + FLY_MODAL_DECELERATE, + FLY_MODAL_PAN_ENABLE, + FLY_MODAL_PAN_DISABLE, + FLY_MODAL_DIR_FORWARD, + FLY_MODAL_DIR_BACKWARD, + FLY_MODAL_DIR_LEFT, + FLY_MODAL_DIR_RIGHT, + FLY_MODAL_DIR_UP, + FLY_MODAL_DIR_DOWN, + FLY_MODAL_AXIS_LOCK_X, + FLY_MODAL_AXIS_LOCK_Z, + FLY_MODAL_PRECISION_ENABLE, + FLY_MODAL_PRECISION_DISABLE, + FLY_MODAL_FREELOOK_ENABLE, + FLY_MODAL_FREELOOK_DISABLE + +}; /* called in transform_ops.c, on each regeneration of keymaps */ void fly_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, - {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, - {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, - {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, + {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, + {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""}, - {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, - {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, + {FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""}, + {FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""}, - {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, - {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, - {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, - {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, - {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, - {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, + {FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""}, + {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""}, + {FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""}, + {FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""}, + {FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""}, + {FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""}, - {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, - {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"}, + {FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"}, - {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, - {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, + {FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""}, + {FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""}, - {0, NULL, 0, NULL, NULL}}; + {FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation Enable", ""}, + {FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation Disable", ""}, + + {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal"); @@ -122,10 +131,10 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, FLY_MODAL_CONFIRM); - WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); - WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, FLY_MODAL_ACCELERATE); - WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, PADPLUSKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE); /* XXX - Bug in the event system, middle mouse release doesnt work */ @@ -144,6 +153,9 @@ void fly_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_PRECISION_ENABLE); WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PRECISION_DISABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_FREELOOK_ENABLE); + WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, FLY_MODAL_FREELOOK_DISABLE); + /* assign map to operators */ WM_modalkeymap_assign(keymap, "VIEW3D_OT_fly"); } @@ -158,8 +170,9 @@ typedef struct FlyInfo { wmTimer *timer; /* needed for redraws */ short state; - short use_precision; short redraw; + unsigned char use_precision; + unsigned char use_freelook; /* if the user presses shift they can look about without movinf the direction there looking */ int mval[2]; /* latest 2D mouse values */ wmNDOFMotionData* ndof; /* latest 3D mouse values */ @@ -187,6 +200,10 @@ typedef struct FlyInfo { float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */ short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */ + short is_ortho_cam; /* are we flying an ortho camera in perspective view, + * which was originall in ortho view? + * could probably figure it out but better be explicit */ + void *obtfm; /* backup the objects transform */ /* compare between last state */ @@ -289,7 +306,8 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->xlock_momentum=0.0f; fly->zlock_momentum=0.0f; fly->grid= 1.0f; - fly->use_precision= 0; + fly->use_precision= FALSE; + fly->use_freelook= FALSE; #ifdef NDOF_FLY_DRAW_TOOMUCH fly->redraw= 1; @@ -317,6 +335,17 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->persp_backup= fly->rv3d->persp; fly->dist_backup= fly->rv3d->dist; + + /* check for flying ortho camera - which we cant support well + * we _could_ also check for an ortho camera but this is easier */ + if( (fly->rv3d->persp == RV3D_CAMOB) && + (fly->v3d->camera != NULL) && + (fly->rv3d->is_persp == FALSE)) + { + ((Camera *)fly->v3d->camera->data)->type= CAM_PERSP; + fly->is_ortho_cam= TRUE; + } + if (fly->rv3d->persp==RV3D_CAMOB) { Object *ob_back; if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) { @@ -420,6 +449,10 @@ static int flyEnd(bContext *C, FlyInfo *fly) /*Done with correcting for the dist */ } + if(fly->is_ortho_cam) { + ((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO; + } + rv3d->rflag &= ~RV3D_NAVIGATING; //XXX2.5 BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */ @@ -516,10 +549,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed= 0.0f; } else { - if (event->shift) - fly->speed += fly->grid*time_wheel * 0.1f; - else - fly->speed += fly->grid*time_wheel; + fly->speed += fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -537,10 +567,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) fly->speed=0; } else { - if (event->shift) - fly->speed-= fly->grid*time_wheel * 0.1f; - else - fly->speed-= fly->grid*time_wheel; + fly->speed-= fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f); } break; } @@ -605,6 +632,13 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) case FLY_MODAL_PRECISION_DISABLE: fly->use_precision= FALSE; break; + + case FLY_MODAL_FREELOOK_ENABLE: + fly->use_freelook= TRUE; + break; + case FLY_MODAL_FREELOOK_DISABLE: + fly->use_freelook= FALSE; + break; } } } @@ -704,8 +738,6 @@ static int flyApply(bContext *C, FlyInfo *fly) // cent_orig[2], /* view center */ //XXX- can avoid using // cent[2], /* view center modified */ xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */ - unsigned char - apply_rotation= 1; /* if the user presses shift they can look about without movinf the direction there looking*/ #ifdef NDOF_FLY_DEBUG static unsigned int iteration = 1; @@ -888,7 +920,7 @@ static int flyApply(bContext *C, FlyInfo *fly) } - if (apply_rotation) { + if (!fly->use_freelook) { /* Normal operation */ /* define dvec, view direction vector */ dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0.0f; @@ -896,9 +928,15 @@ static int flyApply(bContext *C, FlyInfo *fly) dvec_tmp[fly->axis]= 1.0f; mul_m3_v3(mat, dvec_tmp); - - mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } + else { + normalize_v3_v3(dvec_tmp, fly->dvec_prev); + if(fly->speed < 0.0f) { + negate_v3(dvec_tmp); + } + } + + mul_v3_fl(dvec_tmp, fly->speed * time_redraw * 0.25f); } /* impose a directional lag */ @@ -967,11 +1005,9 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly) float speed = 10.f; /* blender units per second */ /* ^^ this is ok for default cube scene, but should scale with.. something */ - float trans[3] = { - lateral_sensitivity * ndof->tvec[0], - vertical_sensitivity * ndof->tvec[1], - forward_sensitivity * ndof->tvec[2] - }; + float trans[3] = {lateral_sensitivity * ndof->tvec[0], + vertical_sensitivity * ndof->tvec[1], + forward_sensitivity * ndof->tvec[2]}; if (fly->use_precision) speed *= 0.2f; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cda0dbe922d..79d6f279f0f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1362,6 +1362,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) int proportional = 0; PropertyRNA *prop; + // Save back mode in case we're in the generic operator + if ((prop= RNA_struct_find_property(op->ptr, "mode"))) { + RNA_property_enum_set(op->ptr, prop, t->mode); + } + if ((prop= RNA_struct_find_property(op->ptr, "value"))) { float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; if (RNA_property_array_check(prop)) { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 062e13f1ad4..3f8999483d0 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -437,8 +437,8 @@ typedef struct TransInfo { #define TD_BEZTRIPLE (1 << 12) /* if this is a bez triple, we need to restore the handles, if this is set transdata->misc.hdata needs freeing */ #define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */ #define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */ -#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ -#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ +#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */ +#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ #define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */ #define TD_MOVEHANDLE2 (1 << 18) #define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 10502609358..30436fad772 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5358,6 +5358,11 @@ static void createTransNodeData(bContext *C, TransInfo *t) SpaceNode *snode= t->sa->spacedata.first; bNode *node; + if(!snode->edittree) { + t->total= 0; + return; + } + /* set transform flags on nodes */ for (node=snode->edittree->nodes.first; node; node=node->next) { if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM))) @@ -5445,7 +5450,7 @@ void createTransData(bContext *C, TransInfo *t) t->ext = NULL; if (t->obedit->type == OB_MESH) { createTransEditVerts(C, t); - } + } else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) { createTransCurveVerts(C, t); } @@ -5458,7 +5463,7 @@ void createTransData(bContext *C, TransInfo *t) else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; createTransArmatureVerts(t); - } + } else { printf("edit type not implemented!\n"); } diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index f2ab43c281b..9b938c44a5f 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -142,7 +142,7 @@ void undo_editmode_push(bContext *C, const char *name, /* make new */ curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode"); - strncpy(uel->name, name, MAXUNDONAME-1); + BLI_strncpy(uel->name, name, sizeof(uel->name)); BLI_addtail(&undobase, uel); uel->getdata= getdata; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index c1aca61f795..55fda84874d 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -471,7 +471,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even if(totitem > 0) { uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); uiLayout *layout= uiPupMenuLayout(pup); - uiLayout *split= uiLayoutSplit(layout, 0, 0), *column; + uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL; int i, c; for(c=0, i=totitem-1; i >= 0; i--, c++) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 0e56f8145b9..09446fc5eab 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2626,7 +2626,7 @@ static PBool p_chart_abf_solve(PChart *chart) PEdge *e, *e1, *e2, *e3; PAbfSystem sys; int i; - float lastnorm, limit = (chart->nfaces > 100)? 1.0f: 0.001f; + float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100)? 1.0f: 0.001f; /* setup id's */ sys.ninterior = sys.nfaces = sys.nangles = 0; @@ -2705,12 +2705,12 @@ static PBool p_chart_abf_solve(PChart *chart) p_abf_compute_sines(&sys); /* iteration */ - lastnorm = 1e10; + /* lastnorm = 1e10; */ /* UNUSED */ for (i = 0; i < ABF_MAX_ITER; i++) { float norm = p_abf_compute_gradient(&sys, chart); - lastnorm = norm; + /* lastnorm = norm; */ /* UNUSED */ if (norm < limit) break; @@ -3611,7 +3611,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f { SmoothNode *node = BLI_memarena_alloc(arena, sizeof *node); int axis, i, t1size = 0, t2size = 0; - float split, mi, mx; + float split, /* mi, */ /* UNUSED */ mx; SmoothTriangle **t1, **t2, *t; node->tri = tri; @@ -3652,7 +3652,7 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f node->axis = axis; node->split = split; - mi = bmin[axis]; + /* mi = bmin[axis]; */ /* UNUSED */ mx = bmax[axis]; bmax[axis] = split; node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 31fee038df0..35672cdfcb5 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -629,7 +629,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i if(smoothnormal) { /* copy vertex normal */ normal_short_to_float_v3(&varray[start], mvert[f->v1].no); - normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); + normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no); normal_short_to_float_v3(&varray[start+6], mvert[f->v3].no); if(f->v4) { diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 4f79d577ae5..120c203e7bd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -717,7 +717,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) } else { /* Do partial drawing. 'buffer' holds only the changed part. Needed for color corrected result */ - float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); + float *buffer = (float *)MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h); glBindTexture(GL_TEXTURE_2D, ima->bindcode); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 2e45c0eb07a..d79e881e5a2 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -183,9 +183,9 @@ struct anim_index * IMB_indexer_open(const char * name) BLI_strncpy(idx->name, name, sizeof(idx->name)); - fseek(fp, 0, SEEK_END); + fseek(fp, 0, SEEK_END); - idx->num_entries = (ftell(fp) - 12) + idx->num_entries = (ftell(fp) - 12) / (sizeof(int) // framepos + sizeof(unsigned long long) // seek_pos + sizeof(unsigned long long) // seek_pos_dts diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index b7a8f21d724..128f19b504b 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -93,7 +93,7 @@ typedef struct ClothCollSettings { struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */ float epsilon; /* min distance for collisions. */ - float self_friction; /* Fiction/damping with self contact. */ + float self_friction; /* Fiction/damping with self contact. */ float friction; /* Friction/damping applied on contact with other object.*/ float selfepsilon; /* for selfcollision */ float repel_force, distance_repel; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 1be2c811a1b..e04bdd4ec45 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -344,7 +344,7 @@ typedef struct bPivotConstraint { * Either target object + offset, or just offset is used */ struct Object *tar; /* target object (optional) */ - char subtarget[32]; /* subtarget name (optional) */ + char subtarget[32]; /* subtarget name (optional) */ float offset[3]; /* offset from the target to use, regardless of whether it exists */ /* Rotation-driven activation: diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 43a4b99bc33..8fe8b3bcf70 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -56,7 +56,7 @@ typedef struct IpoDriver { short blocktype, adrcode; /* sub-channel to use */ short type, flag; /* driver settings */ - char name[128]; /* bone, or python expression here */ + char name[128]; /* bone, or python expression here */ } IpoDriver; /* --- IPO Curve --- */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 16b7d716812..84c09e8ade9 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -816,7 +816,7 @@ typedef struct WeightVGEditModifierData { /* Mapping stuff. */ struct CurveMapping *cmap_curve; /* The custom mapping curve! */ - /* The add/remove vertices weight thresholds. */ + /* The add/remove vertices weight thresholds. */ float add_threshold, rem_threshold; /* Masking options. */ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 69ee530c0b6..9fec5207dbb 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -179,10 +179,12 @@ typedef struct ParticleSettings { float simplify_rate, simplify_transition; float simplify_viewport; - /* general values */ + /* time and emission */ float sta, end, lifetime, randlife; - float timetweak, jitfac, eff_hair, grid_rand; + float timetweak, courant_target; + float jitfac, eff_hair, grid_rand, ps_offset[1]; int totpart, userjit, grid_res, effector_amount; + short time_flag, time_pad[3]; /* initial velocity factors */ float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac; @@ -288,6 +290,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in struct ParticleDrawData *pdd; float *frand; /* array of 1024 random floats for fast lookups */ + + float dt_frac; /* current time step, as a fraction of a frame */ + float _pad; /* spare capacity */ }ParticleSystem; /* part->type */ @@ -402,6 +407,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_SIMPLIFY_ENABLE 1 #define PART_SIMPLIFY_VIEWPORT 2 +/* part->time_flag */ +#define PART_TIME_AUTOSF 1 /* Automatic subframes */ + /* part->bb_align */ #define PART_BB_X 0 #define PART_BB_Y 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 9f176a22848..f0f346fb759 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -236,8 +236,8 @@ typedef struct RenderData { short stereomode; /* standalone player stereo settings */ // XXX deprecated since 2.5 short dimensionspreset; /* for the dimensions presets menu */ - - short filtertype; /* filter is box, tent, gauss, mitch, etc */ + + short filtertype; /* filter is box, tent, gauss, mitch, etc */ short size, maximsize; /* size in %, max in Kb */ /* from buttons: */ @@ -479,8 +479,8 @@ typedef struct GameData { } GameData; #define STEREO_NOSTEREO 1 -#define STEREO_ENABLED 2 -#define STEREO_DOME 3 +#define STEREO_ENABLED 2 +#define STEREO_DOME 3 //#define STEREO_NOSTEREO 1 #define STEREO_QUADBUFFERED 2 @@ -838,7 +838,7 @@ typedef struct Scene { void *sound_scrub_handle; void *speaker_handles; - void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ + void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ /* none of the dependancy graph vars is mean to be saved */ struct DagForest *theDag; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 17c2c5c1bd6..f0e841abdae 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -63,6 +63,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index f429b84d477..539005f2142 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -220,7 +220,7 @@ if(WITH_OPENCOLLADA) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() # Build makesrna executable diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 83149a5308a..e9153b63193 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -99,7 +99,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') makesrna_tool.Append(CPPDEFINES=defs) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index b7709416a75..b52de6a49b6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -470,7 +470,7 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) description= ((IDProperty*)prop)->name; /* XXX - not correct */ } -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) description= BLF_gettext(description); #endif @@ -487,7 +487,7 @@ static const char *rna_ensure_property_name(PropertyRNA *prop) else name= ((IDProperty*)prop)->name; -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) name= BLF_gettext(name); #endif @@ -1160,7 +1160,7 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA { RNA_property_enum_items(C, ptr, prop, item, totitem, free); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) { int i; EnumPropertyItem *nitem; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index ec928415876..a834fcf820b 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -867,7 +867,7 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - prop= RNA_def_property(srna, "vert_deformer", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer"); RNA_def_property_enum_items(prop, prop_vdeformer); RNA_def_property_ui_text(prop, "Vertex Deformer", ""); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 6ed2147ce1b..80a418a0047 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -767,9 +767,9 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) RNA_def_struct_nested(brna, srna, "Material"); RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material datablock"); - prop= RNA_def_property(srna, "back_culling", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */ - RNA_def_property_ui_text(prop, "Back Culling", "Hide Back of the face in Game Engine "); + RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine "); RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 4895ba3d641..ce390c5c99f 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1417,12 +1417,6 @@ static void rna_def_mtexpoly(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem transp_items[]= { - {TF_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, - {TF_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, - {TF_ALPHA, "ALPHA", 0, "Alpha", "Render polygon transparent, depending on alpha channel of the texture"}, - {TF_CLIP, "CLIPALPHA", 0, "Clip Alpha", "Use the images alpha values clipped with no blending (binary alpha)"}, - {0, NULL, 0, NULL, NULL}}; #if 0 /* BMESH_TODO: needed later when do another todo */ int uv_dim[]= {4, 2}; #endif @@ -1474,78 +1468,6 @@ static void rna_def_mtexpoly(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - - prop= RNA_def_property(srna, "use_image", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TEX); - RNA_def_property_ui_text(prop, "Tex", "Render face with texture"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_light", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_LIGHT); - RNA_def_property_ui_text(prop, "Light", "Use light for face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_INVISIBLE); - RNA_def_property_ui_text(prop, "Invisible", "Make face invisible"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_DYNAMIC); - RNA_def_property_ui_text(prop, "Collision", "Use face for collision and ray-sensor detection"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_blend_shared", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHAREDCOL); - RNA_def_property_ui_text(prop, "Shared", "Blend vertex colors across face when vertices are shared"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_twoside", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_TWOSIDE); - RNA_def_property_ui_text(prop, "Two-side", "Render face two-sided"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_OBCOL); - RNA_def_property_ui_text(prop, "Object Color", "Use ObColor instead of vertex colors"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD); - RNA_def_property_ui_text(prop, "Halo", "Screen aligned billboard"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_billboard", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BILLBOARD2); - RNA_def_property_ui_text(prop, "Billboard", "Billboard with Z-axis constraint"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_shadow_cast", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_SHADOW); - RNA_def_property_ui_text(prop, "Shadow", "Face is used for shadow"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_bitmap_text", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_BMFONT); - RNA_def_property_ui_text(prop, "Text", "Enable bitmap text on face"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "use_alpha_sort", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", TF_ALPHASORT); - RNA_def_property_ui_text(prop, "Alpha Sort", "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "transp"); - RNA_def_property_enum_items(prop, transp_items); - RNA_def_property_ui_text(prop, "Transparency", "Transparency blending mode"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); - - //XXX to be deleted soon -- left for now in case we need it for debug - //XXX it should be out before Blender 2.6 (after texface to material patch) - prop= RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1); RNA_def_property_array(prop, 4); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index eb8e4c7782f..cfb40b0f711 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -808,7 +808,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Falloff Type", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED); + prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE); RNA_def_property_ui_text(prop, "Radius", "Radius to apply"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2778,13 +2778,13 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); - prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0); RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist)"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a7343f2526d..0db928d05c9 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -388,7 +388,8 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value) ED_object_parent(ob, ob->parent, value, ob->parsubstr); } -static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -419,7 +420,8 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point return item; } -static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { Object *ob= (Object*)ptr->data; EnumPropertyItem *item= NULL; @@ -890,7 +892,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) switch (ob->body_type) { case OB_BODY_TYPE_SENSOR: ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST; - ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); + ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION + |OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); break; case OB_BODY_TYPE_OCCLUDER: ob->gameflag |= OB_OCCLUDER; @@ -1173,7 +1176,8 @@ static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup) WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } -static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode) +static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, + int *index, float weight, int assignmode) { Object *ob = (Object *)id; @@ -1354,7 +1358,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"}, {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"}, {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"}, - {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, + {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", + "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"}, {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"}, {0, NULL, 0, NULL, NULL}}; @@ -1372,7 +1377,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators"); + RNA_def_property_ui_text(prop, "Controllers", + "Game engine controllers to process events, connecting sensor to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1400,7 +1406,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); - RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); + RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", + "rna_GameObjectSettings_physics_type_set", NULL); RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1476,7 +1483,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1485,7 +1492,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); - RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface"); + RNA_def_property_ui_text(prop, "Rotate From Normal", + "Use face normal to rotate object, so that it points away from the surface"); prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "formfactor"); @@ -1499,7 +1507,9 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled"); + RNA_def_property_ui_text(prop, "Friction Coefficients", + "Relative friction coefficient in the in the X, Y and Z directions, " + "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); @@ -1519,13 +1529,14 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH); RNA_def_property_float_sdna(prop, NULL, "margin"); RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability"); + RNA_def_property_ui_text(prop, "Collision Margin", + "Extra margin around object for collision detection, small amount required for stability"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "bsoft"); RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation"); - prop= RNA_def_property(srna, "create_obstacle", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE); RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation"); @@ -1679,7 +1690,9 @@ static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", + "rna_Object_active_particle_system_index_set", + "rna_Object_active_particle_system_index_range"); RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update"); } @@ -1702,14 +1715,16 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "VertexGroup"); - RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", + "rna_Object_active_vertex_group_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "actdef"); - RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", + "rna_Object_active_vertex_group_index_range"); RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array"); RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); @@ -1761,9 +1776,9 @@ static void rna_def_object(BlenderRNA *brna) static EnumPropertyItem drawtype_items[] = { {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, - {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"}, + {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, // disabled {OB_SHADED, "SHADED", 0, "Shaded", ""}, - {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"}, + {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem boundtype_items[] = { @@ -1786,13 +1801,14 @@ static void rna_def_object(BlenderRNA *brna) // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable static EnumPropertyItem prop_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock. (Default)"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ @@ -1842,8 +1858,8 @@ 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, all values are -1.0 when not available"); + RNA_def_property_ui_text(prop, "Bounding Box", + "Object's bounding box in object-space coordinates, all values are -1.0 when not available"); /* parent */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); @@ -1862,7 +1878,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "par1"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation"); + RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE); @@ -1876,13 +1892,17 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "trackflag"); RNA_def_property_enum_items(prop, track_items); - RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Track Axis", + "Axis that points in 'forward' direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "upflag"); RNA_def_property_enum_items(prop, up_items); - RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction (applies to DupliFrame when parent 'Follow' is enabled)"); + RNA_def_property_ui_text(prop, "Up Axis", + "Axis that points in the upward direction (applies to DupliFrame when " + "parent 'Follow' is enabled)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); /* proxy */ @@ -1909,7 +1929,8 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range"); + RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", + "rna_Object_active_material_index_range"); RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -1976,20 +1997,23 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER); RNA_def_property_float_sdna(prop, NULL, "drot"); - RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", "Extra rotation added to the rotation of the object (when using Euler rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", + "Extra rotation added to the rotation of the object (when using Euler rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION); RNA_def_property_float_sdna(prop, NULL, "dquat"); RNA_def_property_float_array_default(prop, default_quat); - RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", + "Extra rotation added to the rotation of the object (when using Quaternion rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #if 0 // XXX not supported well yet... prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle) RNA_def_property_float_array_default(prop, default_axisAngle); - RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); + RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", + "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); #endif @@ -2017,11 +2041,13 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX); @@ -2124,13 +2150,13 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "FieldSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation"); + RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation"); prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pd"); RNA_def_property_struct_type(prop, "CollisionSettings"); RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation"); + RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the object as a collider in physics simulation"); prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "soft"); @@ -2253,11 +2279,12 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_edit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB); - RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for F-Curve and action views"); + RNA_def_property_ui_text(prop, "Time Offset Edit", + "Use time offset when inserting keys and display time offset for F-Curve and action views"); prop= RNA_def_property(srna, "use_time_offset_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT); - RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship"); + RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this object's parent relationship"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); prop= RNA_def_property(srna, "use_time_offset_particle", PROP_BOOLEAN, PROP_NONE); @@ -2267,7 +2294,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "use_time_offset_add_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD); - RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value"); + RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parent's time offset value"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); /* drawing */ @@ -2279,7 +2306,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX); - RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds"); + RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE); @@ -2290,32 +2317,33 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME); - RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name"); + RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS); - RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's origin and axis"); + RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE); - RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space"); + RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE); - RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing"); + RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP); - RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "Draw Transparent", + "Display material transparency in the object (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); - RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)"); + RNA_def_property_ui_text(prop, "X-Ray", "Make the object draw in front of others (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* Grease Pencil */ diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index cc086bca6d8..c046c222898 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1049,18 +1049,21 @@ static void rna_def_field(BlenderRNA *brna) static EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, - {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Gives a radial field toward the center of object"}, - {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Gives a constant force along the force objects local Z axis"}, - {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Gives a spiraling force that twists the force objects local Z axis"}, + {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"}, + {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"}, + {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"}, {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"}, - {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", "The source of this force field is the zero point of a harmonic oscillator"}, - {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, - {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", "Forcefield based on the Lennard-Jones potential"}, + {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic", + "The source of this force field is the zero point of a harmonic oscillator"}, + {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge", + "Spherical forcefield based on the charge of particles, only influences other charge force fields"}, + {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones", + "Forcefield based on the Lennard-Jones potential"}, {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"}, - {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Creates a force along a curve object"}, + {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Create a force along a curve object"}, {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""}, - {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Creates turbulence with a noise field"}, - {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Creates a force that dampens motion"}, + {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"}, + {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem falloff_items[] = { diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 77fa975761f..1d8a91861d6 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -19,6 +19,9 @@ * * Contributor(s): Blender Foundation (2008). * + * Adaptive time step + * Copyright 2011 AutoCRC + * * ***** END GPL LICENSE BLOCK ***** */ @@ -145,33 +148,38 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSy *psmd_pt= NULL; *pa_pt= NULL; - /* weak, what about multiple particle systems? */ - for (md = ob->modifiers.first; md; md=md->next) { - if (md->type == eModifierType_ParticleSystem) - psmd= (ParticleSystemModifierData*) md; - } - - if (!psmd || !psmd->dm || !psmd->psys) { - return; - } - - psys= psmd->psys; - - /* not a very efficient way of getting hair key location data, - * but it's the best we've got at the present */ - - /* find the particle that corresponds with this HairKey */ - for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) { - - /* hairkeys are stored sequentially in memory, so we can find if - * it's the same particle by comparing pointers, without having - * to iterate over them all */ - if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) - break; + /* given the pointer HairKey *hkey, we iterate over all particles in all + * particle systems in the object "ob" in order to find + *- the ParticleSystemData to which the HairKey (and hence the particle) + * belongs (will be stored in psmd_pt) + *- the ParticleData to which the HairKey belongs (will be stored in pa_pt) + * + * not a very efficient way of getting hair key location data, + * but it's the best we've got at the present + * + * IDEAS: include additional information in pointerRNA beforehand, + * for example a pointer to the ParticleStstemModifierData to which the + * hairkey belongs. + */ + + for (md= ob->modifiers.first; md; md=md->next) { + if (md->type == eModifierType_ParticleSystem) { + psmd= (ParticleSystemModifierData *) md; + if (psmd && psmd->dm && psmd->psys) { + psys = psmd->psys; + for(i= 0, pa= psys->particles; i < psys->totpart; i++, pa++) { + /* hairkeys are stored sequentially in memory, so we can + * find if it's the same particle by comparing pointers, + * without having to iterate over them all */ + if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) { + *psmd_pt = psmd; + *pa_pt = pa; + return; + } + } + } + } } - - *psmd_pt= psmd; - *pa_pt= pa; } static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values) @@ -2044,12 +2052,23 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL); RNA_def_property_range(prop, 0.0001, 100.0); RNA_def_property_ui_range(prop, 0.01, 10, 1, 3); - RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (in seconds)"); + RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - + + prop= RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF); + RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations"); + RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.01, 10); + RNA_def_property_float_default(prop, 0.2); + RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold", "The relative distance a particle can move before requiring more subframes (target Courant number). 0.1-0.3 is the recommended range"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE); @@ -2857,6 +2876,13 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode"); + /* Read-only: this is calculated internally. Changing it would only affect + * the next time-step. The user should change ParticlSettings.subframes or + * ParticleSettings.courant_target instead. */ + prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 1.0f/101.0f, 1.0f); + RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); } @@ -2877,4 +2903,3 @@ void RNA_def_particle(BlenderRNA *brna) } #endif - diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6b46559fdf9..8084ddc60f8 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -630,7 +630,8 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -671,7 +672,8 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value); } -static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *free) { EnumPropertyItem *item= NULL; EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -742,7 +744,8 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } -static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *free) { RenderEngineType *type; EnumPropertyItem *item= NULL; @@ -1114,7 +1117,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) static EnumPropertyItem sketch_convert_items[] = { {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"}, {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"}, - {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", "Subdivide stroke adaptively, with more subdivision in curvier parts"}, + {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", + "Subdivide stroke adaptively, with more subdivision in curvier parts"}, {SK_CONVERT_RETARGET, "RETARGET", 0, "Retarget", "Retarget template bone chain to stroke"}, {0, NULL, 0, NULL, NULL}}; @@ -1167,7 +1171,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "proportional"); RNA_def_property_enum_items(prop, proportional_editing_items); - RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional Editing mode, allows transforms with distance fall-off"); + RNA_def_property_ui_text(prop, "Proportional Editing", + "Proportional Editing mode, allows transforms with distance fall-off"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ prop= RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE); @@ -1230,7 +1235,8 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT); - RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects"); + RNA_def_property_ui_text(prop, "Project Individual Elements", + "Project individual elements on the surface of other objects"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ @@ -1259,11 +1265,14 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA); - RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking"); + RNA_def_property_ui_text(prop, "Layered", + "Add a new NLA Track + Strip for every loop/pass made over the animation " + "to allow non-destructive tweaking"); prop= RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET); - RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set only"); + RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", + "Automatic keyframe insertion using active Keying Set only"); RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0); /* UV */ @@ -1374,11 +1383,13 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", "Instead of per brush radius, the radius is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius", + "Instead of per brush radius, the radius is shared across brushes"); prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA); - RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", "Instead of per brush strength, the strength is shared across brushes"); + RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength", + "Instead of per brush strength, the strength is shared across brushes"); } @@ -1394,7 +1405,7 @@ static void rna_def_unit_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem rotation_units[] = { - {0, "DEGREES", 0, "Degrees", "Use degrees for measuring rotation"}, + {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"}, {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1508,7 +1519,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) prop= RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA); - RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (On top of Solid and Halos)"); + RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)"); if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1792,8 +1803,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem framing_types_items[] ={ - {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"}, - {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", "Show the entire viewport in the display window, viewing more horizontally or vertically"}, + {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", + "Show the entire viewport in the display window, using bar horizontally or vertically"}, + {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", + "Show the entire viewport in the display window, viewing more horizontally or vertically"}, {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"}, {0, NULL, 0, NULL, NULL}}; @@ -1906,7 +1919,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); RNA_def_property_range(prop, 0.01, 5.0); - RNA_def_property_ui_text(prop, "Eye Separation", "Set the distance between the eyes - the camera focal length/30 should be fine"); + RNA_def_property_ui_text(prop, "Eye Separation", + "Set the distance between the eyes - the camera focal length/30 should be fine"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Dome */ @@ -1964,35 +1978,44 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); - RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + RNA_def_property_ui_text(prop, "Occlusion Resolution", + "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ticrate"); RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); - RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate"); + RNA_def_property_ui_text(prop, "Frames Per Second", + "The nominal number of game frames per second " + "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Logic Steps", "Sets the maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics"); + RNA_def_property_ui_text(prop, "Max Logic Steps", + "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxphystep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Physics Steps", "Sets the maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime"); + RNA_def_property_ui_text(prop, "Max Physics Steps", + "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "physubstep"); RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Physics Sub Steps", "Sets the number of simulation substep per physic timestep, higher value give better physics precision"); + RNA_def_property_ui_text(prop, "Physics Sub Steps", + "Sets the number of simulation substep per physic timestep, " + "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); /* mode */ @@ -2009,7 +2032,9 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled"); + RNA_def_property_ui_text(prop, "box radius", + "Radius of the activity bubble, in Manhattan length " + "(objects outside the box are activity-culled)"); /* booleans */ prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE); @@ -2018,7 +2043,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE); - RNA_def_property_ui_text(prop, "Show Framerate and Profile", "Show framerate and profiling information while the game runs"); + RNA_def_property_ui_text(prop, "Show Framerate and Profile", + "Show framerate and profiling information while the game runs"); prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS); @@ -2151,13 +2177,15 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "actlay"); - RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range"); + RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", + "rna_RenderSettings_active_layer_index_range"); RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED); RNA_def_property_struct_type(prop, "SceneRenderLayer"); - RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", + "rna_RenderSettings_active_layer_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL); RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2382,7 +2410,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes"); RNA_def_property_enum_items(prop, image_color_mode_items); - RNA_def_property_ui_text(prop, "Color Mode", "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, AND RGBA for saving red, green, blue + alpha channels"); + RNA_def_property_ui_text(prop, "Color Mode", + "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, " + "and RGBA for saving red, green, blue and alpha channels"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); @@ -2433,7 +2463,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "quality"); RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */ - RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's"); + RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, compression for PNG's"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Tiff */ @@ -2592,19 +2622,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "ffmpeg_video_bitrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.video_bitrate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_minrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_min_rate"); RNA_def_property_range(prop, 0, 9000); - RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate(kb/s)"); + RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_maxrate", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.rc_max_rate"); RNA_def_property_range(prop, 1, 14000); - RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate(kb/s)"); + RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_muxrate", PROP_INT, PROP_NONE); @@ -2648,7 +2678,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_bitrate"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 32, 384); - RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate(kb/s)"); + RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE); @@ -2671,7 +2701,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ffcodecdata.audio_channels"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, audio_channel_items); - RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count"); + RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count"); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frs_sec"); @@ -2692,21 +2722,22 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "framapto"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map Old", "Specify old mapping value in frames"); + RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "images"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); - RNA_def_property_ui_text(prop, "Frame Map New", "Specify how many frames the Map Old will last"); + RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dither_intensity"); RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Dither Intensity", "Amount of dithering noise added to the rendered image to break up banding"); + RNA_def_property_ui_text(prop, "Dither Intensity", + "Amount of dithering noise added to the rendered image to break up banding"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "pixel_filter_type", PROP_ENUM, PROP_NONE); @@ -2730,7 +2761,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ocres"); RNA_def_property_enum_items(prop, octree_resolution_items); - RNA_def_property_ui_text(prop, "Octree Resolution", "Resolution of raytrace accelerator. Use higher resolutions for larger scenes"); + RNA_def_property_ui_text(prop, "Octree Resolution", + "Resolution of raytrace accelerator, use higher resolutions for larger scenes"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "raytrace_method", PROP_ENUM, PROP_NONE); @@ -2741,12 +2773,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_instances", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_INSTANCES); - RNA_def_property_ui_text(prop, "Use Instances", "Instance support leads to effective memory reduction when using duplicates"); + RNA_def_property_ui_text(prop, "Use Instances", + "Instance support leads to effective memory reduction when using duplicates"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_LOCAL_COORDS); - RNA_def_property_ui_text(prop, "Use Local Coords", "Vertex coordinates are stored localy on each primitive. Increases memory usage, but may have impact on speed"); + RNA_def_property_ui_text(prop, "Use Local Coords", + "Vertex coordinates are stored localy on each primitive " + "(increases memory usage, but may have impact on speed)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); @@ -2768,7 +2803,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); RNA_def_property_enum_items(prop, field_order_items); - RNA_def_property_ui_text(prop, "Field Order", "Order of video fields. Select which lines get rendered first, to create smooth motion for TV output"); + RNA_def_property_ui_text(prop, "Field Order", + "Order of video fields (select which lines get rendered first, " + "to create smooth motion for TV output)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_fields_still", PROP_BOOLEAN, PROP_NONE); @@ -2829,7 +2866,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "threads"); RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS); RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Threads", "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); + RNA_def_property_ui_text(prop, "Threads", + "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE); @@ -2860,31 +2898,33 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* border */ prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); - RNA_def_property_ui_text(prop, "Border", "Render a user-defined border region, within the frame size. Note, this disables save_buffers and full_sample"); + RNA_def_property_ui_text(prop, "Border", + "Render a user-defined border region, within the frame size " + "(note that this disables save_buffers and full_sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum X", "Sets minimum X value to for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum X", "Minimum X value to for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymin"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Minimum Y", "Sets minimum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Minimum Y", "Minimum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.xmax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum X", "Sets maximum X value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum X", "Maximum X value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "border.ymax"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Border Maximum Y", "Sets maximum Y value for the render border"); + RNA_def_property_ui_text(prop, "Border Maximum Y", "Maximum Y value for the render border"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE); @@ -2894,7 +2934,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH); - RNA_def_property_ui_text(prop, "Placeholders", "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); + RNA_def_property_ui_text(prop, "Placeholders", + "Create empty placeholder files while rendering frames (similar to Unix 'touch')"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE); @@ -2904,12 +2945,15 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP); - RNA_def_property_ui_text(prop, "Compositing", "Process the render result through the compositing pipeline, if compositing nodes are enabled"); + RNA_def_property_ui_text(prop, "Compositing", + "Process the render result through the compositing pipeline, if compositing nodes are enabled"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ); - RNA_def_property_ui_text(prop, "Sequencer", "Process the render (and composited) result through the video sequence editor pipeline, if sequencer strips exist"); + RNA_def_property_ui_text(prop, "Sequencer", + "Process the render (and composited) result through the video sequence " + "editor pipeline, if sequencer strips exist"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE); @@ -2920,7 +2964,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION); - RNA_def_property_ui_text(prop, "File Extensions", "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); + RNA_def_property_ui_text(prop, "File Extensions", + "Add the file format extensions to the rendered file name (eg: filename + .jpg)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); @@ -2942,7 +2987,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_free_image_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FREE_IMAGE); - RNA_def_property_ui_text(prop, "Free Image Textures", "Free all image texture from memory after render, to save memory before compositing"); + RNA_def_property_ui_text(prop, "Free Image Textures", + "Free all image texture from memory after render, to save memory before compositing"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_free_unused_nodes", PROP_BOOLEAN, PROP_NONE); @@ -2953,13 +2999,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_save_buffers_get", NULL); - RNA_def_property_ui_text(prop, "Save Buffers","Save tiles for all RenderLayers and SceneNodes to files in the temp directory (saves memory, required for Full Sample)"); + RNA_def_property_ui_text(prop, "Save Buffers", + "Save tiles for all RenderLayers and SceneNodes to files in the temp directory " + "(saves memory, required for Full Sample)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE); RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); - RNA_def_property_ui_text(prop, "Full Sample","Save for every anti-aliasing sample the entire RenderLayer results. This solves anti-aliasing issues with compositing"); + RNA_def_property_ui_text(prop, "Full Sample", + "Save for every anti-aliasing sample the entire RenderLayer results " + "(this solves anti-aliasing issues with compositing)"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); @@ -2970,7 +3020,9 @@ static void rna_def_scene_render_data(BlenderRNA *brna) 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_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); /* Bake */ @@ -2996,11 +3048,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE); - RNA_def_property_ui_text(prop, "Selected to Active", "Bake shading on the surface of selected objects to the active object"); + RNA_def_property_ui_text(prop, "Selected to Active", + "Bake shading on the surface of selected objects to the active object"); prop= RNA_def_property(srna, "use_bake_normalize", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_NORMALIZE); - RNA_def_property_ui_text(prop, "Normalized", "With displacement normalize to the distance, with ambient occlusion normalize without using material settings"); + RNA_def_property_ui_text(prop, "Normalized", + "With displacement normalize to the distance, with ambient occlusion " + "normalize without using material settings"); prop= RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR); @@ -3018,7 +3073,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_maxdist"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units"); + RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units)"); prop= RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "bake_biasdist"); @@ -3037,7 +3092,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME); - RNA_def_property_ui_text(prop, "Stamp Time", "Include the render frame as HH:MM:SS.FF in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE); @@ -3057,7 +3112,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS); - RNA_def_property_ui_text(prop, "Stamp Lens", "Include the name of the active cameras lens in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Lens", "Include the active camera's lens in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE); @@ -3077,17 +3132,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME); - RNA_def_property_ui_text(prop, "Stamp Filename", "Include the filename of the .blend file in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Filename", "Include the .blend filename in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP); - RNA_def_property_ui_text(prop, "Stamp Sequence Strip", "Include the name of the foreground sequence strip in image metadata"); + RNA_def_property_ui_text(prop, "Stamp Sequence Strip", + "Include the name of the foreground sequence strip in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME); - RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in the stamp image"); + RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE); @@ -3142,14 +3198,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); /* layers */ - prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); RNA_def_property_struct_type(prop, "SceneRenderLayer"); RNA_def_property_ui_text(prop, "Render Layers", ""); rna_def_render_layers(brna, prop); - + prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); @@ -3159,7 +3214,8 @@ static void rna_def_scene_render_data(BlenderRNA *brna) /* engine */ prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", "rna_RenderSettings_engine_itemf"); + RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", + "rna_RenderSettings_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); RNA_def_property_update(prop, NC_WINDOW, NULL); @@ -3198,7 +3254,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_sdna(prop, NULL, "simplify_aosss"); - RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AA and SSS quality factor"); + RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AO and SSS quality factor"); RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); prop= RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE); @@ -3334,7 +3390,8 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3360,7 +3417,8 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_keyingset"); RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL); - RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); + RNA_def_property_ui_text(prop, "Active Keying Set Index", + "Current Keying Set index (negative for 'builtin' and positive for 'absolute')"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } @@ -3388,7 +3446,8 @@ void RNA_def_scene(BlenderRNA *brna) /* Struct definition */ srna= RNA_def_struct(brna, "Scene", "ID"); - RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings"); + RNA_def_struct_ui_text(srna, "Scene", + "Scene data block, consisting in objects and defining time and render related settings"); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); @@ -3396,7 +3455,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll"); - RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene"); + RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene"); RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update"); prop= RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE); @@ -3485,7 +3544,8 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set"); - RNA_def_property_ui_text(prop, "Use Preview Range", "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); + RNA_def_property_ui_text(prop, "Use Preview Range", + "Use an alternative start/end frame for UI playback, rather than the scene start/end frame"); RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL); RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0); @@ -3506,7 +3566,7 @@ void RNA_def_scene(BlenderRNA *brna) /* Stamp */ prop= RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata"); - RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping"); + RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* Animation Data (for Scene) */ @@ -3516,7 +3576,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */ - RNA_def_property_ui_text(prop, "NLA TweakMode", "Indicates whether there is any action referenced by NLA being edited. Strictly read-only"); + RNA_def_property_ui_text(prop, "NLA TweakMode", + "Whether there is any action referenced by NLA being edited (strictly read-only)"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); /* Frame dropping flag for playback and sync enum */ @@ -3558,9 +3619,11 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_keying_sets(brna, prop); prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); + RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0); RNA_def_property_struct_type(prop, "KeyingSet"); - RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); + RNA_def_property_ui_text(prop, "All Keying Sets", + "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)"); RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); rna_def_scene_keying_sets_all(brna, prop); @@ -3613,7 +3676,8 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC); - RNA_def_property_ui_text(prop, "Audio Sync", "Play back and sync with audio clock, dropping frames if frame display is too slow"); + RNA_def_property_ui_text(prop, "Audio Sync", + "Play back and sync with audio clock, dropping frames if frame display is too slow"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 86682af189c..96e6eea22af 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1421,7 +1421,7 @@ static void rna_def_movie(BlenderRNA *brna) RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames"); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update"); - prop= RNA_def_property(srna, "streamindex", PROP_INT, PROP_NONE); + prop= RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "streamindex"); RNA_def_property_range(prop, 0, 20); RNA_def_property_ui_text(prop, "Streamindex", "For files with several movie streams, use the stream with the given index"); diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index a6c1f400ade..a656e6d56df 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -94,7 +94,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM"); RNA_def_property_update(prop, 0, "rna_Sound_caching_update"); - prop= RNA_def_property(srna, "mono", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO); RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one"); RNA_def_property_update(prop, 0, "rna_Sound_update"); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 587e56443ff..52c359d79dd 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -661,7 +661,7 @@ static void rna_def_panel(BlenderRNA *brna) "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_PT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", @@ -785,7 +785,7 @@ static void rna_def_menu(BlenderRNA *brna) "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the " "script, then bl_idname = \"OBJECT_MT_hello\""); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->label"); RNA_def_property_flag(prop, PROP_REGISTER); RNA_def_property_ui_text(prop, "Label", "The menu label"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 44d645f970f..b81b370a890 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2777,7 +2777,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_range(prop, 3, 40); RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens"); - /* 3D mouse settings */ + /* 3D mouse settings */ /* global options */ prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.25f, 4.0f); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c6805206051..8fa780de498 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1188,7 +1188,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP); RNA_def_struct_name_property(srna, prop); - prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE); + prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set"); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index b74918601e0..99517a9bee6 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -42,6 +42,7 @@ #include "DNA_mesh_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -70,7 +71,7 @@ static void copyData(ModifierData *md, ModifierData *target) tamd->object = amd->object; tamd->deformflag = amd->deformflag; tamd->multi = amd->multi; - strncpy(tamd->defgrp_name, amd->defgrp_name, 32); + BLI_strncpy(tamd->defgrp_name, amd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 9da150f2f60..42ecf34d6dc 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -72,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->lim_flags = bmd->lim_flags; tbmd->e_flags = bmd->e_flags; tbmd->bevel_angle = bmd->bevel_angle; - strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); + BLI_strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index d504445109c..4cdbf850a73 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_deform.h" @@ -77,7 +78,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->flag = cmd->flag; tcmd->type = cmd->type; tcmd->object = cmd->object; - strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); + BLI_strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 6387155b8fd..d756fe02274 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) tcmd->defaxis = cmd->defaxis; tcmd->object = cmd->object; - strncpy(tcmd->name, cmd->name, 32); + BLI_strncpy(tcmd->name, cmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 7bd2dbaa7e0..f7674c321f5 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -75,11 +76,11 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->texture = dmd->texture; tdmd->strength = dmd->strength; tdmd->direction = dmd->direction; - strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); + BLI_strncpy(tdmd->defgrp_name, dmd->defgrp_name, 32); tdmd->midlevel = dmd->midlevel; tdmd->texmapping = dmd->texmapping; tdmd->map_object = dmd->map_object; - strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); + BLI_strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 1c984fbe323..2163dbe87c7 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -41,6 +41,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_action.h" #include "BKE_cdderivedmesh.h" @@ -72,8 +73,8 @@ static void copyData(ModifierData *md, ModifierData *target) thmd->totindex = hmd->totindex; thmd->indexar = MEM_dupallocN(hmd->indexar); memcpy(thmd->parentinv, hmd->parentinv, sizeof(hmd->parentinv)); - strncpy(thmd->name, hmd->name, 32); - strncpy(thmd->subtarget, hmd->subtarget, 32); + BLI_strncpy(thmd->name, hmd->name, 32); + BLI_strncpy(thmd->subtarget, hmd->subtarget, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 2ddbe45ee26..faf27c0207f 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -40,6 +40,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" @@ -57,7 +58,7 @@ static void copyData(ModifierData *md, ModifierData *target) LatticeModifierData *tlmd = (LatticeModifierData*) target; tlmd->object = lmd->object; - strncpy(tlmd->name, lmd->name, 32); + BLI_strncpy(tlmd->name, lmd->name, 32); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 94fc48f6280..1aebf36a343 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" @@ -69,7 +70,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->fac = smd->fac; tsmd->repeat = smd->repeat; tsmd->flag = smd->flag; - strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); } static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 270198737a2..93a83be5a93 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -33,6 +33,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -73,13 +74,13 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->strength = wmd->strength; twmd->falloff_radius = wmd->falloff_radius; twmd->falloff_type = wmd->falloff_type; - strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name)); twmd->curfalloff = curvemapping_copy(wmd->curfalloff); /* map info */ twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; - strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); + BLI_strncpy(twmd->uvlayer_name, wmd->uvlayer_name, sizeof(twmd->uvlayer_name)); twmd->texmapping= wmd->texmapping; } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 305f4383369..cb04be1de21 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -42,6 +42,7 @@ #include "DNA_object_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_DerivedMesh.h" @@ -98,7 +99,7 @@ static void copyData(ModifierData *md, ModifierData *target) twmd->texture = wmd->texture; twmd->map_object = wmd->map_object; twmd->texmapping = wmd->texmapping; - strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); + BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); } static int dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 6149947233e..c18a35fdd98 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -74,7 +74,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i ibuf= BKE_image_get_ibuf(ima, iuser); if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { - return NULL; + return NULL; } if (ibuf->rect_float == NULL) { diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 35f2dbf7b32..fa5a3c727c2 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -551,8 +551,8 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) } /* delete the group instance. this also removes old input links! */ - nodeFreeNode(ntree, gnode); - + nodeFreeNode(ntree, gnode); + /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); @@ -567,7 +567,7 @@ bNodeSocket *node_group_add_socket(bNodeTree *ngroup, const char *name, int type bNodeSocketType *stype = ntreeGetSocketType(type); bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket"); - strncpy(gsock->name, name, sizeof(gsock->name)); + BLI_strncpy(gsock->name, name, sizeof(gsock->name)); gsock->type = type; /* group sockets are dynamically added */ gsock->flag |= SOCK_DYNAMIC; diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index f00d49fe8dd..3f47038687a 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -41,7 +41,7 @@ if env['BF_BUILDINFO']: defs.append('BUILD_DATE') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 67ed90c79eb..90260100c83 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -120,7 +120,7 @@ PyObject *bpy_text_import(Text *text) } len= strlen(text->id.name+2); - strncpy(modulename, text->id.name+2, len); + BLI_strncpy(modulename, text->id.name+2, len); modulename[len - 3]= '\0'; /* remove .py */ return PyImport_ExecCodeModule(modulename, text->compiled); } diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index e628ea10e9c..0d5b980acba 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -96,7 +96,7 @@ if(WITH_AUDASPACE) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 013eac7fd58..3175c0d088e 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,7 +73,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL #include "UI_interface.h" /* bad level call into editors */ #endif @@ -1523,11 +1523,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { param= _PyUnicode_AsString(value); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL if(subtype == PROP_TRANSLATE) { param= UI_translate_do_iface(param); } -#endif // INTERNATIONAL +#endif // WITH_INTERNATIONAL } #else // USE_STRING_COERCE diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index f9486b5d5c0..7f804c9311d 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -76,12 +76,12 @@ typedef struct PixStrMain void calc_view_vector(float *view, float x, float y); -float mistfactor(float zcor, float *co); /* dist and height, return alpha */ +float mistfactor(float zcor, const float co[3]); /* dist and height, return alpha */ -void renderspothalo(struct ShadeInput *shi, float *col, float alpha); +void renderspothalo(struct ShadeInput *shi, float col[4], float alpha); void add_halo_flare(Render *re); -void calc_renderco_zbuf(float co[3], float *view, int z); +void calc_renderco_zbuf(float co[3], const float view[3], int z); void calc_renderco_ortho(float co[3], float x, float y, int z); int count_mask(unsigned short mask); @@ -103,9 +103,9 @@ extern void freeraytree(Render *re); extern void makeraytree(Render *re); struct RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi); -extern void ray_shadow(ShadeInput *, LampRen *, float *); -extern void ray_trace(ShadeInput *, ShadeResult *); -extern void ray_ao(ShadeInput *, float *, float *); +extern void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]); +extern void ray_trace(ShadeInput *shi, ShadeResult *); +extern void ray_ao(ShadeInput *shi, float ao[3], float env[3]); extern void init_jitter_plane(LampRen *lar); extern void init_ao_sphere(struct World *wrld); extern void init_render_qmcsampler(Render *re); diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h index 91507ef3f98..df5578dad7a 100644 --- a/source/blender/render/intern/include/shading.h +++ b/source/blender/render/intern/include/shading.h @@ -96,8 +96,8 @@ void ambient_occlusion(struct ShadeInput *shi); void environment_lighting_apply(struct ShadeInput *shi, struct ShadeResult *shr); ListBase *get_lights(struct ShadeInput *shi); -float lamp_get_visibility(struct LampRen *lar, const float co[3], float *lv, float *dist); -void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real); +float lamp_get_visibility(struct LampRen *lar, const float co[3], float lv[3], float *dist); +void lamp_get_shadow(struct LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real); float fresnel_fac(float *view, float *vn, float fresnel, float fac); diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index dfff35ba51a..550652560be 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -441,7 +441,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i) } else { assert(0); - return 0; + return 0; } } diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp index 331358f727b..8fc3c938427 100644 --- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp @@ -116,8 +116,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp index a99c57ab233..0d1526fba6f 100644 --- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp @@ -152,8 +152,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } /* the cast to pointer function is needed to workarround gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11407 */ diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp index 25eada43a4a..620477f1e70 100644 --- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp @@ -154,8 +154,8 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *min, float *max) { //TODO renable hint support { - hint->size = 0; - hint->stack[hint->size++] = (RayObject*)tree->root; + hint->size = 0; + hint->stack[hint->size++] = (RayObject*)tree->root; } } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 1b96104862a..0835b0ef07f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1349,7 +1349,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl int totsplit = bb->uv_split * bb->uv_split; int tile, x, y; /* Tile offsets */ - float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; + float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; vlr= RE_findOrAddVlak(obr, obr->totvlak++); vlr->v1= RE_findOrAddVert(obr, obr->totvert++); @@ -4852,8 +4852,13 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp * NULL is just for init */ set_dupli_tex_mat(NULL, NULL, NULL); - for(SETLOOPER(re->scene, sce_iter, base)) { - ob= base->object; + /* loop over all objects rather then using SETLOOPER because we may + * reference an mtex-mapped object which isnt rendered or is an + * empty in a dupli group. We could scan all render material/lamp/world + * mtex's for mapto objects but its easier just to set the + * 'imat' / 'imat_ren' on all and unlikely to be a performance hit + * See bug: [#28744] - campbell */ + for(ob= re->main->object.first; ob; ob= ob->id.next) { /* imat objects has to be done here, since displace can have texture using Object map-input */ mul_m4_m4m4(mat, ob->obmat, re->viewmat); invert_m4_m4(ob->imat_ren, mat); @@ -5021,7 +5026,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* per second, per object, stats print this */ re->i.infostr= "Preparing Scene data"; re->i.cfra= scene->r.cfra; - strncpy(re->i.scenename, scene->id.name+2, 20); + BLI_strncpy(re->i.scenename, scene->id.name+2, sizeof(re->i.scenename)); /* XXX add test if dbase was filled already? */ @@ -5304,11 +5309,13 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq, static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen *obi, StrandSurface *mesh) { - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq), (*winspeed)[4]; /* int's can wrap on large images */ - float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; - int a; - if(mesh->co && mesh->prevco && mesh->nextco) { + float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */ + float winroot= sqrt(winsq); + float (*winspeed)[4]; + float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; + int a; + if(obi->flag & R_TRANSFORMED) mul_m4_m4m4(winmat, obi->mat, re->winmat); else diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index e2b3b23b9c9..25895b81dd7 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -689,9 +689,9 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe env->ima= tex->ima; if(env->ima && env->ima->ok) { if(env->cube[1]==NULL) { - ImBuf *ibuf= BKE_image_get_ibuf(env->ima, NULL); - if(ibuf) - envmap_split_ima(env, ibuf); + ImBuf *ibuf_ima= BKE_image_get_ibuf(env->ima, NULL); + if(ibuf_ima) + envmap_split_ima(env, ibuf_ima); else env->ok= 0; } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 05bcc32a90a..7835ae6dcd3 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1198,7 +1198,7 @@ Render *RE_NewRender(const char *name) /* new render data struct */ re= MEM_callocN(sizeof(Render), "new render"); BLI_addtail(&RenderGlobal.renderlist, re); - strncpy(re->name, name, RE_MAXNAME); + BLI_strncpy(re->name, name, RE_MAXNAME); BLI_rw_mutex_init(&re->resultmutex); } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index e82e969d502..8fa90a51442 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -334,7 +334,6 @@ static void makeraytree_single(Render *re) for(obi=re->instancetable.first; obi; obi=obi->next) if(is_raytraceable(re, obi)) { - int v; ObjectRen *obr = obi->obr; obs++; @@ -344,6 +343,7 @@ static void makeraytree_single(Render *re) } else { + int v; for(v=0;v<obr->totvlak;v++) { VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255); @@ -539,7 +539,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) VlakRen *vlr= (VlakRen*)is->hit.face; /* set up view vector */ - VECCOPY(shi->view, is->dir); + copy_v3_v3(shi->view, is->dir); /* render co */ shi->co[0]= is->start[0]+is->dist*(shi->view[0]); @@ -594,16 +594,16 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) } /* raytrace likes to separate the spec color */ - VECSUB(shr->diff, shr->combined, shr->spec); + sub_v3_v3v3(shr->diff, shr->combined, shr->spec); } } -static int refraction(float *refract, float *n, float *view, float index) +static int refraction(float refract[3], const float n[3], const float view[3], float index) { float dot, fac; - VECCOPY(refract, view); + copy_v3_v3(refract, view); dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; @@ -626,26 +626,26 @@ static int refraction(float *refract, float *n, float *view, float index) return 1; } +static void reflection_simple(float ref[3], float n[3], const float view[3]) +{ + const float f1= -2.0f * dot_v3v3(n, view); + madd_v3_v3v3fl(ref, view, n, f1); +} + /* orn = original face normal */ -static void reflection(float *ref, float *n, float *view, float *orn) +static void reflection(float ref[3], float n[3], const float view[3], const float orn[3]) { float f1; - - f1= -2.0f*(n[0]*view[0]+ n[1]*view[1]+ n[2]*view[2]); - - ref[0]= (view[0]+f1*n[0]); - ref[1]= (view[1]+f1*n[1]); - ref[2]= (view[2]+f1*n[2]); - if(orn) { - /* test phong normals, then we should prevent vector going to the back */ - f1= ref[0]*orn[0]+ ref[1]*orn[1]+ ref[2]*orn[2]; - if(f1>0.0f) { - f1+= .01f; - ref[0]-= f1*orn[0]; - ref[1]-= f1*orn[1]; - ref[2]-= f1*orn[2]; - } + reflection_simple(ref, n, view); + + /* test phong normals, then we should prevent vector going to the back */ + f1= dot_v3v3(ref, orn); + if(f1>0.0f) { + f1+= 0.01f; + ref[0]-= f1*orn[0]; + ref[1]-= f1*orn[1]; + ref[2]-= f1*orn[2]; } } @@ -672,8 +672,7 @@ static void color_combine(float *result, float fac1, float fac2, float *col1, fl static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) { - float dx, dy, dz, d, p; - + float d; if (0 == (shi->mat->mode & MA_TRANSP)) return -1; @@ -681,10 +680,12 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) d= 1.0f; } else { + float p; + /* shi.co[] calculated by shade_ray() */ - dx= shi->co[0] - is->start[0]; - dy= shi->co[1] - is->start[1]; - dz= shi->co[2] - is->start[2]; + const float dx= shi->co[0] - is->start[0]; + const float dy= shi->co[1] - is->start[1]; + const float dz= shi->co[2] - is->start[2]; d= sqrt(dx*dx+dy*dy+dz*dz); if (d > shi->mat->tx_limit) d= shi->mat->tx_limit; @@ -701,13 +702,13 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) return d; } -static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, float *vec) +static void ray_fadeout_endcolor(float col[3], ShadeInput *origshi, ShadeInput *shi, ShadeResult *shr, Isect *isec, const float vec[3]) { /* un-intersected rays get either rendered material color or sky color */ if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) { - VECCOPY(col, shr->combined); + copy_v3_v3(col, shr->combined); } else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) { - VECCOPY(shi->view, vec); + copy_v3_v3(shi->view, vec); normalize_v3(shi->view); shadeSkyView(col, isec->start, shi->view, NULL, shi->thread); @@ -715,7 +716,7 @@ static void ray_fadeout_endcolor(float *col, ShadeInput *origshi, ShadeInput *sh } } -static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, float dist_mir) +static void ray_fadeout(Isect *is, ShadeInput *shi, float col[3], const float blendcol[3], float dist_mir) { /* if fading out, linear blend against fade color */ float blendfac; @@ -729,14 +730,14 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, /* the main recursive tracer itself * note: 'col' must be initialized */ -static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *dir, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag) +static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, const float start[3], const float dir[3], float col[4], ObjectInstanceRen *obi, VlakRen *vlr, int traflag) { ShadeInput shi= {0}; Isect isec; float dist_mir = origshi->mat->dist_mir; - VECCOPY(isec.start, start); - VECCOPY(isec.dir, dir ); + copy_v3_v3(isec.start, start); + copy_v3_v3(isec.dir, dir ); isec.dist = dist_mir > 0 ? dist_mir : RE_RAYTRACE_MAXDIST; isec.mode= RE_RAY_MIRROR; isec.check = RE_CHECK_VLR_RENDER; @@ -752,8 +753,8 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float d= 1.0f; /* for as long we don't have proper dx/dy transform for rays we copy over original */ - VECCOPY(shi.dxco, origshi->dxco); - VECCOPY(shi.dyco, origshi->dyco); + copy_v3_v3(shi.dxco, origshi->dxco); + copy_v3_v3(shi.dyco, origshi->dyco); shi.mask= origshi->mask; shi.osatex= origshi->osatex; @@ -845,7 +846,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo float mircol[4]; float ref[3]; - reflection(ref, shi.vn, shi.view, NULL); + reflection_simple(ref, shi.vn, shi.view); traceray(origshi, origshr, depth-1, shi.co, ref, mircol, shi.obi, shi.vlr, 0); f1= 1.0f-f; @@ -896,7 +897,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, flo /* calc distributed planar energy */ -static void DP_energy(float *table, float *vec, int tot, float xsize, float ysize) +static void DP_energy(float *table, float vec[2], int tot, float xsize, float ysize) { int x, y, a; float *fp, force[3], result[3]; @@ -950,7 +951,7 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s void init_jitter_plane(LampRen *lar) { float *fp; - int x, iter=12, tot= lar->ray_totsamp; + int x, tot= lar->ray_totsamp; /* test if already initialized */ if(lar->jitter) return; @@ -962,7 +963,8 @@ void init_jitter_plane(LampRen *lar) /* if 1 sample, we leave table to be zero's */ if(tot>1) { - + int iter=12; + /* set per-lamp fixed seed */ BLI_srandom(tot); @@ -1125,7 +1127,7 @@ static void QMC_getSample(double *s, QMCSampler *qsa, int thread, int num) } /* phong weighted disc using 'blur' for exponent, centred on 0,0 */ -static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, float blur) +static void QMC_samplePhong(float vec[3], QMCSampler *qsa, int thread, int num, float blur) { double s[2]; float phi, pz, sqr; @@ -1142,7 +1144,7 @@ static void QMC_samplePhong(float *vec, QMCSampler *qsa, int thread, int num, fl } /* rect of edge lengths sizex, sizey, centred on 0.0,0.0 i.e. ranging from -sizex/2 to +sizey/2 */ -static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, float sizex, float sizey) +static void QMC_sampleRect(float vec[3], QMCSampler *qsa, int thread, int num, float sizex, float sizey) { double s[2]; @@ -1154,7 +1156,7 @@ static void QMC_sampleRect(float *vec, QMCSampler *qsa, int thread, int num, flo } /* disc of radius 'radius', centred on 0,0 */ -static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, float radius) +static void QMC_sampleDisc(float vec[3], QMCSampler *qsa, int thread, int num, float radius) { double s[2]; float phi, sqr; @@ -1170,7 +1172,7 @@ static void QMC_sampleDisc(float *vec, QMCSampler *qsa, int thread, int num, flo } /* uniform hemisphere sampling */ -static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemi(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1187,7 +1189,7 @@ static void QMC_sampleHemi(float *vec, QMCSampler *qsa, int thread, int num) #if 0 /* currently not used */ /* cosine weighted hemisphere sampling */ -static void QMC_sampleHemiCosine(float *vec, QMCSampler *qsa, int thread, int num) +static void QMC_sampleHemiCosine(float vec[3], QMCSampler *qsa, int thread, int num) { double s[2]; float phi, sqr; @@ -1238,10 +1240,9 @@ static void release_thread_qmcsampler(Render *UNUSED(re), int UNUSED(thread), QM void free_render_qmcsampler(Render *re) { - QMCSampler *qsa, *next; - int a; - if(re->qmcsamplers) { + QMCSampler *qsa, *next; + int a; for(a=0; a<BLENDER_MAX_THREADS; a++) { for(qsa=re->qmcsamplers[a].first; qsa; qsa=next) { next= qsa->next; @@ -1256,7 +1257,7 @@ void free_render_qmcsampler(Render *re) } } -static int adaptive_sample_variance(int samples, float *col, float *colsq, float thresh) +static int adaptive_sample_variance(int samples, const float col[3], const float colsq[3], float thresh) { float var[3], mean[3]; @@ -1306,7 +1307,7 @@ static float get_avg_speed(ShadeInput *shi) /* ***************** main calls ************** */ -static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) +static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr) { QMCSampler *qsa=NULL; int samp_type; @@ -1345,7 +1346,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) if((shi->vlr->flag & R_SMOOTH)) reflection(v_refract, shi->vn, shi->view, shi->facenor); else - reflection(v_refract, shi->vn, shi->view, NULL); + reflection_simple(v_refract, shi->vn, shi->view); /* can't blur total external reflection */ max_samples = 1; @@ -1366,7 +1367,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) normalize_v3(v_refract_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_refract_new, v_refract); + copy_v3_v3(v_refract_new, v_refract); } sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1406,7 +1407,7 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) release_thread_qmcsampler(&R, shi->thread, qsa); } -static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float fresnelfac) +static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float fresnelfac) { QMCSampler *qsa=NULL; int samp_type; @@ -1445,7 +1446,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f * if tangent shading enabled */ if (shi->mat->mode & (MA_TANGENT_V)) { cross_v3_v3v3(orthx, shi->vn, shi->tang); // bitangent - VECCOPY(orthy, shi->tang); + copy_v3_v3(orthy, shi->tang); mul_v3_fl(orthx, samp3d[0]); mul_v3_fl(orthy, samp3d[1]*aniso); } else { @@ -1460,13 +1461,13 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f normalize_v3(v_nor_new); } else { /* no blurriness, use the original normal */ - VECCOPY(v_nor_new, shi->vn); + copy_v3_v3(v_nor_new, shi->vn); } if((shi->vlr->flag & R_SMOOTH)) reflection(v_reflect, v_nor_new, shi->view, shi->facenor); else - reflection(v_reflect, v_nor_new, shi->view, NULL); + reflection_simple(v_reflect, v_nor_new, shi->view); sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; @@ -1517,7 +1518,7 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f /* extern call from render loop */ void ray_trace(ShadeInput *shi, ShadeResult *shr) { - float i, f, f1, fr, fg, fb; + float f1, fr, fg, fb; float mircol[4], tracol[4]; float diff[3]; int do_tra, do_mir; @@ -1527,12 +1528,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) /* raytrace mirror amd refract like to separate the spec color */ if(shi->combinedflag & SCE_PASS_SPEC) - VECSUB(diff, shr->combined, shr->spec) /* no ; */ + sub_v3_v3v3(diff, shr->combined, shr->spec); else - VECCOPY(diff, shr->combined); + copy_v3_v3(diff, shr->combined); if(do_tra) { - float olddiff[3]; + float olddiff[3], f; trace_refract(tracol, shi, shr); @@ -1542,24 +1543,23 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) fb= 1.0f+ shi->mat->filter*(shi->b-1.0f); /* for refract pass */ - VECCOPY(olddiff, diff); + copy_v3_v3(olddiff, diff); diff[0]= f*diff[0] + f1*fr*tracol[0]; diff[1]= f*diff[1] + f1*fg*tracol[1]; diff[2]= f*diff[2] + f1*fb*tracol[2]; if(shi->passflag & SCE_PASS_REFRACT) - VECSUB(shr->refr, diff, olddiff); + sub_v3_v3v3(shr->refr, diff, olddiff); if(!(shi->combinedflag & SCE_PASS_REFRACT)) - VECSUB(diff, diff, shr->refr); + sub_v3_v3v3(diff, diff, shr->refr); shr->alpha= MIN2(1.0f, tracol[3]); } if(do_mir) { - - i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); + const float i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir); if(i!=0.0f) { trace_reflect(mircol, shi, shr, i); @@ -1597,12 +1597,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr) if(shi->combinedflag & SCE_PASS_SPEC) VECADD(shr->combined, diff, shr->spec) /* no ; */ else - VECCOPY(shr->combined, diff); + copy_v3_v3(shr->combined, diff); } /* color 'shadfac' passes through 'col' with alpha and filter */ /* filter is only applied on alpha defined transparent part */ -static void addAlphaLight(float *shadfac, float *col, float alpha, float filter) +static void addAlphaLight(float shadfac[4], const float col[3], float alpha, float filter) { float fr, fg, fb; @@ -1621,19 +1621,20 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int { /* ray to lamp, find first face that intersects, check alpha properties, if it has col[3]>0.0f continue. so exit when alpha is full */ - ShadeInput shi; - ShadeResult shr; - float initial_dist = is->dist; - + const float initial_dist = is->dist; + if(RE_rayobject_raycast(R.raytree, is)) { - float d= 1.0f; - /* we got a face */ - - /* Warning, This is not that nice, and possibly a bit slow for every ray, - however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */ - memset(&shi, 0, sizeof(ShadeInput)); + /* Warning regarding initializing to zero's, This is not that nice, + * and possibly a bit slow for every ray, however some variables were + * not initialized properly in, unless using + * shade_input_initialize(...), we need to zero them. */ + ShadeInput shi= {NULL}; /* end warning! - Campbell */ - + + ShadeResult shr; + + /* we got a face */ + shi.depth= origshi->depth + 1; /* only used to indicate tracing */ shi.mask= origshi->mask; shi.thread= origshi->thread; @@ -1647,9 +1648,9 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int shade_ray(is, &shi, &shr); if (shi.mat->material_type == MA_TYPE_SURFACE) { - if (traflag & RAY_TRA) - d= shade_by_transmission(is, &shi, &shr); - + const float d= (traflag & RAY_TRA) ? + shade_by_transmission(is, &shi, &shr) : + 1.0f; /* mix colors based on shadfac (rgb + amount of light factor) */ addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter); } else if (shi.mat->material_type == MA_TYPE_VOLUME) { @@ -1665,7 +1666,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int if(depth>0 && col[3]>0.0f) { /* adapt isect struct */ - VECCOPY(is->start, shi.co); + copy_v3_v3(is->start, shi.co); is->dist = initial_dist-is->dist; is->orig.ob = shi.obi; is->orig.face = shi.vlr; @@ -1702,7 +1703,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * isec.orig.face = ship->vlr; isec.hint = 0; - VECCOPY(isec.start, ship->co); + copy_v3_v3(isec.start, ship->co); RE_RC_INIT(isec, shi); @@ -1710,14 +1711,14 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * counter+=3; counter %= 768; - VECCOPY(vec, hashvectf+counter); + copy_v3_v3(vec, hashvectf+counter); if(ship->vn[0]*vec[0]+ship->vn[1]*vec[1]+ship->vn[2]*vec[2]>0.0f) { vec[0]-= vec[0]; vec[1]-= vec[1]; vec[2]-= vec[2]; } - VECCOPY(isec.dir, vec ); + copy_v3_v3(isec.dir, vec ); isec.dist = RE_RAYTRACE_MAXDIST; if(RE_rayobject_raycast(R.raytree, &isec)) { @@ -1751,7 +1752,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult * } /* aolight: function to create random unit sphere vectors for total random sampling */ -static void RandomSpherical(float *v) +static void RandomSpherical(float v[3]) { float r; v[2] = 2.f*BLI_frand()-1.f; @@ -1765,7 +1766,7 @@ static void RandomSpherical(float *v) } /* calc distributed spherical energy */ -static void DS_energy(float *sphere, int tot, float *vec) +static void DS_energy(float *sphere, int tot, float vec[3]) { float *fp, fac, force[3], res[3]; int a; @@ -1863,13 +1864,15 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } else { float *sphere; - float cosfi, sinfi, cost, sint; - float ang, *vec1; - int a; + float *vec1; // returns table if xs and ys were equal to last call, and not resetting sphere= (reset)? NULL: threadsafe_table_sphere(1, thread, xs, ys, tot); if(sphere==NULL) { + float cosfi, sinfi, cost, sint; + float ang; + int a; + sphere= threadsafe_table_sphere(0, thread, xs, ys, tot); // random rotation @@ -1890,7 +1893,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in } } -static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) +static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -1924,7 +1927,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -1943,10 +1946,10 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } if(shi->vlr->flag & R_SMOOTH) { - VECCOPY(nrm, shi->vn); + copy_v3_v3(nrm, shi->vn); } else { - VECCOPY(nrm, shi->facenor); + copy_v3_v3(nrm, shi->facenor); } ortho_basis_v3v3_v3( up, side,nrm); @@ -1990,7 +1993,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float skyfac, view[3]; + float view[3]; view[0]= -dir[0]; view[1]= -dir[1]; @@ -1998,7 +2001,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float skyfac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-skyfac)*R.wrld.horr + skyfac*R.wrld.zenr; env[1]+= (1.0f-skyfac)*R.wrld.horg + skyfac*R.wrld.zeng; env[2]+= (1.0f-skyfac)*R.wrld.horb + skyfac*R.wrld.zenb; @@ -2039,7 +2042,7 @@ static void ray_ao_qmc(ShadeInput *shi, float *ao, float *env) } /* extern call from shade_lamp_loop, ambient occlusion calculus */ -static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) +static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3]) { Isect isec; RayHint point_hint; @@ -2063,7 +2066,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) isec.mode= (R.wrld.aomode & WO_AODIST)?RE_RAY_SHADOW_TRA:RE_RAY_SHADOW; isec.lay= -1; - VECCOPY(isec.start, shi->co); + copy_v3_v3(isec.start, shi->co); RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start ); isec.hint = &point_hint; @@ -2128,7 +2131,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) } else if(envcolor!=WO_AOPLAIN) { float skycol[4]; - float fac, view[3]; + float view[3]; view[0]= -vec[0]; view[1]= -vec[1]; @@ -2136,7 +2139,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) normalize_v3(view); if(envcolor==WO_AOSKYCOL) { - fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); + const float fac= 0.5f*(1.0f+view[0]*R.grvec[0]+ view[1]*R.grvec[1]+ view[2]*R.grvec[2]); env[0]+= (1.0f-fac)*R.wrld.horr + fac*R.wrld.zenr; env[1]+= (1.0f-fac)*R.wrld.horg + fac*R.wrld.zeng; env[2]+= (1.0f-fac)*R.wrld.horb + fac*R.wrld.zenb; @@ -2167,7 +2170,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float *ao, float *env) copy_v3_v3(env, ao); } -void ray_ao(ShadeInput *shi, float *ao, float *env) +void ray_ao(ShadeInput *shi, float ao[3], float env[3]) { /* Unfortunately, the unusual way that the sphere sampler calculates roughly twice as many * samples as are actually traced, and skips them based on bias and OSA settings makes it very difficult @@ -2214,12 +2217,12 @@ static void ray_shadow_jittered_coords(ShadeInput *shi, int max, float jitco[RE_ *totjitco= tot; } else { - VECCOPY(jitco[0], shi->co); + copy_v3_v3(jitco[0], shi->co); *totjitco= 1; } } -static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { QMCSampler *qsa=NULL; int samples=0; @@ -2276,7 +2279,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * isec->hint = &bb_hint; isec->check = RE_CHECK_VLR_RENDER; isec->skip = RE_SKIP_VLR_NEIGHBOUR; - VECCOPY(vec, lampco); + copy_v3_v3(vec, lampco); while (samples < max_samples) { @@ -2294,9 +2297,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float ru[3], rv[3], v[3], s[3]; /* calc tangent plane vectors */ - v[0] = co[0] - lampco[0]; - v[1] = co[1] - lampco[1]; - v[2] = co[2] - lampco[2]; + sub_v3_v3v3(v, co, lampco); normalize_v3(v); ortho_basis_v3v3_v3( ru, rv,v); @@ -2308,7 +2309,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * s[1] = samp3d[0]*ru[1] + samp3d[1]*rv[1]; s[2] = samp3d[0]*ru[2] + samp3d[1]*rv[2]; - VECCOPY(samp3d, s); + copy_v3_v3(samp3d, s); } else { /* sampling, returns quasi-random vector in [sizex,sizey]^2 plane */ @@ -2321,7 +2322,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * end[1] = vec[1]+samp3d[1]; end[2] = vec[2]+samp3d[2]; } else { - VECCOPY(end, vec); + copy_v3_v3(end, vec); } if(shi->strand) { @@ -2329,7 +2330,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * float jitbias= 0.5f*(len_v3(shi->dxco) + len_v3(shi->dyco)); float v[3]; - VECSUB(v, co, end); + sub_v3_v3v3(v, co, end); normalize_v3(v); co[0] -= jitbias*v[0]; @@ -2337,7 +2338,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * co[2] -= jitbias*v[2]; } - VECCOPY(isec->start, co); + copy_v3_v3(isec->start, co); isec->dir[0] = end[0]-isec->start[0]; isec->dir[1] = end[1]-isec->start[1]; isec->dir[2] = end[2]-isec->start[2]; @@ -2393,7 +2394,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, float *lampco, float * release_thread_qmcsampler(&R, shi->thread, qsa); } -static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, float *shadfac, Isect *isec) +static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[3], float shadfac[4], Isect *isec) { /* area soft shadow */ float *jitlamp; @@ -2416,7 +2417,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa if(a==4) mask |= (mask>>4)|(mask>>8); else if(a==9) mask |= (mask>>9); - VECCOPY(isec->start, shi->co); + copy_v3_v3(isec->start, shi->co); isec->orig.ob = shi->obi; isec->orig.face = shi->vlr; RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start ); @@ -2477,7 +2478,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, float *lampco, floa } } /* extern call from shade_lamp_loop */ -void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) +void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4]) { Isect isec; float lampco[3]; @@ -2520,7 +2521,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) lampco[2]= shi->co[2] - R.maxdist*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } if (ELEM(lar->ray_samp_method, LA_SAMP_HALTON, LA_SAMP_HAMMERSLEY)) { @@ -2536,8 +2537,8 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) shadfac[3]= 1.0f; // 1.0=full light /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECSUB(isec.dir, lampco, isec.start); + copy_v3_v3(isec.start, shi->co); + sub_v3_v3v3(isec.dir, lampco, isec.start); isec.dist = normalize_v3(isec.dir); if(isec.mode==RE_RAY_SHADOW_TRA) { @@ -2545,7 +2546,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac) float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; ray_trace_shadow_tra(&isec, shi, DEPTH_SHADOW_TRA, 0, col); - QUATCOPY(shadfac, col); + copy_v4_v4(shadfac, col); } else if(RE_rayobject_raycast(R.raytree, &isec)) shadfac[3]= 0.0f; @@ -2584,15 +2585,15 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float lampco[2]= shi->co[2] - RE_RAYTRACE_MAXDIST*lar->vec[2]; } else { - VECCOPY(lampco, lar->co); + copy_v3_v3(lampco, lar->co); } isec.orig.ob = shi->obi; isec.orig.face = shi->vlr; /* set up isec.dir */ - VECCOPY(isec.start, shi->co); - VECCOPY(isec.end, lampco); + copy_v3_v3(isec.start, shi->co); + copy_v3_v3(isec.end, lampco); if(RE_rayobject_raycast(R.raytree, &isec)) { /* we got a face */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index bc5e7f23e21..fd824cee8a4 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -142,7 +142,7 @@ void calc_renderco_ortho(float co[3], float x, float y, int z) co[2]= R.winmat[3][2]/( R.winmat[2][3]*zco - R.winmat[2][2] ); } -void calc_renderco_zbuf(float co[3], float *view, int z) +void calc_renderco_zbuf(float co[3], const float view[3], int z) { float fac, zco; diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 956a3d4de7c..5963c4c8ffd 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1355,16 +1355,14 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl /* Do AO or (future) GI */ void shade_samples_do_AO(ShadeSample *ssamp) { - ShadeInput *shi; - int sample; - if(!(R.r.mode & R_SHADOW)) return; if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)) return; if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) { - shi= &ssamp->shi[0]; + ShadeInput *shi= &ssamp->shi[0]; + int sample; if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index c808d930e7c..66ae219a80a 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -119,7 +119,7 @@ static void fogcolor(float *colf, float *rco, float *view) #endif /* zcor is distance, co the 3d coordinate in eye space, return alpha */ -float mistfactor(float zcor, float *co) +float mistfactor(float zcor, float const co[3]) { float fac, hi; @@ -162,8 +162,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) double t0, t1 = 0.0f, t2= 0.0f, t3; float p1[3], p2[3], ladist, maxz = 0.0f, maxy = 0.0f, haint; int snijp, doclip=1, use_yco=0; - int ok1=0, ok2=0; - + *intens= 0.0f; haint= lar->haint; @@ -243,6 +242,8 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } if(snijp==2) { + int ok1=0, ok2=0; + /* sort */ if(t1>t2) { a= t1; t1= t2; t2= a; @@ -345,7 +346,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) } } -void renderspothalo(ShadeInput *shi, float *col, float alpha) +void renderspothalo(ShadeInput *shi, float col[4], float alpha) { ListBase *lights; GroupObject *go; @@ -891,12 +892,11 @@ void shade_color(ShadeInput *shi, ShadeResult *shr) static void ramp_diffuse_result(float *diff, ShadeInput *shi) { Material *ma= shi->mat; - float col[4], fac=0; + float col[4]; if(ma->ramp_col) { if(ma->rampin_col==MA_RAMP_IN_RESULT) { - - fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; + float fac= 0.3f*diff[0] + 0.58f*diff[1] + 0.12f*diff[2]; do_colorband(ma->ramp_col, fac, col); /* blending method */ @@ -911,8 +911,7 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi) static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, float g, float b) { Material *ma= shi->mat; - float col[4], colt[3], fac=0; - + if(ma->ramp_col && (ma->mode & MA_RAMP_COL)) { /* MA_RAMP_IN_RESULT is exceptional */ @@ -923,6 +922,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa diff[2] += b * shi->b; } else { + float colt[3], col[4]; + float fac; + /* input */ switch(ma->rampin_col) { case MA_RAMP_IN_ENERGY: @@ -934,6 +936,9 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_col, fac, col); @@ -962,11 +967,11 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInput *shi) { Material *ma= shi->mat; - float col[4]; - float fac; - + if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) { - fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + float col[4]; + float fac= 0.3f*(*specr) + 0.58f*(*specg) + 0.12f*(*specb); + do_colorband(ma->ramp_spec, fac, col); /* blending method */ @@ -978,19 +983,19 @@ static void ramp_spec_result(float *specr, float *specg, float *specb, ShadeInpu } /* is = dot product shade, t = spec energy */ -static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) +static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3]) { Material *ma= shi->mat; - float col[4]; - float fac=0.0f; - + spec[0]= shi->specr; spec[1]= shi->specg; spec[2]= shi->specb; /* MA_RAMP_IN_RESULT is exception */ if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) { - + float fac; + float col[4]; + /* input */ switch(ma->rampin_spec) { case MA_RAMP_IN_ENERGY: @@ -1002,6 +1007,9 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec) case MA_RAMP_IN_NOR: fac= shi->view[0]*shi->vn[0] + shi->view[1]*shi->vn[1] + shi->view[2]*shi->vn[2]; break; + default: + fac= 0.0f; + break; } do_colorband(ma->ramp_spec, fac, col); @@ -1086,7 +1094,7 @@ static void indirect_lighting_apply(ShadeInput *shi, ShadeResult *shr) } /* result written in shadfac */ -void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, int do_real) +void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4], int do_real) { LampShadowSubSample *lss= &(lar->shadsamp[shi->thread].s[shi->sample]); @@ -1115,7 +1123,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, i } /* lampdistance and spot angle, writes in lv and dist */ -float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) +float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *dist) { if(lar->type==LA_SUN || lar->type==LA_HEMI) { *dist= 1.0f; @@ -1621,7 +1629,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) } /* let's map negative light as if it mirrors positive light, otherwise negative values disappear */ -static void wrld_exposure_correct(float *diff) +static void wrld_exposure_correct(float diff[3]) { diff[0]= R.wrld.linfac*(1.0f-exp( diff[0]*R.wrld.logfac) ); diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 139eb41d771..e57141648e2 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -92,7 +92,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) Material *ma; StrandBuffer *strandbuf; float *simplify; - float p[4][3], data[4], cross[3], crosslen, w, dx, dy, t; + float p[4][3], data[4], cross[3], w, dx, dy, t; int type; strandbuf= sseg->buffer; @@ -164,7 +164,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) if(w > 0.0f) { if(strandbuf->flag & R_STRAND_B_UNITS) { - crosslen= len_v3(cross); + const float crosslen= len_v3(cross); w= 2.0f*crosslen*strandbuf->minwidth/w; if(spoint->width < w) { diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index f36994e0969..62a54a51102 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1747,13 +1747,14 @@ static void zbuf_project_cache_clear(ZbufProjectCache *cache, int size) static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[][4], float *co, float *ho) { - int clipflag, cindex= index & 255; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + int clipflag; projectvert(co, winmat, ho); clipflag= testclip(ho); @@ -1775,14 +1776,16 @@ static void zbuffer_part_bounds(int winx, int winy, RenderPart *pa, float *bound static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][4], float *bounds, float *co, float *ho) { - float vec[3], wco; - int clipflag= 0, cindex= index & 255; + float vec[3]; + int cindex= index & 255; if(cache[cindex].index == index) { QUATCOPY(ho, cache[cindex].ho); return cache[cindex].clip; } else { + float wco; + int clipflag= 0; VECCOPY(vec, co) projectvert(co, winmat, ho); diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 7c34c086b2e..7da2e17ad89 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -82,7 +82,7 @@ set(SRC add_definitions(-DGLEW_STATIC) if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() if(WITH_OPENCOLLADA) diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript index 17c29a170d8..be037452284 100644 --- a/source/blender/windowmanager/SConscript +++ b/source/blender/windowmanager/SConscript @@ -40,6 +40,6 @@ if env['BF_BUILDINFO']: defs.append('WITH_BUILDINFO') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib ( 'bf_windowmanager', sources, Split(incs), defines=defs, libtype=['core'], priority=[5] ) diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 19ad4a1b0ed..296cd1b86d8 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -404,7 +404,7 @@ void WM_exit_ext(bContext *C, const short do_python) BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 80a77b1fdb6..94be1a6e4e5 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -63,6 +63,8 @@ if(WIN32 AND NOT UNIX) endif() add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc) +elseif(APPLE) + add_executable(blenderplayer MACOSX_BUNDLE ${CMAKE_CURRENT_BINARY_DIR}/dna.c) else() add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c) endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 84e27f2a332..ccda7e9bb74 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -709,6 +709,61 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() + + # install blenderplayer bundle - copy of blender.app above. re-using macros et al + # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it + if(WITH_GAMEENGINE AND WITH_PLAYER) + set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist) + set(TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + + # setup Info.plist + execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) + + set_target_properties(blender PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${SOURCEINFO} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${BLENDER_VERSION} + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}") + + # important to make a clean install each time else old scripts get loaded. + install( + CODE + "file(REMOVE_RECURSE ${TARGETDIR_VER})" + ) + + # message after building. + add_custom_command( + TARGET blender POST_BUILD MAIN_DEPENDENCY blender + COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${TARGETDIR_VER}' + ) + + install( + FILES ${SOURCEDIR}/Contents/PkgInfo + DESTINATION ${TARGETDIR}/blenderplayer.app/Contents + ) + + install_dir( + ${SOURCEDIR}/Contents/Resources + \${TARGETDIR}/blenderplayer.app/Contents/ + ) + + # python + if(WITH_PYTHON) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python + COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ + DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) + + # copy extracted python files + install_dir( + ${CMAKE_CURRENT_BINARY_DIR}/python + \${TARGETDIR_VER} + ) + endif() + + endif() endif() unset(BLENDER_TEXT_FILES) diff --git a/source/creator/creator.c b/source/creator/creator.c index b45cf55e427..d9de5a7cdc4 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -513,7 +513,7 @@ static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data) SYS_SystemHandle *syshandle = data; /** - don't initialize joysticks if user doesn't want to use joysticks + don't initialize joysticks if user doesn't want to use joysticks failed joystick initialization delays over 5 seconds, before game engine start */ SYS_WriteCommandLineInt(*syshandle, "nojoystick",1); @@ -550,8 +550,8 @@ static int set_output(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1){ - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); } else { printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n"); @@ -576,17 +576,17 @@ static int set_engine(int argc, const char **argv, void *data) exit(0); } else { - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); - } - else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { RenderData *rd = &scene->r; if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) { BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine)); } } + else { + printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); + } } return 1; @@ -603,10 +603,8 @@ static int set_image_type(int argc, const char **argv, void *data) bContext *C = data; if (argc >= 1){ const char *imtype = argv[1]; - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); - } else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA; else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS; #ifdef WITH_DDS @@ -642,6 +640,9 @@ static int set_image_type(int argc, const char **argv, void *data) #endif else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); } + else { + printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); + } return 1; } else { printf("\nError: you must specify a format after '-F / --render-foramt'.\n"); @@ -668,8 +669,8 @@ static int set_extension(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1) { - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argv[1][0] == '0') { scene->r.scemode &= ~R_EXTENSION; } else if (argv[1][0] == '1') { @@ -751,9 +752,9 @@ example: static int render_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); if (argc > 1) { Render *re = RE_NewRender(scene->id.name); @@ -793,9 +794,9 @@ static int render_frame(int argc, const char **argv, void *data) static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); Render *re= RE_NewRender(scene->id.name); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); @@ -812,9 +813,9 @@ static int set_scene(int argc, const char **argv, void *data) { if(argc > 1) { bContext *C= data; - Scene *sce= set_scene_name(CTX_data_main(C), argv[1]); - if(sce) { - CTX_data_scene_set(C, sce); + Scene *scene= set_scene_name(CTX_data_main(C), argv[1]); + if(scene) { + CTX_data_scene_set(C, scene); } return 1; } else { @@ -826,8 +827,8 @@ static int set_scene(int argc, const char **argv, void *data) static int set_start_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -845,8 +846,8 @@ static int set_start_frame(int argc, const char **argv, void *data) static int set_end_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -864,8 +865,8 @@ static int set_end_frame(int argc, const char **argv, void *data) static int set_skip_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 895def17e8e..557b4aa7f11 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -226,10 +226,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } - // Continue only really makes sense for play stop and flipper. All other modes go until they are complete. - if (m_flag & ACT_FLAG_CONTINUE && - (m_playtype == ACT_ACTION_LOOP_STOP || - m_playtype == ACT_ACTION_FLIPPER)) + if (m_flag & ACT_FLAG_CONTINUE) bUseContinue = true; @@ -244,12 +241,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) if (m_flag & ACT_FLAG_ATTEMPT_PLAY) SetLocalTime(curtime); - if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) - { - m_localtime = obj->GetActionFrame(m_layer); - ResetStartTime(curtime); - } - // Handle a frame property if it's defined if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0) { @@ -264,22 +255,25 @@ bool BL_ActionActuator::Update(double curtime, bool frame) } // Handle a finished animation - if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer)) + if ((m_flag & ACT_FLAG_PLAY_END) && (m_flag & ACT_FLAG_ACTIVE) && obj->IsActionDone(m_layer)) { m_flag &= ~ACT_FLAG_ACTIVE; m_flag &= ~ACT_FLAG_ATTEMPT_PLAY; - obj->StopAction(m_layer); return false; } // If a different action is playing, we've been overruled and are no longer active - if (obj->GetCurrentAction(m_layer) != m_action) + if (obj->GetCurrentAction(m_layer) != m_action && !obj->IsActionDone(m_layer)) m_flag &= ~ACT_FLAG_ACTIVE; if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE))) { if (bPositiveEvent) + { + if (obj->IsActionDone(m_layer)) + m_localtime = start; ResetStartTime(curtime); + } if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags)) { @@ -307,11 +301,6 @@ bool BL_ActionActuator::Update(double curtime, bool frame) return false; } - - m_localtime = obj->GetActionFrame(m_layer); - if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe)) - m_localtime = m_startframe; - switch(m_playtype) { case ACT_ACTION_LOOP_STOP: @@ -340,6 +329,12 @@ bool BL_ActionActuator::Update(double curtime, bool frame) break; } } + + if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE)) + { + m_localtime = obj->GetActionFrame(m_layer); + ResetStartTime(curtime); + } return true; } diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index df3a575850b..5442878d6c5 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -279,19 +279,19 @@ PyObject* BL_ArmatureChannel::py_attr_get_joint_rotation(void *self_v, const str if (sa > FLT_EPSILON) { norm = atan2(sa,ca)/sa; } else { - if (ca < 0.0) { - norm = M_PI; - mul_v3_fl(joints,0.f); - if (joint_mat[0][0] > 0.f) { - joints[0] = 1.0f; - } else if (joint_mat[1][1] > 0.f) { - joints[1] = 1.0f; - } else { - joints[2] = 1.0f; - } - } else { - norm = 0.0; - } + if (ca < 0.0) { + norm = M_PI; + mul_v3_fl(joints,0.f); + if (joint_mat[0][0] > 0.f) { + joints[0] = 1.0f; + } else if (joint_mat[1][1] > 0.f) { + joints[1] = 1.0f; + } else { + joints[2] = 1.0f; + } + } else { + norm = 0.0; + } } mul_v3_fl(joints,norm); break; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2a088f413b3..5c37aed894c 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -642,7 +642,7 @@ bool ConvertMaterial( if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) material->alphablend = GEMAT_ALPHA; - // always zsort alpha + add + // always zsort alpha + add if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { material->ras_mode |= ALPHA; material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index f3233732ee3..f6cd5814e22 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -48,7 +48,7 @@ unsigned int KX_Hash(void * inDWord) key += ~(key << 9); key ^= (key >> 17); - return (unsigned int)(key & 0xffffffff); + return (unsigned int)(key & 0xffffffff); } diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 934f2a8dd87..ade54f6d924 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -487,12 +487,12 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value) static PySequenceMethods listvalue_as_sequence = { listvalue_bufferlen,//(inquiry)buffer_length, /*sq_length*/ listvalue_buffer_concat, /*sq_concat*/ - NULL, /*sq_repeat*/ + NULL, /*sq_repeat*/ listvalue_buffer_item, /*sq_item*/ // TODO, slicing in py3 NULL, // listvalue_buffer_slice, /*sq_slice*/ - NULL, /*sq_ass_item*/ - NULL, /*sq_ass_slice*/ + NULL, /*sq_ass_item*/ + NULL, /*sq_ass_slice*/ (objobjproc)listvalue_buffer_contains, /* sq_contains */ (binaryfunc) NULL, /* sq_inplace_concat */ (ssizeargfunc) NULL, /* sq_inplace_repeat */ @@ -515,12 +515,12 @@ PyTypeObject CListValue::Type = { sizeof(PyObjectPlus_Proxy), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ - py_base_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ + py_base_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ - py_base_repr, /*tp_repr*/ + 0, /*tp_compare*/ + py_base_repr, /*tp_repr*/ 0, /*tp_as_number*/ &listvalue_as_sequence, /*tp_as_sequence*/ &instance_as_mapping, /*tp_as_mapping*/ diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 080e7196d5a..d3b2eacbb4d 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -563,7 +563,7 @@ public: /** enable/disable display of deprecation warnings */ static void SetDeprecationWarnings(bool ignoreDeprecationWarnings); - /** Shows a deprecation warning */ + /** Shows a deprecation warning */ static void ShowDeprecationWarning_func(const char* method,const char* prop); static void ClearDeprecationWarning(); diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index 19633c2e09d..b61e4f4edca 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -83,8 +83,8 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) SCA_Joystick *SCA_JoystickManager::GetJoystickDevice( short int joyindex) { - /* - *Return the instance of SCA_Joystick for use - */ + /* + *Return the instance of SCA_Joystick for use + */ return m_joystick[joyindex]; } diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index b452bb97cde..479cf3fd7cc 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -79,7 +79,7 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_INTERNATIONAL) - add_definitions(-DINTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) endif() blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 726a1d4119a..f5bd3a91c26 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -999,7 +999,7 @@ int main(int argc, char** argv) RNA_exit(); BLF_exit(); -#ifdef INTERNATIONAL +#ifdef WITH_INTERNATIONAL BLF_free_unifont(); #endif diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 57c1122c2cd..9fb0f053ed8 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -52,6 +52,6 @@ if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') if env['WITH_BF_INTERNATIONAL']: - defs.append('INTERNATIONAL') + defs.append('WITH_INTERNATIONAL') env.BlenderLib (libname='ge_player_ghost', sources=source_files, includes = incs, defines = defs, libtype=['player'],priority=[0], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index ebb291b2284..7df08b83d49 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -253,7 +253,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame) /* ... set up some parameters ... */ /* missing here: the 'floorloc' of the actor's shadow */ - mindistsq= m_minHeight*m_minHeight; + mindistsq= m_minHeight*m_minHeight; maxdistsq= m_maxHeight*m_maxHeight; /* C1: not checked... is a future option */ diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index acd25ace04a..8e6126bb173 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -765,12 +765,12 @@ else m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true); SG_SetActiveStage(SG_STAGE_ACTUATOR); scene->UpdateParents(m_clockTime); - - scene->setSuspendedTime(0.0); + + scene->setSuspendedTime(0.0); } // suspended - else - if(scene->getSuspendedTime()==0.0) - scene->setSuspendedTime(m_clockTime); + else + if(scene->getSuspendedTime()==0.0) + scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index 73c5d94e4a5..07787665b1d 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -140,7 +140,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor */ bool m_positive_event; - /** + /** * Tests whether the object is in mouse focus for this camera */ bool ParentObjectHasFocusCamera(KX_Camera *cam); diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 913a1adac55..eca4d45e9c6 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -49,8 +49,8 @@ KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr, float resetmargin, bool bFindMaterial, const STR_String& touchedpropname, - PHY_IPhysicsController* ctrl) - :KX_TouchSensor(eventmgr, + PHY_IPhysicsController* ctrl) + :KX_TouchSensor(eventmgr, gameobj, bFindMaterial, false, diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h index 0737535b84c..3ba257b4f05 100644 --- a/source/gameengine/Ketsji/KX_ObjectActuator.h +++ b/source/gameengine/Ketsji/KX_ObjectActuator.h @@ -100,7 +100,7 @@ class KX_ObjectActuator : public SCA_IActuator // used in servo control MT_Vector3 m_previous_error; MT_Vector3 m_error_accumulator; - KX_LocalFlags m_bitLocalFlag; + KX_LocalFlags m_bitLocalFlag; KX_GameObject* m_reference; // A hack bool -- oh no sorry everyone // This bool is used to check if we have informed diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h index a850cc72eb9..6984465623d 100644 --- a/source/gameengine/Ketsji/KX_ParentActuator.h +++ b/source/gameengine/Ketsji/KX_ParentActuator.h @@ -56,8 +56,8 @@ class KX_ParentActuator : public SCA_IActuator - public: - enum KX_PARENTACT_MODE +public: + enum KX_PARENTACT_MODE { KX_PARENT_NODEF = 0, KX_PARENT_SET, @@ -65,7 +65,7 @@ class KX_ParentActuator : public SCA_IActuator KX_PARENT_MAX }; - + KX_ParentActuator(class SCA_IObject* gameobj, int mode, bool addToCompound, diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 04a53fbb493..729376f0a24 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -375,9 +375,9 @@ static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self) return (PyObject *)self; } else { return KX_PythonSeq_CreatePyObject(self->base, self->type); - } - } - + } +} + /* * Return next KX_PythonSeq iter. diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h index 04b2c00f4c1..ecae0eba6cd 100644 --- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h +++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h @@ -50,10 +50,10 @@ class KX_SCA_DynamicActuator : public SCA_IActuator float m_setmass; public: KX_SCA_DynamicActuator( - SCA_IObject* gameobj, - short dyn_operation, - float setmass - ); + SCA_IObject* gameobj, + short dyn_operation, + float setmass + ); ~KX_SCA_DynamicActuator( ); diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h index 0163e18fde7..0b3918773e2 100644 --- a/source/gameengine/Network/NG_NetworkMessage.h +++ b/source/gameengine/Network/NG_NetworkMessage.h @@ -72,7 +72,7 @@ public: { if (! --m_refcount) { - delete this; + delete this; } } diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp index 01ada4ea473..c39904bf742 100644 --- a/source/gameengine/SceneGraph/SG_Node.cpp +++ b/source/gameengine/SceneGraph/SG_Node.cpp @@ -128,9 +128,9 @@ Destruct() // We'll delete m_parent_relation now anyway. delete(m_parent_relation); - m_parent_relation = NULL; + m_parent_relation = NULL; - if (m_children.begin() != m_children.end()) + if (m_children.begin() != m_children.end()) { NodeList::iterator childit; for (childit = m_children.begin();childit!=m_children.end();++childit) |