diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 8eec383850e..d10fb99450d 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -126,8 +126,8 @@ void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_) SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background); SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background); - width = b_render.resolution_x(); - height = b_render.resolution_y(); + width = (int)(b_render.resolution_x()*b_render.resolution_percentage()/100); + height = (int)(b_render.resolution_y()*b_render.resolution_percentage()/100); if(scene->params.modified(scene_params) || session->params.modified(session_params) || diff --git a/intern/elbeem/intern/solver_class.h b/intern/elbeem/intern/solver_class.h index 1548aaa19bc..1962e801a4e 100644 --- a/intern/elbeem/intern/solver_class.h +++ b/intern/elbeem/intern/solver_class.h @@ -765,19 +765,19 @@ class LbmFsgrSolver : // lbm testsolver get index define, note - ignores is (set) as flag // array is only a single entry -#define _LBMGI(level, ii,ij,ik, is) ( (mLevel[level].lOffsy*(ik)) + (mLevel[level].lOffsx*(ij)) + (ii) ) +#define _LBMGI(level, ii,ij,ik, is) ( (LONGINT)((LONGINT)mLevel[level].lOffsy*(LONGINT)(ik)) + ((LONGINT)mLevel[level].lOffsx*(LONGINT)(ij)) + (LONGINT)(ii) ) //! flag array acces macro -#define _RFLAG(level,xx,yy,zz,set) mLevel[level].mprsFlags[set][ LBMGI((level),(xx),(yy),(zz),(set)) ] -#define _RFLAG_NB(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ LBMGI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set) ] -#define _RFLAG_NBINV(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ LBMGI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set) ] +#define _RFLAG(level,xx,yy,zz,set) mLevel[level].mprsFlags[set][ (LONGINT)LBMGI((level),(xx),(yy),(zz),(set)) ] +#define _RFLAG_NB(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ (LONGINT)LBMGI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set) ] +#define _RFLAG_NBINV(level,xx,yy,zz,set, dir) mLevel[level].mprsFlags[set][ (LONGINT)LBMGI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set) ] // array handling ----------------------------------------------------------------------------------------------- -#define _LBMQI(level, ii,ij,ik, is, lunused) ( (mLevel[level].lOffsy*(ik)) + (mLevel[level].lOffsx*(ij)) + (ii) ) -#define _QCELL(level,xx,yy,zz,set,l) (mLevel[level].mprsCells[(set)][ LBMQI((level),(xx),(yy),(zz),(set), l)*dTotalNum +(l)]) -#define _QCELL_NB(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ LBMQI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set, l)*dTotalNum +(l)]) -#define _QCELL_NBINV(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ LBMQI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set, l)*dTotalNum +(l)]) +#define _LBMQI(level, ii,ij,ik, is, lunused) ( (LONGINT)((LONGINT)mLevel[level].lOffsy*(LONGINT)(ik)) + (LONGINT)((LONGINT)mLevel[level].lOffsx*(LONGINT)(ij)) + (LONGINT)(ii) ) +#define _QCELL(level,xx,yy,zz,set,l) (mLevel[level].mprsCells[(set)][ (LONGINT)LBMQI((level),(xx),(yy),(zz),(set), l)*(LONGINT)dTotalNum +(LONGINT)(l)]) +#define _QCELL_NB(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ (LONGINT)LBMQI((level),(xx)+this->dfVecX[dir],(yy)+this->dfVecY[dir],(zz)+this->dfVecZ[dir],set, l)*dTotalNum +(l)]) +#define _QCELL_NBINV(level,xx,yy,zz,set, dir,l) (mLevel[level].mprsCells[(set)][ (LONGINT)LBMQI((level),(xx)+this->dfVecX[this->dfInv[dir]],(yy)+this->dfVecY[this->dfInv[dir]],(zz)+this->dfVecZ[this->dfInv[dir]],set, l)*dTotalNum +(l)]) #define QCELLSTEP dTotalNum #define _RACPNT(level, ii,ij,ik, is ) &QCELL(level,ii,ij,ik,is,0) diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp index aede617a4d3..63ce1570eea 100644 --- a/intern/elbeem/intern/solver_init.cpp +++ b/intern/elbeem/intern/solver_init.cpp @@ -817,16 +817,16 @@ bool LbmFsgrSolver::initializeSolverMemory() mLevel[ mMaxRefine ].nodeSize = ((mvGeoEnd[0]-mvGeoStart[0]) / (LbmFloat)(mSizex)); mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize(); mLevel[ mMaxRefine ].lcellfactor = 1.0; - LONGINT rcellSize = ((mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*mLevel[mMaxRefine].lSizez) *dTotalNum); + LONGINT rcellSize = (LONGINT)((LONGINT)((LONGINT)mLevel[mMaxRefine].lSizex*(LONGINT)mLevel[mMaxRefine].lSizey*(LONGINT)mLevel[mMaxRefine].lSizez) * (LONGINT)dTotalNum); #if COMPRESSGRIDS==0 mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ]; mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +4 ]; ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4); #else // COMPRESSGRIDS==0 - LONGINT compressOffset = (mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*dTotalNum*2); - // D int tmp = ( (rcellSize +compressOffset +4)/(1024*1024) )*4; - // D printf("Debug MEMMMM excee: %d\n", tmp); + LONGINT compressOffset = (LONGINT)((LONGINT)mLevel[mMaxRefine].lSizex * (LONGINT)mLevel[mMaxRefine].lSizey * (LONGINT)dTotalNum * 2); + // LONGINT tmp = ( (rcellSize +compressOffset +4)/(1024*1024) )*sizeof(LbmFloat); + // printf("Debug MEMMMM excee: %I64d, %I64d, %I64d, %d, %d\n", tmp, compressOffset, rcellSize, mLevel[mMaxRefine].lSizex, mLevel[mMaxRefine].lSizey ); mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +compressOffset +4 ]; mLevel[ mMaxRefine ].mprsCells[0] = mLevel[ mMaxRefine ].mprsCells[1]+compressOffset; ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4); diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index e4f859217cd..1f6da80069e 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -664,7 +664,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init() #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // make it build with 10.6 deployment target, but as it is not available in 10.6, it will get weaklinked menuItem = [windowMenu addItemWithTitle:@"Enter Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f" ]; - [menuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; + [menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; #endif menuItem = [windowMenu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"]; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 6c17e9e7159..20855a126a8 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -94,8 +94,6 @@ typedef struct { */ /* See the python script above to regenerate the 48x48 icon within blender */ -#define BLENDER_ICON_WIDTH 48 -#define BLENDER_ICON_HEIGHT 48 static long BLENDER_ICON_48x48x32[] = { 48,48, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, 4671303, diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py index 9be786f14c1..ea162557c95 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -135,7 +135,7 @@ def print_info(reports, pot): _print("{} messages were rejected.".format(len(reports["messages_skipped"]))) _print("\n") _print("Current POT stats:") - pot.print_stats(prefix="\t", output=_print) + pot.print_info(prefix="\t", output=_print) _print("\n") check_ctxt = reports["check_ctxt"] @@ -365,9 +365,10 @@ def dump_messages_rna(msgs, reports, settings): walk_properties(cls) def walk_keymap_hierarchy(hier, msgsrc_prev): + km_i18n_context = bpy.app.translations.contexts.id_windowmanager for lvl in hier: msgsrc = msgsrc_prev + "." + lvl[1] - process_msg(msgs, default_context, lvl[0], msgsrc, reports, None, settings) + process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, None, settings) if lvl[3]: walk_keymap_hierarchy(lvl[3], msgsrc) @@ -396,7 +397,6 @@ def dump_messages_rna(msgs, reports, settings): # And parse keymaps! from bpy_extras.keyconfig_utils import KM_HIERARCHY - walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY") diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index fbfca8f639d..31e457151bb 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -237,10 +237,10 @@ _ctxt_re = _ctxt_re_gen("") _msg_re = r"(?P" + _str_whole_re.format(_="_msg") + r")" PYGETTEXT_KEYWORDS = (() + tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it) - for it in ("IFACE_", "TIP_", "N_")) + + for it in ("IFACE_", "TIP_", "DATA_", "N_")) + tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*" + _msg_re + r"\s*\)").format(it) - for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) + + for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_DATA_", "CTX_N_")) + tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf", @@ -308,6 +308,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "sqrt(x*x+y*y+z*z)", "sRGB", "utf-8", + "var", "vBVH", "view", "wav", diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index 925166a3d8b..574553d75b7 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -374,8 +374,9 @@ class SpellChecker(): "fluidsim", "frameserver", "enum", + "idcol", "keyframe", "keyframes", "keyframing", "keyframed", - "metaball", "metaballs", + "metaball", "metaballs", "mball", "metaelement", "metaelements", "metastrip", "metastrips", "movieclip", diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index a3275bea4ee..17dcf267c3b 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -112,3 +112,18 @@ def brush_texture_settings(layout, brush, sculpt): col = layout.column(align=True) col.label(text="Sample Bias:") col.prop(brush, "texture_sample_bias", slider=True, text="") + + +def brush_mask_texture_settings(layout, brush): + mask_tex_slot = brush.mask_texture_slot + + if(brush.mask_texture): + layout.label(text="Mask Mapping:") + col = layout.column() + col.active = brush.brush_capabilities.has_texture_angle + col.prop(mask_tex_slot, "angle", text="") + + # scale and offset + split = layout.split() + split.prop(mask_tex_slot, "offset") + split.prop(mask_tex_slot, "scale") diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index b48e7660a6b..d2bbca358aa 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -19,7 +19,7 @@ # import bpy from bpy.types import Header, Menu, Panel -from bl_ui.properties_paint_common import UnifiedPaintPanel, brush_texture_settings +from bl_ui.properties_paint_common import UnifiedPaintPanel, brush_texture_settings, brush_mask_texture_settings from bpy.app.translations import pgettext_iface as iface_ @@ -477,7 +477,6 @@ class IMAGE_PT_game_properties(Panel): split = layout.split() col = split.column() - col.prop(ima, "use_animation") sub = col.column(align=True) sub.active = ima.use_animation @@ -730,6 +729,28 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel): brush_texture_settings(col, brush, 0) +class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel): + bl_label = "Texture Mask" + bl_options = {'DEFAULT_CLOSED'} + + def draw_header(self, context): + brush = context.tool_settings.image_paint.brush + tex_slot_alpha = brush.mask_texture_slot + self.layout.prop(brush, 'use_mask', text="") + + def draw(self, context): + layout = self.layout + + brush = context.tool_settings.image_paint.brush + tex_slot_alpha = brush.mask_texture_slot + + col = layout.column() + + col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8) + + brush_mask_texture_settings(col, brush) + + class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel): bl_label = "Tool" bl_options = {'DEFAULT_CLOSED'} diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py index 4c634378ed2..a13d77942eb 100644 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py @@ -21,6 +21,8 @@ import bpy from bpy.types import Menu from bpy.app.translations import pgettext_iface as iface_ +km_i18n_context = bpy.app.translations.contexts.id_windowmanager + class USERPREF_MT_keyconfigs(Menu): bl_label = "KeyPresets" @@ -79,7 +81,7 @@ class InputKeyMapPanel: row = col.row() row.prop(km, "show_expanded_children", text="", emboss=False) - row.label(text=km.name) + row.label(text=km.name, text_ctxt=km_i18n_context) row.label() row.label() @@ -110,7 +112,7 @@ class InputKeyMapPanel: # "Add New" at end of keymap item list col = self.indented_layout(col, level + 1) subcol = col.split(percentage=0.2).column() - subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') + subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=km_i18n_context, icon='ZOOMIN') col.separator() diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 24e4dac4ded..54d3b61c665 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -21,6 +21,7 @@ import bpy from bpy.types import Menu, Panel from bl_ui.properties_paint_common import UnifiedPaintPanel from bl_ui.properties_paint_common import brush_texture_settings +from bl_ui.properties_paint_common import brush_mask_texture_settings class View3DPanel(): @@ -782,6 +783,34 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel): sub.prop(brush, "texture_overlay_alpha", text="Alpha") +class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel): + bl_context = "imagepaint" + bl_label = "Texture Mask" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + brush = context.tool_settings.image_paint.brush + return (context.image_paint_object and brush and brush.image_tool != 'SOFTEN') + + def draw_header(self, context): + brush = context.tool_settings.image_paint.brush + tex_slot_alpha = brush.mask_texture_slot + self.layout.prop(brush, 'use_mask', text="") + + def draw(self, context): + layout = self.layout + + brush = context.tool_settings.image_paint.brush + tex_slot_alpha = brush.mask_texture_slot + + col = layout.column() + + col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8) + + brush_mask_texture_settings(col, brush) + + class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): bl_label = "Stroke" bl_options = {'DEFAULT_CLOSED'} diff --git a/source/blender/avi/intern/avi_intern.h b/source/blender/avi/intern/avi_intern.h index 5dc48657831..f3e33ecf86f 100644 --- a/source/blender/avi/intern/avi_intern.h +++ b/source/blender/avi/intern/avi_intern.h @@ -34,8 +34,8 @@ #include /* for FILE */ -unsigned int GET_FCC (FILE *fp); -unsigned int GET_TCC (FILE *fp); +unsigned int GET_FCC(FILE *fp); +unsigned int GET_TCC(FILE *fp); #define PUT_FCC(ch4, fp) \ { \ diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index dc72c77b3bf..2fc179c8d35 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -37,6 +37,10 @@ #define TEXT_DOMAIN_NAME "blender" +#ifdef __cplusplus +extern "C" { +#endif + /* blf_lang.c */ /* Search the path directory to the locale files, this try all @@ -219,4 +223,8 @@ typedef struct {NULL, NULL, NULL} \ } +#ifdef __cplusplus +}; +#endif + #endif /* __BLF_TRANSLATION_H__ */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index c6b02bc8361..2d10b76378a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 266 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 /* 262 was the last editmesh release but it has compatibility code for bmesh data */ #define BLENDER_MINVERSION 262 diff --git a/source/blender/blenkernel/BKE_booleanops_mesh.h b/source/blender/blenkernel/BKE_booleanops_mesh.h deleted file mode 100644 index e8ffefe74ce..00000000000 --- a/source/blender/blenkernel/BKE_booleanops_mesh.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BKE_BOOLEANOPS_MESH_H__ -#define __BKE_BOOLEANOPS_MESH_H__ - -/** \file BKE_booleanops_mesh.h - * \ingroup bke - */ - -#include "CSG_BooleanOps.h" - -/** - * Internal mesh structure. - * Safe to copy by value... hopefully. - */ - -struct Base; -struct Object; -struct CSG_MeshDescriptor; - -typedef void (*CSG_DestroyMeshFunc)(struct CSG_MeshDescriptor *); - -typedef struct CSG_MeshDescriptor { - struct Base *base; // Ptr to base of original blender object - used in creating a new object - CSG_MeshPropertyDescriptor m_descriptor; - CSG_FaceIteratorDescriptor m_face_iterator; - CSG_VertexIteratorDescriptor m_vertex_iterator; - CSG_DestroyMeshFunc m_destroy_func; -} CSG_MeshDescriptor; - - -extern int -CSG_LoadBlenderMesh(struct Object *obj, - CSG_MeshDescriptor *output); - -/** - * Destroy the contents of a mesh descriptor. - * If the internal descriptor refers to a blender - * mesh, no action is performed apart from freeing - * internal memory in the desriptor. - */ - -extern void -CSG_DestroyMeshDescriptor(CSG_MeshDescriptor *mesh); - -/** - * Perform a boolean operation between 2 meshes and return the - * result as a new mesh descriptor. - * op_type is an integer code of the boolean operation type. - * 1 = intersection, - * 2 = union, - * 3 = difference. - */ - -extern int -CSG_PerformOp(CSG_MeshDescriptor *mesh1, - CSG_MeshDescriptor *mesh2, - int op_type, - CSG_MeshDescriptor *output); - - - -/** - * Add a mesh to blender as a new object. - */ - -extern int -CSG_AddMeshToBlender(CSG_MeshDescriptor *mesh); - -/** - * Test functionality. - */ - -extern int -NewBooleanMeshTest(struct Base *base, - struct Base *base_select, - int op_type); - -#endif - diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index e0afb1929a5..17ef8e901f4 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -69,7 +69,7 @@ void BKE_brush_jitter_pos(const struct Scene *scene, struct Brush *brush, const float pos[2], float jitterpos[2]); /* brush curve */ -void BKE_brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/ int preset); +void BKE_brush_curve_preset(struct Brush *b, int preset); float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len); float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ @@ -78,6 +78,8 @@ float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float float rgba[4], const int thread, struct ImagePool *pool); float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4]); +float BKE_brush_sample_masktex(const Scene *scene, struct Brush *br, const float point[3], + const int thread, struct ImagePool *pool); void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, struct ImBuf **imbuf, int use_color_correction); diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index e9d37fb4407..562a67f14f5 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -120,7 +120,7 @@ void pd_point_from_soft(struct Scene *scene, float *loc, float *vel, int index, /* needed for boids */ float effector_falloff(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, struct EffectorWeights *weights); -int closest_point_on_surface(SurfaceModifierData * surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3]); +int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3]); int get_effector_data(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, int real_velocity); /* required for particle_system.c */ diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 816fb2d1b35..944b6e9b8c0 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -119,7 +119,7 @@ void recalc_all_library_objects(struct Main *main); void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowManager *) ); /* use when "" is given to new_id() */ -#define ID_FALLBACK_NAME "Untitled" +#define ID_FALLBACK_NAME N_("Untitled") #define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT)) diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 71024a4ead2..429dacb90ef 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -221,7 +221,7 @@ void BKE_mesh_calc_normals( /* Return a newly MEM_malloc'd array of all the mesh vertex locations * (_numVerts_r_ may be NULL) */ -float (*mesh_getVertexCos(struct Mesh *me, int *r_numVerts))[3]; +float (*BKE_mesh_vertexCos_get(struct Mesh *me, int *r_numVerts))[3]; /* map from uv vertex to face (for select linked, stitch, uv suburf) */ diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 6c207675cb1..1009472cf40 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -321,7 +321,7 @@ void psys_get_dupli_path_transform(struct ParticleSimulationData *sim, struct Pa ParticleThread *psys_threads_create(struct ParticleSimulationData *sim); void psys_threads_free(ParticleThread *threads); -void psys_make_billboard(ParticleBillboardData * bb, float xvec[3], float yvec[3], float zvec[3], float center[3]); +void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]); void psys_apply_hair_lattice(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys); /* particle_system.c */ diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index cdc8ef0bdf4..3d73674d990 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -163,8 +163,8 @@ void BKE_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, void BKE_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, struct MVert **verts); -void BKE_pbvh_node_get_BB(PBVHNode * node, float bb_min[3], float bb_max[3]); -void BKE_pbvh_node_get_original_BB(PBVHNode * node, float bb_min[3], float bb_max[3]); +void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]); +void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]); float BKE_pbvh_node_get_tmin(PBVHNode *node); @@ -181,7 +181,7 @@ void BKE_pbvh_bmesh_after_stroke(PBVH *bvh); /* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */ void BKE_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]); -void BKE_pbvh_redraw_BB(PBVH * bvh, float bb_min[3], float bb_max[3]); +void BKE_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3]); void BKE_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface); void BKE_pbvh_grids_update(PBVH *bvh, struct CCGElem **grid_elems, struct DMGridAdjacency *gridadj, void **gridfaces, diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index ed7ce05506d..c4cfcba4b35 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -126,7 +126,7 @@ void sk_appendStrokePoint(SK_Stroke *stk, SK_Point *pt); void sk_insertStrokePoints(SK_Stroke *stk, SK_Point *pts, int len, int start, int end); void sk_trimStroke(SK_Stroke *stk, int start, int end); -void sk_straightenStroke(SK_Stroke * stk, int start, int end, float p_start[3], float p_end[3]); +void sk_straightenStroke(SK_Stroke *stk, int start, int end, float p_start[3], float p_end[3]); void sk_polygonizeStroke(SK_Stroke *stk, int start, int end); void sk_flattenStroke(SK_Stroke *stk, int start, int end); void sk_reverseStroke(SK_Stroke *stk); diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h index 95581958328..486fe8ed5a8 100644 --- a/source/blender/blenkernel/BKE_softbody.h +++ b/source/blender/blenkernel/BKE_softbody.h @@ -68,7 +68,7 @@ extern void sbObjectToSoftbody(struct Object *ob); /* pass NULL to unlink again */ extern void sbSetInterruptCallBack(int (*f)(void)); -extern void SB_estimate_transform(Object * ob, float lloc[3], float lrot[3][3], float lscale[3][3]); +extern void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3]); #endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 57e99481604..68f381d8456 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -65,7 +65,6 @@ set(SRC intern/blender.c intern/bmfont.c intern/boids.c - intern/booleanops_mesh.c intern/bpath.c intern/brush.c intern/bullet.c @@ -166,7 +165,6 @@ set(SRC BKE_bmfont.h BKE_bmfont_types.h BKE_boids.h - BKE_booleanops_mesh.h BKE_bpath.h BKE_brush.h BKE_bullet.h diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b2a5a3a5593..cc0770cd186 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -845,7 +845,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, if (mti->type == eModifierTypeType_OnlyDeform) { int numVerts; - float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts); + float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts); mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0); dm = mesh_create_derived(me, ob, deformedVerts); @@ -1451,7 +1451,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (mti->type == eModifierTypeType_OnlyDeform && !sculpt_dyntopo) { if (!deformedVerts) - deformedVerts = mesh_getVertexCos(me, &numVerts); + deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, deform_app_flags); } @@ -1485,7 +1485,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (inputVertexCos) deformedVerts = inputVertexCos; else - deformedVerts = mesh_getVertexCos(me, &numVerts); + deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); } @@ -1557,7 +1557,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos dm->getVertCos(dm, deformedVerts); } else { - deformedVerts = mesh_getVertexCos(me, &numVerts); + deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); } } @@ -2441,30 +2441,30 @@ static int GetNumVertsOfFace(const SMikkTSpaceContext *pContext, const int face_ return pMesh->mface[face_num].v4 != 0 ? 4 : 3; } -static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const int face_num, const int vert_index) +static void GetPosition(const SMikkTSpaceContext *pContext, float r_co[3], const int face_num, const int vert_index) { //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; const float *co = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].co; - copy_v3_v3(fPos, co); + copy_v3_v3(r_co, co); } -static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[], const int face_num, const int vert_index) +static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float r_uv[2], const int face_num, const int vert_index) { //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; if (pMesh->mtface != NULL) { - float *uv = pMesh->mtface[face_num].uv[vert_index]; - fUV[0] = uv[0]; fUV[1] = uv[1]; + const float *uv = pMesh->mtface[face_num].uv[vert_index]; + copy_v2_v2(r_uv, uv); } else { const float *orco = pMesh->orco[(&pMesh->mface[face_num].v1)[vert_index]]; - map_to_sphere(&fUV[0], &fUV[1], orco[0], orco[1], orco[2]); + map_to_sphere(&r_uv[0], &r_uv[1], orco[0], orco[1], orco[2]); } } -static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const int face_num, const int vert_index) +static void GetNormal(const SMikkTSpaceContext *pContext, float r_no[3], const int face_num, const int vert_index) { //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; @@ -2472,29 +2472,29 @@ static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const i const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH); if (!smoothnormal) { // flat if (pMesh->precomputedFaceNormals) { - copy_v3_v3(fNorm, &pMesh->precomputedFaceNormals[3 * face_num]); + copy_v3_v3(r_no, &pMesh->precomputedFaceNormals[3 * face_num]); } else { MFace *mf = &pMesh->mface[face_num]; - float *p0 = pMesh->mvert[mf->v1].co; - float *p1 = pMesh->mvert[mf->v2].co; - float *p2 = pMesh->mvert[mf->v3].co; + const float *p0 = pMesh->mvert[mf->v1].co; + const float *p1 = pMesh->mvert[mf->v2].co; + const float *p2 = pMesh->mvert[mf->v3].co; if (mf->v4) { - float *p3 = pMesh->mvert[mf->v4].co; - normal_quad_v3(fNorm, p0, p1, p2, p3); + const float *p3 = pMesh->mvert[mf->v4].co; + normal_quad_v3(r_no, p0, p1, p2, p3); } else { - normal_tri_v3(fNorm, p0, p1, p2); + normal_tri_v3(r_no, p0, p1, p2); } } } else { const short *no = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].no; - normal_short_to_float_v3(fNorm, no); + normal_short_to_float_v3(r_no, no); } } -static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) +static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[3], const float fSign, const int face_num, const int iVert) { //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 509442b1d4e..fa85f6e4f86 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -47,18 +47,19 @@ #include "BLI_utildefines.h" #include "BLI_ghash.h" -#include "BKE_animsys.h" +#include "BLF_translation.h" + #include "BKE_action.h" #include "BKE_anim.h" +#include "BKE_animsys.h" #include "BKE_constraint.h" -#include "BKE_global.h" #include "BKE_fcurve.h" +#include "BKE_global.h" +#include "BKE_idprop.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" -#include "BKE_idprop.h" - #include "BIK_api.h" #include "RNA_access.h" @@ -296,11 +297,11 @@ bActionGroup *action_groups_add_new(bAction *act, const char name[]) /* make it selected, with default name */ agrp->flag = AGRP_SELECTED; - BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name)); + BLI_strncpy(agrp->name, name[0] ? name : DATA_("Group"), sizeof(agrp->name)); /* add to action, and validate */ BLI_addtail(&act->groups, agrp); - BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); + BLI_uniquename(&act->groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name)); /* return the new group */ return agrp; @@ -825,9 +826,9 @@ void BKE_pose_add_group(Object *ob) return; grp = MEM_callocN(sizeof(bActionGroup), "PoseGroup"); - BLI_strncpy(grp->name, "Group", sizeof(grp->name)); + BLI_strncpy(grp->name, DATA_("Group"), sizeof(grp->name)); BLI_addtail(&pose->agroups, grp); - BLI_uniquename(&pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name), sizeof(grp->name)); + BLI_uniquename(&pose->agroups, grp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(grp->name)); pose->active_group = BLI_countlist(&pose->agroups); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index d4563c936d0..5be9ea491b3 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -42,6 +42,8 @@ #include "BLI_dynstr.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" @@ -980,8 +982,8 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam /* allocate new KeyingSet */ ks = MEM_callocN(sizeof(KeyingSet), "KeyingSet"); - BLI_strncpy(ks->idname, (idname) ? idname : (name) ? name : "KeyingSet", sizeof(ks->idname)); - BLI_strncpy(ks->name, (name) ? name : (idname) ? idname : "Keying Set", sizeof(ks->name)); + BLI_strncpy(ks->idname, (idname) ? idname : (name) ? name : DATA_("KeyingSet"), sizeof(ks->idname)); + BLI_strncpy(ks->name, (name) ? name : (idname) ? idname : DATA_("Keying Set"), sizeof(ks->name)); ks->flag = flag; ks->keyingflag = keyingflag; @@ -990,10 +992,10 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam BLI_addtail(list, ks); /* Make sure KeyingSet has a unique idname */ - BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, idname), sizeof(ks->idname)); + BLI_uniquename(list, ks, DATA_("KeyingSet"), '.', offsetof(KeyingSet, idname), sizeof(ks->idname)); /* Make sure KeyingSet has a unique label (this helps with identification) */ - BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name)); + BLI_uniquename(list, ks, DATA_("Keying Set"), '.', offsetof(KeyingSet, name), sizeof(ks->name)); /* return new KeyingSet for further editing */ return ks; diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 78da4f5b1c2..a95e5bd8ed5 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -38,7 +38,7 @@ * detects if an image buffer contains a bitmap font. It makes the * specific bitmap data which is stored in the bitmap invisible to blender. * - * void matrixGlyph(ImBuf * ibuf, unsigned short unicode, *float x 7) + * void matrixGlyph(ImBuf *ibuf, unsigned short unicode, *float x 7) * returns all the information about the character (unicode) in the floats * * Room for improvement: @@ -248,7 +248,7 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode) } void matrixGlyph( - ImBuf * ibuf, unsigned short unicode, + ImBuf *ibuf, unsigned short unicode, float *centerx, float *centery, float *sizex, float *sizey, float *transx, float *transy, diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c deleted file mode 100644 index f53a89fccfd..00000000000 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ /dev/null @@ -1,281 +0,0 @@ -#if 0 -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenkernel/intern/booleanops_mesh.c - * \ingroup bke - */ - -#include "CSG_BooleanOps.h" - - - - - -/** - * Implementation of boolean ops mesh interface. - */ - - void -CSG_DestroyMeshDescriptor( - CSG_MeshDescriptor *mesh -) { - /* Call mesh descriptors destroy function.... */ - mesh->m_destroy_func(mesh); -} - -/* Destroy function for blender mesh internals. */ - -static - void -CSG_DestroyBlenderMeshInternals( - CSG_MeshDescriptor *mesh -) { - /* Free face and vertex iterators. */ - FreeMeshDescriptors(&(mesh->m_face_iterator), &(mesh->m_vertex_iterator)); -} - - -static - void -CSG_DestroyCSGMeshInternals( - CSG_MeshDescriptor *mesh -) { - CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator)); - CSG_FreeFaceDescriptor(&(mesh->m_face_iterator)); -} - -static - int -MakeCSGMeshFromBlenderBase( - Base * base, - CSG_MeshDescriptor * output -) { - Mesh *me; - if (output == NULL || base == NULL) return 0; - - me = BKE_mesh_from_object(base->object); - - output->m_descriptor.user_face_vertex_data_size = 0; - output->m_descriptor.user_data_size = sizeof(FaceData); - - output->base = base; - - BuildMeshDescriptors( - base->object, - &(output->m_face_iterator), - &(output->m_vertex_iterator) - ); - - output->m_destroy_func = CSG_DestroyBlenderMeshInternals; - - return 1; -} - - int -CSG_LoadBlenderMesh( - Object * obj, - CSG_MeshDescriptor *output -) { - - Mesh *me; - if (output == NULL || obj == NULL) return 0; - - me = BKE_mesh_from_object(obj); - - output->m_descriptor.user_face_vertex_data_size = 0; - output->m_descriptor.user_data_size = sizeof(FaceData); - - output->base = NULL; - - BuildMeshDescriptors( - obj, - &(output->m_face_iterator), - &(output->m_vertex_iterator) - ); - - output->m_destroy_func = CSG_DestroyBlenderMeshInternals; - output->base = NULL; - - return 1; -} - - - - - int -CSG_AddMeshToBlender( - CSG_MeshDescriptor *mesh -) { - Mesh *me_new = NULL; - Object *ob_new = NULL; - float inv_mat[4][4]; - - if (mesh == NULL) return 0; - if (mesh->base == NULL) return 0; - - invert_m4_m4(inv_mat, mesh->base->object->obmat); - - /* Create a new blender mesh object - using 'base' as - * a template for the new object. */ - ob_new = AddNewBlenderMesh(mesh->base); - - me_new = ob_new->data; - - /* make sure the iterators are reset. */ - mesh->m_face_iterator.Reset(mesh->m_face_iterator.it); - mesh->m_vertex_iterator.Reset(mesh->m_vertex_iterator.it); - - /* iterate through results of operation and insert into new object - * see subsurf.c */ - - ConvertCSGDescriptorsToMeshObject( - ob_new, - &(mesh->m_descriptor), - &(mesh->m_face_iterator), - &(mesh->m_vertex_iterator), - inv_mat - ); - - return 1; -} - - int -CSG_PerformOp( - CSG_MeshDescriptor *mesh1, - CSG_MeshDescriptor *mesh2, - int int_op_type, - CSG_MeshDescriptor *output -) { - - CSG_OperationType op_type; - CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction(); - int success = 0; - - if (bool_op == NULL) return 0; - - if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) { - return 0; - } - if ((int_op_type < 1) || (int_op_type > 3)) return 0; - - switch (int_op_type) { - case 1 : op_type = e_csg_intersection; break; - case 2 : op_type = e_csg_union; break; - case 3 : op_type = e_csg_difference; break; - case 4 : op_type = e_csg_classify; break; - default : op_type = e_csg_intersection; - } - - output->m_descriptor = CSG_DescibeOperands(bool_op, mesh1->m_descriptor, mesh2->m_descriptor); - output->base = mesh1->base; - - if (output->m_descriptor.user_face_vertex_data_size) { - /* Then use the only interp function supported */ - success = - CSG_PerformBooleanOperation( - bool_op, - op_type, - mesh1->m_face_iterator, - mesh1->m_vertex_iterator, - mesh2->m_face_iterator, - mesh2->m_vertex_iterator, - InterpFaceVertexData - ); - } - else { - success = - CSG_PerformBooleanOperation( - bool_op, - op_type, - mesh1->m_face_iterator, - mesh1->m_vertex_iterator, - mesh2->m_face_iterator, - mesh2->m_vertex_iterator, - InterpNoUserData - ); - } - - if (!success) { - CSG_FreeBooleanOperation(bool_op); - bool_op = NULL; - return 0; - } - - /* get the ouput mesh descriptors. */ - - CSG_OutputFaceDescriptor(bool_op, &(output->m_face_iterator)); - CSG_OutputVertexDescriptor(bool_op, &(output->m_vertex_iterator)); - output->m_destroy_func = CSG_DestroyCSGMeshInternals; - - return 1; -} - - int -NewBooleanMeshTest( - struct Base * base, - struct Base * base_select, - int op_type -) { - - CSG_MeshDescriptor m1, m2, output; - CSG_MeshDescriptor output2, output3; - - if (!MakeCSGMeshFromBlenderBase(base, &m1)) { - return 0; - } - - if (!MakeCSGMeshFromBlenderBase(base_select, &m2)) { - return 0; - } - - CSG_PerformOp(&m1, &m2, 1, &output); - CSG_PerformOp(&m1, &m2, 2, &output2); - CSG_PerformOp(&m1, &m2, 3, &output3); - - if (!CSG_AddMeshToBlender(&output)) { - return 0; - } - if (!CSG_AddMeshToBlender(&output2)) { - return 0; - } - if (!CSG_AddMeshToBlender(&output3)) { - return 0; - } - - - CSG_DestroyMeshDescriptor(&m1); - CSG_DestroyMeshDescriptor(&m2); - CSG_DestroyMeshDescriptor(&output); - CSG_DestroyMeshDescriptor(&output2); - CSG_DestroyMeshDescriptor(&output3); - - return 1; -} - -#endif - diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index d6cd7290038..888426735c5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -107,6 +107,7 @@ static void brush_defaults(Brush *brush) /* BRUSH TEXTURE SETTINGS */ default_mtex(&brush->mtex); + default_mtex(&brush->mask_mtex); brush->texture_sample_bias = 0; /* value to added to texture samples */ brush->texture_overlay_alpha = 33; @@ -152,6 +153,9 @@ Brush *BKE_brush_copy(Brush *brush) if (brush->mtex.tex) id_us_plus((ID *)brush->mtex.tex); + if (brush->mask_mtex.tex) + id_us_plus((ID *)brush->mask_mtex.tex); + if (brush->icon_imbuf) brushn->icon_imbuf = IMB_dupImBuf(brush->icon_imbuf); @@ -174,6 +178,9 @@ void BKE_brush_free(Brush *brush) if (brush->mtex.tex) brush->mtex.tex->id.us--; + if (brush->mask_mtex.tex) + brush->mask_mtex.tex->id.us--; + if (brush->icon_imbuf) IMB_freeImBuf(brush->icon_imbuf); @@ -185,6 +192,7 @@ void BKE_brush_free(Brush *brush) static void extern_local_brush(Brush *brush) { id_lib_extern((ID *)brush->mtex.tex); + id_lib_extern((ID *)brush->mask_mtex.tex); id_lib_extern((ID *)brush->clone.image); } @@ -409,8 +417,11 @@ void BKE_brush_sculpt_reset(Brush *br) } } -/* Library Operations */ -void BKE_brush_curve_preset(Brush *b, /*CurveMappingPreset*/ int preset) +/** + * Library Operations + * \param preset CurveMappingPreset + */ +void BKE_brush_curve_preset(Brush *b, int preset) { CurveMap *cm = NULL; @@ -514,7 +525,9 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, float radius = 1.0f; /* Quite warnings */ float co[3]; - if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) { + if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW || + mtex->brush_map_mode == MTEX_MAP_MODE_RANDOM) + { /* keep coordinates relative to mouse */ rotation += ups->brush_rotation; @@ -575,6 +588,61 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, return intensity; } +float BKE_brush_sample_masktex(const Scene *scene, Brush *br, + const float point[3], + const int thread, + struct ImagePool *pool) +{ + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + MTex *mtex = &br->mask_mtex; + + if (mtex && mtex->tex) { + float rotation = -mtex->rot; + float point_2d[2] = {point[0], point[1]}; + float x = 0.0f, y = 0.0f; /* Quite warnings */ + float radius = 1.0f; /* Quite warnings */ + float co[3]; + float rgba[4], intensity = 1.0; + + point_2d[0] -= ups->tex_mouse[0]; + point_2d[1] -= ups->tex_mouse[1]; + + /* use pressure adjusted size for fixed mode */ + radius = ups->pixel_radius; + + x = point_2d[0]; + y = point_2d[1]; + + x /= radius; + y /= radius; + + /* it is probably worth optimizing for those cases where + * the texture is not rotated by skipping the calls to + * atan2, sqrtf, sin, and cos. */ + if (rotation > 0.001f || rotation < -0.001f) { + const float angle = atan2f(y, x) + rotation; + const float flen = sqrtf(x * x + y * y); + + x = flen * cosf(angle); + y = flen * sinf(angle); + } + + x *= br->mask_mtex.size[0]; + y *= br->mask_mtex.size[1]; + + co[0] = x + br->mask_mtex.ofs[0]; + co[1] = y + br->mask_mtex.ofs[1]; + co[2] = 0.0f; + + externtex(mtex, co, &intensity, + rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool); + + return intensity; + } + else { + return 1.0f; + } +} /* Brush Sampling for 2D brushes. when we unify the brush systems this will be necessarily a separate function */ float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4]) diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index dc47ff40863..4d9f0fc769c 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -100,7 +100,7 @@ /* Find the first available, non-duplicate name for a given constraint */ void BKE_unique_constraint_name(bConstraint *con, ListBase *list) { - BLI_uniquename(list, con, "Const", '.', offsetof(bConstraint, name), sizeof(con->name)); + BLI_uniquename(list, con, DATA_("Const"), '.', offsetof(bConstraint, name), sizeof(con->name)); } /* ----------------- Evaluation Loop Preparation --------------- */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 5fba308e3df..853a55b49c2 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3204,7 +3204,7 @@ void BKE_nurb_direction_switch(Nurb *nu) } -float (*BKE_curve_vertexCos_get(Curve * UNUSED(cu), ListBase * lb, int *numVerts_r))[3] +float (*BKE_curve_vertexCos_get(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] { int i, numVerts = *numVerts_r = BKE_nurbList_verts_count(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "cu_vcos"); @@ -3261,7 +3261,7 @@ void BK_curve_vertexCos_apply(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos } } -float (*BKE_curve_keyVertexCos_get(Curve * UNUSED(cu), ListBase * lb, float *key))[3] +float (*BKE_curve_keyVertexCos_get(Curve *UNUSED(cu), ListBase *lb, float *key))[3] { int i, numVerts = BKE_nurbList_verts_count(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "cu_vcos"); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index bb14dbd3ad0..2118bbcd42b 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -51,6 +51,8 @@ #include "BLI_mempool.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_customdata.h" #include "BKE_customdata_file.h" #include "BKE_global.h" @@ -1051,11 +1053,11 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 4: CD_MFACE */ {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL}, /* 5: CD_MTFACE */ - {sizeof(MTFace), "MTFace", 1, "UVMap", layerCopy_tface, NULL, + {sizeof(MTFace), "MTFace", 1, N_("UVMap"), layerCopy_tface, NULL, layerInterp_tface, layerSwap_tface, layerDefault_tface}, /* 6: CD_MCOL */ /* 4 MCol structs per face */ - {sizeof(MCol) * 4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol, + {sizeof(MCol) * 4, "MCol", 4, N_("Col"), NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, /* 7: CD_ORIGINDEX */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, @@ -1065,25 +1067,25 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 9: CD_POLYINDEX (deprecated) */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 10: CD_PROP_FLT */ - {sizeof(MFloatProperty), "MFloatProperty", 1, "Float", layerCopy_propFloat, NULL, NULL, NULL}, + {sizeof(MFloatProperty), "MFloatProperty", 1, N_("Float"), layerCopy_propFloat, NULL, NULL, NULL}, /* 11: CD_PROP_INT */ - {sizeof(MIntProperty), "MIntProperty", 1, "Int", layerCopy_propInt, NULL, NULL, NULL}, + {sizeof(MIntProperty), "MIntProperty", 1, N_("Int"), layerCopy_propInt, NULL, NULL, NULL}, /* 12: CD_PROP_STR */ - {sizeof(MStringProperty), "MStringProperty", 1, "String", layerCopy_propString, NULL, NULL, NULL}, + {sizeof(MStringProperty), "MStringProperty", 1, N_("String"), layerCopy_propString, NULL, NULL, NULL}, /* 13: CD_ORIGSPACE */ - {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVMap", layerCopy_origspace_face, NULL, + {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, N_("UVMap"), layerCopy_origspace_face, NULL, layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face}, /* 14: CD_ORCO */ {sizeof(float) * 3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 15: CD_MTEXPOLY */ /* note, when we expose the UV Map / TexFace split to the user, change this back to face Texture */ - {sizeof(MTexPoly), "MTexPoly", 1, "UVMap" /* "Face Texture" */, NULL, NULL, NULL, NULL, NULL}, + {sizeof(MTexPoly), "MTexPoly", 1, N_("UVMap") /* "Face Texture" */, NULL, NULL, NULL, NULL, NULL}, /* 16: CD_MLOOPUV */ - {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL, + {sizeof(MLoopUV), "MLoopUV", 1, N_("UV coord"), NULL, NULL, layerInterp_mloopuv, NULL, NULL, layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv}, /* 17: CD_MLOOPCOL */ - {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, + {sizeof(MLoopCol), "MLoopCol", 1, N_("Col"), NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol}, /* 18: CD_TANGENT */ @@ -1094,38 +1096,38 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { NULL, NULL, NULL, NULL, NULL, NULL, layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps}, /* 20: CD_PREVIEW_MCOL */ - {sizeof(MCol) * 4, "MCol", 4, "PreviewCol", NULL, NULL, layerInterp_mcol, + {sizeof(MCol) * 4, "MCol", 4, N_("PreviewCol"), NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, /* 21: CD_ID_MCOL */ - {sizeof(MCol) * 4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol, + {sizeof(MCol) * 4, "MCol", 4, N_("IDCol"), NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, /* 22: CD_TEXTURE_MCOL */ - {sizeof(MCol) * 4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol, + {sizeof(MCol) * 4, "MCol", 4, N_("TexturedCol"), NULL, NULL, layerInterp_mcol, layerSwap_mcol, layerDefault_mcol}, /* 23: CD_CLOTH_ORCO */ {sizeof(float) * 3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 24: CD_RECAST */ - {sizeof(MRecast), "MRecast", 1, "Recast", NULL, NULL, NULL, NULL}, + {sizeof(MRecast), "MRecast", 1, N_("Recast"), NULL, NULL, NULL, NULL}, /* BMESH ONLY */ /* 25: CD_MPOLY */ - {sizeof(MPoly), "MPoly", 1, "NGon Face", NULL, NULL, NULL, NULL, NULL}, + {sizeof(MPoly), "MPoly", 1, N_("NGon Face"), NULL, NULL, NULL, NULL, NULL}, /* 26: CD_MLOOP */ - {sizeof(MLoop), "MLoop", 1, "NGon Face-Vertex", NULL, NULL, NULL, NULL, NULL}, + {sizeof(MLoop), "MLoop", 1, N_("NGon Face-Vertex"), NULL, NULL, NULL, NULL, NULL}, /* 27: CD_SHAPE_KEYINDEX */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 28: CD_SHAPEKEY */ - {sizeof(float) * 3, "", 0, "ShapeKey", NULL, NULL, layerInterp_shapekey}, + {sizeof(float) * 3, "", 0, N_("ShapeKey"), NULL, NULL, layerInterp_shapekey}, /* 29: CD_BWEIGHT */ - {sizeof(float), "", 0, "BevelWeight", NULL, NULL, layerInterp_bweight}, + {sizeof(float), "", 0, N_("BevelWeight"), NULL, NULL, layerInterp_bweight}, /* 30: CD_CREASE */ - {sizeof(float), "", 0, "SubSurfCrease", NULL, NULL, layerInterp_bweight}, + {sizeof(float), "", 0, N_("SubSurfCrease"), NULL, NULL, layerInterp_bweight}, /* 31: CD_ORIGSPACE_MLOOP */ - {sizeof(OrigSpaceLoop), "OrigSpaceLoop", 1, "OS Loop", NULL, NULL, layerInterp_mloop_origspace, NULL, NULL, + {sizeof(OrigSpaceLoop), "OrigSpaceLoop", 1, N_("OS Loop"), NULL, NULL, layerInterp_mloop_origspace, NULL, NULL, layerEqual_mloop_origspace, layerMultiply_mloop_origspace, layerInitMinMax_mloop_origspace, layerAdd_mloop_origspace, layerDoMinMax_mloop_origspace, layerCopyValue_mloop_origspace}, /* 32: CD_PREVIEW_MLOOPCOL */ - {sizeof(MLoopCol), "MLoopCol", 1, "PreviewLoopCol", NULL, NULL, layerInterp_mloopcol, NULL, + {sizeof(MLoopCol), "MLoopCol", 1, N_("PreviewLoopCol"), NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol}, /* 33: CD_BM_ELEM_PYPTR */ @@ -1226,8 +1228,8 @@ void customData_mask_layers__print(CustomDataMask mask) /********************* CustomData functions *********************/ static void customData_update_offsets(CustomData *data); -static CustomDataLayer *customData_add_layer__internal(CustomData *data, - int type, int alloctype, void *layerdata, int totelem, const char *name); +static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, int alloctype, void *layerdata, + int totelem, const char *name); void CustomData_update_typemap(CustomData *data) { @@ -1597,8 +1599,8 @@ static int customData_resize(CustomData *data, int amount) return 1; } -static CustomDataLayer *customData_add_layer__internal(CustomData *data, - int type, int alloctype, void *layerdata, int totelem, const char *name) +static CustomDataLayer *customData_add_layer__internal(CustomData *data, int type, int alloctype, void *layerdata, + int totelem, const char *name) { const LayerTypeInfo *typeInfo = layerType_getInfo(type); int size = typeInfo->size * totelem, flag = 0, index = data->totlayer; @@ -1654,7 +1656,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data, data->layers[index].flag = flag; data->layers[index].data = newlayerdata; - if (name || (name = typeInfo->defaultname)) { + if (name || (name = DATA_(typeInfo->defaultname))) { BLI_strncpy(data->layers[index].name, name, sizeof(data->layers[index].name)); CustomData_set_layer_unique_name(data, index); } @@ -2914,8 +2916,9 @@ void CustomData_set_layer_unique_name(CustomData *data, int index) if (!typeInfo->defaultname) return; - - BLI_uniquename_cb(customdata_unique_check, &data_arg, typeInfo->defaultname, '.', nlayer->name, sizeof(nlayer->name)); + + BLI_uniquename_cb(customdata_unique_check, &data_arg, DATA_(typeInfo->defaultname), '.', nlayer->name, + sizeof(nlayer->name)); } void CustomData_validate_layer_name(const CustomData *data, int type, const char *name, char *outname) diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 7543892f2e3..ed665d44431 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -47,6 +47,8 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_deform.h" /* own include */ void defgroup_copy_list(ListBase *outbase, ListBase *inbase) @@ -459,7 +461,7 @@ void defgroup_unique_name(bDeformGroup *dg, Object *ob) data.ob = ob; data.dg = dg; - BLI_uniquename_cb(defgroup_unique_check, &data, "Group", '.', dg->name, sizeof(dg->name)); + BLI_uniquename_cb(defgroup_unique_check, &data, DATA_("Group"), '.', dg->name, sizeof(dg->name)); } static int is_char_sep(const char c) diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index e4d7814c4e1..0b55c732ade 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -850,7 +850,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl *numVerts_r = numVerts; } -static float (*displist_get_allverts(ListBase * dispbase, int *totvert))[3] +static float (*displist_get_allverts(ListBase *dispbase, int *totvert))[3] { DispList *dl; float (*allverts)[3], *fp; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 4e05595b93a..812c0cf674b 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -520,7 +520,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, int parent /* if object has parents, update them too */ if (parent_recursion) { - int recursion = parent_recursion-1; + int recursion = parent_recursion - 1; int is_canvas = 0; if (ob->parent) is_canvas += subframe_updateObject(scene, ob->parent, 0, recursion, frame); if (ob->track) is_canvas += subframe_updateObject(scene, ob->track, 0, recursion, frame); @@ -1024,7 +1024,8 @@ void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd) DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSettings *canvas, Scene *scene) { DynamicPaintSurface *surface = MEM_callocN(sizeof(DynamicPaintSurface), "DynamicPaintSurface"); - if (!surface) return NULL; + if (!surface) + return NULL; surface->canvas = canvas; surface->format = MOD_DPAINT_SURFACE_F_VERTEX; @@ -1080,7 +1081,8 @@ DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSettings *c modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "cache_dynamicpaint"); - dynamicPaintSurface_setUniqueName(surface, "Surface"); + /* Using ID_BRUSH i18n context, as we have no physics/dpaint one for now... */ + dynamicPaintSurface_setUniqueName(surface, CTX_DATA_(BLF_I18NCONTEXT_ID_BRUSH, "Surface")); surface->effector_weights = BKE_add_effector_weights(NULL); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index f63eb9f87e3..3141d52e22a 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -47,6 +47,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_fcurve.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -1557,8 +1559,9 @@ DriverVar *driver_add_new_variable(ChannelDriver *driver) BLI_addtail(&driver->variables, dvar); /* give the variable a 'unique' name */ - strcpy(dvar->name, "var"); - BLI_uniquename(&driver->variables, dvar, "var", '_', offsetof(DriverVar, name), sizeof(dvar->name)); + strcpy(dvar->name, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "var")); + BLI_uniquename(&driver->variables, dvar, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "var"), '_', + offsetof(DriverVar, name), sizeof(dvar->name)); /* set the default type to 'single prop' */ driver_change_variable_type(dvar, DVAR_TYPE_SINGLE_PROP); diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 755030bd208..31dd79e7623 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_gpencil_types.h" #include "BKE_global.h" @@ -184,7 +186,7 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, int setactive) /* auto-name */ BLI_strncpy(gpl->info, name, sizeof(gpl->info)); - BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); + BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); /* make this one the active one */ if (setactive) diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index c5364744b2d..10226ade786 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -65,6 +65,7 @@ #include "BLI_dynstr.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" #include "BKE_ipo.h" #include "BKE_animsys.h" @@ -1117,7 +1118,8 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch 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)); + BLI_uniquename(&tmp_act.groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), + sizeof(agrp->name)); } /* add F-Curve to group */ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index d123de224e9..864c5ef3f92 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -40,6 +40,8 @@ #include "BLI_math_vector.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_key_types.h" #include "DNA_lattice_types.h" @@ -1441,11 +1443,13 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) BLI_strncpy(kb->name, name, sizeof(kb->name)); } else { - if (tot == 1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name)); - else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot - 1); + if (tot == 1) + BLI_strncpy(kb->name, DATA_("Basis"), sizeof(kb->name)); + else + BLI_snprintf(kb->name, sizeof(kb->name), DATA_("Key %d"), tot - 1); } - BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); + BLI_uniquename(&key->block, kb, DATA_("Key"), '.', offsetof(KeyBlock, name), sizeof(kb->name)); kb->uid = key->uidgen++; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 594905bf7c5..56480434b70 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -71,11 +71,13 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" -#include "BKE_bpath.h" + +#include "BLF_translation.h" #include "BKE_action.h" #include "BKE_animsys.h" #include "BKE_armature.h" +#include "BKE_bpath.h" #include "BKE_brush.h" #include "BKE_camera.h" #include "BKE_context.h" @@ -1370,25 +1372,23 @@ bool new_id(ListBase *lb, ID *id, const char *tname) char name[MAX_ID_NAME - 2]; /* if library, don't rename */ - if (id->lib) return false; + if (id->lib) + return false; /* if no libdata given, look up based on ID */ - if (lb == NULL) lb = which_libbase(G.main, GS(id->name)); + if (lb == NULL) + lb = which_libbase(G.main, GS(id->name)); /* if no name given, use name of current ID * else make a copy (tname args can be const) */ if (tname == NULL) tname = id->name + 2; - strncpy(name, tname, sizeof(name) - 1); - - /* if result > MAX_ID_NAME-3, strncpy don't put the final '\0' to name. - * easier to assign each time then to check if its needed */ - name[sizeof(name) - 1] = 0; + BLI_strncpy(name, tname, sizeof(name)); if (name[0] == '\0') { /* disallow empty names */ - strcpy(name, ID_FALLBACK_NAME); + BLI_strncpy(name, DATA_(ID_FALLBACK_NAME), sizeof(name)); } else { /* disallow non utf8 chars, diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index a5241684e3a..35a5ac7d94a 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -40,6 +40,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" +#include "BLF_translation.h" + #include "DNA_mask_types.h" #include "DNA_node_types.h" #include "DNA_screen_types.h" @@ -187,7 +189,8 @@ void BKE_mask_layer_remove(Mask *mask, MaskLayer *masklay) void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay) { - BLI_uniquename(&mask->masklayers, masklay, "MaskLayer", '.', offsetof(MaskLayer, name), sizeof(masklay->name)); + BLI_uniquename(&mask->masklayers, masklay, DATA_("MaskLayer"), '.', offsetof(MaskLayer, name), + sizeof(masklay->name)); } MaskLayer *BKE_mask_layer_copy(MaskLayer *masklay) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b36f484f4ee..408fadde564 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2190,7 +2190,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *mloop_r = mloop; } -float (*mesh_getVertexCos(Mesh * me, int *r_numVerts))[3] +float (*BKE_mesh_vertexCos_get(Mesh *me, int *r_numVerts))[3] { int i, numVerts = me->totvert; float (*cos)[3] = MEM_mallocN(sizeof(*cos) * numVerts, "vertexcos1"); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 9b8101cdad4..dda243eed5c 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -122,8 +122,8 @@ void modifier_unique_name(ListBase *modifiers, ModifierData *md) { if (modifiers && md) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); - - BLI_uniquename(modifiers, md, mti->name, '.', offsetof(ModifierData, name), sizeof(md->name)); + + BLI_uniquename(modifiers, md, DATA_(mti->name), '.', offsetof(ModifierData, name), sizeof(md->name)); } } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 49a64d8e478..d0eb1494451 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -357,6 +357,8 @@ typedef struct MovieClipCache { int proxy, filter; short render_flag; } stabilized; + + int sequence_offset; } MovieClipCache; typedef struct MovieClipImBufCacheKey { @@ -369,6 +371,32 @@ typedef struct MovieClipCachePriorityData { int framenr; } MovieClipCachePriorityData; +static int user_frame_to_cache_frame(MovieClip *clip, int framenr) +{ + int index; + + index = framenr - clip->start_frame + clip->frame_offset; + + if (clip->source == MCLIP_SRC_SEQUENCE) { + if (clip->cache->sequence_offset == -1) { + unsigned short numlen; + char head[FILE_MAX], tail[FILE_MAX]; + + BLI_stringdec(clip->name, head, tail, &numlen); + + /* see comment in get_sequence_fname */ + clip->cache->sequence_offset = sequence_guess_offset(clip->name, strlen(head), numlen); + } + + index += clip->cache->sequence_offset; + } + + if (index < 0) + return framenr - index; + + return framenr; +} + static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags) { MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *)userkey; @@ -440,7 +468,7 @@ static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag) if (clip->cache) { MovieClipImBufCacheKey key; - key.framenr = user->framenr; + key.framenr = user_frame_to_cache_frame(clip, user->framenr); if (flag & MCLIP_USE_PROXY) { key.proxy = rendersize_to_proxy(user, flag); @@ -462,7 +490,7 @@ static int has_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag) if (clip->cache) { MovieClipImBufCacheKey key; - key.framenr = user->framenr; + key.framenr = user_frame_to_cache_frame(clip, user->framenr); if (flag & MCLIP_USE_PROXY) { key.proxy = rendersize_to_proxy(user, flag); @@ -498,9 +526,10 @@ static bool put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i moviecache_prioritydeleter); clip->cache->moviecache = moviecache; + clip->cache->sequence_offset = -1; } - key.framenr = user->framenr; + key.framenr = user_frame_to_cache_frame(clip, user->framenr); if (flag & MCLIP_USE_PROXY) { key.proxy = rendersize_to_proxy(user, flag); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index ccae1f606fc..72d5e73d67b 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -45,6 +45,8 @@ #include "BLI_string.h" #include "BLI_ghash.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_scene_types.h" #include "DNA_sound_types.h" @@ -264,7 +266,7 @@ NlaTrack *add_nlatrack(AnimData *adt, NlaTrack *prev) /* must have unique name, but we need to seed this */ strcpy(nlt->name, "NlaTrack"); - BLI_uniquename(&adt->nla_tracks, nlt, "NlaTrack", '.', offsetof(NlaTrack, name), sizeof(nlt->name)); + BLI_uniquename(&adt->nla_tracks, nlt, DATA_("NlaTrack"), '.', offsetof(NlaTrack, name), sizeof(nlt->name)); /* return the new track */ return nlt; @@ -1320,7 +1322,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) /* if the hash-table has a match for this name, try other names... * - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :) */ - BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, "NlaStrip", '.', strip->name, sizeof(strip->name)); + BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, DATA_("NlaStrip"), '.', strip->name, sizeof(strip->name)); /* free the hash... */ BLI_ghash_free(gh, NULL, NULL); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 788b185c6eb..1c1102d91ba 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -792,7 +792,7 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin /* Find the first available, non-duplicate name for a given node */ void nodeUniqueName(bNodeTree *ntree, bNode *node) { - BLI_uniquename(&ntree->nodes, node, "Node", '.', offsetof(bNode, name), sizeof(node->name)); + BLI_uniquename(&ntree->nodes, node, DATA_("Node"), '.', offsetof(bNode, name), sizeof(node->name)); } bNode *nodeAddNode(const struct bContext *C, bNodeTree *ntree, const char *idname) diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 5efeeaeedaa..4f3678098ec 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1698,7 +1698,7 @@ void BKE_pbvh_node_layer_disp_free(PBVHNode *node) } } -float (*BKE_pbvh_get_vertCos(PBVH * pbvh))[3] +float (*BKE_pbvh_get_vertCos(PBVH *pbvh))[3] { int a; float (*vertCos)[3] = NULL; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index d01d7090d96..83ee6759b4f 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -57,6 +57,8 @@ #include "BLI_callbacks.h" #include "BLI_string.h" +#include "BLF_translation.h" + #include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_action.h" @@ -77,9 +79,8 @@ #include "BKE_rigidbody.h" #include "BKE_scene.h" #include "BKE_sequencer.h" -#include "BKE_world.h" - #include "BKE_sound.h" +#include "BKE_world.h" #include "RE_engine.h" @@ -1276,11 +1277,11 @@ SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name) SceneRenderLayer *srl; if (!name) - name = "RenderLayer"; + name = DATA_("RenderLayer"); srl = MEM_callocN(sizeof(SceneRenderLayer), "new render layer"); BLI_strncpy(srl->name, name, sizeof(srl->name)); - BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(srl->name)); + BLI_uniquename(&sce->r.layers, srl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(srl->name)); BLI_addtail(&sce->r.layers, srl); /* note, this is also in render, pipeline.c, to make layer when scenedata doesnt have it */ diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c index a64a4895e9b..595907ffb27 100644 --- a/source/blender/blenkernel/intern/seqmodifier.c +++ b/source/blender/blenkernel/intern/seqmodifier.c @@ -39,6 +39,8 @@ #include "BLI_utildefines.h" #include "BLI_math.h" +#include "BLF_translation.h" + #include "DNA_sequence_types.h" #include "BKE_colortools.h" @@ -162,13 +164,13 @@ static void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *ma } static SequenceModifierTypeInfo seqModifier_ColorBalance = { - "Color Balance", /* name */ - "ColorBalanceModifierData", /* struct_name */ - sizeof(ColorBalanceModifierData), /* struct_size */ - colorBalance_init_data, /* init_data */ - NULL, /* free_data */ - NULL, /* copy_data */ - colorBalance_apply /* apply */ + CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Color Balance"), /* name */ + "ColorBalanceModifierData", /* struct_name */ + sizeof(ColorBalanceModifierData), /* struct_size */ + colorBalance_init_data, /* init_data */ + NULL, /* free_data */ + NULL, /* copy_data */ + colorBalance_apply /* apply */ }; /* **** Curves Modifier **** */ @@ -271,13 +273,13 @@ static void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *m } static SequenceModifierTypeInfo seqModifier_Curves = { - "Curves", /* name */ - "CurvesModifierData", /* struct_name */ - sizeof(CurvesModifierData), /* struct_size */ - curves_init_data, /* init_data */ - curves_free_data, /* free_data */ - curves_copy_data, /* copy_data */ - curves_apply /* apply */ + CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Curves"), /* name */ + "CurvesModifierData", /* struct_name */ + sizeof(CurvesModifierData), /* struct_size */ + curves_init_data, /* init_data */ + curves_free_data, /* free_data */ + curves_copy_data, /* copy_data */ + curves_apply /* apply */ }; /* **** Hue Correct Modifier **** */ @@ -379,13 +381,13 @@ static void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImB } static SequenceModifierTypeInfo seqModifier_HueCorrect = { - "Hue Correct", /* name */ - "HueCorrectModifierData", /* struct_name */ - sizeof(HueCorrectModifierData), /* struct_size */ - hue_correct_init_data, /* init_data */ - hue_correct_free_data, /* free_data */ - hue_correct_copy_data, /* copy_data */ - hue_correct_apply /* apply */ + CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Hue Correct"), /* name */ + "HueCorrectModifierData", /* struct_name */ + sizeof(HueCorrectModifierData), /* struct_size */ + hue_correct_init_data, /* init_data */ + hue_correct_free_data, /* free_data */ + hue_correct_copy_data, /* copy_data */ + hue_correct_apply /* apply */ }; /* **** Bright/Contrast Modifier **** */ @@ -476,13 +478,13 @@ static void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, } static SequenceModifierTypeInfo seqModifier_BrightContrast = { - "Bright/Contrast", /* name */ - "BrightContrastModifierData", /* struct_name */ - sizeof(BrightContrastModifierData), /* struct_size */ - NULL, /* init_data */ - NULL, /* free_data */ - NULL, /* copy_data */ - brightcontrast_apply /* apply */ + CTX_N_(BLF_I18NCONTEXT_ID_SEQUENCE, "Bright/Contrast"), /* name */ + "BrightContrastModifierData", /* struct_name */ + sizeof(BrightContrastModifierData), /* struct_size */ + NULL, /* init_data */ + NULL, /* free_data */ + NULL, /* copy_data */ + brightcontrast_apply /* apply */ }; /*********************** Modifier functions *************************/ @@ -572,7 +574,8 @@ void BKE_sequence_modifier_unique_name(Sequence *seq, SequenceModifierData *smd) { SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type); - BLI_uniquename(&seq->modifiers, smd, smti->name, '.', offsetof(SequenceModifierData, name), sizeof(smd->name)); + BLI_uniquename(&seq->modifiers, smd, CTX_DATA_(BLF_I18NCONTEXT_ID_SEQUENCE, smti->name), '.', + offsetof(SequenceModifierData, name), sizeof(smd->name)); } SequenceModifierData *BKE_sequence_modifier_find_by_name(Sequence *seq, char *name) diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 2517324242b..10b0e14d517 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -804,6 +804,10 @@ void BKE_texture_make_local(Tex *tex) if (br->id.lib) is_lib = TRUE; else is_local = TRUE; } + if (br->mask_mtex.tex == tex) { + if (br->id.lib) is_lib = TRUE; + else is_local = TRUE; + } br = br->id.next; } pa = bmain->particle.first; @@ -877,6 +881,13 @@ void BKE_texture_make_local(Tex *tex) tex->id.us--; } } + if (br->mask_mtex.tex == tex) { + if (br->id.lib == NULL) { + br->mask_mtex.tex = tex_new; + tex_new->id.us++; + tex->id.us--; + } + } br = br->id.next; } pa = bmain->particle.first; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index df10d1374bb..fe53f073ea6 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -535,7 +535,8 @@ MovieTrackingTrack *BKE_tracking_track_add(MovieTracking *tracking, ListBase *tr void BKE_tracking_track_unique_name(ListBase *tracksbase, MovieTrackingTrack *track) { - BLI_uniquename(tracksbase, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name)); + BLI_uniquename(tracksbase, track, CTX_DATA_(BLF_I18NCONTEXT_ID_MOVIECLIP, "Track"), '.', + offsetof(MovieTrackingTrack, name), sizeof(track->name)); } void BKE_tracking_track_free(MovieTrackingTrack *track) @@ -1234,7 +1235,7 @@ int BKE_tracking_object_delete(MovieTracking *tracking, MovieTrackingObject *obj void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object) { - BLI_uniquename(&tracking->objects, object, "Object", '.', + BLI_uniquename(&tracking->objects, object, DATA_("Object"), '.', offsetof(MovieTrackingObject, name), sizeof(object->name)); } @@ -2095,7 +2096,8 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking) track->next = track->prev = NULL; BLI_addtail(&new_tracks, track); - BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name)); + BLI_uniquename(&new_tracks, track, CTX_DATA_(BLF_I18NCONTEXT_ID_MOVIECLIP, "Track"), '.', + offsetof(MovieTrackingTrack, name), sizeof(track->name)); track = next; } diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index b0e3f47b627..0a6d95df40a 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -66,7 +66,7 @@ double BLI_dir_free_space(const char *dir); char *BLI_current_working_dir(char *dir, const size_t maxlen); unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist); -void BLI_free_filelist(struct direntry * filelist, unsigned int nrentries); +void BLI_free_filelist(struct direntry *filelist, unsigned int nrentries); /* Files */ diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 5ba37d70ca5..d35ef05a7a4 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -172,10 +172,10 @@ typedef struct DualQuat { void copy_dq_dq(DualQuat *r, DualQuat *dq); void normalize_dq(DualQuat *dq, float totw); void add_weighted_dq_dq(DualQuat *r, DualQuat *dq, float weight); -void mul_v3m3_dq(float r[3], float R[3][3], DualQuat * dq); +void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); -void mat4_to_dquat(DualQuat * r, float base[4][4], float M[4][4]); -void dquat_to_mat4(float R[4][4], DualQuat * dq); +void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]); +void dquat_to_mat4(float R[4][4], DualQuat *dq); void quat_apply_track(float quat[4], short axis, short upflag); void vec_apply_track(float vec[3], short axis); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 1ba3c8b619c..a36627bd903 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -111,8 +111,8 @@ bool BLI_testextensie_array(const char *str, const char **ext_array); bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch); bool BLI_replace_extension(char *path, size_t maxlen, const char *ext); bool BLI_ensure_extension(char *path, size_t maxlen, const char *ext); -void BLI_uniquename(struct ListBase *list, void *vlink, const char * defname, char delim, short name_offs, short len); -bool BLI_uniquename_cb(bool (*unique_check)(void * arg, const char * name), +void BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, short name_offs, short len); +bool BLI_uniquename_cb(bool (*unique_check)(void *arg, const char *name), void *arg, const char * defname, char delim, char *name, short name_len); void BLI_newname(char *name, int add); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 07cd85c4107..3567421daad 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -457,7 +457,7 @@ float linearrgb_to_srgb(float c) return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; } -void minmax_rgb(short c[]) +void minmax_rgb(short c[3]) { if (c[0] > 255) c[0] = 255; else if (c[0] < 0) c[0] = 0; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index f9cf913157b..bcba2715740 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -232,7 +232,7 @@ void BLI_newname(char *name, int add) * \param name_len Maximum length of name area * \return true if there if the name was changed */ -bool BLI_uniquename_cb(bool (*unique_check)(void * arg, const char *name), +bool BLI_uniquename_cb(bool (*unique_check)(void *arg, const char *name), void *arg, const char *defname, char delim, char *name, short name_len) { if (name[0] == '\0') { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2c75daf6878..ac8f52986db 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -147,6 +147,7 @@ #include "BKE_screen.h" #include "BKE_sequencer.h" #include "BKE_text.h" // for txt_extended_ascii_as_utf8 +#include "BKE_texture.h" #include "BKE_tracking.h" #include "BKE_sound.h" @@ -1812,6 +1813,7 @@ static void lib_link_brush(FileData *fd, Main *main) brush->id.flag -= LIB_NEED_LINK; brush->mtex.tex = newlibadr_us(fd, brush->id.lib, brush->mtex.tex); + brush->mask_mtex.tex = newlibadr_us(fd, brush->id.lib, brush->mask_mtex.tex); brush->clone.image = newlibadr_us(fd, brush->id.lib, brush->clone.image); } } @@ -9256,6 +9258,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (!MAIN_VERSION_ATLEAST(main, 266, 4)) { + Brush *brush; + for (brush = main->brush.first; brush; brush = brush->id.next) { + default_mtex(&brush->mask_mtex); + } + } + if (main->versionfile < 267) { /* TIP: to initialize new variables added, use the new function @@ -10821,13 +10830,13 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co return id; } -ID *BLO_library_append_named_part(Main *mainl, BlendHandle** bh, const char *idname, const int idcode) +ID *BLO_library_append_named_part(Main *mainl, BlendHandle **bh, const char *idname, const int idcode) { FileData *fd = (FileData*)(*bh); return append_named_part(mainl, fd, idname, idcode); } -ID *BLO_library_append_named_part_ex(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag) +ID *BLO_library_append_named_part_ex(const bContext *C, Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag) { FileData *fd = (FileData*)(*bh); return append_named_part_ex(C, mainl, fd, idname, idcode, flag); @@ -10875,7 +10884,7 @@ static Main *library_append_begin(Main *mainvar, FileData **fd, const char *file return mainl; } -Main *BLO_library_append_begin(Main *mainvar, BlendHandle** bh, const char *filepath) +Main *BLO_library_append_begin(Main *mainvar, BlendHandle **bh, const char *filepath) { FileData *fd = (FileData*)(*bh); return library_append_begin(mainvar, &fd, filepath); @@ -10949,7 +10958,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in } } -void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag) +void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag) { FileData *fd = (FileData*)(*bh); library_append_end(C, mainl, &fd, idcode, flag); diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 3827a31ae95..c00569e4b51 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -647,7 +647,7 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb) } /* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */ -static void do_versions_seq_unique_name_all_strips(Scene * sce, ListBase *seqbasep) +static void do_versions_seq_unique_name_all_strips(Scene *sce, ListBase *seqbasep) { Sequence * seq = seqbasep->first; @@ -1678,6 +1678,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) /* brush texture changes */ for (brush = main->brush.first; brush; brush = brush->id.next) { default_mtex(&brush->mtex); + default_mtex(&brush->mask_mtex); } for (ma = main->mat.first; ma; ma = ma->id.next) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 3c6e646fe9c..e8426c58324 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2875,6 +2875,7 @@ static void write_brushes(WriteData *wd, ListBase *idbase) if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd); writestruct(wd, DATA, "MTex", 1, &brush->mtex); + writestruct(wd, DATA, "MTex", 1, &brush->mask_mtex); if (brush->curve) write_curvemapping(wd, brush->curve); diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index c3ec5dd83b3..c21da46d678 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -39,6 +39,7 @@ set(INC_SYS ) set(SRC + operators/bmo_beautify.c operators/bmo_bevel.c operators/bmo_connect.c operators/bmo_create.c diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 7e3ee9d249e..869c894b66c 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -57,7 +57,7 @@ #include "BLI_utildefines.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" /* The formatting of these bmesh operators is parsed by * 'doc/python_api/rst_from_bmesh_opdefines.py' diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 850e81ba3ac..6fd18c07179 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -77,6 +77,5 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert /* include the rest of our private declarations */ #include "bmesh_structure.h" -#include "bmesh_operators_private.h" #endif /* __BMESH_PRIVATE_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 26b0e42a1c1..44392383925 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -43,7 +43,7 @@ * Returns whether or not a given vertex is * is part of a given edge. */ -bool BM_vert_in_edge(BMEdge *e, BMVert *v) +bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) { return bmesh_vert_in_edge(e, v); } diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index f894912aad3..8326709a2eb 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -34,7 +34,7 @@ bool BM_verts_in_face(BMFace *f, BMVert **varr, int len); bool BM_edge_in_face(BMFace *f, BMEdge *e); bool BM_edge_in_loop(BMEdge *e, BMLoop *l); -bool BM_vert_in_edge(BMEdge *e, BMVert *v); +bool BM_vert_in_edge(const BMEdge *e, const BMVert *v); bool BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e); float BM_edge_calc_length(BMEdge *e); diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index 0398f9c558f..a0907f0db7a 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -40,7 +40,7 @@ * MISC utility functions. */ -bool bmesh_vert_in_edge(BMEdge *e, BMVert *v) +bool bmesh_vert_in_edge(const BMEdge *e, const BMVert *v) { if (e->v1 == v || e->v2 == v) return true; return false; diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h index e67f1e4fb49..f10e3a12377 100644 --- a/source/blender/bmesh/intern/bmesh_structure.h +++ b/source/blender/bmesh/intern/bmesh_structure.h @@ -68,7 +68,7 @@ BMLoop *bmesh_radial_faceloop_find_vert(BMFace *f, BMVert *v); bool bmesh_radial_validate(int radlen, BMLoop *l); /* EDGE UTILITIES */ -bool bmesh_vert_in_edge(BMEdge *e, BMVert *v); +bool bmesh_vert_in_edge(const BMEdge *e, const BMVert *v); bool bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e); bool bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv); /* relink edge */ BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v); diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c new file mode 100644 index 00000000000..adf8ed4df67 --- /dev/null +++ b/source/blender/bmesh/operators/bmo_beautify.c @@ -0,0 +1,353 @@ +/* + * ***** 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. + * + * Contributor(s): Joseph Eagar. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_beautify.c + * \ingroup bmesh + */ + +#include "BLI_math.h" + +#include "MEM_guardedalloc.h" + +#include "bmesh.h" +#include "intern/bmesh_operators_private.h" + +// #define DEBUG_TIME + +#ifdef DEBUG_TIME +# include "PIL_time.h" +#endif + +/* -------------------------------------------------------------------- */ +/* GHash for edge rotation */ + +typedef struct EdRotState { + int v1, v2; /* edge vert, small -> large */ + int f1, f2; /* face vert, small -> large */ +} EdRotState; + +static unsigned int erot_ghashutil_hash(const void *ptr) +{ + const EdRotState *e_state = (const EdRotState *)ptr; + unsigned int + hash = BLI_ghashutil_inthash(SET_INT_IN_POINTER(e_state->v1)); + hash ^= BLI_ghashutil_inthash(SET_INT_IN_POINTER(e_state->v2)); + hash ^= BLI_ghashutil_inthash(SET_INT_IN_POINTER(e_state->f1)); + hash ^= BLI_ghashutil_inthash(SET_INT_IN_POINTER(e_state->f2)); + return hash; +} +static int erot_ghashutil_cmp(const void *a, const void *b) +{ + const EdRotState *e_state_a = (const EdRotState *)a; + const EdRotState *e_state_b = (const EdRotState *)b; + if (e_state_a->v1 < e_state_b->v1) return -1; + else if (e_state_a->v1 > e_state_b->v1) return 1; + else if (e_state_a->v2 < e_state_b->v2) return -1; + else if (e_state_a->v2 > e_state_b->v2) return 1; + else if (e_state_a->f1 < e_state_b->f1) return -1; + else if (e_state_a->f1 > e_state_b->f1) return 1; + else if (e_state_a->f2 < e_state_b->f2) return -1; + else if (e_state_a->f2 > e_state_b->f2) return 1; + else return 0; +} + +static GHash *erot_ghash_new(void) +{ + return BLI_ghash_new(erot_ghashutil_hash, erot_ghashutil_cmp, __func__); +} + +/* ensure v0 is smaller */ +#define EDGE_ORD(v0, v1) \ + if (v0 > v1) { \ + v0 ^= v1; \ + v1 ^= v0; \ + v0 ^= v1; \ + } (void)0 + +static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2]) +{ + BLI_assert(BM_edge_is_manifold((BMEdge *)e)); + BLI_assert(BM_vert_in_edge(e, e->l->prev->v) == false); + BLI_assert(BM_vert_in_edge(e, e->l->radial_next->prev->v) == false); + + /* verts of the edge */ + v_index[0] = BM_elem_index_get(e->v1); + v_index[1] = BM_elem_index_get(e->v2); + EDGE_ORD(v_index[0], v_index[1]); + + /* verts of each of the 2 faces attached to this edge + * (that are not apart of this edge) */ + f_index[0] = BM_elem_index_get(e->l->prev->v); + f_index[1] = BM_elem_index_get(e->l->radial_next->prev->v); + EDGE_ORD(f_index[0], f_index[1]); +} + +static void erot_state_current(const BMEdge *e, EdRotState *e_state) +{ + erot_state_ex(e, &e_state->v1, &e_state->f1); +} + +static void erot_state_alternate(const BMEdge *e, EdRotState *e_state) +{ + erot_state_ex(e, &e_state->f1, &e_state->v1); +} + +/* -------------------------------------------------------------------- */ +/* Util for setting edge tag once rotated */ + +/* we have rotated an edge, tag other egdes and clear this one */ +static void bm_edge_tag_rotated(BMEdge *e) +{ + BMLoop *l; + BLI_assert(e->l->f->len == 3 && + e->l->radial_next->f->len == 3); + + l = e->l; + BM_elem_flag_enable(l->next->e, BM_ELEM_TAG); + BM_elem_flag_enable(l->prev->e, BM_ELEM_TAG); + l = l->radial_next; + BM_elem_flag_enable(l->next->e, BM_ELEM_TAG); + BM_elem_flag_enable(l->prev->e, BM_ELEM_TAG); +} + +/* -------------------------------------------------------------------- */ +/* Beautify Fill */ + +#define ELE_NEW 1 +#define FACE_MARK 2 + +/** + * \note All edges in \a edge_array must be tagged and + * have their index values set according to their position in the array. + */ +static void bm_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_len) +{ + GHash **edge_state_arr = MEM_callocN(edge_array_len * sizeof(GHash *), __func__); + BLI_mempool *edge_state_pool = BLI_mempool_create(sizeof(EdRotState), 512, 512, BLI_MEMPOOL_SYSMALLOC); + bool is_breaked; + int i; + +#ifdef DEBUG_TIME + TIMEIT_START(beautify_fill); +#endif + + do { + is_breaked = true; + + for (i = 0; i < edge_array_len; i++) { + BMEdge *e = edge_array[i]; + GHash *e_state_hash; + + float v1_xy[2], v2_xy[2], v3_xy[2], v4_xy[2]; + + BLI_assert(BM_edge_is_manifold(e) == true); + BLI_assert(BMO_elem_flag_test(bm, e->l->f, FACE_MARK) && + BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)); + + if (!BM_elem_flag_test(e, BM_ELEM_TAG)) { + continue; + } + else { + /* don't check this edge again, unless adjaced edges are rotated */ + BM_elem_flag_disable(e, BM_ELEM_TAG); + } + + /* check we're not moving back into a state we have been in before */ + e_state_hash = edge_state_arr[i]; + if (e_state_hash != NULL) { + EdRotState e_state_alt; + erot_state_alternate(e, &e_state_alt); + if (BLI_ghash_haskey(e_state_hash, (void *)&e_state_alt)) { + // printf(" skipping, we already have this state\n"); + continue; + } + } + + { + const float *v1, *v2, *v3, *v4; + bool is_zero_a, is_zero_b; + float no[3]; + float axis_mat[3][3]; + + v1 = e->l->prev->v->co; /* first face co */ + v2 = e->l->v->co; /* e->v1 or e->v2*/ + v3 = e->l->radial_next->prev->v->co; /* second face co */ + v4 = e->l->next->v->co; /* e->v1 or e->v2*/ + + if (UNLIKELY(v1 == v3)) { + // printf("This should never happen, but does sometimes!\n"); + continue; + } + + // printf("%p %p %p %p - %p %p\n", v1, v2, v3, v4, e->l->f, e->l->radial_next->f); + BLI_assert((ELEM3(v1, v2, v3, v4) == false) && + (ELEM3(v2, v1, v3, v4) == false) && + (ELEM3(v3, v1, v2, v4) == false) && + (ELEM3(v4, v1, v2, v3) == false)); + + is_zero_a = area_tri_v3(v2, v3, v4) <= FLT_EPSILON; + is_zero_b = area_tri_v3(v2, v4, v1) <= FLT_EPSILON; + + if (LIKELY(is_zero_a == false && is_zero_b == false)) { + float no_a[3], no_b[3]; + normal_tri_v3(no_a, v2, v3, v4); /* a */ + normal_tri_v3(no_b, v2, v4, v1); /* b */ + add_v3_v3v3(no, no_a, no_b); + if (UNLIKELY(normalize_v3(no) <= FLT_EPSILON)) { + continue; + } + } + else if (is_zero_a == false) { + normal_tri_v3(no, v2, v3, v4); /* a */ + } + else if (is_zero_b == false) { + normal_tri_v3(no, v2, v4, v1); /* b */ + } + else { + /* both zero area, no useful normal can be calculated */ + continue; + } + + // { float a = angle_normalized_v3v3(no_a, no_b); printf("~ %.7f\n", a); fflush(stdout);} + + axis_dominant_v3_to_m3(axis_mat, no); + mul_v2_m3v3(v1_xy, axis_mat, v1); + mul_v2_m3v3(v2_xy, axis_mat, v2); + mul_v2_m3v3(v3_xy, axis_mat, v3); + mul_v2_m3v3(v4_xy, axis_mat, v4); + } + + // printf("%p %p %p %p - %p %p\n", v1, v2, v3, v4, e->l->f, e->l->radial_next->f); + + if (is_quad_convex_v2(v1_xy, v2_xy, v3_xy, v4_xy)) { + float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2; + /* testing rule: + * the area divided by the total edge lengths + */ + len1 = len_v2v2(v1_xy, v2_xy); + len2 = len_v2v2(v2_xy, v3_xy); + len3 = len_v2v2(v3_xy, v4_xy); + len4 = len_v2v2(v4_xy, v1_xy); + len5 = len_v2v2(v1_xy, v3_xy); + len6 = len_v2v2(v2_xy, v4_xy); + + opp1 = area_tri_v2(v1_xy, v2_xy, v3_xy); + opp2 = area_tri_v2(v1_xy, v3_xy, v4_xy); + + fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5); + + opp1 = area_tri_v2(v2_xy, v3_xy, v4_xy); + opp2 = area_tri_v2(v2_xy, v4_xy, v1_xy); + + fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6); + + if (fac1 > fac2) { + e = BM_edge_rotate(bm, e, false, BM_EDGEROT_CHECK_EXISTS); + if (LIKELY(e)) { + + /* add the new state into the hash so we don't move into this state again + * note: we could add the previous state too but this isn't essential) + * for avoiding eternal loops */ + EdRotState *e_state = BLI_mempool_alloc(edge_state_pool); + erot_state_current(e, e_state); + if (UNLIKELY(e_state_hash == NULL)) { + edge_state_arr[i] = e_state_hash = erot_ghash_new(); /* store previous state */ + } + BLI_assert(BLI_ghash_haskey(e_state_hash, (void *)e_state) == false); + BLI_ghash_insert(e_state_hash, e_state, NULL); + + + // printf(" %d -> %d, %d\n", i, BM_elem_index_get(e->v1), BM_elem_index_get(e->v2)); + + /* maintain the index array */ + edge_array[i] = e; + BM_elem_index_set(e, i); + + /* tag other edges so we know to check them again */ + bm_edge_tag_rotated(e); + + /* update flags */ + BMO_elem_flag_enable(bm, e, ELE_NEW); + BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW); + BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW); + is_breaked = false; + } + } + } + } + } while (is_breaked == false); + + for (i = 0; i < edge_array_len; i++) { + if (edge_state_arr[i]) { + BLI_ghash_free(edge_state_arr[i], NULL, NULL); + } + } + + MEM_freeN(edge_state_arr); + BLI_mempool_destroy(edge_state_pool); + +#ifdef DEBUG_TIME + TIMEIT_END(beautify_fill); +#endif +} + + +void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) +{ + BMOIter siter; + BMFace *f; + BMEdge *e; + + BMEdge **edge_array; + int edge_array_len = 0; + + BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { + if (f->len == 3) { + BMO_elem_flag_enable(bm, f, FACE_MARK); + } + } + + /* will over alloc if some edges can't be rotated */ + edge_array = MEM_mallocN(sizeof(*edge_array) * BMO_slot_buffer_count(op->slots_in, "edges"), __func__); + + BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { + + /* edge is manifold and can be rotated */ + if (BM_edge_rotate_check(e) && + /* faces are tagged */ + BMO_elem_flag_test(bm, e->l->f, FACE_MARK) && + BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)) + { + BM_elem_index_set(e, edge_array_len); /* set_dirty */ + BM_elem_flag_enable(e, BM_ELEM_TAG); + edge_array[edge_array_len] = e; + edge_array_len++; + } + } + bm->elem_index_dirty |= BM_EDGE; + + bm_mesh_beautify_fill(bm, edge_array, edge_array_len); + + MEM_freeN(edge_array); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW); +} diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index a78a8ec5197..4a241ca645f 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -30,9 +30,8 @@ #include "BLI_math.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ #define FACE_MARK 1 #define FACE_ORIG 2 diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 7dc2884c5ed..810b608b28e 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -28,9 +28,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_utildefines.h" #include "BLI_array.h" -#include "BLI_ghash.h" #include "BLI_listbase.h" #include "BLI_math.h" @@ -38,7 +36,6 @@ /* XXX: using 128 for totelem and pchunk of mempool, no idea what good * values would be though */ -#include "BLI_mempool.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index 0976c4cdfbb..a75d0353079 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -28,28 +28,16 @@ * into a Bmesh, and back again. */ -#include "MEM_guardedalloc.h" #include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_key_types.h" -#include "DNA_modifier_types.h" #include "BLI_math.h" -#include "BLI_array.h" - -#include "BKE_mesh.h" -#include "BLI_listbase.h" -#include "BKE_global.h" -#include "BKE_key.h" -#include "BKE_main.h" -#include "BKE_customdata.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) { diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 011002718d3..10a48c1b78c 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -29,9 +29,8 @@ #include "BLI_math.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ /* ************************ primitives ******************* */ diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index 8b65764fe1c..65b3267914f 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -32,9 +32,8 @@ #include "BKE_customdata.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op, BMOpSlot *slot_targetmap) { diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index 6b91d5fded9..0c0a2c308ee 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -26,16 +26,9 @@ #include "MEM_guardedalloc.h" -#include "DNA_meshdata_types.h" -#include "BLI_array.h" #include "BLI_math.h" -#include "BLI_math_geom.h" -#include "BLI_smallhash.h" -#include "BLI_heap.h" -#include "BKE_customdata.h" -#include "BKE_mesh.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 88e903c1651..9115ee882dd 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -33,12 +33,11 @@ #include "BKE_customdata.h" -#include "DNA_object_types.h" #include "bmesh.h" #include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ typedef struct SubDParams { int numcuts; diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 1f04c7ce845..29c3764045e 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -28,17 +28,14 @@ #include "DNA_listBase.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_smallhash.h" #include "BLI_scanfill.h" #include "bmesh.h" -#include "intern/bmesh_private.h" +#include "intern/bmesh_operators_private.h" -#include "intern/bmesh_operators_private.h" /* own include */ #define ELE_NEW 1 -#define FACE_MARK 2 #define EDGE_MARK 4 void bmo_triangulate_exec(BMesh *bm, BMOperator *op) @@ -55,81 +52,6 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG); } -void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) -{ - BMOIter siter; - BMIter iter; - BMFace *f; - BMEdge *e; - int stop = 0; - - BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, EDGE_MARK); - - BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { - if (f->len == 3) { - BMO_elem_flag_enable(bm, f, FACE_MARK); - } - } - - while (!stop) { - stop = 1; - - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - BMVert *v1, *v2, *v3, *v4; - - if (!BM_edge_is_manifold(e) || !BMO_elem_flag_test(bm, e, EDGE_MARK)) { - continue; - } - - if (!BMO_elem_flag_test(bm, e->l->f, FACE_MARK) || - !BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)) - { - continue; - } - - v1 = e->l->prev->v; - v2 = e->l->v; - v3 = e->l->radial_next->prev->v; - v4 = e->l->next->v; - - if (is_quad_convex_v3(v1->co, v2->co, v3->co, v4->co)) { - float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2; - /* testing rule: - * the area divided by the total edge lengths - */ - len1 = len_v3v3(v1->co, v2->co); - len2 = len_v3v3(v2->co, v3->co); - len3 = len_v3v3(v3->co, v4->co); - len4 = len_v3v3(v4->co, v1->co); - len5 = len_v3v3(v1->co, v3->co); - len6 = len_v3v3(v2->co, v4->co); - - opp1 = area_tri_v3(v1->co, v2->co, v3->co); - opp2 = area_tri_v3(v1->co, v3->co, v4->co); - - fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5); - - opp1 = area_tri_v3(v2->co, v3->co, v4->co); - opp2 = area_tri_v3(v2->co, v4->co, v1->co); - - fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6); - - if (fac1 > fac2) { - e = BM_edge_rotate(bm, e, false, BM_EDGEROT_CHECK_EXISTS); - if (e) { - BMO_elem_flag_enable(bm, e, ELE_NEW | EDGE_MARK); - - BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW); - BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW); - stop = 0; - } - } - } - } - } - - BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW); -} void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) { diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index f685b741176..525bf3a2da7 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -43,11 +43,12 @@ #include "bmesh.h" #include "./intern/bmesh_private.h" - - #define BEVEL_EPSILON_D 1e-6 #define BEVEL_EPSILON 1e-6f +/* happens far too often, uncomment for development */ +// #define BEVEL_ASSERT_PROJECT + /* for testing */ // #pragma GCC diagnostic error "-Wpadded" @@ -369,7 +370,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, /* intersect the lines; by construction they should be on the same plane and not parallel */ if (!isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2)) { +#ifdef BEVEL_ASSERT_PROJECT BLI_assert(!"offset_meet failure"); +#endif copy_v3_v3(meetco, off1a); /* just to do something */ } } @@ -485,7 +488,9 @@ static void project_to_edge(BMEdge *e, const float co_a[3], const float co_b[3], float otherco[3]; if (!isect_line_line_v3(e->v1->co, e->v2->co, co_a, co_b, projco, otherco)) { +#ifdef BEVEL_ASSERT_PROJECT BLI_assert(!"project meet failure"); +#endif copy_v3_v3(projco, e->v1->co); } } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 60188071832..e36a9873574 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -38,6 +38,8 @@ #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLF_translation.h" + #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_fcurve.h" @@ -217,7 +219,8 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector& BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); BLI_addtail(&act->groups, grp); - BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); + BLI_uniquename(&act->groups, grp, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "Group"), '.', + offsetof(bActionGroup, name), 64); } /* add F-Curve to group */ @@ -1968,14 +1971,15 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv if (grp == NULL) { /* Add a new group, and make it active */ grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - + grp->flag = AGRP_SELECTED; BLI_strncpy(grp->name, bone_name, sizeof(grp->name)); - + BLI_addtail(&act->groups, grp); - BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64); + BLI_uniquename(&act->groups, grp, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "Group"), '.', + offsetof(bActionGroup, name), 64); } - + /* add F-Curve to group */ action_groups_add_channel(act, grp, fcu); } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 0f8a4e5af76..901dd85a482 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -79,7 +79,7 @@ JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node); } #endif -void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBone *parent, int totchild, +void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBone *parent, int totchild, float parent_mat[4][4], bArmature *arm) { //Checking if bone is already made. diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index 8747d2995f2..8b021f75f28 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC . ../blenkernel ../blenlib + ../blenfont ../blenloader ../editors/include ../makesdna @@ -107,6 +108,10 @@ if(WITH_BUILDINFO) add_definitions(-DWITH_BUILDINFO) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + if(CMAKE_COMPILER_IS_GNUCXX) # COLLADAFWArray.h gives error with gcc 4.5 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") diff --git a/source/blender/collada/SConscript b/source/blender/collada/SConscript index 4da99a21517..e1ab774ffbe 100644 --- a/source/blender/collada/SConscript +++ b/source/blender/collada/SConscript @@ -32,12 +32,42 @@ defs = [] # TODO sanitize inc path building # relative paths to include dirs, space-separated, string +incs = [ + '../ikplugin', + '#/intern/iksolver/extern', + '../blenlib', + '../blenfont', + '../blenkernel', + '../windowmanager', + '../blenloader', + '../makesdna', + '../makesrna', + '../editors/include', + '../imbuf', + '../bmesh', + '#/intern/guardedalloc', +] if env['OURPLATFORM']=='darwin': - incs = '../ikplugin ../../../intern/iksolver/extern ../blenlib ../blenkernel ../windowmanager ../blenloader ../makesdna ../makesrna ../editors/include ../imbuf ../bmesh ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter [OPENCOLLADA]/COLLADABaseUtils [OPENCOLLADA]/COLLADAFramework [OPENCOLLADA]/COLLADASaxFrameworkLoader [OPENCOLLADA]/GeneratedSaxParser '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC']) + incs += [ + env['BF_OPENCOLLADA_INC'] + '/COLLADAStreamWriter', + env['BF_OPENCOLLADA_INC'] + '/COLLADABaseUtils', + env['BF_OPENCOLLADA_INC'] + '/COLLADAFramework', + env['BF_OPENCOLLADA_INC'] + '/COLLADASaxFrameworkLoader', + env['BF_OPENCOLLADA_INC'] + '/GeneratedSaxParser', + ] else: - incs = '../ikplugin ../../../intern/iksolver/extern ../blenlib ../blenkernel ../windowmanager ../makesdna ../blenloader ../makesrna ../editors/include ../imbuf ../bmesh ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include [OPENCOLLADA]/GeneratedSaxParser/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC']) + incs += [ + env['BF_OPENCOLLADA_INC'] + '/COLLADAStreamWriter/include', + env['BF_OPENCOLLADA_INC'] + '/COLLADABaseUtils/include', + env['BF_OPENCOLLADA_INC'] + '/COLLADAFramework/include', + env['BF_OPENCOLLADA_INC'] + '/COLLADASaxFrameworkLoader/include', + env['BF_OPENCOLLADA_INC'] + '/GeneratedSaxParser/include', + ] if env['BF_BUILDINFO']: defs.append('WITH_BUILDINFO') -env.BlenderLib ('bf_collada', sources, Split(incs), defs, libtype='core', priority=200 ) +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +env.BlenderLib ('bf_collada', sources, incs, defs, libtype='core', priority=200 ) diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index e1c32482835..c530135bc4d 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -139,7 +139,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob, B void TransformWriter::add_node_transform_identity(COLLADASW::Node& node) { - float loc[] = {0.0f, 0.0f, 0.0f}, scale[] = {1.0f, 1.0f, 1.0f}, rot[] = {0.0f, 0.0f, 0.0f}; + float loc[3] = {0.0f, 0.0f, 0.0f}, scale[3] = {1.0f, 1.0f, 1.0f}, rot[3] = {0.0f, 0.0f, 0.0f}; add_transform(node, loc, rot, scale); } diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 84b81f4d332..9aa1f7b9714 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -327,8 +327,8 @@ std::string bc_replace_string(std::string data, const std::string& pattern, */ void bc_match_scale(std::vector *objects_done, Scene &sce, - UnitConverter &bc_unit) { - + UnitConverter &bc_unit) +{ Object *ob = NULL; PointerRNA scene_ptr, unit_settings; diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index ad396e053f2..eb0c9cbdf11 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -69,8 +69,11 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star nodelink = nodelink->next; } - /* Expand group nodes */ - for (unsigned int i = nodes_start; i < nodes.size(); ++i) { + /* Expand group nodes + * Only go up to nodes_end, to avoid ungrouping nested node groups repeatedly. + */ + int nodes_end = nodes.size(); + for (unsigned int i = nodes_start; i < nodes_end; ++i) { Node *execnode = nodes[i]; if (execnode->isGroupNode()) { GroupNode *groupNode = (GroupNode *)execnode; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 56527da47bc..f46aae9e455 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -175,8 +175,8 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber) Full frame */ - int full_width = rd->xsch * rd->size / 100; - int full_height =rd->ysch * rd->size / 100; + int full_width = rd->xsch * rd->size / 100; + int full_height = rd->ysch * rd->size / 100; dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f; dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f; diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index c7b28587e47..2dae78ce5eb 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3524,7 +3524,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale but = uiDefButR(block, TEX, 1, "", offset + 3, yminc, RENAME_TEXT_WIDTH, channel_height, &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL); uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL); - uiButActiveOnly(C, block, but); + uiButActiveOnly(C, ac->ar, block, but); uiBlockSetEmboss(block, UI_EMBOSSN); } diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 561e196bf41..196b8064967 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -38,6 +38,8 @@ #include "BLI_blenlib.h" #include "BLI_ghash.h" +#include "BLF_translation.h" + #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_armature.h" @@ -85,7 +87,7 @@ void unique_editbone_name(ListBase *edbo, char *name, EditBone *bone) data.lb = edbo; data.bone = bone; - BLI_uniquename_cb(editbone_unique_check, &data, "Bone", '.', name, sizeof(bone->name)); + BLI_uniquename_cb(editbone_unique_check, &data, DATA_("Bone"), '.', name, sizeof(bone->name)); } /* ************************************************** */ @@ -98,7 +100,7 @@ static bool bone_unique_check(void *arg, const char *name) static void unique_bone_name(bArmature *arm, char *name) { - BLI_uniquename_cb(bone_unique_check, (void *)arm, "Bone", '.', name, sizeof(((Bone *)NULL)->name)); + BLI_uniquename_cb(bone_unique_check, (void *)arm, DATA_("Bone"), '.', name, sizeof(((Bone *)NULL)->name)); } /* helper call for armature_bone_rename */ diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 09c0f7e9647..cb7a699b522 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -462,7 +462,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op) } /* validate name */ - BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name)); + BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name)); /* use Keying Set to determine what to store for the pose */ /* FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't @@ -666,7 +666,7 @@ static int poselib_rename_exec(bContext *C, wmOperator *op) /* copy name and validate it */ BLI_strncpy(marker->name, newname, sizeof(marker->name)); - BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name)); + BLI_uniquename(&act->markers, marker, DATA_("Pose"), '.', offsetof(TimeMarker, name), sizeof(marker->name)); /* send notifiers for this - using keyframe editing notifiers, since action * may be being shown in anim editors as active action diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index d19d8084608..ac01cbb5f4a 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -277,8 +277,9 @@ static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, floa /* using this path, find each matching F-Curve for the variables we're interested in */ while ( (ld = poseAnim_mapping_getNextFCurve(&pfl->fcurves, ld, path)) ) { FCurve *fcu = (FCurve *)ld->data; - + /* just work on these channels one by one... there's no interaction between values */ + BLI_assert(fcu->array_index < 3); pose_slide_apply_val(pso, fcu, &vec[fcu->array_index]); } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index f95fbd1eacb..314967d4426 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4644,7 +4644,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) copy_v3_v3(location, give_cursor(vc.scene, vc.v3d)); } - view3d_get_view_aligned_coordinate(vc.ar, location, event->mval, true); + ED_view3d_win_to_3d_int(vc.ar, location, event->mval, location); RNA_float_set_array(op->ptr, "location", location); } @@ -6150,20 +6150,20 @@ static const char *get_curve_defname(int type) if ((type & CU_TYPE) == CU_BEZIER) { switch (stype) { - case CU_PRIM_CURVE: return DATA_("BezierCurve"); - case CU_PRIM_CIRCLE: return DATA_("BezierCircle"); - case CU_PRIM_PATH: return DATA_("CurvePath"); + case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "BezierCurve"); + case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "BezierCircle"); + case CU_PRIM_PATH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "CurvePath"); default: - return DATA_("Curve"); + return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Curve"); } } else { switch (stype) { - case CU_PRIM_CURVE: return DATA_("NurbsCurve"); - case CU_PRIM_CIRCLE: return DATA_("NurbsCircle"); - case CU_PRIM_PATH: return DATA_("NurbsPath"); + case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsCurve"); + case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsCircle"); + case CU_PRIM_PATH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "NurbsPath"); default: - return DATA_("Curve"); + return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Curve"); } } } @@ -6173,13 +6173,13 @@ static const char *get_surf_defname(int type) int stype = type & CU_PRIMITIVE; switch (stype) { - case CU_PRIM_CURVE: return DATA_("SurfCurve"); - case CU_PRIM_CIRCLE: return DATA_("SurfCircle"); - case CU_PRIM_PATCH: return DATA_("SurfPatch"); - case CU_PRIM_SPHERE: return DATA_("SurfSphere"); - case CU_PRIM_DONUT: return DATA_("SurfTorus"); + case CU_PRIM_CURVE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfCurve"); + case CU_PRIM_CIRCLE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfCircle"); + case CU_PRIM_PATCH: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfPatch"); + case CU_PRIM_SPHERE: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfSphere"); + case CU_PRIM_DONUT: return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "SurfTorus"); default: - return DATA_("Surface"); + return CTX_DATA_(BLF_I18NCONTEXT_ID_CURVE, "Surface"); } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 59850aff72f..fae3416e00a 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -499,9 +499,7 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int continue; /* check which stroke-drawer to use */ - if (gps->totpoints == 1) - gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy); - else if (dflag & GP_DRAWDATA_ONLY3D) { + if (dflag & GP_DRAWDATA_ONLY3D) { const int no_xray = (dflag & GP_DRAWDATA_NO_XRAY); int mask_orig = 0; @@ -519,7 +517,12 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int #endif } - gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug); + if (gps->totpoints == 1) { + gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy); + } + else { + gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug); + } if (no_xray) { glDepthMask(mask_orig); @@ -532,8 +535,14 @@ static void gp_draw_strokes(bGPDframe *gpf, int offsx, int offsy, int winx, int #endif } } - else if (gps->totpoints > 1) - gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); + else { + if (gps->totpoints == 1) { + gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy); + } + else { + gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); + } + } } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index bc68ad8869a..22ec2c8cfa5 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -138,7 +138,8 @@ enum { /* Runtime flags */ enum { GP_PAINTFLAG_FIRSTRUN = (1 << 0), /* operator just started */ - GP_PAINTFLAG_STROKEADDED = (1 << 1) + GP_PAINTFLAG_STROKEADDED = (1 << 1), + GP_PAINTFLAG_V3D_ERASER_DEPTH = (1 << 2) }; /* ------ */ @@ -842,8 +843,41 @@ static short gp_stroke_eraser_splitdel(bGPDframe *gpf, bGPDstroke *gps, int i) } } +/* which which point is infront (result should only be used for comparison) */ +static float view3d_point_depth(const RegionView3D *rv3d, const float co[3]) +{ + if (rv3d->is_persp) { + return ED_view3d_calc_zfac(rv3d, co, NULL); + } + else { + return -dot_v3v3(rv3d->viewinv[2], co); + } +} + +static bool gp_stroke_eraser_is_occluded(tGPsdata *p, + const bGPDspoint *pt, const int x, const int y) +{ + if ((p->sa->spacetype == SPACE_VIEW3D) && + (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH)) + { + RegionView3D *rv3d = p->ar->regiondata; + const int mval[2] = {x, y}; + float mval_3d[3]; + + if (ED_view3d_autodist_simple(p->ar, mval, mval_3d, 0, NULL)) { + const float depth_mval = view3d_point_depth(rv3d, mval_3d); + const float depth_pt = view3d_point_depth(rv3d, &pt->x); + + if (depth_pt > depth_mval) { + return true; + } + } + } + return false; +} + /* eraser tool - check if part of stroke occurs within last segment drawn by eraser */ -static short gp_stroke_eraser_strokeinside(const int mval[], const int UNUSED(mvalo[]), +static short gp_stroke_eraser_strokeinside(const int mval[2], const int UNUSED(mvalo[2]), int rad, int x0, int y0, int x1, int y1) { /* simple within-radius check for now */ @@ -893,7 +927,7 @@ static void gp_point_to_xy(ARegion *ar, View2D *v2d, rctf *subrect, bGPDstroke * /* eraser tool - evaluation per stroke */ /* TODO: this could really do with some optimization (KD-Tree/BVH?) */ static void gp_stroke_eraser_dostroke(tGPsdata *p, - const int mval[], const int mvalo[], + const int mval[2], const int mvalo[2], short rad, const rcti *rect, bGPDframe *gpf, bGPDstroke *gps) { bGPDspoint *pt1, *pt2; @@ -940,9 +974,13 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, * - this assumes that linewidth is irrelevant */ if (gp_stroke_eraser_strokeinside(mval, mvalo, rad, x0, y0, x1, y1)) { - /* if function returns true, break this loop (as no more point to check) */ - if (gp_stroke_eraser_splitdel(gpf, gps, i)) - break; + if ((gp_stroke_eraser_is_occluded(p, pt1, x0, y0) == false) || + (gp_stroke_eraser_is_occluded(p, pt2, x1, y1) == false)) + { + /* if function returns true, break this loop (as no more point to check) */ + if (gp_stroke_eraser_splitdel(gpf, gps, i)) + break; + } } } } @@ -961,7 +999,16 @@ static void gp_stroke_doeraser(tGPsdata *p) rect.ymin = p->mval[1] - p->radius; rect.xmax = p->mval[0] + p->radius; rect.ymax = p->mval[1] + p->radius; - + + if (p->sa->spacetype == SPACE_VIEW3D) { + if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { + View3D *v3d = p->sa->spacedata.first; + + view3d_region_operator_needs_opengl(p->win, p->ar); + ED_view3d_autodist_init(p->scene, p->ar, v3d, 0); + } + } + /* loop over strokes, checking segments for intersections */ for (gps = gpf->strokes.first; gps; gps = gpn) { gpn = gps->next; @@ -1213,9 +1260,17 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode) /* set 'eraser' for this stroke if using eraser */ p->paintmode = paintmode; - if (p->paintmode == GP_PAINTMODE_ERASER) + if (p->paintmode == GP_PAINTMODE_ERASER) { p->gpd->sbuffer_sflag |= GP_STROKE_ERASER; - + + /* check if we should respect depth while erasing */ + if (p->sa->spacetype == SPACE_VIEW3D) { + if (p->gpl->flag & GP_LAYER_NO_XRAY) { + p->flags |= GP_PAINTFLAG_V3D_ERASER_DEPTH; + } + } + } + /* set 'initial run' flag, which is only used to denote when a new stroke is starting */ p->flags |= GP_PAINTFLAG_FIRSTRUN; @@ -1910,12 +1965,12 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) */ /* printf("\t\tGP - resize eraser\n"); */ switch (event->type) { - case WHEELUPMOUSE: /* larger */ + case WHEELDOWNMOUSE: /* larger */ case PADPLUSKEY: p->radius += 5; break; - case WHEELDOWNMOUSE: /* smaller */ + case WHEELUPMOUSE: /* smaller */ case PADMINUS: p->radius -= 5; diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 39d1e283f54..5774a057eb5 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -188,7 +188,7 @@ gla2DDrawInfo *glaBegin2DDraw(struct rcti *screen_rect, struct rctf *world_rect void gla2DDrawTranslatePt(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r); /** Translate the \a world point from world coordiantes into screen space. */ -void gla2DDrawTranslatePtv(gla2DDrawInfo * di, float world[2], int screen_r[2]); +void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2]); /* Restores the previous OpenGL state and free's the auxilary * gla data. diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 81f49b4e1f8..ee0946be620 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -199,6 +199,7 @@ float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bo void ED_view3d_win_to_ray(const struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]); void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3]); void ED_view3d_win_to_3d(const struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]); +void ED_view3d_win_to_3d_int(const struct ARegion *ar, const float depth_pt[3], const int mval[2], float out[3]); void ED_view3d_win_to_delta(const struct ARegion *ar, const float mval[2], float out[3], const float zfac); void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]); void ED_view3d_win_to_segment(const struct ARegion *ar, struct View3D *v3d, const float mval[2], @@ -261,7 +262,6 @@ short view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigne void view3d_set_viewcontext(struct bContext *C, struct ViewContext *vc); void view3d_operator_needs_opengl(const struct bContext *C); void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar); -bool view3d_get_view_aligned_coordinate(struct ARegion *ar, float fp[3], const int mval[2], const bool do_fallback); void view3d_opengl_read_pixels(struct ARegion *ar, int x, int y, int w, int h, int format, int type, void *data); void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv3d, struct Object *ob, struct bglMats *mats); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 3b4415703d5..2572d4b4d99 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -448,7 +448,7 @@ void uiButSetDrawFlag(uiBut *but, int flag); void uiButClearDrawFlag(uiBut *but, int flag); /* special button case, only draw it when used actively, for outliner etc */ -int uiButActiveOnly(const struct bContext *C, uiBlock *block, uiBut *but); +int uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but); void uiButExecute(const struct bContext *C, uiBut *but); @@ -643,6 +643,9 @@ void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), void *arg1, void *arg2); +bool UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar, + const void *rna_poin_data, const char *rna_prop_id); + void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but); /* Autocomplete diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 16598511921..be51651dee7 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -682,7 +682,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut /* needed for temporarily rename buttons, such as in outliner or file-select, * they should keep calling uiDefButs to keep them alive */ /* returns 0 when button removed */ -int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) +int uiButActiveOnly(const bContext *C, ARegion *ar, uiBlock *block, uiBut *but) { uiBlock *oldblock; uiBut *oldbut; @@ -704,7 +704,7 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) } } if ((activate == TRUE) || (found == FALSE)) { - ui_button_activate_do((bContext *)C, CTX_wm_region(C), but); + ui_button_activate_do((bContext *)C, ar, but); } else if ((found == TRUE) && (isactive == FALSE)) { BLI_remlink(&block->buttons, but); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b34f4c9653f..6d30db9c4d6 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2997,7 +2997,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == ESCKEY || event->type == RIGHTMOUSE) { data->cancel = TRUE; data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -3261,7 +3261,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == ESCKEY || event->type == RIGHTMOUSE) { data->cancel = TRUE; data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -3839,7 +3839,7 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == ESCKEY || event->type == RIGHTMOUSE) { data->cancel = TRUE; data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -4036,7 +4036,7 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle } } else if (data->state == BUTTON_STATE_NUM_EDITING) { - if (event->type == ESCKEY) { + if (event->type == ESCKEY || event->type == RIGHTMOUSE) { data->cancel = TRUE; data->escapecancel = TRUE; button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -7456,4 +7456,32 @@ void UI_remove_popup_handlers(ListBase *handlers, uiPopupBlockHandle *popup) WM_event_remove_ui_handler(handlers, ui_handler_popup, ui_handler_remove_popup, popup, FALSE); } +bool UI_textbutton_activate_event(const bContext *C, ARegion *ar, + const void *rna_poin_data, const char *rna_prop_id) +{ + uiBlock *block; + uiBut *but = NULL; + + for (block = ar->uiblocks.first; block; block = block->next) { + for (but = block->buttons.first; but; but = but->next) { + if (but->type == TEX) { + if (but->rnaprop && but->rnapoin.data == rna_poin_data) { + if (STREQ(RNA_property_identifier(but->rnaprop), rna_prop_id)) { + break; + } + } + } + } + if (but) + break; + } + + if (but) { + uiButActiveOnly(C, ar, block, but); + return true; + } + else { + return false; + } +} diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 9f836ed789f..e7b659f99fc 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -520,9 +520,9 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad, bool use_alpha); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); uiWidgetColors *ui_tooltip_get_theme(void); -void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock * block, rcti * rect); +void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect); void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect); -int ui_link_bezier_points(const rcti * rect, float coord_array[][2], int resol); +int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol); void ui_draw_link_bezier(const rcti *rect); extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 96c8ded46da..b5b10b623d2 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3527,7 +3527,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int rcti trect = *rect, bg_rect; float font_dims[2] = {0.0f, 0.0f}; uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM); - unsigned char bg_col[3]; wt->state(wt, state); wt->draw(&wt->wcol, rect, 0, 0); @@ -3553,16 +3552,12 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int if (bg_rect.xmax > rect->xmax - PREVIEW_PAD) bg_rect.xmax = rect->xmax - PREVIEW_PAD; - UI_GetThemeColor3ubv(TH_BUTBACK, bg_col); - glColor4ubv((unsigned char *)wt->wcol.item); + glColor4ubv((unsigned char *)wt->wcol_theme->inner_sel); glEnable(GL_BLEND); glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax); glDisable(GL_BLEND); - if (state == UI_ACTIVE) - glColor4ubv((unsigned char *)wt->wcol.text); - else - glColor4ubv((unsigned char *)wt->wcol.text_sel); + glColor3ubv((unsigned char *)wt->wcol.text); uiStyleFontDraw(fstyle, &trect, name); } diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 1daf39d3319..3117f45156d 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -108,7 +108,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) unsigned int layer; ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Plane"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Plane"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "verts.out", @@ -149,7 +149,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) unsigned int layer; ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Cube"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cube"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", mat, dia * 2.0f)) { @@ -198,7 +198,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) cap_tri = (cap_end == 2); ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Circle"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Circle"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "verts.out", @@ -253,7 +253,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) cap_tri = (cap_end == 2); ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Cylinder"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cylinder"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( @@ -314,7 +314,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) cap_tri = (cap_end == 2); ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Cone"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cone"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( @@ -371,7 +371,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) unsigned int layer; ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Grid"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Grid"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "verts.out", @@ -427,7 +427,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) if (!view_aligned) rot[0] += (float)M_PI / 2.0f; - obedit = make_prim_init(C, DATA_("Suzanne"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Suzanne"), &dia, mat, &state, loc, rot, layer); mat[0][0] *= dia; mat[1][1] *= dia; mat[2][2] *= dia; @@ -470,7 +470,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) unsigned int layer; ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Sphere"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Sphere"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf(em, op, "verts.out", @@ -522,7 +522,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) unsigned int layer; ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL); - obedit = make_prim_init(C, DATA_("Icosphere"), &dia, mat, &state, loc, rot, layer); + obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Icosphere"), &dia, mat, &state, loc, rot, layer); em = BMEdit_FromObject(obedit); if (!EDBM_op_call_and_selectf( diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 13660a47248..f05df06ffa2 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -862,7 +862,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w copy_v3_v3(min, cent); mul_m4_v3(vc.obedit->obmat, min); /* view space */ - view3d_get_view_aligned_coordinate(vc.ar, min, event->mval, true); + ED_view3d_win_to_3d_int(vc.ar, min, event->mval, min); mul_m4_v3(vc.obedit->imat, min); // back in object space sub_v3_v3(min, cent); @@ -911,7 +911,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w BMOIter oiter; copy_v3_v3(min, curs); - view3d_get_view_aligned_coordinate(vc.ar, min, event->mval, false); + ED_view3d_win_to_3d_int(vc.ar, min, event->mval, min); invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); mul_m4_v3(vc.obedit->imat, min); // back in object space @@ -1238,6 +1238,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BMEdit_FromObject(obedit); const short use_smooth = edbm_add_edge_face__smooth_get(em->bm); + const int totedge_orig = em->bm->totedge; + const int totface_orig = em->bm->totface; /* when this is used to dissolve we could avoid this, but checking isnt too slow */ #ifdef USE_FACE_CREATE_SEL_EXTEND @@ -1258,6 +1260,14 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) BMO_op_exec(em->bm, &bmop); + /* cancel if nothing was done */ + if ((totedge_orig == em->bm->totedge) && + (totface_orig == em->bm->totface)) + { + EDBM_op_finish(em, &bmop, op, true); + return OPERATOR_CANCELLED; + } + #ifdef USE_FACE_CREATE_SEL_EXTEND /* normally we would want to leave the new geometry selected, * but being able to press F many times to add geometry is too useful! */ @@ -1279,7 +1289,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) } EDBM_update_generic(em, true, true); - + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 63582feadb7..b33c7212f0e 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -452,7 +452,7 @@ static int effector_add_exec(bContext *C, wmOperator *op) if (!ob) return OPERATOR_CANCELLED; - rename_id(&ob->id, DATA_("CurveGuide")); + rename_id(&ob->id, CTX_DATA_(BLF_I18NCONTEXT_ID_OBJECT, "CurveGuide")); ((Curve *)ob->data)->flag |= CU_PATH | CU_3D; ED_object_editmode_enter(C, 0); ED_object_new_primitive_matrix(C, ob, loc, rot, mat, FALSE); @@ -465,7 +465,7 @@ static int effector_add_exec(bContext *C, wmOperator *op) if (!ob) return OPERATOR_CANCELLED; - rename_id(&ob->id, DATA_("Field")); + rename_id(&ob->id, CTX_DATA_(BLF_I18NCONTEXT_ID_OBJECT, "Field")); if (ELEM(type, PFIELD_WIND, PFIELD_VORTEX)) ob->empty_drawtype = OB_SINGLE_ARROW; } @@ -822,13 +822,13 @@ void OBJECT_OT_drop_named_image(wmOperatorType *ot) static const char *get_lamp_defname(int type) { switch (type) { - case LA_LOCAL: return DATA_("Point"); - case LA_SUN: return DATA_("Sun"); - case LA_SPOT: return DATA_("Spot"); - case LA_HEMI: return DATA_("Hemi"); - case LA_AREA: return DATA_("Area"); + case LA_LOCAL: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Point"); + case LA_SUN: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Sun"); + case LA_SPOT: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Spot"); + case LA_HEMI: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Hemi"); + case LA_AREA: return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Area"); default: - return DATA_("Lamp"); + return CTX_DATA_(BLF_I18NCONTEXT_ID_LAMP, "Lamp"); } } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 5abbb7124c0..bdf04dcd20d 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -52,6 +52,8 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_deform.h" @@ -135,7 +137,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name) bDeformGroup *ED_vgroup_add(Object *ob) { - return ED_vgroup_add_name(ob, "Group"); + return ED_vgroup_add_name(ob, DATA_("Group")); } void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup) diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index aa4652af0ba..05c3af40a29 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -66,12 +66,14 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) /* Make sure we're dealing with a canvas */ pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint); - if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED; + if (!pmd || !pmd->canvas) + return OPERATOR_CANCELLED; canvas = pmd->canvas; surface = dynamicPaint_createNewSurface(canvas, CTX_data_scene(C)); - if (!surface) return OPERATOR_CANCELLED; + if (!surface) + return OPERATOR_CANCELLED; /* set preview for this surface only and set active */ canvas->active_sur = 0; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index d1254a7cb78..87d83f820c9 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -46,6 +46,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -383,7 +385,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) ma = BKE_material_copy(ma); } else { - ma = BKE_material_add(bmain, "Material"); + ma = BKE_material_add(bmain, DATA_("Material")); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(C, &ma->id); @@ -436,7 +438,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) if (tex) tex = BKE_texture_copy(tex); else - tex = add_texture(bmain, "Texture"); + tex = add_texture(bmain, DATA_("Texture")); /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 2d6e8d0ada0..eb52c06d08f 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1847,7 +1847,6 @@ void ED_region_header(const bContext *C, ARegion *ar) void ED_region_header_init(ARegion *ar) { - ar->v2d.flag &= ~V2D_IS_INITIALISED; UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index d5d5add215c..68dd6c65e36 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3520,7 +3520,7 @@ static int scene_new_exec(bContext *C, wmOperator *op) int type = RNA_enum_get(op->ptr, "type"); if (type == SCE_COPY_NEW) { - newscene = BKE_scene_add(bmain, "Scene"); + newscene = BKE_scene_add(bmain, DATA_("Scene")); } else { /* different kinds of copying */ newscene = BKE_scene_copy(scene, type); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 4f935ebdd8c..4478d68d3be 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -407,6 +407,9 @@ void paint_brush_init_tex(Brush *brush) MTex *mtex = &brush->mtex; if (mtex->tex && mtex->tex->nodetree) ntreeTexBeginExecTree(mtex->tex->nodetree); /* has internal flag to detect it only does it once */ + mtex = &brush->mask_mtex; + if (mtex->tex && mtex->tex->nodetree) + ntreeTexBeginExecTree(mtex->tex->nodetree); } } @@ -416,6 +419,9 @@ void paint_brush_exit_tex(Brush *brush) MTex *mtex = &brush->mtex; if (mtex->tex && mtex->tex->nodetree) ntreeTexEndExecTree(mtex->tex->nodetree->execdata); + mtex = &brush->mask_mtex; + if (mtex->tex && mtex->tex->nodetree) + ntreeTexEndExecTree(mtex->tex->nodetree->execdata); } } diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 90a2c8037c4..9bc232c6a61 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -793,7 +793,7 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op) return s; } -void paint_2d_redraw (const bContext *C, void *ps, int final) +void paint_2d_redraw(const bContext *C, void *ps, int final) { ImagePaintState *s = ps; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 7a0f7b817b3..5dcfa181fa2 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -264,7 +264,8 @@ typedef struct ProjPaintState { short is_ortho; bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */ - short is_texbrush; /* only to avoid running */ + bool is_texbrush; /* only to avoid running */ + bool is_maskbrush; #ifndef PROJ_DEBUG_NOSEAMBLEED float seam_bleed_px; #endif @@ -3905,6 +3906,10 @@ static void *do_projectpaint_thread(void *ph_v) alpha = 1.0f; } + if (ps->is_maskbrush) { + alpha *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool); + } + if (!ps->do_masking) { /* for an aurbrush there is no real mask, so just multiply the alpha by it */ alpha *= falloff * BKE_brush_alpha_get(ps->scene, brush); @@ -4153,14 +4158,15 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->blend = brush->blend; /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */ - ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW || - brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true; - ps->is_texbrush = (brush->mtex.tex && brush->imagepaint_tool == PAINT_TOOL_DRAW) ? 1 : 0; + ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode != MTEX_MAP_MODE_TILED) ? false : true; + ps->is_texbrush = (brush->mtex.tex && brush->imagepaint_tool == PAINT_TOOL_DRAW) ? true : false; + ps->is_maskbrush = (brush->flag & BRUSH_USE_MASK && brush->mask_mtex.tex) ? true : false; } else { /* brush may be NULL*/ ps->do_masking = false; ps->is_texbrush = false; + ps->is_maskbrush = false; } /* sizeof(ProjPixel), since we alloc this a _lot_ */ @@ -4321,7 +4327,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) } /* override */ - ps.is_texbrush = 0; + ps.is_texbrush = false; + ps.is_maskbrush = false; ps.do_masking = false; orig_brush_size = BKE_brush_size_get(scene, ps.brush); BKE_brush_size_set(scene, ps.brush, 32); /* cover the whole image */ diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index a15795dc2da..88c18602c89 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -125,7 +125,7 @@ void image_undo_restore(struct bContext *C, struct ListBase *lb); void image_undo_free(struct ListBase *lb); void imapaint_image_update(struct SpaceImage *sima, struct Image *image, struct ImBuf *ibuf, short texpaint); struct ImagePaintPartialRedraw *get_imapaintpartial(void); -void set_imapaintpartial(struct ImagePaintPartialRedraw * ippr); +void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr); void imapaint_clear_partial_redraw(void); void imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h); int get_imapaint_zoom(struct bContext *C, float *zoomx, float *zoomy); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 8c5552f48bc..d7e2d010f03 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -178,13 +178,22 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) { - copy_v2_v2(ups->tex_mouse, mouse); - - if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) && - (brush->flag & BRUSH_RANDOM_ROTATION) && + if (((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) || + (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) && !(brush->flag & BRUSH_RAKE)) { - ups->brush_rotation = 2.0f * (float)M_PI * BLI_frand(); + if (brush->flag & BRUSH_RANDOM_ROTATION) + ups->brush_rotation = 2.0f * (float)M_PI * BLI_frand(); + else + ups->brush_rotation = 0.0f; + } + + if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) { + ups->tex_mouse[0] = BLI_frand() * stroke->vc.ar->sizex; + ups->tex_mouse[1] = BLI_frand() * stroke->vc.ar->sizey;; + } + else { + copy_v2_v2(ups->tex_mouse, mouse); } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 51500ab8e1c..20b8f90df8b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3456,7 +3456,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, free_sculptsession_deformMats(ss); - ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL); + ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL); crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos); BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 6d9c5b4ba46..05e05b95967 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -741,14 +741,16 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc) typedef struct PrefetchJob { MovieClip *clip; - int start_frame, end_frame; + int start_frame, current_frame, end_frame; short render_size, render_flag; } PrefetchJob; typedef struct PrefetchQueue { - int current_frame, start_frame, end_frame; + int initial_frame, current_frame, start_frame, end_frame; short render_size, render_flag; + short direction; + SpinLock spin; short *stop; @@ -828,19 +830,29 @@ static unsigned char *prefetch_read_file_to_memory(MovieClip *clip, int current_ /* find first uncached frame within prefetching frame range */ static int prefetch_find_uncached_frame(MovieClip *clip, int from_frame, int end_frame, - short render_size, short render_flag) + short render_size, short render_flag, short direction) { int current_frame; + MovieClipUser user = {0}; - for (current_frame = from_frame; current_frame <= end_frame; current_frame++) { - MovieClipUser user = {0}; + user.render_size = render_size; + user.render_flag = render_flag; - user.framenr = current_frame; - user.render_size = render_size; - user.render_flag = render_flag; + if (direction > 0) { + for (current_frame = from_frame; current_frame <= end_frame; current_frame++) { + user.framenr = current_frame; - if (!BKE_movieclip_has_cached_frame(clip, &user)) - break; + if (!BKE_movieclip_has_cached_frame(clip, &user)) + break; + } + } + else { + for (current_frame = from_frame; current_frame >= end_frame; current_frame--) { + user.framenr = current_frame; + + if (!BKE_movieclip_has_cached_frame(clip, &user)) + break; + } } return current_frame; @@ -853,12 +865,23 @@ static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip unsigned char *mem = NULL; BLI_spin_lock(&queue->spin); - if (!*queue->stop && queue->current_frame <= queue->end_frame && check_prefetch_allowed()) { + if (!*queue->stop && check_prefetch_allowed() && + IN_RANGE_INCL(queue->current_frame, queue->start_frame, queue->end_frame)) + { int current_frame; - current_frame = prefetch_find_uncached_frame(clip, queue->current_frame + 1, queue->end_frame, - queue->render_size, queue->render_flag); - if (current_frame <= queue->end_frame) { + if (queue->direction > 0) { + current_frame = prefetch_find_uncached_frame(clip, queue->current_frame + 1, queue->end_frame, + queue->render_size, queue->render_flag, 1); + } + else { + current_frame = prefetch_find_uncached_frame(clip, queue->current_frame - 1, queue->start_frame, + queue->render_size, queue->render_flag, -1); + } + + if (IN_RANGE_INCL(current_frame, queue->start_frame, queue->end_frame)) { + int frames_processed; + mem = prefetch_read_file_to_memory(clip, current_frame, queue->render_size, queue->render_flag, size_r); @@ -866,9 +889,22 @@ static unsigned char *prefetch_thread_next_frame(PrefetchQueue *queue, MovieClip queue->current_frame = current_frame; + if (queue->direction > 0) { + frames_processed = queue->current_frame - queue->initial_frame; + } + else { + frames_processed = (queue->end_frame - queue->initial_frame) + + (queue->initial_frame - queue->current_frame); + } + *queue->do_update = 1; - *queue->progress = (float)(queue->current_frame - queue->start_frame) / - (queue->end_frame - queue->start_frame); + *queue->progress = (float)frames_processed / (queue->end_frame - queue->start_frame); + + /* switch direction if read frames from current up to scene end frames */ + if (current_frame == queue->end_frame) { + queue->current_frame = queue->initial_frame; + queue->direction = -1; + } } } BLI_spin_unlock(&queue->spin); @@ -911,8 +947,9 @@ static void *do_prefetch_thread(void *data_v) return NULL; } -static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_frame, short render_size, - short render_flag, short *stop, short *do_update, float *progress) +static void start_prefetch_threads(MovieClip *clip, int start_frame, int current_frame, int end_frame, + short render_size, short render_flag, short *stop, short *do_update, + float *progress) { ListBase threads; PrefetchQueue queue; @@ -927,11 +964,13 @@ static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_fra /* initialize queue */ BLI_spin_init(&queue.spin); - queue.current_frame = start_frame; + queue.current_frame = current_frame; + queue.initial_frame = current_frame; queue.start_frame = start_frame; queue.end_frame = end_frame; queue.render_size = render_size; queue.render_flag = render_flag; + queue.direction = 1; queue.stop = stop; queue.do_update = do_update; @@ -962,45 +1001,70 @@ static void start_prefetch_threads(MovieClip *clip, int start_frame, int end_fra MEM_freeN(handles); } -static void do_prefetch_movie(MovieClip *clip, int start_frame, int end_frame, short render_size, - short render_flag, short *stop, short *do_update, float *progress) +static bool prefetch_movie_frame(MovieClip *clip, int frame, short render_size, + short render_flag, short *stop) { - int current_frame; + MovieClipUser user = {0}; + ImBuf *ibuf; - for (current_frame = start_frame; current_frame <= end_frame; current_frame++) { - MovieClipUser user = {0}; - ImBuf *ibuf; + if (!check_prefetch_allowed() || *stop) + return false; - if (!check_prefetch_allowed() || *stop) - break; + user.framenr = frame; + user.render_size = render_size; + user.render_flag = render_flag; - user.framenr = current_frame; - user.render_size = render_size; - user.render_flag = render_flag; + if (!BKE_movieclip_has_cached_frame(clip, &user)) { + ibuf = BKE_movieclip_anim_ibuf_for_frame(clip, &user); - if (!BKE_movieclip_has_cached_frame(clip, &user)) { - ibuf = BKE_movieclip_anim_ibuf_for_frame(clip, &user); + if (ibuf) { + int result; - if (ibuf) { - int result; + result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf); - result = BKE_movieclip_put_frame_if_possible(clip, &user, ibuf); - - if (!result) { - /* no more space in the cache, we could stop prefetching here */ - *stop = 1; - } - - IMB_freeImBuf(ibuf); - } - else { - /* error reading frame, fair enough stop attempting further reading */ + if (!result) { + /* no more space in the cache, we could stop prefetching here */ *stop = 1; } + + IMB_freeImBuf(ibuf); } + else { + /* error reading frame, fair enough stop attempting further reading */ + *stop = 1; + } + } + + return true; +} + +static void do_prefetch_movie(MovieClip *clip, int start_frame, int current_frame, int end_frame, + short render_size, short render_flag, short *stop, short *do_update, + float *progress) +{ + int frame; + int frames_processed = 0; + + /* read frames starting from current frame up to scene end frame */ + for (frame = current_frame; frame <= end_frame; frame++) { + if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop)) + return; + + frames_processed++; *do_update = 1; - *progress = (float)(current_frame - start_frame) / (end_frame - start_frame); + *progress = (float) frames_processed / (end_frame - start_frame); + } + + /* read frames starting from current frame up to scene start frame */ + for (frame = current_frame; frame >= start_frame; frame--) { + if (!prefetch_movie_frame(clip, frame, render_size, render_flag, stop)) + return; + + frames_processed++; + + *do_update = 1; + *progress = (float) frames_processed / (end_frame - start_frame); } } @@ -1010,13 +1074,13 @@ static void prefetch_startjob(void *pjv, short *stop, short *do_update, float *p if (pj->clip->source == MCLIP_SRC_SEQUENCE) { /* read sequence files in multiple threads */ - start_prefetch_threads(pj->clip, pj->start_frame, pj->end_frame, + start_prefetch_threads(pj->clip, pj->start_frame, pj->current_frame, pj->end_frame, pj->render_size, pj->render_flag, stop, do_update, progress); } else if (pj->clip->source == MCLIP_SRC_MOVIE) { /* read movie in a single thread */ - do_prefetch_movie(pj->clip, pj->start_frame, pj->end_frame, + do_prefetch_movie(pj->clip, pj->start_frame, pj->current_frame, pj->end_frame, pj->render_size, pj->render_flag, stop, do_update, progress); } @@ -1032,6 +1096,13 @@ static void prefetch_freejob(void *pjv) MEM_freeN(pj); } +static int prefetch_get_start_frame(const bContext *C) +{ + Scene *scene = CTX_data_scene(C); + + return SFRA; +} + static int prefetch_get_final_frame(const bContext *C) { Scene *scene = CTX_data_scene(C); @@ -1059,6 +1130,20 @@ static bool prefetch_check_early_out(const bContext *C) if (clip->prefetch_ok) return true; + if (clip->source == MCLIP_SRC_MOVIE) { + /* for movies we only prefetch undistorted proxy, + * in other cases prefetching could lead to issues + * due to timecodes issues. + */ + + if (clip->flag & MCLIP_USE_PROXY) { + MovieClipUser *user = &sc->user; + + if ((user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) == 0) + return true; + } + } + clip_len = BKE_movieclip_get_duration(clip); /* check whether all the frames from prefetch range are cached */ @@ -1066,10 +1151,18 @@ static bool prefetch_check_early_out(const bContext *C) first_uncached_frame = prefetch_find_uncached_frame(clip, sc->user.framenr, end_frame, - sc->user.render_size, sc->user.render_flag); + sc->user.render_size, sc->user.render_flag, 1); - if (first_uncached_frame > end_frame || first_uncached_frame == clip_len) - return true; + if (first_uncached_frame > end_frame || first_uncached_frame == clip_len) { + int start_frame = prefetch_get_start_frame(C); + + first_uncached_frame = + prefetch_find_uncached_frame(clip, sc->user.framenr, start_frame, + sc->user.render_size, sc->user.render_flag, -1); + + if (first_uncached_frame < start_frame) + return true; + } return false; } @@ -1101,7 +1194,8 @@ void clip_start_prefetch_job(const bContext *C) /* create new job */ pj = MEM_callocN(sizeof(PrefetchJob), "prefetch job"); pj->clip = ED_space_clip_get_clip(sc); - pj->start_frame = sc->user.framenr; + pj->start_frame = prefetch_get_start_frame(C); + pj->current_frame = sc->user.framenr; pj->end_frame = prefetch_get_final_frame(C); pj->render_size = sc->user.render_size; pj->render_flag = sc->user.render_flag; diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 5b6b8656072..1c677d7c006 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -538,7 +538,7 @@ void file_draw_list(const bContext *C, ARegion *ar) uiButSetRenameFunc(but, renamebutton_cb, file); uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ uiButClearFlag(but, UI_BUT_UNDO); - if (0 == uiButActiveOnly(C, block, but)) { + if (0 == uiButActiveOnly(C, ar, block, but)) { file->selflag &= ~EDITING_FILE; } } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index f705831c715..e3270d9ce8e 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1460,17 +1460,21 @@ static int file_delete_poll(bContext *C) { int poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); - struct direntry *file; if (sfile && sfile->params) { - if (sfile->params->active_file < 0) { - poll = 0; + char dir[FILE_MAX], group[FILE_MAX]; + int numfiles = filelist_numfiles(sfile->files); + int i; + int num_selected = 0; + + if (filelist_islibrary(sfile->files, dir, group)) poll = 0; + for (i = 0; i < numfiles; i++) { + if (filelist_is_selected(sfile->files, i, CHECK_FILES)) { + num_selected++; + } } - else { - char dir[FILE_MAX], group[FILE_MAX]; - if (filelist_islibrary(sfile->files, dir, group)) poll = 0; - file = filelist_file(sfile->files, sfile->params->active_file); - if (file && S_ISDIR(file->type)) poll = 0; + if (num_selected <= 0) { + poll = 0; } } else @@ -1484,12 +1488,18 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) char str[FILE_MAX]; wmWindowManager *wm = CTX_wm_manager(C); SpaceFile *sfile = CTX_wm_space_file(C); - struct direntry *file; + struct direntry *file; + int numfiles = filelist_numfiles(sfile->files); + int i; + + for (i = 0; i < numfiles; i++) { + if (filelist_is_selected(sfile->files, i, CHECK_FILES)) { + file = filelist_file(sfile->files, i); + BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); + BLI_delete(str, false, false); + } + } - - file = filelist_file(sfile->files, sfile->params->active_file); - BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); - BLI_delete(str, false, false); ED_fileselect_clear(wm, sfile); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); @@ -1500,8 +1510,8 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) void FILE_OT_delete(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "Delete File"; - ot->description = "Delete selected file"; + ot->name = "Delete Selected Files"; + ot->description = "Delete selected files"; ot->idname = "FILE_OT_delete"; /* api callbacks */ diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 816ad9960df..578006115a5 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1116,7 +1116,7 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) uiLayout *row, *col; row = uiLayoutRow(layout, FALSE); - uiItemL(row, IFACE_("Key:"), ICON_NONE); + uiItemL(row, CTX_IFACE_(BLF_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE); col = uiLayoutColumn(row, FALSE); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE); uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE); @@ -2155,7 +2155,11 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "update_period", 0, NULL, ICON_NONE); row = uiLayoutRow(layout, FALSE); } + row = uiLayoutRow(layout, FALSE); uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE); + if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) { + uiLayoutSetActive(row, FALSE); + } } static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C) diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 2f6090d67ce..48051014c58 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -135,7 +135,7 @@ void NODE_OT_backimage_sample(struct wmOperatorType *ot); /* drawnode.c */ void node_draw_link(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link); void node_draw_link_bezier(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3); -int node_link_bezier_points(struct View2D * v2d, struct SpaceNode * snode, struct bNodeLink * link, float coord_array[][2], int resol); +int node_link_bezier_points(struct View2D *v2d, struct SpaceNode *snode, struct bNodeLink *link, float coord_array[][2], int resol); // void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 ); void draw_nodespace_back_pix(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 26a0d0a2fa8..418d4ff04a4 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -506,8 +506,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) Object *ob = (Object *)tselem->id; // id = object bActionGroup *grp = te->directdata; - BLI_uniquename(&ob->pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name), - sizeof(grp->name)); + BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "Group"), '.', + offsetof(bActionGroup, name), sizeof(grp->name)); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); } break; @@ -1043,7 +1043,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa uiButSetRenameFunc(bt, namebutton_cb, tselem); /* returns false if button got removed */ - if (0 == uiButActiveOnly(C, block, bt) ) + if (0 == uiButActiveOnly(C, ar, block, bt) ) tselem->flag &= ~TSE_TEXTBUT; } } diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 935bd13fcfc..cd79c43eac2 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -167,11 +167,11 @@ void sequencer_operatortypes(void); void sequencer_keymap(struct wmKeyConfig *keyconf); /* sequencer_scope.c */ -struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf); -struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf); -struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf); -struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf * ibuf, float perc); -struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf); +struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf *ibuf); +struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf *ibuf); +struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf *ibuf); +struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf *ibuf, float perc); +struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf *ibuf); /* sequencer_buttons.c */ void sequencer_buttons_register(struct ARegionType *art); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 58e45bc766f..61cdddfc740 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -220,6 +220,8 @@ static void text_operatortypes(void) WM_operatortype_append(TEXT_OT_replace); WM_operatortype_append(TEXT_OT_replace_set_selected); + WM_operatortype_append(TEXT_OT_start_find); + WM_operatortype_append(TEXT_OT_to_3d_object); WM_operatortype_append(TEXT_OT_resolve_conflict); @@ -233,9 +235,9 @@ static void text_keymap(struct wmKeyConfig *keyconf) wmKeyMapItem *kmi; keymap = WM_keymap_find(keyconf, "Text Generic", SPACE_TEXT, 0); - WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_CTRL, 0); #ifdef __APPLE__ - WM_keymap_add_item(keymap, "TEXT_OT_properties", FKEY, KM_PRESS, KM_OSKEY, 0); + WM_keymap_add_item(keymap, "TEXT_OT_start_find", FKEY, KM_PRESS, KM_OSKEY, 0); #endif keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0); @@ -515,7 +517,19 @@ static void text_properties_area_init(wmWindowManager *wm, ARegion *ar) static void text_properties_area_draw(const bContext *C, ARegion *ar) { + SpaceText *st = CTX_wm_space_text(C); + ED_region_panels(C, ar, 1, NULL, -1); + + /* this flag trick is make sure buttons have been added already */ + if (st->flags & ST_FIND_ACTIVATE) { + if (UI_textbutton_activate_event(C, ar, st, "find_text")) { + /* if the panel was already open we need to do another redraw */ + ScrArea *sa = CTX_wm_area(C); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_TEXT, sa); + } + st->flags &= ~ST_FIND_ACTIVATE; + } } /********************* registration ********************/ diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 605a08e587a..aaeea40c1a5 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -113,6 +113,38 @@ void TEXT_OT_properties(wmOperatorType *ot) ot->poll = text_properties_poll; } +static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op)) +{ + ScrArea *sa = CTX_wm_area(C); + ARegion *ar = text_has_properties_region(sa); + SpaceText *st = CTX_wm_space_text(C); + + if (ar) { + if (ar->flag & RGN_FLAG_HIDDEN) + ED_region_toggle_hidden(C, ar); + + /* cannot send a button activate yet for case when region wasn't visible yet */ + /* flag gets checked and cleared in main draw callback */ + st->flags |= ST_FIND_ACTIVATE; + + ED_region_tag_redraw(ar); + } + return OPERATOR_FINISHED; +} + + +void TEXT_OT_start_find(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Find"; + ot->description = "Start searching text"; + ot->idname = "TEXT_OT_start_find"; + + /* api callbacks */ + ot->exec = text_text_search_exec; + ot->poll = text_properties_poll; +} + /******************** XXX popup menus *******************/ #if 0 diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 799bc49b624..371ccfd9bd9 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -134,11 +134,15 @@ void TEXT_OT_line_number(struct wmOperatorType *ot); void TEXT_OT_properties(struct wmOperatorType *ot); +/* find = find indicated text */ void TEXT_OT_find(struct wmOperatorType *ot); void TEXT_OT_find_set_selected(struct wmOperatorType *ot); void TEXT_OT_replace(struct wmOperatorType *ot); void TEXT_OT_replace_set_selected(struct wmOperatorType *ot); +/* text_find = open properties, activate search button */ +void TEXT_OT_start_find(struct wmOperatorType *ot); + void TEXT_OT_to_3d_object(struct wmOperatorType *ot); void TEXT_OT_resolve_conflict(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index cdbb3e7c600..b4dc4f55368 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2966,7 +2966,7 @@ static int text_find_exec(bContext *C, wmOperator *op) void TEXT_OT_find(wmOperatorType *ot) { /* identifiers */ - ot->name = "Find"; + ot->name = "Find Next"; ot->idname = "TEXT_OT_find"; ot->description = "Find specified text"; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9d9dd0535ff..9dbdd8a9789 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2665,6 +2665,48 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot) ot->flag = 0; } +static int viewcenter_pick_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) +{ + View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); + Scene *scene = CTX_data_scene(C); + ARegion *ar = CTX_wm_region(C); + + if (rv3d) { + float new_ofs[3]; + + view3d_operator_needs_opengl(C); + + if (ED_view3d_autodist(scene, ar, v3d, event->mval, new_ofs, false)) { + /* pass */ + } + else { + /* fallback to simple pan */ + negate_v3_v3(new_ofs, rv3d->ofs); + ED_view3d_win_to_3d_int(ar, new_ofs, event->mval, new_ofs); + } + negate_v3(new_ofs); + view3d_smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, NULL, NULL); + } + + return OPERATOR_FINISHED; +} + +void VIEW3D_OT_view_center_pick(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Center View to Mouse"; + ot->description = "Center the view to the Z-depth position under the mouse cursor"; + ot->idname = "VIEW3D_OT_view_center_pick"; + + /* api callbacks */ + ot->invoke = viewcenter_pick_invoke; + ot->poll = ED_operator_view3d_active; + + /* flags */ + ot->flag = 0; +} + static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 11cd0fdb1d7..3e79696f209 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -86,6 +86,7 @@ void VIEW3D_OT_view_selected(struct wmOperatorType *ot); void VIEW3D_OT_view_lock_clear(struct wmOperatorType *ot); void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot); void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot); +void VIEW3D_OT_view_center_pick(struct wmOperatorType *ot); void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot); void VIEW3D_OT_view_pan(struct wmOperatorType *ot); void VIEW3D_OT_view_persportho(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index e567ebda4b7..00356074605 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -146,6 +146,7 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_view_lock_clear); WM_operatortype_append(VIEW3D_OT_view_lock_to_active); WM_operatortype_append(VIEW3D_OT_view_center_cursor); + WM_operatortype_append(VIEW3D_OT_view_center_pick); WM_operatortype_append(VIEW3D_OT_view_center_camera); WM_operatortype_append(VIEW3D_OT_select); WM_operatortype_append(VIEW3D_OT_select_border); @@ -245,6 +246,7 @@ void view3d_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */ WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_cursor", HOMEKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_pick", FKEY, KM_PRESS, KM_ALT, 0); kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */ diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 7d728234c92..ccfbf964d36 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -347,6 +347,39 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3], normalize_v3(vec); } +/* very similar to ED_view3d_win_to_3d() but has no advantage, de-duplicating */ +#if 0 +bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval[2], const bool do_fallback) +{ + RegionView3D *rv3d = ar->regiondata; + float dvec[3]; + int mval_cpy[2]; + eV3DProjStatus ret; + + ret = ED_view3d_project_int_global(ar, fp, mval_cpy, V3D_PROJ_TEST_NOP); + + if (ret == V3D_PROJ_RET_OK) { + const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]), + (float)(mval_cpy[1] - mval[1])}; + const float zfac = ED_view3d_calc_zfac(rv3d, fp, NULL); + ED_view3d_win_to_delta(ar, mval_f, dvec, zfac); + sub_v3_v3(fp, dvec); + + return true; + } + else { + /* fallback to the view center */ + if (do_fallback) { + negate_v3_v3(fp, rv3d->ofs); + return view3d_get_view_aligned_coordinate(ar, fp, mval, false); + } + else { + return false; + } + } +} +#endif + /** * Calculate a 3d location from 2d window coordinates. * \param ar The region (used for the window width and height). @@ -357,7 +390,7 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3], void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]) { RegionView3D *rv3d = ar->regiondata; - + float line_sta[3]; float line_end[3]; @@ -384,6 +417,12 @@ void ED_view3d_win_to_3d(const ARegion *ar, const float depth_pt[3], const float } } +void ED_view3d_win_to_3d_int(const ARegion *ar, const float depth_pt[3], const int mval[2], float out[3]) +{ + const float mval_fl[2] = {mval[0], mval[1]}; + ED_view3d_win_to_3d(ar, depth_pt, mval_fl, out); +} + /** * Calculate a 3d difference vector from 2d window offset. * note that ED_view3d_calc_zfac() must be called first to determine diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index d6cc218e266..ef8c2b5eff6 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -653,7 +653,7 @@ static void view3d_ruler_free(RulerInfo *ruler_info) static void view3d_ruler_item_project(RulerInfo *ruler_info, float r_co[3], const int xy[2]) { - view3d_get_view_aligned_coordinate(ruler_info->ar, r_co, xy, true); + ED_view3d_win_to_3d_int(ruler_info->ar, r_co, xy, r_co); } /* use for mousemove events */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index a84075fb60e..209bb76df91 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -108,39 +108,6 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc) vc->obedit = CTX_data_edit_object(C); } -/** - * Re-project \a fp so it stays on the same view-plane but is under \a mval (normally the cursor location). - */ -bool view3d_get_view_aligned_coordinate(ARegion *ar, float fp[3], const int mval[2], const bool do_fallback) -{ - RegionView3D *rv3d = ar->regiondata; - float dvec[3]; - int mval_cpy[2]; - eV3DProjStatus ret; - - ret = ED_view3d_project_int_global(ar, fp, mval_cpy, V3D_PROJ_TEST_NOP); - - if (ret == V3D_PROJ_RET_OK) { - const float mval_f[2] = {(float)(mval_cpy[0] - mval[0]), - (float)(mval_cpy[1] - mval[1])}; - const float zfac = ED_view3d_calc_zfac(rv3d, fp, NULL); - ED_view3d_win_to_delta(ar, mval_f, dvec, zfac); - sub_v3_v3(fp, dvec); - - return true; - } - else { - /* fallback to the view center */ - if (do_fallback) { - negate_v3_v3(fp, rv3d->ofs); - return view3d_get_view_aligned_coordinate(ar, fp, mval, false); - } - else { - return false; - } - } -} - /* * ob == NULL if you want global matrices * */ diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 60b0c655691..778795bb3a1 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -721,7 +721,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_screenactive; + ot->poll = ED_operator_view3d_active; RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index b12c0906fa0..0c1f169935a 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -96,7 +96,8 @@ static bool uniqueOrientationNameCheck(void *arg, const char *name) static void uniqueOrientationName(ListBase *lb, char *name) { - BLI_uniquename_cb(uniqueOrientationNameCheck, lb, "Space", '.', name, sizeof(((TransformOrientation *)NULL)->name)); + BLI_uniquename_cb(uniqueOrientationNameCheck, lb, CTX_DATA_(BLF_I18NCONTEXT_ID_SCENE, "Space"), '.', name, + sizeof(((TransformOrientation *)NULL)->name)); } void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name, int use, int overwrite) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index c92cd77449e..fdbfdfc8675 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -282,7 +282,7 @@ int handleSnapping(TransInfo *t, const wmEvent *event) void applyProject(TransInfo *t) { /* XXX FLICKER IN OBJECT MODE */ - if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) { + if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0 && (t->con.mode & CON_APPLY) == 0) { TransData *td = t->data; float tvec[3]; float imat[4][4]; diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index e953aa2f0ed..7f534493975 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -332,7 +332,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma if (!defmats) { Mesh *me = (Mesh *)ob->data; dm = mesh_create_derived(me, ob, NULL); - deformedVerts = mesh_getVertexCos(me, &numVerts); + deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts); defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats"); for (a = 0; a < numVerts; a++) @@ -413,7 +413,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 int a, numVerts; Mesh *me = (Mesh *)ob->data; - *deformcos = mesh_getVertexCos(me, &numVerts); + *deformcos = BKE_mesh_vertexCos_get(me, &numVerts); *deformmats = MEM_callocN(sizeof(*(*deformmats)) * numVerts, "defmats"); for (a = 0; a < numVerts; a++) diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 4c56a016176..8f8c5b8e03c 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -754,7 +754,8 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer /* setup face preview for all coincident uvs and their faces */ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ StitchPreviewer *preview = state->stitch_preview; /* static island does not change so returning immediately */ @@ -774,7 +775,8 @@ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchSta /* checks if uvs are indeed stitchable and registers so that they can be shown in preview */ static void stitch_validate_uv_stichability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ UvElement *element_iter; StitchPreviewer *preview = state->stitch_preview; int vert_index; @@ -809,7 +811,8 @@ static void stitch_validate_uv_stichability(UvElement *element, StitchState *sta static void stitch_validate_edge_stichability(UvEdge *edge, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ UvEdge *edge_iter = edge->first; StitchPreviewer *preview = state->stitch_preview; diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 48c14fc07f2..59242e9020f 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -134,7 +134,7 @@ struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, */ void IMB_refImBuf(struct ImBuf *ibuf); -struct ImBuf * IMB_makeSingleUser(struct ImBuf *ibuf); +struct ImBuf *IMB_makeSingleUser(struct ImBuf *ibuf); /** * @@ -213,9 +213,9 @@ typedef enum IMB_Proxy_Size { } IMB_Proxy_Size; /* defaults to BL_proxy within the directory of the animation */ -void IMB_anim_set_index_dir(struct anim * anim, const char * dir); +void IMB_anim_set_index_dir(struct anim *anim, const char *dir); -int IMB_anim_index_get_frame_index(struct anim * anim, IMB_Timecode_Type tc, +int IMB_anim_index_get_frame_index(struct anim *anim, IMB_Timecode_Type tc, int position); struct IndexBuildContext; @@ -241,8 +241,8 @@ int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc); * Return the fps contained in movie files (function rval is FALSE, * and frs_sec and frs_sec_base untouched if none available!) */ -int IMB_anim_get_fps(struct anim * anim, - short * frs_sec, float * frs_sec_base); +int IMB_anim_get_fps(struct anim *anim, + short *frs_sec, float *frs_sec_base); /** * diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 68ad4808c80..154941c5c09 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -70,12 +70,12 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags); /* targa */ int imb_is_a_targa(unsigned char *buf); struct ImBuf *imb_loadtarga(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]); -int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags); +int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags); /* iris */ int imb_is_a_iris(unsigned char *mem); struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]); -int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags); +int imb_saveiris(struct ImBuf *ibuf, const char *name, int flags); /* jp2 */ int imb_is_a_jp2(unsigned char *buf); @@ -85,7 +85,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags); /* jpeg */ int imb_is_a_jpeg(unsigned char *mem); int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags); -struct ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE]); +struct ImBuf *imb_load_jpeg (unsigned char *buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE]); /* bmp */ int imb_is_a_bmp(unsigned char *buf); @@ -109,7 +109,7 @@ int imb_is_dpx(unsigned char *buf); /* hdr */ int imb_is_a_hdr(unsigned char *buf); struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]); -int imb_savehdr(struct ImBuf * ibuf, const char *name, int flags); +int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags); /* tiff */ void imb_inittiff(void); diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index d114df945ae..64ec658f0db 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -81,7 +81,7 @@ typedef struct anim_index_builder { struct anim_index_entry *entry); } anim_index_builder; -anim_index_builder * IMB_index_builder_create(const char * name); +anim_index_builder * IMB_index_builder_create(const char *name); void IMB_index_builder_add_entry( anim_index_builder * fp, int frameno, unsigned long long seek_pos, @@ -96,25 +96,25 @@ void IMB_index_builder_proc_frame( unsigned long long seek_pos_dts, unsigned long long pts); -void IMB_index_builder_finish(anim_index_builder * fp, int rollback); +void IMB_index_builder_finish(anim_index_builder *fp, int rollback); -struct anim_index *IMB_indexer_open(const char * name); +struct anim_index *IMB_indexer_open(const char *name); unsigned long long IMB_indexer_get_seek_pos( struct anim_index *idx, int frameno_index); unsigned long long IMB_indexer_get_seek_pos_dts( struct anim_index *idx, int frameno_index); -int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno); +int IMB_indexer_get_frame_index(struct anim_index *idx, int frameno); unsigned long long IMB_indexer_get_pts(struct anim_index *idx, int frame_index); -int IMB_indexer_get_duration(struct anim_index * idx); +int IMB_indexer_get_duration(struct anim_index *idx); -int IMB_indexer_can_scan(struct anim_index * idx, +int IMB_indexer_can_scan(struct anim_index *idx, int old_frame_index, int new_frame_index); -void IMB_indexer_close(struct anim_index * idx); +void IMB_indexer_close(struct anim_index *idx); -void IMB_free_indices(struct anim * anim); +void IMB_free_indices(struct anim *anim); struct anim *IMB_anim_open_proxy( struct anim *anim, IMB_Proxy_Size preview_size); diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 4ef1f962a0f..7f25d9b1d25 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -946,7 +946,8 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx) } static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, - IMB_Timecode_Type tc) { + IMB_Timecode_Type tc) +{ int64_t pts_to_search = 0; double frame_rate; double pts_time_base; @@ -1303,7 +1304,8 @@ struct ImBuf *IMB_anim_previewframe(struct anim *anim) struct ImBuf *IMB_anim_absolute(struct anim *anim, int position, IMB_Timecode_Type tc, - IMB_Proxy_Size preview_size) { + IMB_Proxy_Size preview_size) +{ struct ImBuf *ibuf = NULL; char head[256], tail[256]; unsigned short digits; diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index aa3dd05dbd1..65a3db839a9 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2401,15 +2401,15 @@ void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *tot static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffer, const float *linear_buffer, const unsigned char *byte_buffer, int display_stride, int linear_stride, int linear_offset_x, int linear_offset_y, ColormanageProcessor *cm_processor, - int xmin, int ymin, int xmax, int ymax) + const int xmin, const int ymin, const int xmax, const int ymax) { int x, y; int channels = ibuf->channels; float dither = ibuf->dither; ColorSpace *rect_colorspace = ibuf->rect_colorspace; float *display_buffer_float = NULL; - int width = xmax - xmin; - int height = ymax - ymin; + const int width = xmax - xmin; + const int height = ymax - ymin; int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA; if (dither != 0.0f) { @@ -2467,7 +2467,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe width, height, width, display_stride); } else { - int i, width = xmax - xmin; + int i; for (i = ymin; i < ymax; i++) { int byte_offset = (linear_stride * i + xmin) * 4; diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 348e1e9f53a..8e571483e08 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -220,7 +220,7 @@ void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const } -void BlockDXT1::decodeBlock(ColorBlock * block) const +void BlockDXT1::decodeBlock(ColorBlock *block) const { // Decode color block. Color32 color_array[4]; @@ -235,7 +235,7 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const } } -void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const +void BlockDXT1::decodeBlockNV5x(ColorBlock *block) const { // Decode color block. Color32 color_array[4]; @@ -277,7 +277,7 @@ inline void BlockDXT1::flip2() BlockDXT3 ----------------------------------------------------------------------------*/ -void BlockDXT3::decodeBlock(ColorBlock * block) const +void BlockDXT3::decodeBlock(ColorBlock *block) const { // Decode color. color.decodeBlock(block); @@ -286,13 +286,13 @@ void BlockDXT3::decodeBlock(ColorBlock * block) const alpha.decodeBlock(block); } -void BlockDXT3::decodeBlockNV5x(ColorBlock * block) const +void BlockDXT3::decodeBlockNV5x(ColorBlock *block) const { color.decodeBlockNV5x(block); alpha.decodeBlock(block); } -void AlphaBlockDXT3::decodeBlock(ColorBlock * block) const +void AlphaBlockDXT3::decodeBlock(ColorBlock *block) const { block->color(0x0).a = (alpha0 << 4) | alpha0; block->color(0x1).a = (alpha1 << 4) | alpha1; @@ -415,7 +415,7 @@ void AlphaBlockDXT5::setIndex(uint index, uint value) this->u = (this->u & ~mask) | (uint64(value) << offset); } -void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const +void AlphaBlockDXT5::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; evaluatePalette(alpha_array); @@ -454,7 +454,7 @@ void AlphaBlockDXT5::flip2() *b = tmp; } -void BlockDXT5::decodeBlock(ColorBlock * block) const +void BlockDXT5::decodeBlock(ColorBlock *block) const { // Decode color. color.decodeBlock(block); @@ -463,7 +463,7 @@ void BlockDXT5::decodeBlock(ColorBlock * block) const alpha.decodeBlock(block); } -void BlockDXT5::decodeBlockNV5x(ColorBlock * block) const +void BlockDXT5::decodeBlockNV5x(ColorBlock *block) const { // Decode color. color.decodeBlockNV5x(block); @@ -488,7 +488,7 @@ void BlockDXT5::flip2() /// Decode ATI1 block. -void BlockATI1::decodeBlock(ColorBlock * block) const +void BlockATI1::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; alpha.evaluatePalette(alpha_array); @@ -517,7 +517,7 @@ void BlockATI1::flip2() /// Decode ATI2 block. -void BlockATI2::decodeBlock(ColorBlock * block) const +void BlockATI2::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; uint8 index_array[16]; @@ -580,7 +580,7 @@ void BlockCTX1::evaluatePalette(Color32 color_array[4]) const color_array[3].a = 0xFF; } -void BlockCTX1::decodeBlock(ColorBlock * block) const +void BlockCTX1::decodeBlock(ColorBlock *block) const { // Decode color block. Color32 color_array[4]; diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index dbd87bf1426..28f31fcad8b 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -57,7 +57,7 @@ ColorBlock::ColorBlock() } /// Init the color block from an array of colors. -ColorBlock::ColorBlock(const uint * linearImage) +ColorBlock::ColorBlock(const uint *linearImage) { for (uint i = 0; i < 16; i++) { color(i) = Color32(linearImage[i]); @@ -74,17 +74,17 @@ ColorBlock::ColorBlock(const ColorBlock & block) /// Initialize this color block. -ColorBlock::ColorBlock(const Image * img, uint x, uint y) +ColorBlock::ColorBlock(const Image *img, uint x, uint y) { init(img, x, y); } -void ColorBlock::init(const Image * img, uint x, uint y) +void ColorBlock::init(const Image *img, uint x, uint y) { init(img->width(), img->height(), (const uint *)img->pixels(), x, y); } -void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) +void ColorBlock::init(uint w, uint h, const uint *data, uint x, uint y) { const uint bw = min(w - x, 4U); const uint bh = min(h - y, 4U); @@ -105,7 +105,7 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) } } -void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y) +void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) { const uint bw = min(w - x, 4U); const uint bh = min(h - y, 4U); @@ -245,7 +245,7 @@ bool ColorBlock::hasAlpha() const #if 0 /// Get diameter color range. -void ColorBlock::diameterRange(Color32 * start, Color32 * end) const +void ColorBlock::diameterRange(Color32 *start, Color32 *end) const { Color32 c0, c1; uint best_dist = 0; @@ -266,7 +266,7 @@ void ColorBlock::diameterRange(Color32 * start, Color32 * end) const } /// Get luminance color range. -void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const +void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const { Color32 minColor, maxColor; uint minLuminance, maxLuminance; @@ -292,7 +292,7 @@ void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const } /// Get color range based on the bounding box. -void ColorBlock::boundsRange(Color32 * start, Color32 * end) const +void ColorBlock::boundsRange(Color32 *start, Color32 *end) const { Color32 minColor(255, 255, 255); Color32 maxColor(0, 0, 0); @@ -326,7 +326,7 @@ void ColorBlock::boundsRange(Color32 * start, Color32 * end) const } /// Get color range based on the bounding box. -void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const +void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const { Color32 minColor(255, 255, 255, 255); Color32 maxColor(0, 0, 0, 0); @@ -387,7 +387,7 @@ void ColorBlock::sortColorsByAbsoluteValue() /*/// Find extreme colors in the given axis. -void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end) const +void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) const { int mini, maxi; diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 0c240f16227..a6d53ffac96 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -47,7 +47,7 @@ extern "C" { #include "IMB_colormanagement.h" #include "IMB_colormanagement_intern.h" -int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags) +int imb_save_dds(struct ImBuf *ibuf, const char *name, int flags) { return(0); /* todo: finish this function */ @@ -85,7 +85,7 @@ int imb_is_a_dds(unsigned char *mem) // note: use at most first 32 bytes struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) { - struct ImBuf * ibuf = 0; + struct ImBuf *ibuf = NULL; DirectDrawSurface dds(mem, size); /* reads header */ unsigned char bits_per_pixel; unsigned int *rect; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 0c30af60388..7e6116b242c 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -344,8 +344,8 @@ static int checktarga(TARGA *tga, unsigned char *mem) return 0; } if (tga->mapsize && tga->mapbits > 32) return 0; - if (tga->xsize <= 0 || tga->xsize >= 8192) return 0; - if (tga->ysize <= 0 || tga->ysize >= 8192) return 0; + if (tga->xsize <= 0) return 0; + if (tga->ysize <= 0) return 0; if (tga->pixsize > 32) return 0; if (tga->pixsize == 0) return 0; return 1; diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 147791b4835..0c38adb3c83 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -56,6 +56,7 @@ typedef struct Brush { struct BrushClone clone; struct CurveMapping *curve; /* falloff curve */ struct MTex mtex; + struct MTex mask_mtex; struct Brush *toggle_brush; @@ -140,7 +141,8 @@ typedef enum BrushFlags { /* temporary flag which sets up automatically for correct brush * drawing when inverted modal operator is running */ BRUSH_INVERTED = (1 << 29), - BRUSH_ABSOLUTE_JITTER = (1 << 30) + BRUSH_ABSOLUTE_JITTER = (1 << 30), + BRUSH_USE_MASK = (1 << 31) } BrushFlags; /* Brush.sculpt_tool */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index a106afd38b2..f9286052aeb 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -392,7 +392,9 @@ typedef struct RenderData { short filtertype; /* filter is box, tent, gauss, mitch, etc */ - short size, maximsize; /* size in %, max in Kb */ + short size; /* size in % */ + + short maximsize DNA_DEPRECATED; /* max in Kb */ short pad6; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index b9c4788336f..1bc858f59f4 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -841,6 +841,8 @@ typedef enum eSpaceText_Flags { ST_FIND_ALL = (1 << 6), ST_SHOW_MARGIN = (1 << 7), ST_MATCH_CASE = (1 << 8), + + ST_FIND_ACTIVATE = (1 << 9), } eSpaceText_Flags; /* stext->findstr/replacestr */ diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index dd63e6aad59..afb2ac74d99 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -499,6 +499,7 @@ typedef struct ColorMapping { #define MTEX_MAP_MODE_TILED 1 #define MTEX_MAP_MODE_3D 2 #define MTEX_MAP_MODE_AREA 3 +#define MTEX_MAP_MODE_RANDOM 4 /* **************** EnvMap ********************* */ diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 2c022e80ddd..97ccdae089d 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -122,7 +122,7 @@ static void rna_Actuator_name_set(PointerRNA *ptr, const char *value) if (ptr->id.data) { Object *ob = (Object *)ptr->id.data; - BLI_uniquename(&ob->actuators, act, "Actuator", '.', offsetof(bActuator, name), sizeof(act->name)); + BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); } } @@ -2075,7 +2075,7 @@ static void rna_def_steering_actuator(BlenderRNA *brna) prop = RNA_def_property(srna, "show_visualization", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_ENABLEVISUALIZATION); - RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization"); + RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization for 'Path following'"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop = RNA_def_property(srna, "update_period", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 8480427c433..de68c4d19d9 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -432,6 +432,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, + {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; @@ -439,6 +440,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, + {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; @@ -911,6 +913,11 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH); RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned"); RNA_def_property_update(prop, 0, "rna_Brush_update"); + + prop = RNA_def_property(srna, "use_mask", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_USE_MASK); + RNA_def_property_ui_text(prop, "Mask Texture", "Use a texture as mask for the brush"); + RNA_def_property_update(prop, 0, "rna_Brush_update"); /* only for projection paint, TODO, other paint modes */ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); @@ -953,6 +960,18 @@ static void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Texture", ""); RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_update"); + prop = RNA_def_property(srna, "mask_texture_slot", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "BrushTextureSlot"); + RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mask Texture Slot", ""); + + prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex.tex"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mask Texture", ""); + RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_update"); + prop = RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE); RNA_def_property_int_sdna(prop, NULL, "texture_overlay_alpha"); RNA_def_property_range(prop, 1, 100); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 472cc6e89e6..28a2ca7cb75 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -31,6 +31,8 @@ #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "RNA_define.h" #include "rna_internal.h" @@ -88,7 +90,8 @@ static void rna_Constroller_name_set(PointerRNA *ptr, const char *value) if (ptr->id.data) { Object *ob = (Object *)ptr->id.data; - BLI_uniquename(&ob->controllers, cont, "Controller", '.', offsetof(bController, name), sizeof(cont->name)); + BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), + sizeof(cont->name)); } } diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 7156b76bab2..fbf6f921d0d 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -33,6 +33,8 @@ #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "RNA_access.h" #include "RNA_define.h" @@ -110,7 +112,7 @@ static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value) /* copy the new name into the name slot */ BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info)); - BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); + BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); } static void rna_GPencil_stroke_point_add(bGPDstroke *stroke, int count) diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 1577019f22a..b84436820b8 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -35,6 +35,8 @@ #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "RNA_access.h" #include "RNA_define.h" @@ -81,7 +83,8 @@ static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) /* make sure the name is truly unique */ if (ptr->id.data) { Key *key = rna_ShapeKey_find_key(ptr->id.data); - BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); + BLI_uniquename(&key->block, kb, CTX_DATA_(BLF_I18NCONTEXT_ID_SHAPEKEY, "Key"), '.', + offsetof(KeyBlock, name), sizeof(kb->name)); } /* fix all the animation data which may link to this */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index aed0e49cf7e..13ce4a77153 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1287,7 +1287,7 @@ static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name) static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer) { if (ED_mesh_color_remove_named(me, layer->name) == false) { - BKE_reportf(reports, RPT_ERROR, "vertex color '%s' not found", layer->name); + BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", layer->name); } } @@ -1383,7 +1383,7 @@ static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, const char *name) static void rna_Mesh_uv_texture_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer) { if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) { - BKE_reportf(reports, RPT_ERROR, "texture layer '%s' not found", layer->name); + BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found", layer->name); } } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index c675aa6ebc3..1ed3e673c8e 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -45,6 +45,8 @@ #include "RNA_define.h" #include "RNA_enum_types.h" +#include "BLF_translation.h" + #include "rna_internal.h" #include "WM_types.h" @@ -871,7 +873,7 @@ static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value) /* copy the new name into the name slot */ BLI_strncpy_utf8(part->name, value, sizeof(part->name)); - BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), + BLI_uniquename(&ob->particlesystem, part, DATA_("ParticleSystem"), '.', offsetof(ParticleSystem, name), sizeof(part->name)); } diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 6a1b3d4cfc5..0a19d7b5250 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -41,6 +41,8 @@ #include "BLI_math.h" +#include "BLF_translation.h" + #include "WM_types.h" @@ -156,7 +158,8 @@ static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) /* copy the new name into the name slot */ BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name)); - BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); + BLI_uniquename(&ob->pose->agroups, agrp, CTX_DATA_(BLF_I18NCONTEXT_ID_ARMATURE, "Group"), '.', + offsetof(bActionGroup, name), sizeof(agrp->name)); } static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, bool create) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ebce22bac79..13df8c91831 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1115,7 +1115,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) Scene *scene = (Scene *)ptr->id.data; SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data; BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); - BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); + BLI_uniquename(&scene->r.layers, rl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); if (scene->nodetree) { bNode *node; @@ -4196,7 +4196,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "blurfac"); - RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 1); + RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 2); RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 547d0ff78c9..278dc074c50 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -32,6 +32,8 @@ #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "RNA_define.h" #include "RNA_enum_types.h" #include "RNA_access.h" @@ -113,7 +115,7 @@ static void rna_Sensor_name_set(PointerRNA *ptr, const char *value) if (ptr->id.data) { Object *ob = (Object *)ptr->id.data; - BLI_uniquename(&ob->sensors, sens, "Sensor", '.', offsetof(bSensor, name), sizeof(sens->name)); + BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); } } @@ -458,6 +460,7 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna) RNA_def_property_enum_items(prop, event_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL); RNA_def_property_ui_text(prop, "Key", ""); + RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_WINDOWMANAGER); RNA_def_property_update(prop, NC_LOGIC, NULL); prop = RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index ed9d12cd1e0..475b3e614c1 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -92,6 +92,18 @@ static void meta_tmp_ref(Sequence *seq_par, Sequence *seq) } } +static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *) ptr->id.data; + Editing *ed = BKE_sequencer_editing_get(scene, FALSE); + + if (ed) { + Sequence *seq = (Sequence *) ptr->data; + + BKE_sequence_invalidate_cache(scene, seq); + } +} + static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; @@ -145,7 +157,7 @@ static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, rna_SequenceEditor_elements_length(ptr), 0, NULL); } -static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq) +static void do_sequence_frame_change_update(Scene *scene, Sequence *seq) { Editing *ed = BKE_sequencer_editing_get(scene, FALSE); ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq); @@ -157,13 +169,23 @@ static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq) BKE_sequencer_sort(scene); } +/* A simple wrapper around above func, directly usable as prop update func. + * Also invalidate cache if needed. + */ +static void rna_Sequence_frame_change_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->id.data; + do_sequence_frame_change_update(scene, (Sequence *)ptr->data); + rna_Sequence_update(bmain, scene, ptr); +} + static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value) { Sequence *seq = (Sequence *)ptr->data; Scene *scene = (Scene *)ptr->id.data; BKE_sequence_translate(scene, seq, value - seq->start); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value) @@ -173,7 +195,7 @@ static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value) BKE_sequence_tx_set_final_left(seq, value); BKE_sequence_single_fix(seq); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value) @@ -183,7 +205,7 @@ static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value) BKE_sequence_tx_set_final_right(seq, value); BKE_sequence_single_fix(seq); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) @@ -194,7 +216,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs); BKE_sequence_reload_new_file(scene, seq, FALSE); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) @@ -205,7 +227,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs); BKE_sequence_reload_new_file(scene, seq, FALSE); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) @@ -214,7 +236,7 @@ static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value) Scene *scene = (Scene *)ptr->id.data; BKE_sequence_tx_set_final_right(seq, seq->start + value); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static int rna_Sequence_frame_length_get(PointerRNA *ptr) @@ -602,18 +624,6 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) } #endif -static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - Scene *scene = (Scene *) ptr->id.data; - Editing *ed = BKE_sequencer_editing_get(scene, FALSE); - - if (ed) { - Sequence *seq = (Sequence *) ptr->data; - - BKE_sequence_invalidate_cache(scene, seq); - } -} - static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *) ptr->id.data; @@ -672,7 +682,7 @@ static void rna_Sequence_tcindex_update(Main *bmain, Scene *UNUSED(scene), Point Sequence *seq = sequence_get_by_proxy(ed, ptr->data); BKE_sequence_reload_new_file(scene, seq, FALSE); - rna_Sequence_frame_change_update(scene, seq); + do_sequence_frame_change_update(scene, seq); } static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -1404,14 +1414,14 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "startofs"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_ui_text(prop, "Start Offset", ""); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update"); + prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "endofs"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ RNA_def_property_ui_text(prop, "End Offset", ""); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update"); + prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "startstill"); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */ @@ -1651,10 +1661,9 @@ static void rna_def_input(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "anim_startofs"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); /* overlap tests */ - RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - + prop = RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "anim_endofs"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c index 3bf3dec3872..61e12c1cea0 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.c +++ b/source/blender/python/intern/bpy_app_ffmpeg.c @@ -81,8 +81,10 @@ static PyObject *make_ffmpeg_info(void) #define SetIntItem(flag) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyLong_FromLong(flag)) #endif +#ifndef WITH_FFMPEG #define SetStrItem(str) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyUnicode_FromString(str)) +#endif #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, obj) diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 3f66fb7b337..623d45dfd90 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -330,10 +330,10 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) mainl = BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath); { - int i = 0, code; - while ((code = BKE_idcode_iter_step(&i))) { - if (BKE_idcode_is_linkable(code)) { - const char *name_plural = BKE_idcode_to_name_plural(code); + int idcode_step = 0, idcode; + while ((idcode = BKE_idcode_iter_step(&idcode_step))) { + if (BKE_idcode_is_linkable(idcode)) { + const char *name_plural = BKE_idcode_to_name_plural(idcode); PyObject *ls = PyDict_GetItemString(self->dict, name_plural); // printf("lib: %s\n", name_plural); if (ls && PyList_Check(ls)) { @@ -350,7 +350,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) // printf(" %s\n", item_str); if (item_str) { - ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code); + ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, idcode); if (id) { #ifdef USE_RNA_DATABLOCKS PointerRNA id_ptr; diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index c330eb1549d..eef02285f3c 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2527,13 +2527,16 @@ BPY_PROPDEF_DESC_DOC " :arg items: sequence of enum items formatted:\n" " [(identifier, name, description, icon, number), ...] where the identifier is used\n" " for python access and other values are used for the interface.\n" +" The three first elements of the tuples are mandatory.\n" +" The forth one is either the (unique!) number id of the item or, if followed by a fith element \n" +" (which must be the numid), an icon string identifier.\n" " Note the item is optional.\n" " For dynamic values a callback can be passed which returns a list in\n" " the same format as the static list.\n" " This function must take 2 arguments (self, context)\n" " WARNING: Do not use generators here (they will work the first time, but will lead to empty values\n" -" in some unload/reload scenarii)!\n" -" :type items: sequence of string triples or a function\n" +" in some unload/reload scenarii)!\n" +" :type items: sequence of string tuples or a function\n" BPY_PROPDEF_UPDATE_DOC ); static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index 7b03b149459..142fcde8f1b 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -64,12 +64,12 @@ typedef struct { #include "mathutils_geometry.h" #include "mathutils_noise.h" -PyObject *BaseMathObject_owner_get(BaseMathObject * self, void *); +PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *); PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *); int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg); int BaseMathObject_clear(BaseMathObject *self); -void BaseMathObject_dealloc(BaseMathObject * self); +void BaseMathObject_dealloc(BaseMathObject *self); PyMODINIT_FUNC PyInit_mathutils(void); diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 7e7c986c6ea..c22544d1891 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -218,7 +218,7 @@ static NSString *stringWithCodecType(int codecType) return [NSString stringWithCString:str encoding:NSASCIIStringEncoding]; } -void makeqtstring (RenderData *rd, char *string) +void makeqtstring(RenderData *rd, char *string) { char txt[64]; diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m index 974c2555ee5..700d2614248 100644 --- a/source/blender/quicktime/apple/qtkit_import.m +++ b/source/blender/quicktime/apple/qtkit_import.m @@ -78,7 +78,7 @@ void quicktime_exit(void) } -int anim_is_quicktime (const char *name) +int anim_is_quicktime(const char *name) { NSAutoreleasePool *pool; @@ -119,7 +119,7 @@ int anim_is_quicktime (const char *name) } -void free_anim_quicktime (struct anim *anim) +void free_anim_quicktime(struct anim *anim) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -143,7 +143,7 @@ void free_anim_quicktime (struct anim *anim) [pool drain]; } -static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height) +static ImBuf *nsImageToiBuf(NSImage *sourceImage, int width, int height) { ImBuf *ibuf = NULL; uchar *rasterRGB = NULL; @@ -260,7 +260,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height) return ibuf; } -ImBuf * qtime_fetchibuf (struct anim *anim, int position) +ImBuf *qtime_fetchibuf (struct anim *anim, int position) { NSImage *frameImage; QTTime time; @@ -299,7 +299,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) } -int startquicktime (struct anim *anim) +int startquicktime(struct anim *anim) { NSAutoreleasePool *pool; NSArray* videoTracks; @@ -390,7 +390,7 @@ int startquicktime (struct anim *anim) return 0; } -int imb_is_a_quicktime (char *name) +int imb_is_a_quicktime(char *name) { NSImage *image; int result; diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h index 8fd016a3d74..4ec435db982 100644 --- a/source/blender/quicktime/quicktime_import.h +++ b/source/blender/quicktime/quicktime_import.h @@ -64,14 +64,14 @@ char *get_valid_qtname(const char *name); /* quicktime movie import functions */ -int anim_is_quicktime (const char *name); -int startquicktime (struct anim *anim); -void free_anim_quicktime (struct anim *anim); -ImBuf *qtime_fetchibuf (struct anim *anim, int position); +int anim_is_quicktime(const char *name); +int startquicktime(struct anim *anim); +void free_anim_quicktime(struct anim *anim); +ImBuf *qtime_fetchibuf(struct anim *anim, int position); /* quicktime image import functions */ -int imb_is_a_quicktime (char *name); +int imb_is_a_quicktime(char *name); ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags); #endif /* __QUICKTIME_IMPORT_H__ */ diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 020fa57cf94..2bcd39ab71b 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -165,9 +165,9 @@ int RE_RenderInProgress(struct Render *re); void RE_InitRenderCB(struct Render *re); /* use free render as signal to do everything over (previews) */ -void RE_FreeRender (struct Render *re); +void RE_FreeRender(struct Render *re); /* only called on exit */ -void RE_FreeAllRender (void); +void RE_FreeAllRender(void); /* only call on file load */ void RE_FreeAllRenderResults(void); /* for external render engines that can keep persistent data */ @@ -187,22 +187,22 @@ struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name) float *RE_RenderLayerGetPass(struct RenderLayer *rl, int passtype); /* obligatory initialize call, disprect is optional */ -void RE_InitState (struct Render *re, struct Render *source, struct RenderData *rd, struct SceneRenderLayer *srl, int winx, int winy, rcti *disprect); +void RE_InitState(struct Render *re, struct Render *source, struct RenderData *rd, struct SceneRenderLayer *srl, int winx, int winy, rcti *disprect); /* set up the viewplane/perspective matrix, three choices */ struct Object *RE_GetCamera(struct Render *re); /* return camera override if set */ void RE_SetCamera(struct Render *re, struct Object *camera); void RE_SetEnvmapCamera(struct Render *re, struct Object *cam_ob, float viewscale, float clipsta, float clipend); -void RE_SetWindow (struct Render *re, rctf *viewplane, float clipsta, float clipend); -void RE_SetOrtho (struct Render *re, rctf *viewplane, float clipsta, float clipend); +void RE_SetWindow(struct Render *re, rctf *viewplane, float clipsta, float clipend); +void RE_SetOrtho(struct Render *re, rctf *viewplane, float clipsta, float clipend); void RE_SetPixelSize(struct Render *re, float pixsize); /* option to set viewmatrix before making dbase */ -void RE_SetView (struct Render *re, float mat[4][4]); +void RE_SetView(struct Render *re, float mat[4][4]); /* make or free the dbase */ void RE_Database_FromScene(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int use_camera_view); -void RE_Database_Free (struct Render *re); +void RE_Database_Free(struct Render *re); /* project dbase again, when viewplane/perspective changed */ void RE_DataBase_ApplyWindow(struct Render *re); diff --git a/source/blender/render/intern/include/raycounter.h b/source/blender/render/intern/include/raycounter.h index 075a6337435..1694273df0e 100644 --- a/source/blender/render/intern/include/raycounter.h +++ b/source/blender/render/intern/include/raycounter.h @@ -50,7 +50,7 @@ typedef struct RayCounter { } RayCounter; #define RE_RC_INIT(isec, shi) (isec).raycounter = &((shi).shading.raycounter) -void RE_RC_INFO (RayCounter *rc); +void RE_RC_INFO(RayCounter *rc); void RE_RC_MERGE(RayCounter *rc, RayCounter *tmp); #define RE_RC_COUNT(var) (var)++ diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 162fa3b7e88..ca9897b652c 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -55,10 +55,10 @@ int testclip(const float v[3]); void zbuffer_shadow(struct Render *re, float winmat[4][4], struct LampRen *lar, int *rectz, int size, float jitx, float jity); void zbuffer_abuf_shadow(struct Render *re, struct LampRen *lar, float winmat[4][4], struct APixstr *APixbuf, struct APixstrand *apixbuf, struct ListBase *apsmbase, int size, int samples, float (*jit)[2]); -void zbuffer_solid(struct RenderPart *pa, struct RenderLayer *rl, void (*fillfunc)(struct RenderPart *, struct ZSpan *, int, void*), void *data); +void zbuffer_solid(struct RenderPart *pa, struct RenderLayer *rl, void (*fillfunc)(struct RenderPart *, struct ZSpan *, int, void *), void *data); unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass, struct ListBase *psmlist); -void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int)); +void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void *, int, int, int, int, int)); int zbuffer_strands_abuf(struct Render *re, struct RenderPart *pa, struct APixstrand *apixbuf, struct ListBase *apsmbase, unsigned int lay, int negzmask, float winmat[4][4], int winx, int winy, int sample, float (*jit)[2], float clipcrop, int shadow, struct StrandShadeCache *cache); typedef struct APixstr { diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp index 198577f61c6..18e8ba6cd14 100644 --- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp +++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp @@ -44,7 +44,7 @@ static int RE_rayobject_blibvh_intersect(RayObject *o, Isect *isec); static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob); static void RE_rayobject_blibvh_done(RayObject *o); static void RE_rayobject_blibvh_free(RayObject *o); -static void RE_rayobject_blibvh_bb(RayObject * o, float min[3], float max[3]); +static void RE_rayobject_blibvh_bb(RayObject *o, float min[3], float max[3]); static float RE_rayobject_blibvh_cost(RayObject *UNUSED(o)) { diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h index 07a1cd26c47..5b8a43eab03 100644 --- a/source/blender/render/intern/raytrace/rayobject_internal.h +++ b/source/blender/render/intern/raytrace/rayobject_internal.h @@ -46,7 +46,7 @@ extern "C" { * ... */ -typedef int (*RE_rayobjectcontrol_test_break_callback)(void *data); +typedef int (*RE_rayobjectcontrol_test_break_callback)(void *data); typedef struct RayObjectControl { void *data; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index fbcab8c19d4..0cbb00abed0 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -520,68 +520,68 @@ typedef struct { /* interface */ #include "mikktspace.h" -static int GetNumFaces(const SMikkTSpaceContext * pContext) +static int GetNumFaces(const SMikkTSpaceContext *pContext) { - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; return pMesh->obr->totvlak; } -static int GetNumVertsOfFace(const SMikkTSpaceContext * pContext, const int face_num) +static int GetNumVertsOfFace(const SMikkTSpaceContext *pContext, const int face_num) { - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); return vlr->v4!=NULL ? 4 : 3; } -static void GetPosition(const SMikkTSpaceContext * pContext, float fPos[], const int face_num, const int vert_index) +static void GetPosition(const SMikkTSpaceContext *pContext, float r_co[3], const int face_num, const int vert_index) { //assert(vert_index>=0 && vert_index<4); - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); - const float *co= (&vlr->v1)[vert_index]->co; - copy_v3_v3(fPos, co); + const float *co = (&vlr->v1)[vert_index]->co; + copy_v3_v3(r_co, co); } -static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[], const int face_num, const int vert_index) +static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float r_uv[2], const int face_num, const int vert_index) { //assert(vert_index>=0 && vert_index<4); - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); MTFace *tface= RE_vlakren_get_tface(pMesh->obr, vlr, pMesh->obr->actmtface, NULL, 0); const float *coord; - if (tface != NULL) { + if (tface != NULL) { coord= tface->uv[vert_index]; - fUV[0]= coord[0]; fUV[1]= coord[1]; + copy_v2_v2(r_uv, coord); } - else if ((coord= (&vlr->v1)[vert_index]->orco)) { - map_to_sphere(&fUV[0], &fUV[1], coord[0], coord[1], coord[2]); + else if ((coord = (&vlr->v1)[vert_index]->orco)) { + map_to_sphere(&r_uv[0], &r_uv[1], coord[0], coord[1], coord[2]); } else { /* else we get un-initialized value, 0.0 ok default? */ - fUV[0]= fUV[1]= 0.0f; + zero_v2(r_uv); } } -static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const int face_num, const int vert_index) +static void GetNormal(const SMikkTSpaceContext *pContext, float r_no[3], const int face_num, const int vert_index) { //assert(vert_index>=0 && vert_index<4); - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); if (vlr->flag & ME_SMOOTH) { const float *n = (&vlr->v1)[vert_index]->n; - copy_v3_v3(fNorm, n); + copy_v3_v3(r_no, n); } else { - negate_v3_v3(fNorm, vlr->n); + negate_v3_v3(r_no, vlr->n); } } -static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) +static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[3], const float fSign, const int face_num, const int iVert) { //assert(vert_index>=0 && vert_index<4); - SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; - VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num); - float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1); + SRenderMeshToTangent *pMesh = (SRenderMeshToTangent *) pContext->m_pUserData; + VlakRen *vlr = RE_findOrAddVlak(pMesh->obr, face_num); + float *ftang = RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1); if (ftang!=NULL) { copy_v3_v3(&ftang[iVert*4+0], fvTangent); ftang[iVert*4+3]=fSign; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 96eaa656c36..48a64822aed 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1532,7 +1532,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen return in; } -static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, +static void texco_mapping(ShadeInput *shi, Tex *tex, MTex *mtex, const float co[3], const float dx[3], const float dy[3], float texvec[3], float dxt[3], float dyt[3]) { /* new: first swap coords, then map, then trans/scale */ diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index a0267cd65b7..cc9717bd9d2 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2062,7 +2062,7 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg) /* ***************** ZBUFFER MAIN ROUTINES **************** */ -void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*, ZSpan*, int, void*), void *data) +void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart *, ZSpan *, int, void *), void *data) { ZbufProjectCache cache[ZBUF_PROJECT_CACHE_SIZE]; ZSpan zspans[16], *zspan; /* 16 = RE_MAX_OSA */ @@ -2531,7 +2531,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, } } -void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int)) +void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void *, int, int, int, int, int)) { ZbufProjectCache cache[ZBUF_PROJECT_CACHE_SIZE]; ZSpan zspan; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 2fd80d17bb7..25c8c5db0a1 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -193,7 +193,7 @@ int WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_operator_props_popup (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height); +int WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width, int height); int WM_operator_redo_popup (struct bContext *C, struct wmOperator *op); int WM_operator_ui_popup (struct bContext *C, struct wmOperator *op, int width, int height); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index b2647626f3a..6c129ec0a92 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -339,7 +339,7 @@ void wm_event_do_notifiers(bContext *C) static int wm_event_always_pass(wmEvent *event) { /* some events we always pass on, to ensure proper communication */ - return ISTIMER(event->type) || (event->type == WINDEACTIVATE); + return ISTIMER(event->type) || (event->type == WINDEACTIVATE) || (event->type == EVT_BUT_OPEN); } /* ********************* ui handler ******************* */ diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 6004eb57000..de40f7d6d3c 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -196,7 +196,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen void texture_rgb_blend(float *in, float *tex, float *out, float fact, float facg, int blendtype) {} char stipple_quarttone[1]; //GLubyte stipple_quarttone[128] double elbeemEstimateMemreq(int res, float sx, float sy, float sz, int refine, char *retstr) {return 0.0f;} -struct Render *RE_NewRender(const char *name) {return (struct Render*) NULL;} +struct Render *RE_NewRender(const char *name) {return (struct Render *) NULL;} void RE_SwapResult(struct Render *re, struct RenderResult **rr) {} void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame) {} int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, const char imtype, float layout[12]) { return 0; } @@ -246,7 +246,7 @@ void UI_view2d_view_to_region(struct View2D *v2d, float x, float y, int *regionx void UI_view2d_to_region_no_clip(struct View2D *v2d, float x, float y, int *regionx, int *region_y) {} struct EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, struct EditBone *ebo) {return (struct EditBone *) NULL;} -struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name) {return (struct EditBone*) NULL;} +struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name) {return (struct EditBone *) NULL;} struct ListBase *get_active_constraints (struct Object *ob) {return (struct ListBase *) NULL;} struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, struct bPoseChannel **pchan_r) {return (struct ListBase *) NULL;} int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan) {return 0;} @@ -524,8 +524,8 @@ void WM_operator_properties_free(struct PointerRNA *ptr) {} void WM_operator_properties_create(struct PointerRNA *ptr, const char *opstring) {} void WM_operator_properties_create_ptr(struct PointerRNA *ptr, struct wmOperatorType *ot) {} void WM_operator_properties_sanitize(struct PointerRNA *ptr, const short no_context) {}; -void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {} -void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, void *), void *userdata) {} +void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata) {} +void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata) {} void WM_operator_bl_idname(char *to, const char *from) {} void WM_operator_py_idname(char *to, const char *from) {} void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) {} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 6ab1d032bf2..e51daf615b8 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -248,7 +248,7 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) -void KX_BlenderCanvas::MakeScreenShot(const char* filename) +void KX_BlenderCanvas::MakeScreenShot(const char *filename) { ScrArea area_dummy= {0}; area_dummy.totrct.xmin = m_frame_rect.GetLeft(); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index f24392352b0..f808b1b7272 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -190,7 +190,7 @@ void BL_print_game_line(int fontid, const char *text, int size, int dpi, float * BLF_disable(fontid, BLF_MATRIX|BLF_ASPECT); } -void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int height) +void BL_print_gamedebug_line(const char *text, int xco, int yco, int width, int height) { /* gl prepping */ DisableForText(); @@ -219,7 +219,7 @@ void BL_print_gamedebug_line(const char* text, int xco, int yco, int width, int glEnable(GL_DEPTH_TEST); } -void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int width, int height) +void BL_print_gamedebug_line_padded(const char *text, int xco, int yco, int width, int height) { /* This is a rather important line :( The gl-mode hasn't been left * behind quite as neatly as we'd have wanted to. I don't know @@ -296,7 +296,7 @@ static unsigned int *screenshot(ScrArea *curarea, int *dumpsx, int *dumpsy) } /* based on screendump.c::screenshot_exec */ -void BL_MakeScreenShot(ScrArea *curarea, const char* filename) +void BL_MakeScreenShot(ScrArea *curarea, const char *filename) { char path[MAX_FILE_LENGTH]; strcpy(path,filename); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h index 5c3f0684764..2545cd34acb 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h @@ -44,7 +44,7 @@ void BL_SwapBuffers(struct wmWindow *win); void BL_warp_pointer(struct wmWindow *win,int x,int y); -void BL_MakeScreenShot(struct ScrArea *curarea, const char* filename); +void BL_MakeScreenShot(struct ScrArea *curarea, const char *filename); void BL_HideMouse(struct wmWindow *win); void BL_NormalMouse(struct wmWindow *win); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index 64ed384e961..4c162376b36 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -154,7 +154,7 @@ void KX_BlenderRenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) } } -bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) +bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { double* const oglmatrix = (double* const) data; MT_Point3 resultpoint(result->m_hitPoint); diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 0bd09146f3a..af537db0203 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -59,7 +59,7 @@ extern "C" { #include "RNA_define.h" } -BL_ActionActuator::BL_ActionActuator(SCA_IObject* gameobj, +BL_ActionActuator::BL_ActionActuator(SCA_IObject *gameobj, const STR_String& propname, const STR_String& framepropname, float starttime, @@ -123,7 +123,7 @@ void BL_ActionActuator::ProcessReplica() } -void BL_ActionActuator::SetBlendTime (float newtime) +void BL_ActionActuator::SetBlendTime(float newtime) { m_blendframe = newtime; } diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index c5dea5d0b43..dcf99502a3e 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2107,7 +2107,7 @@ struct parentChildLink { #include "DNA_constraint_types.h" //XXX #include "BIF_editconstraint.h" -static bPoseChannel *get_active_posechannel2 (Object *ob) +static bPoseChannel *get_active_posechannel2(Object *ob) { bArmature *arm= (bArmature*)ob->data; bPoseChannel *pchan; diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp index 4806ed04cc6..67712c683f9 100644 --- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp +++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp @@ -105,7 +105,7 @@ void BL_ShapeActionActuator::ProcessReplica() m_lastUpdate=-1; } -void BL_ShapeActionActuator::SetBlendTime (float newtime) +void BL_ShapeActionActuator::SetBlendTime(float newtime) { m_blendframe = newtime; } diff --git a/source/gameengine/Expressions/EmptyValue.cpp b/source/gameengine/Expressions/EmptyValue.cpp index 8170c588a28..7f3af9f649d 100644 --- a/source/gameengine/Expressions/EmptyValue.cpp +++ b/source/gameengine/Expressions/EmptyValue.cpp @@ -50,7 +50,7 @@ CEmptyValue::~CEmptyValue() -CValue * CEmptyValue::Calc(VALUE_OPERATOR op, CValue * val) +CValue *CEmptyValue::Calc(VALUE_OPERATOR op, CValue *val) /* * pre: * ret: a new object containing the result of applying operator op to this @@ -63,7 +63,7 @@ CValue * CEmptyValue::Calc(VALUE_OPERATOR op, CValue * val) -CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue * val) +CValue * CEmptyValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val) /* * pre: the type of val is dtype * ret: a new object containing the result of applying operator op to val and diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index 51550d52636..555ef7f9500 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -32,7 +32,7 @@ #include "KX_HashedPtr.h" -unsigned int KX_Hash(void * inDWord) +unsigned int KX_Hash(void *inDWord) { #if defined(_WIN64) && !defined(FREE_WINDOWS64) unsigned __int64 key = (unsigned __int64)inDWord; diff --git a/source/gameengine/Expressions/KX_HashedPtr.h b/source/gameengine/Expressions/KX_HashedPtr.h index d822af38c44..acd9d4daafa 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.h +++ b/source/gameengine/Expressions/KX_HashedPtr.h @@ -36,7 +36,7 @@ #include "MEM_guardedalloc.h" #endif -unsigned int KX_Hash(void * inDWord); +unsigned int KX_Hash(void *inDWord); class CHashedPtr { diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 5f97b03fed4..20c66bd7bc9 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -123,7 +123,7 @@ void CListValue::ReleaseAndRemoveAll() -CValue* CListValue::FindValue(const STR_String & name) +CValue* CListValue::FindValue(const STR_String &name) { for (int i=0; i < GetCount(); i++) if (GetValue(i)->GetName() == name) @@ -132,7 +132,7 @@ CValue* CListValue::FindValue(const STR_String & name) return NULL; } -CValue* CListValue::FindValue(const char * name) +CValue* CListValue::FindValue(const char *name) { for (int i=0; i < GetCount(); i++) if (GetValue(i)->GetName() == name) diff --git a/source/gameengine/Expressions/Operator1Expr.cpp b/source/gameengine/Expressions/Operator1Expr.cpp index 98228dfbe7d..b985f76825d 100644 --- a/source/gameengine/Expressions/Operator1Expr.cpp +++ b/source/gameengine/Expressions/Operator1Expr.cpp @@ -31,7 +31,7 @@ effect: constucts an empty COperator1Expr m_lhs = NULL; } -COperator1Expr::COperator1Expr(VALUE_OPERATOR op, CExpression * lhs) +COperator1Expr::COperator1Expr(VALUE_OPERATOR op, CExpression *lhs) /* pre: effect: constucts a COperator1Expr with op and lhs in it diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp index 706cfc13ca3..30a56c9165a 100644 --- a/source/gameengine/Expressions/Value.cpp +++ b/source/gameengine/Expressions/Value.cpp @@ -144,7 +144,7 @@ effect: deletes the object #define VALUE_POS(val1) (val1)->Calc(VALUE_POS_OPERATOR, val1) -STR_String CValue::op2str (VALUE_OPERATOR op) +STR_String CValue::op2str(VALUE_OPERATOR op) { //pre: //ret: the stringrepresentation of operator op @@ -531,7 +531,7 @@ PyAttributeDef CValue::Attributes[] = { { NULL } //Sentinel }; -PyObject *CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF *attrdef) +PyObject *CValue::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { CValue * self = static_cast (self_v); return PyUnicode_From_STR_String(self->GetName()); diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp index 612de658ce9..a0e1b616d5e 100644 --- a/source/gameengine/Expressions/VectorValue.cpp +++ b/source/gameengine/Expressions/VectorValue.cpp @@ -47,7 +47,7 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype) m_vec[KX_Z] = m_transformedvec[KX_Z] = z; } -CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) +CVectorValue::CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype) { SetCustomFlag1(false);//FancyOutput=false; @@ -65,7 +65,7 @@ CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctyp SetName(name); } -CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype) +CVectorValue::CVectorValue(double vec[3], AllocationTYPE alloctype) { SetCustomFlag1(false);//FancyOutput=false; diff --git a/source/gameengine/Expressions/VectorValue.h b/source/gameengine/Expressions/VectorValue.h index 9b9f9612810..69f2d4b54ae 100644 --- a/source/gameengine/Expressions/VectorValue.h +++ b/source/gameengine/Expressions/VectorValue.h @@ -45,10 +45,10 @@ public: CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); - CVectorValue(double vec[],const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); + CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); CVectorValue() {}; - CVectorValue(double vec[],AllocationTYPE alloctype=CValue::HEAPVALUE); + CVectorValue(double vec[3], AllocationTYPE alloctype=CValue::HEAPVALUE); CVectorValue(float x,float y,float z, AllocationTYPE alloctype = CValue::HEAPVALUE); virtual ~CVectorValue(); //virtual bool ExportT3D(File *txtfile,bool bNoName=false); diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp index 1263514d475..adf57dec278 100644 --- a/source/gameengine/GameLogic/SCA_LogicManager.cpp +++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp @@ -249,7 +249,7 @@ void SCA_LogicManager::UpdateFrame(double curtime, bool frame) -void* SCA_LogicManager::GetActionByName (const STR_String& actname) +void *SCA_LogicManager::GetActionByName(const STR_String& actname) { STR_HashedString an = actname; void** actptr = m_mapStringToActions[an]; diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index bab4aa14bbd..d81140992ec 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -163,7 +163,7 @@ void GPC_RenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) } } -bool GPC_RenderTools::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) +bool GPC_RenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { double* const oglmatrix = (double* const) data; MT_Point3 resultpoint(result->m_hitPoint); diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp index 8ffbe757222..8e073f7d17b 100644 --- a/source/gameengine/GamePlayer/common/bmfont.cpp +++ b/source/gameengine/GamePlayer/common/bmfont.cpp @@ -43,7 +43,7 @@ * detects if an image buffer contains a bitmap font. It makes the * specific bitmap data which is stored in the bitmap invisible to blender. * - * void matrixGlyph(ImBuf * ibuf, unsigned short unicode, *float x 7) + * void matrixGlyph(ImBuf *ibuf, unsigned short unicode, *float x 7) * returns all the information about the character (unicode) in the floats * * Room for improvement: @@ -62,8 +62,8 @@ #include "BKE_bmfont.h" #include "BKE_bmfont_types.h" -/*MAART: -void printfGlyph(bmGlyph * glyph) +#if 0 +void printfGlyph(bmGlyph *glyph) { printf("unicode: %d '%c'\n", glyph->unicode, glyph->unicode); printf(" locx: %4d locy: %4d\n", glyph->locx, glyph->locy); @@ -71,9 +71,9 @@ void printfGlyph(bmGlyph * glyph) printf(" ofsx: %3d ofsy: %3d\n", glyph->ofsx, glyph->ofsy); printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved); } -*/ +#endif -void calcAlpha(ImBuf * ibuf) +void calcAlpha(ImBuf *ibuf) { int i; char * rect; @@ -87,7 +87,7 @@ void calcAlpha(ImBuf * ibuf) } } -void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) +void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) { int glyphcount, bytes, i, index, linelength, ysize; unsigned char * buffer; @@ -253,7 +253,7 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode) return(current); } -void matrixGlyph(ImBuf * ibuf, unsigned short unicode, +void matrixGlyph(ImBuf *ibuf, unsigned short unicode, float *centerx, float *centery, float *sizex, float *sizey, float *transx, float *transy, diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp index 3caa4d35565..a3059317d36 100644 --- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp +++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp @@ -116,7 +116,7 @@ KX_ConstraintActuator::~KX_ConstraintActuator() // there's nothing to be done here, really.... } /* end of destructor */ -bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) +bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { m_hitObject = client->m_gameobject; @@ -150,7 +150,7 @@ bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo* client, KX_RayCast* resu /* This function is used to pre-filter the object before casting the ray on them. * This is useful for "X-Ray" option when we want to see "through" unwanted object. */ -bool KX_ConstraintActuator::NeedRayCast(KX_ClientObjectInfo* client) +bool KX_ConstraintActuator::NeedRayCast(KX_ClientObjectInfo *client) { if (client->m_type > KX_ClientObjectInfo::ACTOR) { diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 9f530f80e37..e2fb9573129 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -1435,7 +1435,7 @@ void KX_Dome::SplitFace(vector & face, int *nfaces) *nfaces = n2; } -void KX_Dome::CalculateFrustum(KX_Camera * cam) +void KX_Dome::CalculateFrustum(KX_Camera *cam) { #if 0 // manually creating a 90deg Field of View Frustum diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 138124f9b1a..95798900ccc 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -117,7 +117,7 @@ void KX_FontObject::ProcessReplica() KX_GetActiveScene()->AddFont(this); } -int GetFontId (VFont *vfont) +int GetFontId(VFont *vfont) { PackedFile *packedfile=NULL; int fontid = -1; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index ae5758b8597..98da18dcc68 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -187,7 +187,7 @@ KX_GameObject::~KX_GameObject() #endif // WITH_PYTHON } -KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo* info) +KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo *info) { if (!info) return NULL; @@ -2987,7 +2987,7 @@ KX_PYMETHODDEF_DOC_O(KX_GameObject, getVectTo, return returnValue; } -bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) +bool KX_GameObject::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { KX_GameObject* hitKXObj = client->m_gameobject; @@ -3006,7 +3006,7 @@ bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void /* this function is used to pre-filter the object before casting the ray on them. * This is useful for "X-Ray" option when we want to see "through" unwanted object. */ -bool KX_GameObject::NeedRayCast(KX_ClientObjectInfo* client) +bool KX_GameObject::NeedRayCast(KX_ClientObjectInfo *client) { KX_GameObject* hitKXObj = client->m_gameobject; diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp index 57695df2782..8e803c46358 100644 --- a/source/gameengine/Ketsji/KX_MeshProxy.cpp +++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp @@ -403,15 +403,15 @@ PyObject *KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_ return materials; } -PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) +PyObject *KX_MeshProxy::pyattr_get_numMaterials(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { - KX_MeshProxy * self = static_cast (selfv); + KX_MeshProxy * self = static_cast (self_v); return PyLong_FromLong(self->m_meshobj->NumMaterials()); } -PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) +PyObject *KX_MeshProxy::pyattr_get_numPolygons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { - KX_MeshProxy * self = static_cast (selfv); + KX_MeshProxy * self = static_cast (self_v); return PyLong_FromLong(self->m_meshobj->NumPolygons()); } diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 9368bc6458f..82ae8c13633 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -136,7 +136,7 @@ bool KX_MouseFocusSensor::Evaluate() return result; } -bool KX_MouseFocusSensor::RayHit(KX_ClientObjectInfo* client_info, KX_RayCast* result, void * const data) +bool KX_MouseFocusSensor::RayHit(KX_ClientObjectInfo *client_info, KX_RayCast *result, void * const data) { KX_GameObject* hitKXObj = client_info->m_gameobject; diff --git a/source/gameengine/Ketsji/KX_NearSensor.cpp b/source/gameengine/Ketsji/KX_NearSensor.cpp index 232a872bf10..cbb4e77d165 100644 --- a/source/gameengine/Ketsji/KX_NearSensor.cpp +++ b/source/gameengine/Ketsji/KX_NearSensor.cpp @@ -186,7 +186,7 @@ bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2) // need the mapping from PHY_IPhysicsController to gameobjects now assert(obj1==m_physCtrl && obj2); - KX_ClientObjectInfo* client_info = static_cast((static_cast(obj2))->getNewClientInfo()); + KX_ClientObjectInfo *client_info = static_cast((static_cast(obj2))->getNewClientInfo()); KX_GameObject* gameobj = ( client_info ? client_info->m_gameobject : @@ -208,14 +208,14 @@ bool KX_NearSensor::BroadPhaseFilterCollision(void*obj1,void*obj2) return false; } -bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData * coll_data) +bool KX_NearSensor::NewHandleCollision(void *obj1, void *obj2, const PHY_CollData *coll_data) { // KX_TouchEventManager* toucheventmgr = static_cast(m_eventmgr); // KX_GameObject* parent = static_cast(GetParent()); // need the mapping from PHY_IPhysicsController to gameobjects now - KX_ClientObjectInfo* client_info =static_cast (obj1 == m_physCtrl? + KX_ClientObjectInfo *client_info = static_cast (obj1 == m_physCtrl? ((PHY_IPhysicsController*)obj2)->getNewClientInfo() : ((PHY_IPhysicsController*)obj1)->getNewClientInfo()); diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index f0e11645bc1..4c491654d1f 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -63,7 +63,7 @@ static int KX_PythonSeq_clear(KX_PythonSeq *self) return 0; } -static void KX_PythonSeq_dealloc(KX_PythonSeq * self) +static void KX_PythonSeq_dealloc(KX_PythonSeq *self) { KX_PythonSeq_clear(self); PyObject_GC_Del(self); @@ -264,7 +264,7 @@ static PyObjectPlus * KX_PythonSeq_subscript__internal(PyObject *self, const cha } -static PyObject * KX_PythonSeq_subscript(PyObject *self, PyObject *key) +static PyObject *KX_PythonSeq_subscript(PyObject *self, PyObject *key) { PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base); @@ -394,9 +394,9 @@ static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self) } -static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b ) +static int KX_PythonSeq_compare(KX_PythonSeq *a, KX_PythonSeq *b) { - return ( a->type == b->type && a->base == b->base) ? 0 : -1; + return (a->type == b->type && a->base == b->base) ? 0 : -1; } static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op) @@ -434,7 +434,7 @@ static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op) * repr function * convert to a list and get its string value */ -static PyObject *KX_PythonSeq_repr( KX_PythonSeq * self ) +static PyObject *KX_PythonSeq_repr(KX_PythonSeq *self) { PyObject *list = PySequence_List((PyObject *)self); PyObject *repr = PyObject_Repr(list); diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp index 878f9d267dc..f1bfb10220a 100644 --- a/source/gameengine/Ketsji/KX_RayCast.cpp +++ b/source/gameengine/Ketsji/KX_RayCast.cpp @@ -80,7 +80,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_ frompoint.x(),frompoint.y(),frompoint.z(), topoint.x(),topoint.y(),topoint.z())) != NULL) { - KX_ClientObjectInfo* info = static_cast(hit_controller->getNewClientInfo()); + KX_ClientObjectInfo *info = static_cast(hit_controller->getNewClientInfo()); if (!info) { diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp index 14786e8429e..3fbce690a9f 100644 --- a/source/gameengine/Ketsji/KX_RaySensor.cpp +++ b/source/gameengine/Ketsji/KX_RaySensor.cpp @@ -108,7 +108,7 @@ bool KX_RaySensor::IsPositiveTrigger() return result; } -bool KX_RaySensor::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data) +bool KX_RaySensor::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { KX_GameObject* hitKXObj = client->m_gameobject; @@ -153,7 +153,7 @@ bool KX_RaySensor::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void /* this function is used to pre-filter the object before casting the ray on them. * This is useful for "X-Ray" option when we want to see "through" unwanted object. */ -bool KX_RaySensor::NeedRayCast(KX_ClientObjectInfo* client) +bool KX_RaySensor::NeedRayCast(KX_ClientObjectInfo *client) { if (client->m_type > KX_ClientObjectInfo::ACTOR) { diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 3e1a81c2f4f..92e064c6e91 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1468,7 +1468,7 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam } } -void KX_Scene::PhysicsCullingCallback(KX_ClientObjectInfo* objectInfo, void* cullingInfo) +void KX_Scene::PhysicsCullingCallback(KX_ClientObjectInfo *objectInfo, void* cullingInfo) { KX_GameObject* gameobj = objectInfo->m_gameobject; if (!gameobj->GetVisible()) diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp index 83b57dee7c1..6fe33fd2f63 100644 --- a/source/gameengine/Ketsji/KX_SceneActuator.cpp +++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp @@ -208,7 +208,7 @@ KX_Camera* KX_SceneActuator::FindCamera(const char *camName) -KX_Scene* KX_SceneActuator::FindScene(const char * sceneName) +KX_Scene* KX_SceneActuator::FindScene(const char *sceneName) { return m_KetsjiEngine->FindScene(sceneName); } diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp index d2a5ce58641..96872f4e6fd 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp @@ -82,7 +82,7 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, const PHY_CollData *coll_data) { PHY_IPhysicsController* ctrl = static_cast(object1); - KX_ClientObjectInfo* info = (ctrl) ? static_cast(ctrl->getNewClientInfo()) : NULL; + KX_ClientObjectInfo *info = (ctrl) ? static_cast(ctrl->getNewClientInfo()) : NULL; // This call back should only be called for controllers of Near and Radar sensor if (!info) return true; diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp b/source/gameengine/Ketsji/KX_TouchSensor.cpp index 36e0bf692f1..9d87da48fae 100644 --- a/source/gameengine/Ketsji/KX_TouchSensor.cpp +++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp @@ -175,7 +175,7 @@ void KX_TouchSensor::RegisterSumo(KX_TouchEventManager *touchman) { if (touchman->GetPhysicsEnvironment()->requestCollisionCallback(m_physCtrl)) { - KX_ClientObjectInfo* client_info = static_cast(m_physCtrl->getNewClientInfo()); + KX_ClientObjectInfo *client_info = static_cast(m_physCtrl->getNewClientInfo()); if (client_info->isSensor()) touchman->GetPhysicsEnvironment()->addSensor(m_physCtrl); } @@ -188,7 +188,7 @@ void KX_TouchSensor::UnregisterSumo(KX_TouchEventManager* touchman) if (touchman->GetPhysicsEnvironment()->removeCollisionCallback(m_physCtrl)) { // no more sensor on the controller, can remove it if it is a sensor object - KX_ClientObjectInfo* client_info = static_cast(m_physCtrl->getNewClientInfo()); + KX_ClientObjectInfo *client_info = static_cast(m_physCtrl->getNewClientInfo()); if (client_info->isSensor()) touchman->GetPhysicsEnvironment()->removeSensor(m_physCtrl); } @@ -203,8 +203,8 @@ bool KX_TouchSensor::BroadPhaseSensorFilterCollision(void*obj1,void*obj2) KX_GameObject* myobj = (KX_GameObject*)GetParent(); KX_GameObject* myparent = myobj->GetParent(); - KX_ClientObjectInfo* client_info = static_cast(((PHY_IPhysicsController*)obj2)->getNewClientInfo()); - KX_ClientObjectInfo* my_client_info = static_cast(m_physCtrl->getNewClientInfo()); + KX_ClientObjectInfo *client_info = static_cast(((PHY_IPhysicsController*)obj2)->getNewClientInfo()); + KX_ClientObjectInfo *my_client_info = static_cast(m_physCtrl->getNewClientInfo()); KX_GameObject* otherobj = ( client_info ? client_info->m_gameobject : NULL); // first, decrement refcount as GetParent() increases it @@ -243,7 +243,7 @@ bool KX_TouchSensor::NewHandleCollision(void*object1,void*object2,const PHY_Coll // need the mapping from PHY_IPhysicsController to gameobjects now - KX_ClientObjectInfo* client_info = static_cast (object1 == m_physCtrl? + KX_ClientObjectInfo *client_info = static_cast (object1 == m_physCtrl? ((PHY_IPhysicsController*)object2)->getNewClientInfo(): ((PHY_IPhysicsController*)object1)->getNewClientInfo()); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index d5ceba0ec57..29b526067fd 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -1799,7 +1799,7 @@ struct DbvtCullingCallback : btDbvt::ICollide btBroadphaseProxy* proxy=(btBroadphaseProxy*)leaf->data; // the client object is a graphic controller CcdGraphicController* ctrl = static_cast(proxy->m_clientObject); - KX_ClientObjectInfo* info = (KX_ClientObjectInfo*)ctrl->getNewClientInfo(); + KX_ClientObjectInfo *info = (KX_ClientObjectInfo*)ctrl->getNewClientInfo(); if (m_ocb) { // means we are doing occlusion culling. Check if this object is an occluders diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h index 72a04064834..2dcf3c6492e 100644 --- a/source/gameengine/SceneGraph/SG_IObject.h +++ b/source/gameengine/SceneGraph/SG_IObject.h @@ -83,19 +83,19 @@ typedef void* (*SG_DestructionNewCallback)( void* clientinfo ); -typedef void (*SG_UpdateTransformCallback)( +typedef void (*SG_UpdateTransformCallback)( SG_IObject* sgobject, void* clientobj, void* clientinfo ); -typedef bool (*SG_ScheduleUpdateCallback)( +typedef bool (*SG_ScheduleUpdateCallback)( SG_IObject* sgobject, void* clientobj, void* clientinfo ); -typedef bool (*SG_RescheduleUpdateCallback)( +typedef bool (*SG_RescheduleUpdateCallback)( SG_IObject* sgobject, void* clientobj, void* clientinfo diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp index 8b8918d8141..0f571550205 100644 --- a/source/gameengine/VideoTexture/Exception.cpp +++ b/source/gameengine/VideoTexture/Exception.cpp @@ -40,15 +40,15 @@ ExceptionID ErrGeneral, ErrNotFound; // exception descriptions -ExpDesc errGenerDesc (ErrGeneral, "General Error"); -ExpDesc errNFoundDesc (ErrNotFound, "Error description not found"); +ExpDesc errGenerDesc(ErrGeneral, "General Error"); +ExpDesc errNFoundDesc(ErrNotFound, "Error description not found"); // implementation of ExpDesc // constructor -ExpDesc::ExpDesc (ExceptionID & exp, const char * desc, RESULT hres) +ExpDesc::ExpDesc (ExceptionID & exp, const char *desc, RESULT hres) : m_expID(exp), m_hRslt(hres), m_description(desc) { } @@ -105,7 +105,7 @@ const char * Exception::what() // debug version - with file and line of exception -Exception::Exception (ExceptionID & expID, RESULT rslt, const char * fil, int lin) +Exception::Exception (ExceptionID & expID, RESULT rslt, const char *fil, int lin) : m_expID (&expID), m_hRslt (rslt) { // set file and line @@ -115,7 +115,7 @@ Exception::Exception (ExceptionID & expID, RESULT rslt, const char * fil, int li // set file and line -void Exception::setFileLine (const char * fil, int lin) +void Exception::setFileLine (const char *fil, int lin) { if (fil != NULL) m_fileName = fil; m_line = lin; diff --git a/source/gameengine/VideoTexture/FilterBase.cpp b/source/gameengine/VideoTexture/FilterBase.cpp index a232bcc1201..77d12ddc9e6 100644 --- a/source/gameengine/VideoTexture/FilterBase.cpp +++ b/source/gameengine/VideoTexture/FilterBase.cpp @@ -105,7 +105,7 @@ PyObject *Filter_allocNew (PyTypeObject *type, PyObject *args, PyObject *kwds) } // object deallocation -void Filter_dealloc (PyFilter *self) +void Filter_dealloc(PyFilter *self) { // release object attributes if (self->m_filter != NULL) @@ -124,7 +124,7 @@ PyObject *Filter_getPrevious (PyFilter *self, void *closure) if (self->m_filter != NULL) { // pixel filter object - PyObject * filt = reinterpret_cast(self->m_filter->getPrevious()); + PyObject *filt = reinterpret_cast(self->m_filter->getPrevious()); // if filter is present if (filt != NULL) { @@ -139,7 +139,7 @@ PyObject *Filter_getPrevious (PyFilter *self, void *closure) // set previous pixel filter object -int Filter_setPrevious (PyFilter *self, PyObject *value, void *closure) +int Filter_setPrevious(PyFilter *self, PyObject *value, void *closure) { // if filter object is available if (self->m_filter != NULL) diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.cpp b/source/gameengine/VideoTexture/FilterBlueScreen.cpp index 662ecabd283..857da12c28d 100644 --- a/source/gameengine/VideoTexture/FilterBlueScreen.cpp +++ b/source/gameengine/VideoTexture/FilterBlueScreen.cpp @@ -84,7 +84,7 @@ static PyObject *getColor (PyFilter *self, void *closure) } // set color -static int setColor (PyFilter *self, PyObject *value, void *closure) +static int setColor(PyFilter *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || @@ -114,7 +114,7 @@ static PyObject *getLimits (PyFilter *self, void *closure) } // set limit -static int setLimits (PyFilter *self, PyObject *value, void *closure) +static int setLimits(PyFilter *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || diff --git a/source/gameengine/VideoTexture/FilterColor.cpp b/source/gameengine/VideoTexture/FilterColor.cpp index e4101b5587d..26b5303e365 100644 --- a/source/gameengine/VideoTexture/FilterColor.cpp +++ b/source/gameengine/VideoTexture/FilterColor.cpp @@ -130,7 +130,7 @@ static PyObject *getMatrix (PyFilter *self, void *closure) } // set color matrix -static int setMatrix (PyFilter *self, PyObject *value, void *closure) +static int setMatrix(PyFilter *self, PyObject *value, void *closure) { // matrix to store items ColorMatrix mat; @@ -141,7 +141,7 @@ static int setMatrix (PyFilter *self, PyObject *value, void *closure) for (int r = 0; valid && r < 4; ++r) { // get row object - PyObject * row = PySequence_Fast_GET_ITEM(value, r); + PyObject *row = PySequence_Fast_GET_ITEM(value, r); // check sequence valid = PySequence_Check(row) && PySequence_Size(row) == 5; // check items @@ -263,7 +263,7 @@ static PyObject *getLevels (PyFilter *self, void *closure) } // set color levels -static int setLevels (PyFilter *self, PyObject *value, void *closure) +static int setLevels(PyFilter *self, PyObject *value, void *closure) { // matrix to store items ColorLevel lev; @@ -274,7 +274,7 @@ static int setLevels (PyFilter *self, PyObject *value, void *closure) for (int r = 0; valid && r < 4; ++r) { // get row object - PyObject * row = PySequence_Fast_GET_ITEM(value, r); + PyObject *row = PySequence_Fast_GET_ITEM(value, r); // check sequence valid = PySequence_Check(row) && PySequence_Size(row) == 2; // check items diff --git a/source/gameengine/VideoTexture/FilterNormal.cpp b/source/gameengine/VideoTexture/FilterNormal.cpp index ba963d93079..78a09f8afac 100644 --- a/source/gameengine/VideoTexture/FilterNormal.cpp +++ b/source/gameengine/VideoTexture/FilterNormal.cpp @@ -76,7 +76,7 @@ static PyObject *getColor (PyFilter *self, void *closure) } // set index of color used to calculate normal -static int setColor (PyFilter *self, PyObject *value, void *closure) +static int setColor(PyFilter *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || !PyLong_Check(value)) @@ -98,7 +98,7 @@ static PyObject *getDepth (PyFilter *self, void *closure) } // set depth -static int setDepth (PyFilter *self, PyObject *value, void *closure) +static int setDepth(PyFilter *self, PyObject *value, void *closure) { // check validity of parameter if (value) diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 3b6dec21e52..5a11cd24bcf 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -182,8 +182,8 @@ void ImageBase::setFilter (PyFilter * filt) ExceptionID ImageHasExports; ExceptionID InvalidColorChannel; -ExpDesc ImageHasExportsDesc (ImageHasExports, "Image has exported buffers, cannot resize"); -ExpDesc InvalidColorChannelDesc (InvalidColorChannel, "Invalid or too many color channels specified. At most 4 values within R, G, B, A, 0, 1"); +ExpDesc ImageHasExportsDesc(ImageHasExports, "Image has exported buffers, cannot resize"); +ExpDesc InvalidColorChannelDesc(InvalidColorChannel, "Invalid or too many color channels specified. At most 4 values within R, G, B, A, 0, 1"); // initialize image data void ImageBase::init (short width, short height) @@ -364,7 +364,7 @@ PyTypeList pyImageTypes; // functions for python interface // object allocation -PyObject *Image_allocNew (PyTypeObject *type, PyObject *args, PyObject *kwds) +PyObject *Image_allocNew(PyTypeObject *type, PyObject *args, PyObject *kwds) { // allocate object PyImage *self = reinterpret_cast(type->tp_alloc(type, 0)); @@ -375,7 +375,7 @@ PyObject *Image_allocNew (PyTypeObject *type, PyObject *args, PyObject *kwds) } // object deallocation -void Image_dealloc (PyImage *self) +void Image_dealloc(PyImage *self) { // release object attributes if (self->m_image != NULL) @@ -394,7 +394,7 @@ void Image_dealloc (PyImage *self) } // get image data -PyObject *Image_getImage (PyImage *self, char * mode) +PyObject *Image_getImage(PyImage *self, char *mode) { try { @@ -514,7 +514,7 @@ PyObject *Image_getScale (PyImage *self, void *closure) } // set scale -int Image_setScale (PyImage *self, PyObject *value, void *closure) +int Image_setScale(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -536,7 +536,7 @@ PyObject *Image_getFlip (PyImage *self, void *closure) } // set flip -int Image_setFlip (PyImage *self, PyObject *value, void *closure) +int Image_setFlip(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -551,14 +551,14 @@ int Image_setFlip (PyImage *self, PyObject *value, void *closure) } // get zbuff -PyObject * Image_getZbuff (PyImage * self, void * closure) +PyObject *Image_getZbuff(PyImage * self, void *closure) { if (self->m_image != NULL && self->m_image->getZbuff()) Py_RETURN_TRUE; else Py_RETURN_FALSE; } // set zbuff -int Image_setZbuff (PyImage * self, PyObject * value, void * closure) +int Image_setZbuff(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -573,14 +573,14 @@ int Image_setZbuff (PyImage * self, PyObject * value, void * closure) } // get depth -PyObject * Image_getDepth (PyImage * self, void * closure) +PyObject *Image_getDepth(PyImage * self, void *closure) { if (self->m_image != NULL && self->m_image->getDepth()) Py_RETURN_TRUE; else Py_RETURN_FALSE; } // set depth -int Image_setDepth (PyImage * self, PyObject * value, void * closure) +int Image_setDepth(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -598,7 +598,7 @@ int Image_setDepth (PyImage * self, PyObject * value, void * closure) // get filter source object -PyObject *Image_getSource (PyImage *self, PyObject *args) +PyObject *Image_getSource(PyImage *self, PyObject *args) { // get arguments char * id; @@ -622,7 +622,7 @@ PyObject *Image_getSource (PyImage *self, PyObject *args) // set filter source object -PyObject *Image_setSource (PyImage *self, PyObject *args) +PyObject *Image_setSource(PyImage *self, PyObject *args) { // get arguments char * id; @@ -657,13 +657,13 @@ PyObject *Image_setSource (PyImage *self, PyObject *args) // get pixel filter object -PyObject *Image_getFilter (PyImage *self, void *closure) +PyObject *Image_getFilter(PyImage *self, void *closure) { // if image object is available if (self->m_image != NULL) { // pixel filter object - PyObject * filt = reinterpret_cast(self->m_image->getFilter()); + PyObject *filt = reinterpret_cast(self->m_image->getFilter()); // if filter is present if (filt != NULL) { @@ -678,7 +678,7 @@ PyObject *Image_getFilter (PyImage *self, void *closure) // set pixel filter object -int Image_setFilter (PyImage *self, PyObject *value, void *closure) +int Image_setFilter(PyImage *self, PyObject *value, void *closure) { // if image object is available if (self->m_image != NULL) diff --git a/source/gameengine/VideoTexture/ImageBase.h b/source/gameengine/VideoTexture/ImageBase.h index 3bb9c8cb090..718191fd049 100644 --- a/source/gameengine/VideoTexture/ImageBase.h +++ b/source/gameengine/VideoTexture/ImageBase.h @@ -57,52 +57,52 @@ public: /// constructor ImageBase (bool staticSrc = false); /// destructor - virtual ~ImageBase (void); + virtual ~ImageBase(void); /// release contained objects, if returns true, object should be deleted - virtual bool release (void); + virtual bool release(void); /// is an image available bool isImageAvailable(void) { return m_avail; } /// get image - unsigned int * getImage (unsigned int texId = 0, double timestamp=-1.0); + unsigned int *getImage(unsigned int texId = 0, double timestamp=-1.0); /// get image size - short * getSize (void) { return m_size; } + short * getSize(void) { return m_size; } /// get image buffer size - unsigned long getBuffSize (void) + unsigned long getBuffSize(void) { return m_size[0] * m_size[1] * sizeof(unsigned int); } /// refresh image - invalidate its current content - virtual void refresh (void); + virtual void refresh(void); /// get scale - bool getScale (void) { return m_scale; } + bool getScale(void) { return m_scale; } /// set scale - void setScale (bool scale) { m_scale = scale; m_scaleChange = true; } + void setScale(bool scale) { m_scale = scale; m_scaleChange = true; } /// get vertical flip - bool getFlip (void) { return m_flip; } + bool getFlip(void) { return m_flip; } /// set vertical flip - void setFlip (bool flip) { m_flip = flip; } + void setFlip(bool flip) { m_flip = flip; } /// get Z buffer - bool getZbuff (void) { return m_zbuff; } + bool getZbuff(void) { return m_zbuff; } /// set Z buffer - void setZbuff (bool zbuff) { m_zbuff = zbuff; } + void setZbuff(bool zbuff) { m_zbuff = zbuff; } /// get depth - bool getDepth (void) { return m_depth; } + bool getDepth(void) { return m_depth; } /// set depth - void setDepth (bool depth) { m_depth = depth; } + void setDepth(bool depth) { m_depth = depth; } /// get source object - PyImage * getSource (const char * id); + PyImage * getSource(const char * id); /// set source object, return true, if source was set - bool setSource (const char * id, PyImage *source); + bool setSource(const char * id, PyImage *source); /// get pixel filter - PyFilter * getFilter (void) { return m_pyfilter; } + PyFilter * getFilter(void) { return m_pyfilter; } /// set pixel filter - void setFilter (PyFilter * filt); + void setFilter(PyFilter * filt); - /// calculate size (nearest power of 2) - static short calcSize (short size); + /// calculate size(nearest power of 2) + static short calcSize(short size); /// number of buffer pointing to m_image, public because not handled by this class int m_exports; @@ -137,25 +137,25 @@ protected: PyFilter * m_pyfilter; /// initialize image data - void init (short width, short height); + void init(short width, short height); /// find source - ImageSourceList::iterator findSource (const char * id); + ImageSourceList::iterator findSource(const char *id); /// create new source - virtual ImageSource * newSource (const char * id) { return NULL; } + virtual ImageSource *newSource(const char *id) { return NULL; } /// check source sizes - bool checkSourceSizes (void); + bool checkSourceSizes(void); /// calculate image from sources and set its availability - virtual void calcImage (unsigned int texId, double ts) {} + virtual void calcImage(unsigned int texId, double ts) {} /// perform loop detection - bool loopDetect (ImageBase * img); + bool loopDetect(ImageBase * img); /// template for image conversion - template void convImage (FLT & filter, SRC srcBuff, + template void convImage(FLT & filter, SRC srcBuff, short * srcSize) { // destination buffer @@ -328,7 +328,7 @@ extern PyTypeList pyImageTypes; // functions for python interface // object initialization -template static int Image_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +template static int Image_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { PyImage *self = reinterpret_cast(pySelf); // create source object @@ -339,43 +339,43 @@ template static int Image_init (PyObject *pySelf, PyObject *args, PyOb } // object allocation -PyObject *Image_allocNew (PyTypeObject *type, PyObject *args, PyObject *kwds); +PyObject *Image_allocNew(PyTypeObject *type, PyObject *args, PyObject *kwds); // object deallocation -void Image_dealloc (PyImage *self); +void Image_dealloc(PyImage *self); // get image data -PyObject *Image_getImage (PyImage *self, char * mode); +PyObject *Image_getImage(PyImage *self, char * mode); // get image size -PyObject *Image_getSize (PyImage *self, void *closure); +PyObject *Image_getSize(PyImage *self, void *closure); // refresh image - invalidate current content -PyObject *Image_refresh (PyImage *self); +PyObject *Image_refresh(PyImage *self); // get scale -PyObject *Image_getScale (PyImage *self, void *closure); +PyObject *Image_getScale(PyImage *self, void *closure); // set scale -int Image_setScale (PyImage *self, PyObject *value, void *closure); +int Image_setScale(PyImage *self, PyObject *value, void *closure); // get flip -PyObject *Image_getFlip (PyImage *self, void *closure); +PyObject *Image_getFlip(PyImage *self, void *closure); // set flip -int Image_setFlip (PyImage *self, PyObject *value, void *closure); +int Image_setFlip(PyImage *self, PyObject *value, void *closure); // get filter source object -PyObject *Image_getSource (PyImage *self, PyObject *args); +PyObject *Image_getSource(PyImage *self, PyObject *args); // set filter source object -PyObject *Image_setSource (PyImage *self, PyObject *args); +PyObject *Image_setSource(PyImage *self, PyObject *args); // get Z buffer -PyObject * Image_getZbuff (PyImage * self, void * closure); +PyObject *Image_getZbuff(PyImage * self, void *closure); // set Z buffer -int Image_setZbuff (PyImage * self, PyObject * value, void * closure); +int Image_setZbuff(PyImage * self, PyObject *value, void *closure); // get depth -PyObject * Image_getDepth (PyImage * self, void * closure); +PyObject *Image_getDepth(PyImage * self, void *closure); // set depth -int Image_setDepth (PyImage * self, PyObject * value, void * closure); +int Image_setDepth(PyImage * self, PyObject *value, void *closure); // get pixel filter object -PyObject *Image_getFilter (PyImage *self, void *closure); +PyObject *Image_getFilter(PyImage *self, void *closure); // set pixel filter object -int Image_setFilter (PyImage *self, PyObject *value, void *closure); +int Image_setFilter(PyImage *self, PyObject *value, void *closure); // check if a buffer can be extracted PyObject *Image_valid(PyImage *self, void *closure); // for buffer access to PyImage objects diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp index 1593a08bb4b..80ad9b40c24 100644 --- a/source/gameengine/VideoTexture/ImageBuff.cpp +++ b/source/gameengine/VideoTexture/ImageBuff.cpp @@ -51,7 +51,7 @@ FilterRGB24 defFilter; // forward declaration; extern PyTypeObject ImageBuffType; -static int ImageBuff_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +static int ImageBuff_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { short width = -1; short height = -1; diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp index 27c4fed6fe6..ee6e16d0a86 100644 --- a/source/gameengine/VideoTexture/ImageMix.cpp +++ b/source/gameengine/VideoTexture/ImageMix.cpp @@ -69,7 +69,7 @@ bool ImageMix::setWeight (const char * id, short weight) ExceptionID ImageSizesNotMatch; -ExpDesc ImageSizesNotMatchDesc (ImageSizesNotMatch, "Image sizes of sources are different"); +ExpDesc ImageSizesNotMatchDesc(ImageSizesNotMatch, "Image sizes of sources are different"); // calculate image from sources and set its availability void ImageMix::calcImage (unsigned int texId, double ts) diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index f778f840864..11ddec681c5 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -52,14 +52,14 @@ ExceptionID SceneInvalid, CameraInvalid, ObserverInvalid; ExceptionID MirrorInvalid, MirrorSizeInvalid, MirrorNormalInvalid, MirrorHorizontal, MirrorTooSmall; -ExpDesc SceneInvalidDesc (SceneInvalid, "Scene object is invalid"); -ExpDesc CameraInvalidDesc (CameraInvalid, "Camera object is invalid"); -ExpDesc ObserverInvalidDesc (ObserverInvalid, "Observer object is invalid"); -ExpDesc MirrorInvalidDesc (MirrorInvalid, "Mirror object is invalid"); -ExpDesc MirrorSizeInvalidDesc (MirrorSizeInvalid, "Mirror has no vertex or no size"); -ExpDesc MirrorNormalInvalidDesc (MirrorNormalInvalid, "Cannot determine mirror plane"); -ExpDesc MirrorHorizontalDesc (MirrorHorizontal, "Mirror is horizontal in local space"); -ExpDesc MirrorTooSmallDesc (MirrorTooSmall, "Mirror is too small"); +ExpDesc SceneInvalidDesc(SceneInvalid, "Scene object is invalid"); +ExpDesc CameraInvalidDesc(CameraInvalid, "Camera object is invalid"); +ExpDesc ObserverInvalidDesc(ObserverInvalid, "Observer object is invalid"); +ExpDesc MirrorInvalidDesc(MirrorInvalid, "Mirror object is invalid"); +ExpDesc MirrorSizeInvalidDesc(MirrorSizeInvalid, "Mirror has no vertex or no size"); +ExpDesc MirrorNormalInvalidDesc(MirrorNormalInvalid, "Cannot determine mirror plane"); +ExpDesc MirrorHorizontalDesc(MirrorHorizontal, "Mirror is horizontal in local space"); +ExpDesc MirrorTooSmallDesc(MirrorTooSmall, "Mirror is too small"); // constructor ImageRender::ImageRender (KX_Scene * scene, KX_Camera * camera) : @@ -294,12 +294,12 @@ BlendType cameraType ("KX_Camera"); // object initialization -static int ImageRender_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +static int ImageRender_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { // parameters - scene object PyObject *scene; // camera object - PyObject * camera; + PyObject *camera; // parameter keywords static const char *kwlist[] = {"sceneObj", "cameraObj", NULL}; // get parameters @@ -347,7 +347,7 @@ static PyObject *getBackground (PyImage *self, void *closure) } // set color -static int setBackground (PyImage *self, PyObject *value, void *closure) +static int setBackground(PyImage *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 4 @@ -441,7 +441,7 @@ PyTypeObject ImageRenderType = }; // object initialization -static int ImageMirror_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +static int ImageMirror_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { // parameters - scene object PyObject *scene; @@ -523,7 +523,7 @@ static PyObject *getClip (PyImage *self, void *closure) } // set clip -static int setClip (PyImage *self, PyObject *value, void *closure) +static int setClip(PyImage *self, PyObject *value, void *closure) { // check validity of parameter double clip; diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp index 5fc388bdefb..19d0289be20 100644 --- a/source/gameengine/VideoTexture/ImageViewport.cpp +++ b/source/gameengine/VideoTexture/ImageViewport.cpp @@ -210,7 +210,7 @@ PyObject *ImageViewport_getWhole (PyImage *self, void *closure) } // set whole -int ImageViewport_setWhole (PyImage *self, PyObject *value, void *closure) +int ImageViewport_setWhole(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -240,7 +240,7 @@ PyObject *ImageViewport_getAlpha (PyImage *self, void *closure) } // set whole -int ImageViewport_setAlpha (PyImage *self, PyObject *value, void *closure) +int ImageViewport_setAlpha(PyImage *self, PyObject *value, void *closure) { // check parameter, report failure if (value == NULL || !PyBool_Check(value)) @@ -266,7 +266,7 @@ static PyObject *ImageViewport_getPosition (PyImage *self, void *closure) } // set position -static int ImageViewport_setPosition (PyImage *self, PyObject *value, void *closure) +static int ImageViewport_setPosition(PyImage *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || @@ -299,7 +299,7 @@ PyObject *ImageViewport_getCaptureSize (PyImage *self, void *closure) } // set capture size -int ImageViewport_setCaptureSize (PyImage *self, PyObject *value, void *closure) +int ImageViewport_setCaptureSize(PyImage *self, PyObject *value, void *closure) { // check validity of parameter if (value == NULL || diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h index 5afd4654d62..10d894a9fb8 100644 --- a/source/gameengine/VideoTexture/ImageViewport.h +++ b/source/gameengine/VideoTexture/ImageViewport.h @@ -95,12 +95,12 @@ protected: GLint * getViewportSize (void) { return m_viewport + 2; } }; -PyObject *ImageViewport_getCaptureSize (PyImage *self, void *closure); -int ImageViewport_setCaptureSize (PyImage *self, PyObject *value, void *closure); -PyObject *ImageViewport_getWhole (PyImage *self, void *closure); -int ImageViewport_setWhole (PyImage *self, PyObject *value, void *closure); -PyObject *ImageViewport_getAlpha (PyImage *self, void *closure); -int ImageViewport_setAlpha (PyImage *self, PyObject *value, void *closure); +PyObject *ImageViewport_getCaptureSize(PyImage *self, void *closure); +int ImageViewport_setCaptureSize(PyImage *self, PyObject *value, void *closure); +PyObject *ImageViewport_getWhole(PyImage *self, void *closure); +int ImageViewport_setWhole(PyImage *self, PyObject *value, void *closure); +PyObject *ImageViewport_getAlpha(PyImage *self, void *closure); +int ImageViewport_setAlpha(PyImage *self, PyObject *value, void *closure); #endif diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index 98d36d19ddf..ebad7a92437 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -68,8 +68,8 @@ BlendType lightObjectType ("KX_LightObject"); // load texture -void loadTexture (unsigned int texId, unsigned int * texture, short * size, - bool mipmap) +void loadTexture(unsigned int texId, unsigned int *texture, short *size, + bool mipmap) { // load texture for rendering glBindTexture(GL_TEXTURE_2D, texId); @@ -171,8 +171,8 @@ static PyObject *Texture_new(PyTypeObject *type, PyObject *args, PyObject *kwds) // forward declaration -PyObject *Texture_close(Texture * self); -int Texture_setSource (Texture * self, PyObject *value, void *closure); +PyObject *Texture_close(Texture *self); +int Texture_setSource(Texture *self, PyObject *value, void *closure); // Texture object deallocation @@ -191,7 +191,7 @@ static void Texture_dealloc(Texture *self) ExceptionID MaterialNotAvail; -ExpDesc MaterialNotAvailDesc (MaterialNotAvail, "Texture material is not available"); +ExpDesc MaterialNotAvailDesc(MaterialNotAvail, "Texture material is not available"); // Texture object initialization static int Texture_init(Texture *self, PyObject *args, PyObject *kwds) @@ -439,7 +439,7 @@ static PyObject *Texture_getSource(Texture *self, PyObject *value, void *closure // set source object -int Texture_setSource (Texture * self, PyObject *value, void *closure) +int Texture_setSource(Texture *self, PyObject *value, void *closure) { // check new value if (value == NULL || !pyImageTypes.in(Py_TYPE(value))) diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp index 576e358fe75..edf03dea484 100644 --- a/source/gameengine/VideoTexture/VideoBase.cpp +++ b/source/gameengine/VideoTexture/VideoBase.cpp @@ -102,11 +102,11 @@ void VideoBase::process (BYTE * sample) // exceptions for video source initialization ExceptionID SourceVideoEmpty, SourceVideoCreation; -ExpDesc SourceVideoEmptyDesc (SourceVideoEmpty, "Source Video is empty"); -ExpDesc SourceVideoCreationDesc (SourceVideoCreation, "SourceVideo object was not created"); +ExpDesc SourceVideoEmptyDesc(SourceVideoEmpty, "Source Video is empty"); +ExpDesc SourceVideoCreationDesc(SourceVideoCreation, "SourceVideo object was not created"); // open video source -void Video_open (VideoBase * self, char * file, short captureID) +void Video_open(VideoBase * self, char * file, short captureID) { // if file is empty, throw exception if (file == NULL) THRWEXCP(SourceVideoEmpty, S_OK); diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 93a1d09869b..be7f9392f39 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -504,7 +504,7 @@ void VideoFFmpeg::stopCache() } } -void VideoFFmpeg::releaseFrame(AVFrame* frame) +void VideoFFmpeg::releaseFrame(AVFrame *frame) { if (frame == m_frameRGB) { @@ -521,7 +521,7 @@ void VideoFFmpeg::releaseFrame(AVFrame* frame) } // open video file -void VideoFFmpeg::openFile (char * filename) +void VideoFFmpeg::openFile (char *filename) { if (openStream(filename, NULL, NULL) != 0) return; @@ -578,7 +578,7 @@ void VideoFFmpeg::openFile (char * filename) // open video capture device -void VideoFFmpeg::openCam (char * file, short camIdx) +void VideoFFmpeg::openCam (char *file, short camIdx) { // open camera source AVInputFormat *inputFormat; @@ -1085,7 +1085,7 @@ inline VideoFFmpeg * getVideoFFmpeg (PyImage *self) // object initialization -static int VideoFFmpeg_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +static int VideoFFmpeg_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { PyImage *self = reinterpret_cast(pySelf); // parameters - video source @@ -1243,7 +1243,7 @@ PyTypeObject VideoFFmpegType = }; // object initialization -static int ImageFFmpeg_init (PyObject *pySelf, PyObject *args, PyObject *kwds) +static int ImageFFmpeg_init(PyObject *pySelf, PyObject *args, PyObject *kwds) { PyImage *self = reinterpret_cast(pySelf); // parameters - video source diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 92043bb1f74..2f466eb5eeb 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -51,12 +51,12 @@ extern "C" { #endif #ifdef FFMPEG_CODEC_IS_POINTER -static inline AVCodecContext* get_codec_from_stream(AVStream* stream) +static inline AVCodecContext *get_codec_from_stream(AVStream* stream) { return stream->codec; } #else -static inline AVCodecContext* get_codec_from_stream(AVStream* stream) +static inline AVCodecContext *get_codec_from_stream(AVStream* stream) { return &stream->codec; }