Merged revision(s) 58241-58355 from trunk/blender into soc-2013-dingto.

This commit is contained in:
Thomas Dinges 2013-07-17 21:43:38 +00:00
commit c04575b974
127 changed files with 915 additions and 498 deletions

@ -2053,6 +2053,20 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)

@ -530,7 +530,9 @@ macro(remove_strict_flags_file
foreach(_SOURCE ${ARGV})
if(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${_SOURCE}
PROPERTIES
COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#include "codec.h"
#include "format.h"
#include "debayer.h"

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 Libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#ifndef __CODEC_H__
#define __CODEC_H__

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 Libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#include "debayer.h"
/* pretty simple but astonishingly very effective "debayer" function

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 Libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#ifndef __DEBAYER_H__
#define __DEBAYER_H__

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 Libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@ -1,3 +1,25 @@
/* ***** BEGIN GPL LICENSE BLOCK *****
*
* Copyright 2008 Peter Schlaile
*
* This file is part of libredcode.
*
* Libredcode 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.
*
* Libredcode 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 Libredcode; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****/
#ifndef __FORMAT_H__
#define __FORMAT_H__

@ -28,10 +28,10 @@ set(INC
../container
../guardedalloc
../memutil
../moto/include
)
set(INC_SYS
../moto/include
../../extern/carve/include
)

@ -271,7 +271,7 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
ls->pdf = invarea;
if(type == LIGHT_SPOT) {
/* spot light attentuation */
/* spot light attenuation */
float4 data2 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 2);
ls->eval_fac *= spot_light_attenuation(data1, data2, ls);
}

@ -152,6 +152,10 @@ private:
GHOST_SystemWin32 *m_system;
/* Data type of the dragged object */
GHOST_TDragnDropTypes m_draggedObjectType;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32")
#endif
};
#endif // __GHOST_DROPTARGETWIN32_H__

@ -84,6 +84,9 @@ void GHOST_DropTargetX11::Initialize(void)
void GHOST_DropTargetX11::Uninitialize(void)
{
xdnd_shut(&m_dndClass);
delete[] m_dndActions;
delete[] m_dndTypes;
}
GHOST_DropTargetX11::GHOST_DropTargetX11(GHOST_WindowX11 *window, GHOST_SystemX11 *system)

@ -130,6 +130,10 @@ private:
/* counter of references to global XDND structures */
static int m_refCounter;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetX11")
#endif
};
#endif // __GHOST_DROPTARGETX11_H__

@ -26,11 +26,10 @@
set(INC
intern
../memutil
../moto/include
)
set(INC_SYS
../moto/include
)
set(SRC

@ -28,7 +28,7 @@ extern "C" {
#endif
#include "intern/clew.h"
void OCL_init(void);
int OCL_init(void);
#ifdef __cplusplus
}

@ -22,7 +22,7 @@
#include "OCL_opencl.h"
void OCL_init(void)
int OCL_init(void)
{
#ifdef _WIN32
const char *path = "OpenCL.dll";
@ -32,6 +32,6 @@ void OCL_init(void)
const char *path = "libOpenCL.so";
#endif
clewInit(path);
return (clewInit(path) == CLEW_SUCCESS);
}

@ -227,6 +227,11 @@ int clewInit(const char* path)
__oclEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
__oclEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
__oclGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
if(__oclGetPlatformIDs == NULL) return CLEW_ERROR_OPEN_FAILED;
if(__oclGetPlatformInfo == NULL) return CLEW_ERROR_OPEN_FAILED;
if(__oclGetDeviceIDs == NULL) return CLEW_ERROR_OPEN_FAILED;
if(__oclGetDeviceInfo == NULL) return CLEW_ERROR_OPEN_FAILED;
return CLEW_SUCCESS;
}

@ -95,7 +95,7 @@ endif()
if(WITH_FFTW3)
add_definitions(-DWITH_FFTW3)
list(APPEND INC
list(APPEND INC_SYS
${FFTW3_INCLUDE_DIRS}
)
endif()

@ -40,6 +40,7 @@ class SpellChecker():
"derivate",
"doesn", # doesn't
"fader",
"globbing",
"hasn", # hasn't
"hoc", # ad-hoc
"indices",
@ -59,6 +60,7 @@ class SpellChecker():
"autoclip",
"autocomplete",
"autoexec",
"autoexecution",
"autoname",
"autosave",
"autoscale",

@ -66,8 +66,12 @@ class NodeAddOperator():
# convert mouse position to the View2D for later node placement
if context.region.type == 'WINDOW':
# XXX, temp fix for [#35920], still fails for (U.pixelsize != 1)
dpi_fac = context.user_preferences.system.dpi / 72.0
space.cursor_location = v2d.region_to_view(event.mouse_region_x,
event.mouse_region_y)
space.cursor_location /= dpi_fac
else:
space.cursor_location = tree.view_center

@ -29,6 +29,7 @@
struct bContext;
struct wmOperator;
struct Scene;
/* Actual surface point */
typedef struct PaintSurfaceData {
@ -69,8 +70,8 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn
int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
void dynamicPaint_clearSurface(struct DynamicPaintSurface *surface);
int dynamicPaint_resetSurface(struct DynamicPaintSurface *surface);
void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
int dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface);
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
@ -85,7 +86,7 @@ void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas);
/* image sequence baking */
int dynamicPaint_createUVSurface(struct DynamicPaintSurface *surface);
int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct Scene *scene, struct Object *cObject, int frame);
void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer);

@ -209,6 +209,7 @@ const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]);
void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob);
/* if old, it converts mface->edcode to edge drawflags */
void BKE_mesh_make_edges(struct Mesh *me, const bool use_old);

@ -334,7 +334,7 @@ typedef struct SeqLoadInfo {
int tot_success;
int tot_error;
int len; /* only for image strips */
char path[512];
char path[1024]; /* 1024 = FILE_MAX */
char name[64];
} SeqLoadInfo;

@ -484,8 +484,6 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask)
Mesh tmp = *me;
int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
int did_shapekeys = 0;
float *texloc, *texrot, *texsize;
short *texflag;
CustomData_reset(&tmp.vdata);
CustomData_reset(&tmp.edata);
@ -533,12 +531,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask)
}
/* copy texture space */
if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) {
tmp.texflag = *texflag;
copy_v3_v3(tmp.loc, texloc);
copy_v3_v3(tmp.size, texsize);
copy_v3_v3(tmp.rot, texrot);
}
BKE_mesh_texspace_copy_from_object(&tmp, ob);
/* not all DerivedMeshes store their verts/edges/faces in CustomData, so
* we set them here in case they are missing */

@ -993,7 +993,8 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side)
co[2] = 0.0f;
/* This is copied from displace modifier code */
hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL);
/* TODO(sergey): brush are always cacheing with CM enabled for now. */
hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL, true);
/* if the texture gave an RGB value, we assume it didn't give a valid
* intensity, so calculate one (formula from do_material_tex).

@ -2323,6 +2323,7 @@ void BKE_curve_bevelList_make(Object *ob)
bl = MEM_callocN(sizeof(BevList) + 1 * sizeof(BevPoint), "makeBevelList1");
BLI_addtail(&(cu->bev), bl);
bl->nr = 0;
bl->charidx = nu->charidx;
}
else {
if (G.is_rendering && cu->resolu_ren != 0)
@ -2335,10 +2336,10 @@ void BKE_curve_bevelList_make(Object *ob)
bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2");
BLI_addtail(&(cu->bev), bl);
if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
else bl->poly = -1;
bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
bl->nr = len;
bl->dupe_nr = 0;
bl->charidx = nu->charidx;
bevp = (BevPoint *)(bl + 1);
bp = nu->bp;
@ -2358,8 +2359,8 @@ void BKE_curve_bevelList_make(Object *ob)
bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints");
BLI_addtail(&(cu->bev), bl);
if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
else bl->poly = -1;
bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
bl->charidx = nu->charidx;
bevp = (BevPoint *)(bl + 1);
a = nu->pntsu - 1;
@ -2445,8 +2446,8 @@ void BKE_curve_bevelList_make(Object *ob)
BLI_addtail(&(cu->bev), bl);
bl->nr = len;
bl->dupe_nr = 0;
if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
else bl->poly = -1;
bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
bl->charidx = nu->charidx;
bevp = (BevPoint *)(bl + 1);
BKE_nurb_makeCurve(nu, &bevp->vec[0],
@ -2572,9 +2573,11 @@ void BKE_curve_bevelList_make(Object *ob)
bl = sd->bl; /* is bl a hole? */
sd1 = sortdata + (a - 1);
for (b = a - 1; b >= 0; b--, sd1--) { /* all polys to the left */
if (bevelinside(sd1->bl, bl)) {
bl->hole = 1 - sd1->bl->hole;
break;
if (sd1->bl->charidx == bl->charidx) { /* for text, only check matching char */
if (bevelinside(sd1->bl, bl)) {
bl->hole = 1 - sd1->bl->hole;
break;
}
}
}
}

@ -1729,16 +1729,19 @@ bool CustomData_free_layer(CustomData *data, int type, int totelem, int index)
data->totlayer--;
/* if layer was last of type in array, set new active layer */
if ((index >= data->totlayer) || (data->layers[index].type != type)) {
i = CustomData_get_layer_index__notypemap(data, type);
if (i >= 0)
for (; i < data->totlayer && data->layers[i].type == type; i++) {
data->layers[i].active--;
data->layers[i].active_rnd--;
data->layers[i].active_clone--;
data->layers[i].active_mask--;
}
i = CustomData_get_layer_index__notypemap(data, type);
if (i != -1) {
/* don't decrement zero index */
const int index_nonzero = index ? index : 1;
CustomDataLayer *layer;
for (layer = &data->layers[i]; i < data->totlayer && layer->type == type; i++, layer++) {
if (layer->active >= index_nonzero) layer->active--;
if (layer->active_rnd >= index_nonzero) layer->active_rnd--;
if (layer->active_clone >= index_nonzero) layer->active_clone--;
if (layer->active_mask >= index_nonzero) layer->active_mask--;
}
}
if (data->totlayer <= data->maxlayer - CUSTOMDATA_GROW)

@ -1449,12 +1449,13 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
MEM_freeN(temp_data);
}
static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
PaintPoint *pPoint = (PaintPoint *)sData->type_data;
DerivedMesh *dm = surface->canvas->dm;
int i;
bool scene_color_manage = BKE_scene_check_color_management_enabled(scene);
if (surface->type != MOD_DPAINT_SURFACE_T_PAINT)
return;
@ -1503,7 +1504,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
uv[0] = tface[i].uv[j][0] * 2.0f - 1.0f;
uv[1] = tface[i].uv[j][1] * 2.0f - 1.0f;
multitex_ext_safe(tex, uv, &texres, pool);
multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage);
if (texres.tin > pPoint[*vert].alpha) {
copy_v3_v3(pPoint[*vert].color, &texres.tr);
@ -1536,8 +1537,8 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
/* remap to -1.0 to 1.0 */
uv_final[0] = uv_final[0] * 2.0f - 1.0f;
uv_final[1] = uv_final[1] * 2.0f - 1.0f;
multitex_ext_safe(tex, uv_final, &texres, NULL);
multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage);
/* apply color */
copy_v3_v3(pPoint[i].color, &texres.tr);
@ -1596,7 +1597,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
}
/* clears surface data back to zero */
void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
if (sData && sData->type_data) {
@ -1613,7 +1614,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
/* set initial color */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
dynamicPaint_setInitialColor(surface);
dynamicPaint_setInitialColor(scene, surface);
if (sData->bData)
sData->bData->clear = 1;
@ -1621,7 +1622,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
}
/* completely (re)initializes surface (only for point cache types)*/
int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
{
int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
/* free existing data */
@ -1642,16 +1643,16 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
/* set initial color */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
dynamicPaint_setInitialColor(surface);
dynamicPaint_setInitialColor(scene, surface);
return 1;
}
/* make sure allocated surface size matches current requirements */
static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface)
{
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
return dynamicPaint_resetSurface(surface);
return dynamicPaint_resetSurface(scene, surface);
}
return 1;
}
@ -1953,7 +1954,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
/* make sure surface is valid */
no_surface_data = surface->data == NULL;
if (!dynamicPaint_checkSurfaceData(surface)) continue;
if (!dynamicPaint_checkSurfaceData(scene, surface)) continue;
/* limit frame range */
CLAMP(current_frame, surface->start_frame, surface->end_frame);
@ -2225,7 +2226,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
/*
* Create a surface for uv image sequence format
*/
int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
{
/* Antialias jitter point relative coords */
float jitter5sample[10] = {0.0f, 0.0f,
@ -2676,7 +2677,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
}
#endif
dynamicPaint_setInitialColor(surface);
dynamicPaint_setInitialColor(scene, surface);
}
return (error == 0);

@ -744,6 +744,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
float nabla = eff->pd->tex_nabla;
int hasrgb;
short mode = eff->pd->tex_mode;
bool scene_color_manage;
if (!eff->pd->tex)
return;
@ -763,7 +764,9 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
mul_m4_v3(eff->ob->imat, tex_co);
}
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL);
scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene);
hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL, scene_color_manage);
if (hasrgb && mode==PFIELD_TEX_RGB) {
force[0] = (0.5f - result->tr) * strength;
@ -774,15 +777,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
strength/=nabla;
tex_co[0] += nabla;
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL);
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL, scene_color_manage);
tex_co[0] -= nabla;
tex_co[1] += nabla;
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL);
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL, scene_color_manage);
tex_co[1] -= nabla;
tex_co[2] += nabla;
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL);
multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL, scene_color_manage);
if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
/* generate intensity if texture only has rgb value */

@ -516,7 +516,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
/* Create unicode string */
utf8len = BLI_strlen_utf8(cu->str);
mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
mem = MEM_mallocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1);

@ -633,7 +633,7 @@ Image *BKE_image_load_exists(const char *filepath)
for (ima = G.main->image.first; ima; ima = ima->id.next) {
if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
BLI_path_abs(strtest, G.main->name);
BLI_path_abs(strtest, ID_BLEND_PATH(G.main, &ima->id));
if (BLI_path_cmp(strtest, str) == 0) {
if (ima->anim == NULL || ima->id.us == 0) {

@ -702,6 +702,19 @@ void BKE_mesh_texspace_get(Mesh *me, float r_loc[3], float r_rot[3], float r_siz
if (r_size) copy_v3_v3(r_size, me->size);
}
void BKE_mesh_texspace_copy_from_object(Mesh *me, Object *ob)
{
float *texloc, *texrot, *texsize;
short *texflag;
if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) {
me->texflag = *texflag;
copy_v3_v3(me->loc, texloc);
copy_v3_v3(me->size, texsize);
copy_v3_v3(me->rot, texrot);
}
}
float (*BKE_mesh_orco_verts_get(Object *ob))[3]
{
Mesh *me = ob->data;
@ -2450,10 +2463,11 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
int totvert, int totpoly, int totloop)
{
MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert poly map");
int *indices = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
int *indices, *index_iter;
int i, j;
indices = index_iter = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
/* Count number of polys for each vertex */
for (i = 0; i < totpoly; i++) {
const MPoly *p = &mpoly[i];
@ -2464,8 +2478,8 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
/* Assign indices mem */
for (i = 0; i < totvert; i++) {
map[i].indices = indices;
indices += map[i].count;
map[i].indices = index_iter;
index_iter += map[i].count;
/* Reset 'count' for use as index in last loop */
map[i].count = 0;
@ -2495,6 +2509,7 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
{
MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert-edge map");
int *indices = MEM_mallocN(sizeof(int) * totedge * 2, "vert-edge map mem");
int *i_pt = indices;
int i;
@ -2506,8 +2521,8 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
/* Assign indices mem */
for (i = 0; i < totvert; i++) {
map[i].indices = indices;
indices += map[i].count;
map[i].indices = i_pt;
i_pt += map[i].count;
/* Reset 'count' for use as index in last loop */
map[i].count = 0;

@ -2800,7 +2800,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
smokeModifier_reset_turbulence(pid->calldata);
#endif
else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
dynamicPaint_clearSurface(scene, (DynamicPaintSurface*)pid->calldata);
}
if (clear)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);

@ -1479,6 +1479,16 @@ void BKE_scene_disable_color_management(Scene *scene)
int BKE_scene_check_color_management_enabled(const Scene *scene)
{
/* TODO(sergey): shouldn't be needed. but we're currently far to close to the release,
* so better be extra-safe than sorry.
*
* Will remove the check after the release.
*/
if (!scene) {
BLI_assert(!"Shouldn't happen!");
return TRUE;
}
return strcmp(scene->display_settings.display_device, "None") != 0;
}

@ -50,6 +50,7 @@
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
@ -3111,8 +3112,18 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat
Editing *ed = scene->ed;
/* invalidate cache for current sequence */
if (invalidate_self)
if (invalidate_self) {
if (seq->anim) {
/* Animation structure holds some buffers inside,
* so for proper cache invalidation we need to
* re-open the animation.
*/
IMB_free_anim(seq->anim);
seq->anim = NULL;
}
BKE_sequencer_cache_cleanup_sequence(seq);
}
/* if invalidation is invoked from sequence free routine, effectdata would be NULL here */
if (seq->effectdata && seq->type == SEQ_TYPE_SPEED)
@ -3938,7 +3949,8 @@ Mask *BKE_sequencer_mask_get(Scene *scene)
static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
{
if (seq) {
BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
BLI_strncpy_utf8(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
BLI_utf8_invalid_strip(seq->name + 2, sizeof(seq->name) - 2);
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {

@ -1413,12 +1413,14 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
}
}
/* TODO(sergey): de-duplicate with get_texture_value from modifier utils */
/* NOTE: Skips color management, because result is only used for value now, not for color. */
static void get_texture_value(Tex *texture, float tex_co[3], TexResult *texres)
{
int result_type;
/* no node textures for now */
result_type = multitex_ext_safe(texture, tex_co, texres, NULL);
result_type = multitex_ext_safe(texture, tex_co, texres, NULL, false);
/* if the texture gave an RGB value, we assume it didn't give a valid
* intensity, since this is in the context of modifiers don't use perceptual color conversion.
@ -2100,7 +2102,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
/* sample subframes */
else {
int scene_frame = scene->r.cfra;
float scene_subframe = scene->r.subframe;
// float scene_subframe = scene->r.subframe; // UNUSED
int subframe;
for (subframe = 0; subframe <= subframes; subframe++) {
EmissionMap em_temp = {0};

@ -72,7 +72,7 @@ void BLI_freelinkN(struct ListBase *listbase, void *vlink);
void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src);
void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src);
void BLI_reverselist(struct ListBase *lb);
void BLI_rotatelist(struct ListBase *lb, LinkData *vlink);
void BLI_rotatelist(struct ListBase *lb, void *vlink);
/* create a generic list node containing link to provided data */
struct LinkData *BLI_genericNodeN(void *data);

@ -93,14 +93,14 @@ __attribute__((nonnull))
#endif
;
size_t BLI_snprintf(char *__restrict buffer, size_t len, const char *__restrict format, ...)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
#ifdef __GNUC__
__attribute__ ((format(printf, 3, 4)))
__attribute__((nonnull))
#endif
;
size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg)
#ifdef __GNUC__
__attribute__ ((format(printf, 3, 0)))
#endif

@ -199,7 +199,7 @@ bool BLI_file_touch(const char *file)
{
FILE *f = BLI_fopen(file, "r+b");
if (f != NULL) {
char c = getc(f);
int c = getc(f);
rewind(f);
putc(c, f);
}

@ -557,14 +557,14 @@ void BLI_reverselist(ListBase *lb)
/**
* \param vlink Link to make first.
*/
void BLI_rotatelist(ListBase *lb, LinkData *vlink)
void BLI_rotatelist(ListBase *lb, void *vlink)
{
/* make circular */
((LinkData *)lb->first)->prev = lb->last;
((LinkData *)lb->last)->next = lb->first;
lb->first = vlink;
lb->last = vlink->prev;
lb->last = ((LinkData *)vlink)->prev;
((LinkData *)lb->first)->prev = NULL;
((LinkData *)lb->last)->next = NULL;

@ -836,6 +836,7 @@ void orthogonalize_m3(float mat[3][3], int axis)
normalize_v3(mat[0]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
}
break;
default:
BLI_assert(0);
}

@ -47,6 +47,8 @@
# pragma GCC diagnostic error "-Wsign-conversion"
#endif
// #define DEBUG_STRSIZE
/**
* Duplicates the first \a len bytes of cstring \a str
* into a newly mallocN'd string and returns it. \a str
@ -111,6 +113,10 @@ char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t
size_t srclen = BLI_strnlen(src, maxncpy - 1);
BLI_assert(maxncpy != 0);
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
memcpy(dst, src, srclen);
dst[srclen] = '\0';
return dst;
@ -134,6 +140,10 @@ size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const
size_t srclen = BLI_strnlen(src, maxncpy - 1);
BLI_assert(maxncpy != 0);
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
memcpy(dst, src, srclen);
dst[srclen] = '\0';
return srclen;
@ -149,21 +159,21 @@ size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src)
/**
* Portable replacement for #vsnprintf
*/
size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
size_t BLI_vsnprintf(char *__restrict buffer, size_t maxncpy, const char *__restrict format, va_list arg)
{
size_t n;
BLI_assert(buffer != NULL);
BLI_assert(count > 0);
BLI_assert(maxncpy > 0);
BLI_assert(format != NULL);
n = (size_t)vsnprintf(buffer, count, format, arg);
n = (size_t)vsnprintf(buffer, maxncpy, format, arg);
if (n != -1 && n < count) {
if (n != -1 && n < maxncpy) {
buffer[n] = '\0';
}
else {
buffer[count - 1] = '\0';
buffer[maxncpy - 1] = '\0';
}
return n;
@ -172,13 +182,17 @@ size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restri
/**
* Portable replacement for #snprintf
*/
size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
{
size_t n;
va_list arg;
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
va_start(arg, format);
n = BLI_vsnprintf(buffer, count, format, arg);
n = BLI_vsnprintf(dst, maxncpy, format, arg);
va_end(arg);
return n;

@ -45,6 +45,8 @@
# pragma GCC diagnostic error "-Wsign-conversion"
#endif
// #define DEBUG_STRSIZE
/* from libswish3, originally called u8_isvalid(),
* modified to return the index of the bad character (byte index not utf).
* http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
@ -195,6 +197,10 @@ char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t
BLI_assert(maxncpy != 0);
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
/* note: currently we don't attempt to deal with invalid utf8 chars */
BLI_STR_UTF8_CPY(dst, src, maxncpy);
@ -208,6 +214,10 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
maxncpy--;
}
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
BLI_STR_UTF8_CPY(dst, src, maxncpy);
return dst;
@ -220,11 +230,16 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
{
const size_t maxlen = maxncpy - 1;
size_t len = 0;
BLI_assert(maxncpy != 0);
while (*src && len < maxncpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
#ifdef DEBUG_STRSIZE
memset(dst, 0xff, sizeof(*dst) * maxncpy);
#endif
while (*src && len < maxlen) { /* XXX can still run over the buffer because utf8 size isn't known :| */
len += BLI_str_utf8_from_unicode((unsigned int)*src++, dst + len);
}
@ -300,13 +315,16 @@ size_t BLI_strnlen_utf8(const char *strc, const size_t maxlen)
size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy)
{
const size_t maxlen = maxncpy - 1;
size_t len = 0;
if (dst_w == NULL || src_c == NULL) {
return 0;
}
BLI_assert(maxncpy != 0);
while (*src_c && len < maxncpy) {
#ifdef DEBUG_STRSIZE
memset(dst_w, 0xff, sizeof(*dst_w) * maxncpy);
#endif
while (*src_c && len != maxlen) {
size_t step = 0;
unsigned int unicode = BLI_str_utf8_as_unicode_and_size(src_c, &step);
if (unicode != BLI_UTF8_ERR) {
@ -320,6 +338,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest
dst_w++;
len++;
}
*dst_w = 0;
return len;
}

@ -162,7 +162,7 @@ static void bridge_loop_pair(BMesh *bm,
}
if (use_merge) {
BLI_assert((el_store_a_len == el_store_a_len));
BLI_assert((el_store_a_len == el_store_b_len));
}
if (el_store_a_len != el_store_b_len) {

@ -893,7 +893,7 @@ static void bm_edgering_pair_order(BMesh *bm,
/* before going much further, get ourselves in order
* - align loops (not strictly necessary but handy)
* - ensure winding is set for both loops */
if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_a)) {
if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_b)) {
BMIter eiter;
BMEdge *e;
BMVert *v_other;

@ -1687,6 +1687,18 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
}
}
static void report_class_type_unsupported(const char *path,
const COLLADAFW::AnimationList::AnimationClass animclass,
const COLLADAFW::Transformation::TransformationType type)
{
if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
fprintf(stderr, "%s: UNKNOWN animation class\n", path);
}
else {
fprintf(stderr, "%s: animation class %d is not supported yet for transformation type %d\n", path, animclass, type);
}
}
// return true to indicate that mat contains a sane value
bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id)
{
@ -1741,11 +1753,6 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
break;
}
if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
fprintf(stderr, "%s: UNKNOWN animation class\n", path);
//continue;
}
if (type == COLLADAFW::Transformation::ROTATE) {
if (curves.size() != 1) {
fprintf(stderr, "expected 1 curve, got %d\n", (int)curves.size());
@ -1754,7 +1761,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
// TODO support other animclasses
if (animclass != COLLADAFW::AnimationList::ANGLE) {
fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
report_class_type_unsupported(path, animclass, type);
return false;
}
@ -1793,7 +1800,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
vec[2] = evaluate_fcurve(curves[2], fra);
break;
default:
fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
report_class_type_unsupported(path, animclass, type);
break;
}
}

@ -133,24 +133,28 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
add_v3_v3v3(bone->tail, bone->head, vec);
// set parent tail
if (parent && totchild == 1) {
copy_v3_v3(parent->tail, bone->head);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
bone->flag |= BONE_CONNECTED;
if (parent) {
// XXX increase this to prevent "very" small bones?
const float epsilon = 0.000001f;
// derive leaf bone length
float length = len_v3v3(parent->head, parent->tail);
float length = len_v3v3(parent->head, bone->head);
if ((length < leaf_bone_length || totbone == 0) && length > epsilon) {
leaf_bone_length = length;
}
// treat zero-sized bone like a leaf bone
if (length <= epsilon) {
add_leaf_bone(parent_mat, parent, node);
if (totchild == 1) {
copy_v3_v3(parent->tail, bone->head);
// not setting BONE_CONNECTED because this would lock child bone location with respect to parent
bone->flag |= BONE_CONNECTED;
// treat zero-sized bone like a leaf bone
if (length <= epsilon) {
add_leaf_bone(parent_mat, parent, node);
}
}
}
@ -166,7 +170,7 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
}
bone->length = len_v3v3(bone->head, bone->tail);
joint_by_uid[node->getUniqueId()] = node;
finished_joints.push_back(node);
}
@ -517,16 +521,11 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con
// root - if this joint is the top joint in hierarchy, if a joint
// is a child of a node (not joint), root should be true since
// this is where we build armature bones from
void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent)
void ArmatureImporter::add_root_joint(COLLADAFW::Node *node, Object *parent)
{
joint_by_uid[node->getUniqueId()] = node;
if (root) {
root_joints.push_back(node);
if (parent) {
joint_parent_map[node->getUniqueId()] = parent;
}
root_joints.push_back(node);
if (parent) {
joint_parent_map[node->getUniqueId()] = parent;
}
}

@ -140,11 +140,7 @@ public:
ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce);
~ArmatureImporter();
void add_joint(COLLADAFW::Node *node, bool root, Object *parent);
#if 0
void add_root_joint(COLLADAFW::Node *node);
#endif
void add_root_joint(COLLADAFW::Node *node, Object *parent);
// here we add bones to armatures, having armatures previously created in write_controller
void make_armatures(bContext *C);

@ -311,11 +311,6 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
#endif
unsigned int i;
//for (i = 0; i < 4; i++)
// ob =
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) {
// For Skeletons without root node we have to simulate the
// root node here and recursively enter the same function
@ -323,6 +318,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
translate_anim_recursive(node, node, parob);
}
else {
anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
COLLADAFW::NodePointerArray &children = node->getChildNodes();
for (i = 0; i < children.getCount(); i++) {
translate_anim_recursive(children[i], node, NULL);
@ -480,7 +476,9 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par));
node_map[node->getUniqueId()] = node;
}
armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par);
if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) {
armature_importer.add_root_joint(node, par);
}
if (parent_node == NULL) {
// for skeletons without root node all has been done above.

@ -304,7 +304,8 @@ void WorkScheduler::initialize(bool use_opencl)
g_context = NULL;
g_program = NULL;
OCL_init(); /* this will check and skip if already initialized */
if (!OCL_init()) /* this will check for errors and skip if already initialized */
return;
if (clCreateContextFromType) {
cl_uint numberOfPlatforms = 0;

@ -34,11 +34,14 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
bNode *editorNode = this->getbNode();
Tex *texture = (Tex *)editorNode->id;
TextureOperation *operation = new TextureOperation();
const ColorManagedDisplaySettings *displaySettings = context->getDisplaySettings();
bool sceneColorManage = strcmp(displaySettings->display_device, "None") != 0;
this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket());
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
operation->setTexture(texture);
operation->setRenderData(context->getRenderData());
operation->setSceneColorManage(sceneColorManage);
system->addOperation(operation);
addPreviewOperation(system, context, operation->getOutputSocket());
@ -49,6 +52,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1));
alphaOperation->setTexture(texture);
alphaOperation->setRenderData(context->getRenderData());
alphaOperation->setSceneColorManage(sceneColorManage);
system->addOperation(alphaOperation);
}
}

@ -32,6 +32,7 @@
#include "DNA_movieclip_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
extern "C" {
#include "BLI_voronoi.h"
@ -76,7 +77,7 @@ public:
void deinitializeTileData(rcti *rect, void *data);
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));}
void setTrackingObject(const char *object) { BLI_strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject)); }
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
void executePixel(float output[4], int x, int y, void *data);

@ -33,6 +33,8 @@ TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation()
this->m_inputSize = NULL;
this->m_inputOffset = NULL;
this->m_rd = NULL;
this->m_pool = NULL;
this->m_sceneColorManage = false;
}
TextureOperation::TextureOperation() : TextureBaseOperation()
{
@ -101,7 +103,7 @@ void TextureBaseOperation::executePixel(float output[4], float x, float y, Pixel
vec[1] = textureSize[1] * (v + textureOffset[1]);
vec[2] = textureSize[2] * textureOffset[2];
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool);
retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage);
if (texres.talpha)
output[3] = texres.ta;

@ -46,6 +46,7 @@ private:
SocketReader *m_inputSize;
SocketReader *m_inputOffset;
struct ImagePool *m_pool;
bool m_sceneColorManage;
protected:
@ -67,6 +68,7 @@ public:
void initExecution();
void deinitExecution();
void setRenderData(const RenderData *rd) { this->m_rd = rd; }
void setSceneColorManage(bool sceneColorManage) { this->m_sceneColorManage = sceneColorManage; }
};
class TextureOperation : public TextureBaseOperation {

@ -33,6 +33,7 @@
#include "DNA_tracking_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
/**
* Class with implementation of green screen gradient rasterization
@ -60,8 +61,8 @@ public:
TrackPositionOperation();
void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
void setTrackingObject(char *object) {strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName));}
void setTrackName(char *track) {strncpy(this->m_trackName, track, sizeof(this->m_trackName));}
void setTrackingObject(char *object) { BLI_strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName)); }
void setTrackName(char *track) { BLI_strncpy(this->m_trackName, track, sizeof(this->m_trackName)); }
void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
void setAxis(int value) {this->m_axis = value;}
void setPosition(int value) {this->m_position = value;}

@ -434,7 +434,7 @@ void ED_armature_deselect_all_visible(Object *obedit)
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
/* first and foremost, bone must be visible and selected */
if (EBONE_SELECTABLE(arm, ebone)) {
if (EBONE_VISIBLE(arm, ebone)) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
@ -597,38 +597,48 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
/* Determine if there are any selected bones
* And therefore whether we are selecting or deselecting */
if (CTX_DATA_COUNT(C, selected_bones) > 0)
action = SEL_DESELECT;
action = SEL_SELECT;
CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
{
if (ebone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
action = SEL_DESELECT;
break;
}
}
CTX_DATA_END;
}
/* Set the flags */
CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
{
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
switch (action) {
case SEL_SELECT:
switch (action) {
case SEL_SELECT:
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if (ebone->parent)
if (ebone->parent) {
ebone->parent->flag |= (BONE_TIPSEL);
break;
case SEL_DESELECT:
}
}
break;
case SEL_DESELECT:
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
break;
case SEL_INVERT:
if (ebone->flag & BONE_SELECTED) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
break;
case SEL_INVERT:
if (ebone->flag & BONE_SELECTED) {
ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
else {
}
else {
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if (ebone->parent)
if (ebone->parent) {
ebone->parent->flag |= (BONE_TIPSEL);
}
}
break;
}
}
break;
}
}
CTX_DATA_END;
@ -672,16 +682,6 @@ static EnumPropertyItem prop_similar_types[] = {
{0, NULL, 0, NULL, NULL}
};
/* could be used in more places */
static void ED_armature_edit_bone_select(EditBone *ebone)
{
BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if ((ebone->flag & BONE_CONNECTED) && (ebone->parent != NULL)) {
ebone->parent->flag |= BONE_TIPSEL;
}
}
static void select_similar_length(bArmature *arm, EditBone *ebone_act, const float thresh)
{
@ -696,7 +696,7 @@ static void select_similar_length(bArmature *arm, EditBone *ebone_act, const flo
if ((ebone->length >= len_min) &&
(ebone->length <= len_max))
{
ED_armature_edit_bone_select(ebone);
ED_armature_ebone_select_set(ebone, true);
}
}
}
@ -714,7 +714,7 @@ static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const
sub_v3_v3v3(dir, ebone->head, ebone->tail);
if (angle_v3v3(dir_act, dir) / (float)M_PI < thresh) {
ED_armature_edit_bone_select(ebone);
ED_armature_ebone_select_set(ebone, true);
}
}
}
@ -727,7 +727,7 @@ static void select_similar_layer(bArmature *arm, EditBone *ebone_act)
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
if (EBONE_SELECTABLE(arm, ebone)) {
if (ebone->layer & ebone_act->layer) {
ED_armature_edit_bone_select(ebone);
ED_armature_ebone_select_set(ebone, true);
}
}
}
@ -750,8 +750,8 @@ static void select_similar_prefix(bArmature *arm, EditBone *ebone_act)
if (EBONE_SELECTABLE(arm, ebone)) {
char prefix_other[MAX_VGROUP_NAME];
BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp);
if (!strcmp(prefix_act, prefix_other)) {
ED_armature_edit_bone_select(ebone);
if (STREQ(prefix_act, prefix_other)) {
ED_armature_ebone_select_set(ebone, true);
}
}
}
@ -774,8 +774,8 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act)
if (EBONE_SELECTABLE(arm, ebone)) {
char suffix_other[MAX_VGROUP_NAME];
BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other);
if (!strcmp(suffix_act, suffix_other)) {
ED_armature_edit_bone_select(ebone);
if (STREQ(suffix_act, suffix_other)) {
ED_armature_ebone_select_set(ebone, true);
}
}
}

@ -337,18 +337,9 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
}
else {
/* if the bone is not selected, but connected to its parent
* copy the parents tip selection state */
* always use the parents tip selection state */
if (eBone->parent && (eBone->flag & BONE_CONNECTED)) {
/* selecting with the mouse gives this behavior */
if (eBone->parent->flag & BONE_TIPSEL) {
eBone->flag |= BONE_ROOTSEL;
}
else {
eBone->flag &= ~BONE_ROOTSEL;
}
/* probably not selected but just in case */
eBone->flag &= ~BONE_TIPSEL;
eBone->flag &= ~BONE_ROOTSEL;
}
}
@ -713,3 +704,62 @@ void undo_push_armature(bContext *C, const char *name)
// XXX solve getdata()
undo_editmode_push(C, name, get_armature_edit, free_undoBones, undoBones_to_editBones, editBones_to_undoBones, NULL);
}
/* *************************************************************** */
/* Low level selection functions which hide connected-parent
* flag behavior which gets tricky to handle in selection operators.
* (no flushing in ED_armature_ebone_select.*, that should be explicit) */
int ED_armature_ebone_selectflag_get(const EditBone *ebone)
{
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
return ((ebone->flag & (BONE_SELECTED | BONE_TIPSEL)) |
((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0));
}
else {
return (ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL));
}
}
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag)
{
flag = flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
ebone->parent->flag &= ~BONE_TIPSEL;
ebone->flag |= flag;
ebone->parent->flag |= (flag & BONE_ROOTSEL) ? BONE_TIPSEL : 0;
}
else {
ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
ebone->flag |= flag;
}
}
void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag)
{
BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0);
ED_armature_ebone_selectflag_set(ebone, ebone->flag | flag);
}
void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag)
{
BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0);
ED_armature_ebone_selectflag_set(ebone, ebone->flag & ~flag);
}
/* could be used in more places */
void ED_armature_ebone_select_set(EditBone *ebone, bool select)
{
int flag;
if (select) {
BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
flag = (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
else {
flag = 0;
}
ED_armature_ebone_selectflag_set(ebone, flag);
}

@ -380,7 +380,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
if (cu->len + filelen < MAXTEXT) {
int tmplen;
wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
wchar_t *mem = MEM_mallocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
wcscat(ef->textbuf, mem);
MEM_freeN(mem);
@ -1273,7 +1273,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
accentcode = 0;
}
else if (event->utf8_buf[0]) {
BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 1);
BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 2);
ascii = inserted_text[0];
insert_into_textbuf(obedit, ascii);
accentcode = 0;

@ -153,6 +153,13 @@ void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const
void undo_push_armature(struct bContext *C, const char *name);
/* low level selection functions which handle */
int ED_armature_ebone_selectflag_get(const EditBone *ebone);
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag);
void ED_armature_ebone_select_set(EditBone *ebone, bool select);
void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag);
void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag);
/* poseobject.c */
void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
void ED_armature_enter_posemode(struct bContext *C, struct Base *base);

@ -962,10 +962,10 @@ static bool ui_but_event_property_operator_string(const bContext *C, uiBut *but,
data_path = BLI_sprintfN("scene.%s", path);
MEM_freeN(path);
}
else {
/*else {
printf("ERROR in %s(): Couldn't get path for scene property - %s\n",
__func__, RNA_property_identifier(but->rnaprop));
}
}*/
}
}
else {

@ -255,7 +255,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
pa->sizey = 0;
}
BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR);
BLI_strncpy(pa->drawname, drawname, sizeof(pa->drawname));
/* if a new panel is added, we insert it right after the panel
* that was last added. this way new panels are inserted in the

@ -125,98 +125,22 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
#define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data)
static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
{
const int type = layer->type;
CustomData *data;
void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata = layer->data;
int type = layer->type;
int index;
int i, actindex, rndindex, cloneindex, stencilindex, tot;
int layer_index, tot, n;
if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
data = mesh_customdata_get_type(me, BM_LOOP, &tot);
}
else {
data = mesh_customdata_get_type(me, BM_FACE, &tot);
}
index = CustomData_get_layer_index(data, type);
/* ok, deleting a non-active layer needs to preserve the active layer indices.
* to do this, we store a pointer to the .data member of both layer and the active layer,
* (to detect if we're deleting the active layer or not), then use the active
* layer data pointer to find where the active layer has ended up.
*
* this is necessary because the deletion functions only support deleting the active
* layer. */
actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data;
rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data;
clonelayerdata = data->layers[CustomData_get_clone_layer_index(data, type)].data;
stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
CustomData_set_layer_active(data, type, layer - &data->layers[index]);
data = mesh_customdata_get_type(me, (ELEM(type, CD_MLOOPUV, CD_MLOOPCOL)) ? BM_LOOP : BM_FACE, &tot);
layer_index = CustomData_get_layer_index(data, type);
n = (layer - &data->layers[layer_index]);
BLI_assert(n >= 0 && (n + layer_index) < data->totlayer);
if (me->edit_btmesh) {
BM_data_layer_free(me->edit_btmesh->bm, data, type);
BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
}
else {
CustomData_free_layer_active(data, type, tot);
CustomData_free_layer(data, type, tot, n);
BKE_mesh_update_customdata_pointers(me, true);
}
/* reconstruct active layer */
if (actlayerdata != layerdata) {
/* find index */
actindex = CustomData_get_layer_index(data, type);
for (i = actindex; i < data->totlayer; i++) {
if (data->layers[i].data == actlayerdata) {
actindex = i - actindex;
break;
}
}
/* set index */
CustomData_set_layer_active(data, type, actindex);
}
if (rndlayerdata != layerdata) {
/* find index */
rndindex = CustomData_get_layer_index(data, type);
for (i = rndindex; i < data->totlayer; i++) {
if (data->layers[i].data == rndlayerdata) {
rndindex = i - rndindex;
break;
}
}
/* set index */
CustomData_set_layer_render(data, type, rndindex);
}
if (clonelayerdata != layerdata) {
/* find index */
cloneindex = CustomData_get_layer_index(data, type);
for (i = cloneindex; i < data->totlayer; i++) {
if (data->layers[i].data == clonelayerdata) {
cloneindex = i - cloneindex;
break;
}
}
/* set index */
CustomData_set_layer_clone(data, type, cloneindex);
}
if (stencillayerdata != layerdata) {
/* find index */
stencilindex = CustomData_get_layer_index(data, type);
for (i = stencilindex; i < data->totlayer; i++) {
if (data->layers[i].data == stencillayerdata) {
stencilindex = i - stencilindex;
break;
}
}
/* set index */
CustomData_set_layer_stencil(data, type, stencilindex);
}
}
static void mesh_uv_reset_array(float **fuv, const int len)

@ -226,7 +226,7 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
return dia;
}
return 1.0f;
// return 1.0f;
}
/********************* Add Object Operator ********************/

@ -682,12 +682,17 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
Object *obedit = CTX_data_edit_object(C);
Object *tob;
float cursor[3], cent[3], cent_neg[3], centn[3];
int centermode = RNA_enum_get(op->ptr, "type");
int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
ListBase ctx_data_list;
CollectionPointerLink *ctx_ob;
CollectionPointerLink *ctx_ob_act = NULL;
/* keep track of what is changed */
int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
@ -746,12 +751,25 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
CTX_data_selected_editable_objects(C, &ctx_data_list);
/* reset flags */
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
for (ctx_ob = ctx_data_list.first;
ctx_ob;
ctx_ob = ctx_ob->next)
{
Object *ob = ctx_ob->ptr.data;
ob->flag &= ~OB_DONE;
/* move active first */
if (ob == obact) {
ctx_ob_act = ctx_ob;
}
}
if (ctx_ob_act) {
BLI_rotatelist(&ctx_data_list, (LinkData *)ctx_ob_act);
}
CTX_DATA_END;
for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data)
@ -760,8 +778,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
}
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
for (ctx_ob = ctx_data_list.first;
ctx_ob;
ctx_ob = ctx_ob->next)
{
Object *ob = ctx_ob->ptr.data;
if ((ob->flag & OB_DONE) == 0) {
int do_inverse_offset = FALSE;
ob->flag |= OB_DONE;
@ -992,7 +1014,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
}
CTX_DATA_END;
BLI_freelistN(&ctx_data_list);
for (tob = bmain->object.first; tob; tob = tob->id.next)
if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))

@ -3073,7 +3073,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
/* identifiers */
ot->name = "Remove Vertex Group";
ot->idname = "OBJECT_OT_vertex_group_remove";
ot->description = "Delete the active vertex group";
ot->description = "Delete the active or all vertex groups from the active object";
/* api callbacks */
ot->poll = vertex_group_poll;
@ -3457,7 +3457,8 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action", "Lock action to execute on vertex groups");
RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action",
"Lock action to execute on vertex groups");
}
static int vertex_group_invert_exec(bContext *C, wmOperator *op)
@ -3593,7 +3594,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
/* identifiers */
ot->name = "Clean Vertex Group";
ot->idname = "OBJECT_OT_vertex_group_clean";
ot->description = "Remove Vertex Group assignments which aren't required";
ot->description = "Remove vertex group assignments which are not required";
/* api callbacks */
ot->poll = vertex_group_poll;
@ -3730,7 +3731,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Vertex Groups to Linked";
ot->idname = "OBJECT_OT_vertex_group_copy_to_linked";
ot->description = "Copy Vertex Groups to all users of the same Geometry data";
ot->description = "Copy vertex groups to all users of the same geometry data";
/* api callbacks */
ot->poll = vertex_group_poll;
@ -3757,7 +3758,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
if ((change == 0 && fail == 0) || fail) {
BKE_reportf(op->reports, RPT_ERROR,
"Copy VGroups to Selected warning, %d done, %d failed (object data must have matching indices)",
"Copy vertex groups to selected: %d done, %d failed (object data must have matching indices)",
change, fail);
}
@ -3769,7 +3770,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
/* identifiers */
ot->name = "Copy Vertex Group to Selected";
ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
ot->description = "Copy Vertex Groups to other selected objects with matching indices";
ot->description = "Copy vertex groups to other selected objects with matching indices";
/* api callbacks */
ot->poll = vertex_group_poll;
@ -3887,7 +3888,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
}
else {
if (op->reports->list.first == NULL) {
BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found.");
BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found");
}
return OPERATOR_FINISHED; /* to get the chance to make changes in the redo panel */
@ -4107,7 +4108,7 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
{
ot->name = "Sort Vertex Groups";
ot->idname = "OBJECT_OT_vertex_group_sort";
ot->description = "Sorts vertex groups alphabetically";
ot->description = "Sort vertex groups alphabetically";
/* api callbacks */
ot->poll = vertex_group_poll;
@ -4251,12 +4252,12 @@ static bool check_vertex_group_accessible(wmOperator *op, Object *ob, int def_nr
bDeformGroup *dg = BLI_findlink(&ob->defbase, def_nr);
if (!dg) {
BKE_report(op->reports, RPT_ERROR, "Invalid Weight Group Index");
BKE_report(op->reports, RPT_ERROR, "Invalid vertex group index");
return false;
}
if (dg->flag & DG_LOCK_WEIGHT) {
BKE_report(op->reports, RPT_ERROR, "Weight Group is locked");
BKE_report(op->reports, RPT_ERROR, "Vertex group is locked");
return false;
}
@ -4284,9 +4285,9 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot)
{
PropertyRNA *prop;
ot->name = "Paste weight to Selected";
ot->name = "Paste Weight to Selected";
ot->idname = "OBJECT_OT_vertex_weight_paste";
ot->description = "Copy this group's weight to other selected verts (disabled if vertex Group is locked)";
ot->description = "Copy this group's weight to other selected verts (disabled if vertex group is locked)";
/* api callbacks */
ot->poll = vertex_group_vert_select_mesh_poll;
@ -4296,7 +4297,7 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
"Index of source weight in active Weight Group", -1, INT_MAX);
"Index of source weight in active vertex group", -1, INT_MAX);
RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}
@ -4323,7 +4324,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot)
ot->name = "Delete Weight";
ot->idname = "OBJECT_OT_vertex_weight_delete";
ot->description = "Delete this weight from the vertex (disabled if vertex Group is locked)";
ot->description = "Delete this weight from the vertex (disabled if vertex group is locked)";
/* api callbacks */
ot->poll = vertex_group_vert_select_mesh_poll;
@ -4333,7 +4334,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
"Index of source weight in active Weight Group", -1, INT_MAX);
"Index of source weight in active vertex group", -1, INT_MAX);
RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}
@ -4357,7 +4358,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot)
ot->name = "Set Active Group";
ot->idname = "OBJECT_OT_vertex_weight_set_active";
ot->description = "Set as active Vertex Group";
ot->description = "Set as active vertex group";
/* api callbacks */
ot->poll = vertex_group_vert_select_mesh_poll;
@ -4367,7 +4368,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
"Index of source weight in active Weight Group", -1, INT_MAX);
"Index of source weight in active vertex group", -1, INT_MAX);
RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
}
@ -4390,7 +4391,7 @@ void OBJECT_OT_vertex_weight_normalize_active_vertex(wmOperatorType *ot)
ot->name = "Normalize Active";
ot->idname = "OBJECT_OT_vertex_weight_normalize_active_vertex";
ot->description = "Normalize Active Vert Weights";
ot->description = "Normalize active vertex's weights";
/* api callbacks */
ot->poll = vertex_group_vert_select_mesh_poll;
@ -4419,7 +4420,7 @@ void OBJECT_OT_vertex_weight_copy(wmOperatorType *ot)
ot->name = "Copy Active";
ot->idname = "OBJECT_OT_vertex_weight_copy";
ot->description = "Copy weights from Active to selected";
ot->description = "Copy weights from active to selected";
/* api callbacks */
ot->poll = vertex_group_vert_select_mesh_poll;

@ -294,7 +294,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
ED_update_for_newframe(CTX_data_main(C), scene, 1);
/* Init surface */
if (!dynamicPaint_createUVSurface(surface)) return 0;
if (!dynamicPaint_createUVSurface(scene, surface)) return 0;
/* Loop through selected frames */
for (frame = surface->start_frame; frame <= surface->end_frame; frame++) {

@ -831,9 +831,10 @@ static void render_view3d_renderinfo_cb(void *rjp, RenderStats *rs)
RenderPreview *rp = rjp;
/* during render, rv3d->engine can get freed */
if (rp->rv3d->render_engine == NULL)
if (rp->rv3d->render_engine == NULL) {
*rp->stop = 1;
else if (rp->engine->text) {
}
else {
make_renderinfo_string(rs, rp->scene, false, rp->engine->text);
/* make jobs timer to send notifier */

@ -107,6 +107,10 @@ typedef struct OGLRender {
bMovieHandle *mh;
int cfrao, nfra;
/* wm vars for timer and progress cursor */
wmWindowManager *wm;
wmWindow *win;
wmTimer *timer; /* use to check if running modal or not (invoke'd or exec'd)*/
} OGLRender;
@ -327,6 +331,9 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
static int screen_opengl_render_init(bContext *C, wmOperator *op)
{
/* new render clears all callbacks */
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
Scene *scene = CTX_data_scene(C);
ScrArea *prevsa = CTX_wm_area(C);
ARegion *prevar = CTX_wm_region(C);
@ -353,7 +360,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
}
/* only one render job at a time */
if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER))
return 0;
if (!is_view_context && scene->camera == NULL) {
@ -367,7 +374,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
}
/* stop all running jobs, except screen one. currently previews frustrate Render */
WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
WM_jobs_kill_all_except(wm, CTX_wm_screen(C));
/* create offscreen buffer */
sizex = (scene->r.size * scene->r.xsch) / 100;
@ -381,9 +388,6 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
return 0;
}
/* handle UI stuff */
WM_cursor_wait(1);
/* allocate opengl render */
oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender");
op->customdata = oglrender;
@ -441,6 +445,10 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
rr->rectf = MEM_callocN(sizeof(float) * 4 * sizex * sizey, "screen_opengl_render_init rect");
RE_ReleaseResult(oglrender->re);
/* wm vars */
oglrender->wm = wm;
oglrender->win = win;
return 1;
}
@ -458,10 +466,13 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
scene->r.cfra = oglrender->cfrao;
BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer);
WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer);
}
if (oglrender->win) {
WM_cursor_restore(oglrender->win);
}
WM_cursor_wait(0);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
U.obcenter_dia = oglrender->obcenter_dia_back;
@ -549,6 +560,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
}
}
if (oglrender->win) {
WM_cursor_time(oglrender->win, scene->r.cfra);
}
BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
if (view_context) {
@ -714,7 +729,7 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven
render_view_open(C, event->x, event->y);
WM_event_add_modal_handler(C, op);
oglrender->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
oglrender->timer = WM_event_add_timer(oglrender->wm, oglrender->win, TIMER, 0.01f);
return OPERATOR_RUNNING_MODAL;
}

@ -110,6 +110,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
object_add_material_slot(ob);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob);
return OPERATOR_FINISHED;
}
@ -146,6 +147,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob);
return OPERATOR_FINISHED;
}

@ -3534,7 +3534,14 @@ int sculpt_mode_poll(bContext *C)
int sculpt_mode_poll_view3d(bContext *C)
{
return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C));
return (sculpt_mode_poll(C) &&
CTX_wm_region_view3d(C));
}
int sculpt_poll_view3d(bContext *C)
{
return (sculpt_poll(C) &&
CTX_wm_region_view3d(C));
}
int sculpt_poll(bContext *C)
@ -4951,7 +4958,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT);
paint_cursor_start(C, sculpt_mode_poll_view3d);
paint_cursor_start(C, sculpt_poll_view3d);
}
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);

@ -56,7 +56,9 @@ struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct
int sculpt_mode_poll(struct bContext *C);
int sculpt_mode_poll_view3d(struct bContext *C);
/* checks for a brush, not just sculpt mode */
int sculpt_poll(struct bContext *C);
int sculpt_poll_view3d(struct bContext *C);
void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob,
int need_pmap, int need_mask);

@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_threads.h"
#include "BLI_string.h"
#include "BLF_translation.h"
@ -250,13 +251,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)
clip = ED_space_clip_get_clip(sc);
if (clip) {
strncpy(path, clip->name, sizeof(path));
BLI_strncpy(path, clip->name, sizeof(path));
BLI_path_abs(path, G.main->name);
BLI_parent_dir(path);
}
else {
strncpy(path, U.textudir, sizeof(path));
BLI_strncpy(path, U.textudir, sizeof(path));
}
if (RNA_struct_property_is_set(op->ptr, "files"))

@ -420,7 +420,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
float padding, int width, int height)
{
const float size = 12.0f;
int inside = 0;
float min[2], max[2];
float dx, dy;
@ -445,8 +444,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) &&
IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy);
return inside;
}
static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,

@ -463,10 +463,7 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir)
/* create next folder element */
folder = (FolderList *)MEM_mallocN(sizeof(FolderList), "FolderList");
folder->foldername = (char *)MEM_mallocN(sizeof(char) * (strlen(dir) + 1), "foldername");
folder->foldername[0] = '\0';
BLI_strncpy(folder->foldername, dir, FILE_MAXDIR);
folder->foldername = BLI_strdup(dir);
/* add it to the end of the list */
BLI_addtail(folderlist, folder);

@ -1898,6 +1898,8 @@ static int image_invert_exec(bContext *C, wmOperator *op)
void IMAGE_OT_invert(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Invert Channels";
ot->idname = "IMAGE_OT_invert";
@ -1908,10 +1910,14 @@ void IMAGE_OT_invert(wmOperatorType *ot)
ot->poll = image_invert_poll;
/* properties */
RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel");
RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel");
RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
prop = RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

@ -704,7 +704,7 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
// XXX select_single_seq(seq, 1);
p = ed->seqbasep->first;
while (p) {
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) {
p = p->next;
continue;
}

@ -957,7 +957,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if (type == TSE_SEQ_STRIP) {
Strip *strip = (Strip *)idv;
if (strip->dir)
if (strip->dir[0] != '\0')
te->name = strip->dir;
else
te->name = IFACE_("Strip None");
@ -1171,7 +1171,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
p = seq;
while (p) {
if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) {
p = p->next;
continue;
}

@ -118,7 +118,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
Scene *scene = CTX_data_scene(C);
Sequence *last_seq = BKE_sequencer_active_get(scene);
if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
char path[FILE_MAX];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
BLI_path_abs(path, G.main->name);
RNA_string_set(op->ptr, identifier, path);
@ -761,7 +761,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
BKE_sequencer_sort(scene);
/* last active name */
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir));
if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
if (BKE_sequence_test_overlap(ed->seqbasep, seq))

@ -551,6 +551,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
}
if (seq1 == NULL) seq1 = seq2;
if (seq3 == NULL) seq3 = seq2;
/* fall-through */
case 2:
if (seq1 == NULL || seq2 == NULL) {
*error_str = N_("2 selected sequence strips are needed");

@ -566,7 +566,12 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
{
drawEMTFMapped_userData *data = userData;
BMEditMesh *em = data->em;
BMFace *efa = EDBM_face_at_index(em, index);
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_SKIP;
@ -922,7 +927,13 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
/* editmode face hiding */
TexMatCallback *data = (TexMatCallback *)userData;
Mesh *me = (Mesh *)data->me;
BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
BMEditMesh *em = me->edit_btmesh;
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}

@ -3049,24 +3049,38 @@ static void draw_em_indices(BMEditMesh *em)
static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index)
{
BMFace *efa = EDBM_face_at_index(userData, index);
BMEditMesh *em = userData;
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
GPU_enable_material(efa->mat_nr + 1, NULL);
return DM_DRAW_OPTION_NORMAL;
}
else
else {
return DM_DRAW_OPTION_SKIP;
}
}
static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
{
BMFace *efa = EDBM_face_at_index(userData, index);
BMEditMesh *em = userData;
BMFace *efa;
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
return DM_DRAW_OPTION_SKIP;
else
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_NORMAL;
}
else {
return DM_DRAW_OPTION_SKIP;
}
}
static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,

@ -915,7 +915,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1);
but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize",
0, yco, UI_UNIT_X * 5, UI_UNIT_Y,
TIP_("Normalize weights of active vertex (if affected groups are unlocked"));
TIP_("Normalize weights of active vertex (if affected groups are unlocked)"));
if (lock_count) {
uiButSetFlag(but, UI_BUT_DISABLED);
}
@ -923,7 +923,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1);
but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy",
UI_UNIT_X * 5, yco, UI_UNIT_X * 5, UI_UNIT_Y,
TIP_("Copy active vertex to other selected verts (if affected groups are unlocked)"));
TIP_("Copy active vertex to other selected vertices (if affected groups are unlocked)"));
if (lock_count) {
uiButSetFlag(but, UI_BUT_DISABLED);
}

@ -3033,7 +3033,7 @@ static void view3d_main_area_draw_engine_info(View3D *v3d, RegionView3D *rv3d, A
{
float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
if (!rv3d->render_engine || !rv3d->render_engine->text)
if (!rv3d->render_engine || !rv3d->render_engine->text[0])
return;
if (render_border) {

@ -609,7 +609,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
LassoSelectUserData *data = userData;
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) {
bool is_point_done = false;
int points_proj_tot = 0;
@ -1907,7 +1907,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
int index = buffer[(4 * a) + 3];
if (index != -1) {
ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) {
if (index & BONESEL_TIP) {
ebone->flag |= BONE_DONE;
if (select) ebone->flag |= BONE_TIPSEL;
@ -1937,7 +1937,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
if (index != -1) {
ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
if (index & BONESEL_BONE) {
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) {
if (!(ebone->flag & BONE_DONE)) {
if (select)
ebone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED);
@ -1974,7 +1974,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
if (bone_only) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
if ((select == false) || ((pchan->bone->flag & BONE_UNSELECTABLE) == 0)) {
pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
}
@ -2622,7 +2622,7 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
CircleSelectUserData *data = userData;
bArmature *arm = data->vc->obedit->data;
if (EBONE_SELECTABLE(arm, ebone)) {
if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) {
bool is_point_done = false;
int points_proj_tot = 0;

@ -115,7 +115,7 @@ static TransformOrientation *createViewSpace(bContext *C, ReportList *UNUSED(rep
View3D *v3d = CTX_wm_view3d(C);
if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
/* If an object is used as camera, then this space is the same as object space! */
strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
BLI_strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
}
else {
strcpy(name, "Custom View");
@ -141,7 +141,7 @@ static TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(r
/* use object name if no name is given */
if (name[0] == 0) {
strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
BLI_strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
}
return addMatrixSpace(C, mat, name, overwrite);
@ -306,7 +306,7 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3], char name[],
if (ts == NULL) {
ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix");
BLI_addtail(transform_spaces, ts);
strncpy(ts->name, name, sizeof(ts->name));
BLI_strncpy(ts->name, name, sizeof(ts->name));
}
/* copy matrix into transform space */

@ -918,25 +918,35 @@ static int getYUVtoRGBMatrix(float *matrix, LogImageElement logElement)
}
}
static void getLinToLogLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement)
{
float *lut;
float gain, negativeFilmGamma, offset, step;
unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
unsigned int i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLinToLogLut");
negativeFilmGamma = 0.6;
step = logElement.refHighQuantity / logElement.maxValue;
gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
offset = gain - logElement.maxValue;
for (i = 0; i < (int)(logElement.maxValue + 1); i++)
for (i = 0; i < lutsize; i++)
lut[i] = (logImage->referenceWhite + log10f(powf((i + offset) / gain, 1.7f / logImage->gamma)) / (step / negativeFilmGamma)) / logElement.maxValue;
return lut;
}
static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement)
{
float *lut;
float breakPoint, gain, kneeGain, kneeOffset, negativeFilmGamma, offset, step, softClip;
/* float filmGamma; unused */
unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
unsigned int i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
/* Building the Log -> Lin LUT */
step = logElement.refHighQuantity / logElement.maxValue;
@ -952,7 +962,7 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l
kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset;
kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100);
for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
for (i = 0; i < lutsize; i++) {
if (i < logImage->referenceBlack)
lut[i] = 0.0f;
else if (i > breakPoint)
@ -960,61 +970,76 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l
else
lut[i] = (powf(10, ((float)i - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset) / logElement.maxValue;
}
return lut;
}
static void getLinToSrgbLut(float *lut, LogImageElement logElement)
static float *getLinToSrgbLut(LogImageElement logElement)
{
float col, *lut;
unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
unsigned int i;
float col;
for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
for (i = 0; i < lutsize; i++) {
col = (float)i / logElement.maxValue;
if (col < 0.0031308f)
lut[i] = (col < 0.0f) ? 0.0f : col * 12.92f;
else
lut[i] = 1.055f * powf(col, 1.0f / 2.4f) - 0.055f;
}
return lut;
}
static void getSrgbToLinLut(float *lut, LogImageElement logElement)
static float *getSrgbToLinLut(LogImageElement logElement)
{
float col, *lut;
unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
unsigned int i;
float col;
for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
for (i = 0; i < lutsize; i++) {
col = (float)i / logElement.maxValue;
if (col < 0.04045f)
lut[i] = (col < 0.0f) ? 0.0f : col * (1.0f / 12.92f);
else
lut[i] = powf((col + 0.055f) * (1.0f / 1.055f), 2.4f);
}
return lut;
}
static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage,
LogImageElement logElement, int elementIsSource)
{
unsigned int i;
float lut[65536];
float *src_ptr = src;
float *dst_ptr = dst;
switch (logElement.transfer) {
case transfer_UserDefined:
case transfer_Linear:
case transfer_Logarithmic:
case transfer_Logarithmic: {
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = *(src_ptr++);
*(dst_ptr++) = *(src_ptr++);
*(dst_ptr++) = *(src_ptr++);
src_ptr++;
}
return 0;
case transfer_PrintingDensity:
return 0;
}
case transfer_PrintingDensity: {
float *lut;
if (elementIsSource == 1)
getLogToLinLut((float *)&lut, logImage, logElement);
lut = getLogToLinLut(logImage, logElement);
else
getLinToLogLut((float *)&lut, logImage, logElement);
lut = getLinToLogLut(logImage, logElement);
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@ -1022,7 +1047,11 @@ static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage,
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
src_ptr++;
}
MEM_freeN(lut);
return 0;
}
default:
return 1;
@ -1033,27 +1062,30 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage,
LogImageElement logElement, int elementIsSource)
{
unsigned int i;
float lut[65536];
float *src_ptr = src;
float *dst_ptr = dst;
switch (logElement.transfer) {
case transfer_UserDefined:
case transfer_Linear:
case transfer_Logarithmic:
case transfer_Logarithmic: {
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = *(src_ptr++);
*(dst_ptr++) = *(src_ptr++);
*(dst_ptr++) = *(src_ptr++);
*(dst_ptr++) = 1.0f;
}
return 0;
case transfer_PrintingDensity:
return 0;
}
case transfer_PrintingDensity: {
float *lut;
if (elementIsSource == 1)
getLogToLinLut((float *)&lut, logImage, logElement);
lut = getLogToLinLut(logImage, logElement);
else
getLinToLogLut((float *)&lut, logImage, logElement);
lut = getLinToLogLut(logImage, logElement);
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@ -1061,7 +1093,11 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage,
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
*(dst_ptr++) = 1.0f;
}
MEM_freeN(lut);
return 0;
}
default:
return 1;
@ -1072,22 +1108,24 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage,
LogImageElement logElement, int elementIsSource)
{
unsigned int i;
float lut[65536];
float *src_ptr = src;
float *dst_ptr = dst;
switch (logElement.transfer) {
case transfer_UserDefined:
case transfer_Linear:
case transfer_Logarithmic:
case transfer_Logarithmic: {
memcpy(dst, src, 4 * logImage->width * logImage->height * sizeof(float));
return 0;
}
case transfer_PrintingDensity: {
float *lut;
case transfer_PrintingDensity:
if (elementIsSource == 1)
getLogToLinLut((float *)&lut, logImage, logElement);
lut = getLogToLinLut(logImage, logElement);
else
getLinToLogLut((float *)&lut, logImage, logElement);
lut = getLinToLogLut(logImage, logElement);
for (i = 0; i < logImage->width * logImage->height; i++) {
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@ -1095,7 +1133,11 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage,
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
*(dst_ptr++) = *(src_ptr++);
}
MEM_freeN(lut);
return 0;
}
default:
return 1;
@ -1106,14 +1148,13 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
LogImageElement logElement, int elementIsSource)
{
unsigned int i;
float lut[65536];
float *src_ptr = src;
float *dst_ptr = dst;
switch (logElement.transfer) {
case transfer_UserDefined:
case transfer_Linear:
case transfer_Logarithmic:
case transfer_Logarithmic: {
for (i = 0; i < logImage->width * logImage->height; i++) {
src_ptr += 4;
*(dst_ptr++) = *(src_ptr--);
@ -1123,12 +1164,15 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
src_ptr += 4;
}
return 0;
}
case transfer_PrintingDensity: {
float *lut;
case transfer_PrintingDensity:
if (elementIsSource == 1)
getLogToLinLut((float *)&lut, logImage, logElement);
lut = getLogToLinLut(logImage, logElement);
else
getLinToLogLut((float *)&lut, logImage, logElement);
lut = getLinToLogLut(logImage, logElement);
for (i = 0; i < logImage->width * logImage->height; i++) {
src_ptr += 4;
@ -1138,7 +1182,11 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
*(dst_ptr++) = *(src_ptr--);
src_ptr += 4;
}
MEM_freeN(lut);
return 0;
}
default:
return 1;
@ -1309,7 +1357,6 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
unsigned int i;
float *src_ptr;
float *dst_ptr;
float lut[65536];
/* Convert data in src to linear RGBA in dst */
switch (logElement.descriptor) {
@ -1357,7 +1404,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
return 1;
else if (dstIsLinearRGB) {
/* convert data from sRGB to Linear RGB via lut */
getSrgbToLinLut((float *)&lut, logElement);
float *lut = getSrgbToLinLut(logElement);
src_ptr = dst; // no error here
dst_ptr = dst;
for (i = 0; i < logImage->width * logImage->height; i++) {
@ -1366,6 +1413,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
*(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
dst_ptr++; src_ptr++;
}
MEM_freeN(lut);
}
return 0;
}
@ -1378,7 +1426,7 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag
float *srgbSrc;
float *srgbSrc_ptr;
float *src_ptr = src;
float lut[65536];
float *lut;
if (srcIsLinearRGB != 0) {
/* we need to convert src to sRGB */
@ -1390,13 +1438,14 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag
srgbSrc_ptr = srgbSrc;
/* convert data from Linear RGB to sRGB via lut */
getLinToSrgbLut((float *)&lut, logElement);
lut = getLinToSrgbLut(logElement);
for (i = 0; i < logImage->width * logImage->height; i++) {
*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
*(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
srgbSrc_ptr++; src_ptr++;
}
MEM_freeN(lut);
}
else
srgbSrc = src;

@ -75,6 +75,7 @@ typedef struct BevList {
struct BevList *next, *prev;
int nr, dupe_nr;
int poly, hole;
int charidx;
} BevList;
/* These two Lines with # tell makesdna this struct can be excluded. */

@ -1256,7 +1256,7 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " int found= 0;\n");
fprintf(f, " bool found = false;\n");
fprintf(f, " CollectionPropertyIterator iter;\n");
fprintf(f, " char namebuf[%d];\n", namebuflen);
fprintf(f, " char *name;\n\n");
@ -1264,26 +1264,29 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
fprintf(f, " while (iter.valid) {\n");
fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (namelen < %d) {\n", namebuflen);
fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
fprintf(f, " found = 1;\n");
fprintf(f, " *r_ptr = iter.ptr;\n");
fprintf(f, " break;\n");
fprintf(f, " if (iter.ptr.data) {\n");
fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (namelen < %d) {\n", namebuflen);
fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
fprintf(f, " found = true;\n");
fprintf(f, " *r_ptr = iter.ptr;\n");
fprintf(f, " break;\n");
fprintf(f, " }\n");
fprintf(f, " }\n");
fprintf(f, " }\n");
fprintf(f, " else {\n");
fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (strcmp(name, key) == 0) {\n");
fprintf(f, " MEM_freeN(name);\n\n");
fprintf(f, " found = 1;\n");
fprintf(f, " *r_ptr = iter.ptr;\n");
fprintf(f, " break;\n");
fprintf(f, " else {\n");
fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
fprintf(f, " if (strcmp(name, key) == 0) {\n");
fprintf(f, " MEM_freeN(name);\n\n");
fprintf(f, " found = true;\n");
fprintf(f, " *r_ptr = iter.ptr;\n");
fprintf(f, " break;\n");
fprintf(f, " }\n");
fprintf(f, " else {\n");
fprintf(f, " MEM_freeN(name);\n");
fprintf(f, " }\n");
fprintf(f, " }\n");
fprintf(f, " else\n");
fprintf(f, " MEM_freeN(name);\n");
fprintf(f, " }\n");
fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
fprintf(f, " }\n");

@ -107,7 +107,7 @@ static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, Poi
static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data);
dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
}
@ -116,7 +116,7 @@ static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene,
DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
surface->init_layername[0] = '\0';
dynamicPaint_clearSurface(surface);
dynamicPaint_clearSurface(scene, surface);
rna_DynamicPaint_redoModifier(bmain, scene, ptr);
}
@ -143,7 +143,7 @@ static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, Pointe
static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
{
dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data);
dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
rna_DynamicPaintSurface_reset(bmain, scene, ptr);
}

@ -335,6 +335,8 @@ Mesh *rna_Main_meshes_new_from_object(
return NULL;
}
BKE_mesh_texspace_copy_from_object(tmpmesh, ob);
BKE_libblock_free_us(&bmain->object, tmpobj);
break;
}
@ -362,6 +364,8 @@ Mesh *rna_Main_meshes_new_from_object(
else
BKE_mesh_from_metaball(&ob->disp, tmpmesh);
BKE_mesh_texspace_copy_from_object(tmpmesh, ob);
break;
}

@ -72,7 +72,9 @@ static void clear_envmap(struct EnvMap *env, bContext *C)
static void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
{
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL);
/* TODO(sergey): always use color management now. */
multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL, true);
color_r[0] = texres.tr;
color_r[1] = texres.tg;

@ -333,17 +333,23 @@ void RNA_api_wm(StructRNA *srna)
/* Progress bar interface */
func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
RNA_def_function_ui_description(func, "Start Progress bar");
parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
func = RNA_def_function(srna, "progress_update", "rna_progress_update");
parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_init()");
RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_begin()");
func = RNA_def_function(srna, "progress_end", "rna_progress_end");
RNA_def_function_ui_description(func, "Terminate Progress bar");
/* invoke functions, for use with python */
func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");

@ -453,7 +453,7 @@ static void deformVerts(ModifierData *md, Object *ob,
DerivedMesh *dm = NULL;
CastModifierData *cmd = (CastModifierData *)md;
dm = get_dm(ob, NULL, derivedData, NULL, 0);
dm = get_dm(ob, NULL, derivedData, NULL, false, false);
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
cuboid_do(cmd, ob, dm, vertexCos, numVerts);
@ -470,7 +470,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct BMEditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->type == MOD_CAST_TYPE_CUBOID) {

@ -82,7 +82,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
return;
}
dm = get_dm(ob, NULL, derivedData, NULL, 0);
dm = get_dm(ob, NULL, derivedData, NULL, false, false);
if (dm == derivedData)
dm = CDDM_copy(dm);

@ -219,7 +219,7 @@ static void displaceModifier_do(
if (dmd->texture) {
texres.nor = NULL;
get_texture_value(dmd->texture, tex_co[i], &texres);
get_texture_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false);
delta = texres.tin - dmd->midlevel;
}
else {
@ -265,7 +265,7 @@ static void deformVerts(ModifierData *md, Object *ob,
int numVerts,
ModifierApplyFlag UNUSED(flag))
{
DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos);
DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos, dependsOnNormals(md));
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);
@ -278,7 +278,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct BMEditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos);
DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md));
displaceModifier_do((DisplaceModifierData *)md, ob, dm,
vertexCos, numVerts);

@ -252,7 +252,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, NULL, dm, NULL, 0);
dm = get_dm(ob, NULL, dm, NULL, false, false);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
@ -267,7 +267,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
DerivedMesh *dm = derivedData;
/* We need a valid dm for meshes when a vgroup is set... */
if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
dm = get_dm(ob, editData, dm, NULL, 0);
dm = get_dm(ob, editData, dm, NULL, false, false);
deformVerts_do(hmd, ob, dm, vertexCos, numVerts);

@ -669,7 +669,7 @@ static void laplaciansmoothModifier_do(
static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
{
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
vertexCos, numVerts);
@ -682,7 +682,7 @@ static void deformVertsEM(
ModifierData *md, Object *ob, struct BMEditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
vertexCos, numVerts);

@ -212,7 +212,7 @@ static void meshdeformModifier_do(
/* if we don't have one computed, use derivedmesh from data
* without any modifiers */
if (!cagedm) {
cagedm = get_dm(mmd->object, NULL, NULL, NULL, 0);
cagedm = get_dm(mmd->object, NULL, NULL, NULL, false, false);
if (cagedm)
cagedm->needsFree = 1;
}
@ -343,7 +343,7 @@ static void deformVerts(ModifierData *md, Object *ob,
int numVerts,
ModifierApplyFlag UNUSED(flag))
{
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
@ -359,7 +359,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
float (*vertexCos)[3],
int numVerts)
{
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);

@ -142,7 +142,7 @@ static void deformVerts(ModifierData *md, Object *ob,
return;
if (dm == NULL) {
dm = get_dm(ob, NULL, NULL, vertexCos, 1);
dm = get_dm(ob, NULL, NULL, vertexCos, false, true);
if (!dm)
return;

@ -48,6 +48,8 @@
#include "MOD_util.h"
static bool dependsOnNormals(ModifierData *md);
static void initData(ModifierData *md)
{
@ -120,8 +122,9 @@ static void deformVerts(ModifierData *md, Object *ob,
CustomDataMask dataMask = requiredDataMask(ob, md);
/* ensure we get a CDDM with applied vertex coords */
if (dataMask)
dm = get_cddm(ob, NULL, dm, vertexCos);
if (dataMask) {
dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md));
}
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts);
@ -136,8 +139,9 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
CustomDataMask dataMask = requiredDataMask(ob, md);
/* ensure we get a CDDM with applied vertex coords */
if (dataMask)
dm = get_cddm(ob, editData, dm, vertexCos);
if (dataMask) {
dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md));
}
shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts);

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