Merging r55547 through r55594 from trunk into soc-2008-mxcurioni

This commit is contained in:
Sergey Sharybin 2013-03-26 09:09:31 +00:00
commit 18d2dd7e3a
228 changed files with 1805 additions and 1267 deletions

@ -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) ||

@ -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)

@ -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);

@ -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"];

@ -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,

@ -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")

@ -237,10 +237,10 @@ _ctxt_re = _ctxt_re_gen("")
_msg_re = r"(?P<msg_raw>" + _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",

@ -374,8 +374,9 @@ class SpellChecker():
"fluidsim",
"frameserver",
"enum",
"idcol",
"keyframe", "keyframes", "keyframing", "keyframed",
"metaball", "metaballs",
"metaball", "metaballs", "mball",
"metaelement", "metaelements",
"metastrip", "metastrips",
"movieclip",

@ -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")

@ -19,7 +19,7 @@
# <pep8 compliant>
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'}

@ -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()

@ -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'}

@ -34,8 +34,8 @@
#include <stdio.h> /* 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) \
{ \

@ -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__ */

@ -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

@ -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

@ -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);

@ -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 */

@ -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))

@ -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) */

@ -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 */

@ -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,

@ -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);

@ -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

@ -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

@ -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;

@ -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);
}

@ -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;

@ -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,

@ -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

@ -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])

@ -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 --------------- */

@ -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");

@ -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)

@ -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)

@ -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;

@ -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);

@ -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);

@ -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)

@ -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 */

@ -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++;

@ -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,

@ -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)

@ -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");

@ -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));
}
}

@ -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);

@ -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);

@ -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)

@ -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;

@ -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 */

@ -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)

@ -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;

@ -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;
}

@ -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 */

@ -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);

@ -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);

@ -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;

@ -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') {

@ -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);

@ -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) {

@ -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);

@ -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

@ -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'

@ -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__ */

@ -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);
}

@ -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);

@ -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;

@ -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);

@ -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);
}

@ -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

@ -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"

@ -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)
{

@ -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 ******************* */

@ -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)
{

@ -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"

@ -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;

@ -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)
{

@ -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);
}
}

@ -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<FCurve *>&
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);
}

@ -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.

@ -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")

@ -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 )

@ -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);
}

@ -327,8 +327,8 @@ std::string bc_replace_string(std::string data, const std::string& pattern,
*/
void bc_match_scale(std::vector<Object *> *objects_done,
Scene &sce,
UnitConverter &bc_unit) {
UnitConverter &bc_unit)
{
Object *ob = NULL;
PointerRNA scene_ptr, unit_settings;

@ -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;

@ -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;

@ -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);
}

@ -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 */

@ -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

@ -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]);
}

@ -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");
}
}

@ -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);
}
}
}
}

@ -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;

@ -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.

@ -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);

@ -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

@ -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);

@ -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;
}
}

@ -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);

@ -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);
}

Some files were not shown because too many files have changed in this diff Show More