Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 13:09:31 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-26 13:09:31 +0400
commit18d2dd7e3ae0338829fd61740151f41c21668474 (patch)
tree53d755b496944c9017c2cda0ac812e7c545f4024 /source/blender/blenkernel/intern
parentfc9e0a37f0087d003808a87c26e46ed573ae39dd (diff)
parentf1ed223e34e61777af46d33e5bfc2fc03223a689 (diff)
Merging r55547 through r55594 from trunk into soc-2008-mxcurioni
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c40
-rw-r--r--source/blender/blenkernel/intern/action.c17
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c10
-rw-r--r--source/blender/blenkernel/intern/bmfont.c4
-rw-r--r--source/blender/blenkernel/intern/booleanops_mesh.c281
-rw-r--r--source/blender/blenkernel/intern/brush.c74
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c4
-rw-r--r--source/blender/blenkernel/intern/customdata.c57
-rw-r--r--source/blender/blenkernel/intern/deform.c4
-rw-r--r--source/blender/blenkernel/intern/displist.c2
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c8
-rw-r--r--source/blender/blenkernel/intern/fcurve.c7
-rw-r--r--source/blender/blenkernel/intern/gpencil.c4
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/key.c10
-rw-r--r--source/blender/blenkernel/intern/library.c18
-rw-r--r--source/blender/blenkernel/intern/mask.c5
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/modifier.c4
-rw-r--r--source/blender/blenkernel/intern/movieclip.c35
-rw-r--r--source/blender/blenkernel/intern/nla.c6
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/pbvh.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c9
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c61
-rw-r--r--source/blender/blenkernel/intern/texture.c11
-rw-r--r--source/blender/blenkernel/intern/tracking.c8
28 files changed, 275 insertions, 416 deletions
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;
}