Cleanup: style/whitespace

Also use 'uint'.
This commit is contained in:
2018-05-30 19:45:03 +02:00
parent 61fc9fcffa
commit 1f693aefca
16 changed files with 250 additions and 203 deletions

View File

@@ -886,7 +886,7 @@ Mesh *BKE_mesh_new_from_object(
BKE_object_free_modifiers(tmpobj, 0); BKE_object_free_modifiers(tmpobj, 0);
/* copies the data */ /* copies the data */
BKE_id_copy_ex(bmain,ob->data, (ID **)&copycu, LIB_ID_CREATE_NO_DEG_TAG, false); BKE_id_copy_ex(bmain, ob->data, (ID **)&copycu, LIB_ID_CREATE_NO_DEG_TAG, false);
tmpobj->data = copycu; tmpobj->data = copycu;
/* make sure texture space is calculated for a copy of curve, /* make sure texture space is calculated for a copy of curve,

View File

@@ -3351,7 +3351,8 @@ MovieClip *BKE_object_movieclip_get(Scene *scene, Object *ob, bool use_default)
return clip; return clip;
} }
void BKE_object_runtime_reset(Object *object) { void BKE_object_runtime_reset(Object *object)
{
memset(&object->runtime, 0, sizeof(object->runtime)); memset(&object->runtime, 0, sizeof(object->runtime));
} }

View File

@@ -207,7 +207,7 @@ static void studiolight_calculate_radiance_cubemap_buffers(StudioLight *sl)
{ {
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) { if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED); BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED);
ImBuf* ibuf = sl->equirectangular_radiance_buffer; ImBuf *ibuf = sl->equirectangular_radiance_buffer;
if (ibuf) { if (ibuf) {
float *colbuf = MEM_mallocN(SQUARE(STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) * sizeof(float[4]), __func__); float *colbuf = MEM_mallocN(SQUARE(STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) * sizeof(float[4]), __func__);
const float add = 1.0f / (STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE + 1); const float add = 1.0f / (STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE + 1);
@@ -462,7 +462,7 @@ static void studiolight_add_files_from_datafolder(const int folder_id, const cha
struct direntry *dir; struct direntry *dir;
const char *folder = BKE_appdir_folder_id(folder_id, subfolder); const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
if (folder) { if (folder) {
unsigned int totfile = BLI_filelist_dir_contents(folder, &dir); uint totfile = BLI_filelist_dir_contents(folder, &dir);
int i; int i;
for (i = 0; i < totfile; i++) { for (i = 0; i < totfile; i++) {
if ((dir[i].type & S_IFREG)) { if ((dir[i].type & S_IFREG)) {
@@ -512,7 +512,7 @@ static int studiolight_cmp(const void *a, const void *b)
} }
/* icons */ /* icons */
static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size) static uint *studiolight_radiance_preview(StudioLight *sl, int icon_size)
{ {
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED); BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED);
@@ -566,7 +566,7 @@ static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size
return rect; return rect;
} }
static unsigned int* studiolight_irradiance_preview(StudioLight *sl, int icon_size) static uint *studiolight_irradiance_preview(StudioLight *sl, int icon_size)
{ {
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_DIFFUSE_LIGHT_CALCULATED); BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_DIFFUSE_LIGHT_CALCULATED);
@@ -660,7 +660,8 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag)
if (STREQLEN(sl->name, name, FILE_MAXFILE)) { if (STREQLEN(sl->name, name, FILE_MAXFILE)) {
if ((sl->flag & flag) == flag) { if ((sl->flag & flag) == flag) {
return sl; return sl;
} else { }
else {
/* flags do not match, so use default */ /* flags do not match, so use default */
return studiolights.first; return studiolights.first;
} }
@@ -686,11 +687,12 @@ const struct ListBase *BKE_studiolight_listbase(void)
return &studiolights; return &studiolights;
} }
unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type) uint *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type)
{ {
if (icon_id_type == STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE) { if (icon_id_type == STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE) {
return studiolight_irradiance_preview(sl, icon_size); return studiolight_irradiance_preview(sl, icon_size);
} else { }
else {
return studiolight_radiance_preview(sl, icon_size); return studiolight_radiance_preview(sl, icon_size);
} }
} }

View File

@@ -300,7 +300,8 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
iter->data = data; iter->data = data;
if ((num_id_nodes == 0) || if ((num_id_nodes == 0) ||
(data->only_updated && !DEG_id_type_any_updated(depsgraph))) { (data->only_updated && !DEG_id_type_any_updated(depsgraph)))
{
iter->valid = false; iter->valid = false;
return; return;
} }

View File

@@ -511,10 +511,13 @@ void EEVEE_draw_effects(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
/* Save the final texture and framebuffer for final transformation or read. */ /* Save the final texture and framebuffer for final transformation or read. */
effects->final_tx = effects->source_buffer; effects->final_tx = effects->source_buffer;
effects->final_fb = (effects->target_buffer != fbl->main_color_fb) ? fbl->main_fb : fbl->effect_fb; effects->final_fb = (effects->target_buffer != fbl->main_color_fb) ? fbl->main_fb : fbl->effect_fb;
if ((effects->enabled_effects & EFFECT_TAA) && (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) { if ((effects->enabled_effects & EFFECT_TAA) &&
(effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0)
{
if (!effects->swap_double_buffer) { if (!effects->swap_double_buffer) {
effects->final_fb = fbl->double_buffer_fb; effects->final_fb = fbl->double_buffer_fb;
} else { }
else {
effects->final_fb = fbl->main_fb; effects->final_fb = fbl->main_fb;
} }
} }

View File

@@ -32,13 +32,14 @@
#include "eevee_private.h" #include "eevee_private.h"
void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, World *world, EEVEE_LightProbesInfo *pinfo) void EEVEE_lookdev_cache_init(
EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass,
World *world, EEVEE_LightProbesInfo *pinfo)
{ {
EEVEE_StorageList *stl = vedata->stl; EEVEE_StorageList *stl = vedata->stl;
const DRWContextState *draw_ctx = DRW_context_state_get(); const DRWContextState *draw_ctx = DRW_context_state_get();
View3D *v3d = draw_ctx->v3d; View3D *v3d = draw_ctx->v3d;
if (LOOK_DEV_MODE_ENABLED(v3d)) if (LOOK_DEV_MODE_ENABLED(v3d)) {
{
StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD); StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD);
if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) {
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
@@ -57,14 +58,18 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE); BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE);
tex = sl->equirectangular_irradiance_gputexture; tex = sl->equirectangular_irradiance_gputexture;
} else { }
else {
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE); BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
tex = sl->equirectangular_radiance_gputexture; tex = sl->equirectangular_radiance_gputexture;
} }
DRW_shgroup_uniform_texture(*grp, "image", tex); DRW_shgroup_uniform_texture(*grp, "image", tex);
/* Do we need to recalc the lightprobes? */ /* Do we need to recalc the lightprobes? */
if (pinfo && (pinfo->studiolight_index != sl->index || pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)) { if (pinfo &&
((pinfo->studiolight_index != sl->index) ||
(pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)))
{
pinfo->update_world |= PROBE_UPDATE_ALL; pinfo->update_world |= PROBE_UPDATE_ALL;
pinfo->studiolight_index = sl->index; pinfo->studiolight_index = sl->index;
pinfo->studiolight_rot_z = v3d->shading.studiolight_rot_z; pinfo->studiolight_rot_z = v3d->shading.studiolight_rot_z;
@@ -106,8 +111,8 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata)
BKE_camera_params_compute_matrix(&params); BKE_camera_params_compute_matrix(&params);
const float *viewport_size = DRW_viewport_size_get(); const float *viewport_size = DRW_viewport_size_get();
int viewport_inset_x = viewport_size[0]/4; int viewport_inset_x = viewport_size[0] / 4;
int viewport_inset_y = viewport_size[1]/4; int viewport_inset_y = viewport_size[1] / 4;
EEVEE_CommonUniformBuffer *common = &sldata->common_data; EEVEE_CommonUniformBuffer *common = &sldata->common_data;
common->la_num_light = 0; common->la_num_light = 0;
@@ -137,7 +142,7 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata)
GPUFrameBuffer *fb = effects->final_fb; GPUFrameBuffer *fb = effects->final_fb;
GPU_framebuffer_bind(fb); GPU_framebuffer_bind(fb);
GPU_framebuffer_viewport_set(fb, viewport_size[0]-viewport_inset_x, 0, viewport_inset_x, viewport_inset_y); GPU_framebuffer_viewport_set(fb, viewport_size[0] - viewport_inset_x, 0, viewport_inset_x, viewport_inset_y);
DRW_draw_pass(psl->lookdev_pass); DRW_draw_pass(psl->lookdev_pass);
DRW_viewport_matrix_override_unset_all(); DRW_viewport_matrix_override_unset_all();

View File

@@ -37,7 +37,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color); copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color);
wd->object_outline_color[3] = 1.0f; wd->object_outline_color[3] = 1.0f;
wd->specular_sharpness = 100 - sqrtf(scene->display.roughness)* 100; wd->specular_sharpness = 100.0f - sqrtf(scene->display.roughness) * 100.0f;
wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data); wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data);
} }

View File

@@ -3252,7 +3252,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
/* Create edges for each pair of triangles sharing an edge. */ /* Create edges for each pair of triangles sharing an edge. */
for (int i = 0; i < tri_len; i++) { for (int i = 0; i < tri_len; i++) {
for (int e = 0; e < 3; ++e) { for (int e = 0; e < 3; ++e) {
unsigned int v0, v1, v2; uint v0, v1, v2;
if (rdata->edit_bmesh) { if (rdata->edit_bmesh) {
const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i]; const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) { if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) {
@@ -3283,7 +3283,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
/* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */ /* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */
*pval = SET_INT_IN_POINTER(NO_EDGE); *pval = SET_INT_IN_POINTER(NO_EDGE);
bool inv_opposite = (v_data < 0); bool inv_opposite = (v_data < 0);
unsigned int v_opposite = (unsigned int)abs(v_data) - 1; uint v_opposite = (uint)abs(v_data) - 1;
if (inv_opposite == inv_indices) { if (inv_opposite == inv_indices) {
/* Don't share edge if triangles have non matching winding. */ /* Don't share edge if triangles have non matching winding. */
@@ -3303,15 +3303,15 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
BLI_edgehashIterator_isDone(ehi) == false; BLI_edgehashIterator_isDone(ehi) == false;
BLI_edgehashIterator_step(ehi)) BLI_edgehashIterator_step(ehi))
{ {
unsigned int v1, v2; uint v1, v2;
int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
if (v_data == NO_EDGE) { if (v_data == NO_EDGE) {
continue; continue;
} }
BLI_edgehashIterator_getKey(ehi, &v1, &v2); BLI_edgehashIterator_getKey(ehi, &v1, &v2);
unsigned int v0 = (unsigned int)abs(v_data) - 1; uint v0 = (uint)abs(v_data) - 1;
if (v_data < 0) { /* inv_opposite */ if (v_data < 0) { /* inv_opposite */
SWAP(unsigned int, v1, v2); SWAP(uint, v1, v2);
} }
GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0); GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0);
cache->is_manifold = false; cache->is_manifold = false;

View File

@@ -216,7 +216,8 @@ void DRW_particle_batch_cache_free(ParticleSystem *psys)
MEM_SAFE_FREE(psys->batch_cache); MEM_SAFE_FREE(psys->batch_cache);
} }
static void count_cache_segment_keys(ParticleCacheKey **pathcache, static void count_cache_segment_keys(
ParticleCacheKey **pathcache,
const int num_path_cache_keys, const int num_path_cache_keys,
ParticleHairCache *hair_cache) ParticleHairCache *hair_cache)
{ {
@@ -230,12 +231,14 @@ static void count_cache_segment_keys(ParticleCacheKey **pathcache,
} }
} }
static void ensure_seg_pt_count(PTCacheEdit *edit, static void ensure_seg_pt_count(
PTCacheEdit *edit,
ParticleSystem *psys, ParticleSystem *psys,
ParticleHairCache *hair_cache) ParticleHairCache *hair_cache)
{ {
if ((hair_cache->pos != NULL && hair_cache->indices != NULL) || if ((hair_cache->pos != NULL && hair_cache->indices != NULL) ||
(hair_cache->proc_point_buf != NULL)) { (hair_cache->proc_point_buf != NULL))
{
return; return;
} }
@@ -268,7 +271,8 @@ static void particle_pack_mcol(MCol *mcol, unsigned short r_scol[3])
} }
/* Used by parent particles and simple children. */ /* Used by parent particles and simple children. */
static void particle_calculate_parent_uvs(ParticleSystem *psys, static void particle_calculate_parent_uvs(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const int num_uv_layers, const int num_uv_layers,
const int parent_index, const int parent_index,
@@ -292,7 +296,8 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
if (num != DMCACHE_NOTFOUND) { if (num != DMCACHE_NOTFOUND) {
MFace *mface = &psmd->mesh_final->mface[num]; MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_uv_layers; j++) { for (int j = 0; j < num_uv_layers; j++) {
psys_interpolate_uvs(mtfaces[j] + num, psys_interpolate_uvs(
mtfaces[j] + num,
mface->v4, mface->v4,
particle->fuv, particle->fuv,
r_uv[j]); r_uv[j]);
@@ -300,7 +305,8 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
} }
} }
static void particle_calculate_parent_mcol(ParticleSystem *psys, static void particle_calculate_parent_mcol(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const int num_uv_layers, const int num_uv_layers,
const int parent_index, const int parent_index,
@@ -324,7 +330,8 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
if (num != DMCACHE_NOTFOUND) { if (num != DMCACHE_NOTFOUND) {
MFace *mface = &psmd->mesh_final->mface[num]; MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_uv_layers; j++) { for (int j = 0; j < num_uv_layers; j++) {
psys_interpolate_mcol(mcols[j] + num, psys_interpolate_mcol(
mcols[j] + num,
mface->v4, mface->v4,
particle->fuv, particle->fuv,
&r_mcol[j]); &r_mcol[j]);
@@ -333,7 +340,8 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
} }
/* Used by interpolated children. */ /* Used by interpolated children. */
static void particle_interpolate_children_uvs(ParticleSystem *psys, static void particle_interpolate_children_uvs(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const int num_uv_layers, const int num_uv_layers,
const int child_index, const int child_index,
@@ -352,7 +360,8 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys,
if (num != DMCACHE_NOTFOUND) { if (num != DMCACHE_NOTFOUND) {
MFace *mface = &psmd->mesh_final->mface[num]; MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_uv_layers; j++) { for (int j = 0; j < num_uv_layers; j++) {
psys_interpolate_uvs(mtfaces[j] + num, psys_interpolate_uvs(
mtfaces[j] + num,
mface->v4, mface->v4,
particle->fuv, particle->fuv,
r_uv[j]); r_uv[j]);
@@ -360,7 +369,8 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys,
} }
} }
static void particle_interpolate_children_mcol(ParticleSystem *psys, static void particle_interpolate_children_mcol(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const int num_col_layers, const int num_col_layers,
const int child_index, const int child_index,
@@ -379,7 +389,8 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys,
if (num != DMCACHE_NOTFOUND) { if (num != DMCACHE_NOTFOUND) {
MFace *mface = &psmd->mesh_final->mface[num]; MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_col_layers; j++) { for (int j = 0; j < num_col_layers; j++) {
psys_interpolate_mcol(mcols[j] + num, psys_interpolate_mcol(
mcols[j] + num,
mface->v4, mface->v4,
particle->fuv, particle->fuv,
&r_mcol[j]); &r_mcol[j]);
@@ -387,7 +398,8 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys,
} }
} }
static void particle_calculate_uvs(ParticleSystem *psys, static void particle_calculate_uvs(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const bool is_simple, const bool is_simple,
const int num_uv_layers, const int num_uv_layers,
@@ -433,7 +445,8 @@ static void particle_calculate_uvs(ParticleSystem *psys,
} }
} }
static void particle_calculate_mcol(ParticleSystem *psys, static void particle_calculate_mcol(
ParticleSystem *psys,
ParticleSystemModifierData *psmd, ParticleSystemModifierData *psmd,
const bool is_simple, const bool is_simple,
const int num_col_layers, const int num_col_layers,
@@ -508,11 +521,13 @@ static int particle_batch_cache_fill_segments(
const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN);
if (is_simple && *r_parent_uvs == NULL) { if (is_simple && *r_parent_uvs == NULL) {
/* TODO(sergey): For edit mode it should be edit->totcached. */ /* TODO(sergey): For edit mode it should be edit->totcached. */
*r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, *r_parent_uvs = MEM_callocN(
sizeof(*r_parent_uvs) * psys->totpart,
"Parent particle UVs"); "Parent particle UVs");
} }
if (is_simple && *r_parent_mcol == NULL) { if (is_simple && *r_parent_mcol == NULL) {
*r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, *r_parent_mcol = MEM_callocN(
sizeof(*r_parent_mcol) * psys->totpart,
"Parent particle MCol"); "Parent particle MCol");
} }
int curr_point = start_index; int curr_point = start_index;
@@ -552,16 +567,15 @@ static int particle_batch_cache_fill_segments(
for (int k = 0; k < num_uv_layers; k++) { for (int k = 0; k < num_uv_layers; k++) {
GWN_vertbuf_attr_set( GWN_vertbuf_attr_set(
hair_cache->pos, uv_id[k], curr_point, hair_cache->pos, uv_id[k], curr_point,
(is_simple && is_child) (is_simple && is_child) ?
? (*r_parent_uvs)[psys->child[i].parent][k] (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]);
: uv[k]);
} }
for (int k = 0; k < num_col_layers; k++) { for (int k = 0; k < num_col_layers; k++) {
/* TODO Put the conversion outside the loop */ /* TODO Put the conversion outside the loop */
unsigned short scol[4]; unsigned short scol[4];
particle_pack_mcol((is_simple && is_child) particle_pack_mcol(
? &(*r_parent_mcol)[psys->child[i].parent][k] (is_simple && is_child) ?
: &mcol[k], &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
scol); scol);
GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol);
} }
@@ -580,16 +594,15 @@ static int particle_batch_cache_fill_segments(
for (int k = 0; k < num_uv_layers; k++) { for (int k = 0; k < num_uv_layers; k++) {
GWN_vertbuf_attr_set( GWN_vertbuf_attr_set(
hair_cache->pos, uv_id[k], curr_point, hair_cache->pos, uv_id[k], curr_point,
(is_simple && is_child) (is_simple && is_child) ?
? (*r_parent_uvs)[psys->child[i].parent][k] (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]);
: uv[k]);
} }
for (int k = 0; k < num_col_layers; k++) { for (int k = 0; k < num_col_layers; k++) {
/* TODO Put the conversion outside the loop */ /* TODO Put the conversion outside the loop */
unsigned short scol[4]; unsigned short scol[4];
particle_pack_mcol((is_simple && is_child) particle_pack_mcol(
? &(*r_parent_mcol)[psys->child[i].parent][k] (is_simple && is_child) ?
: &mcol[k], &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
scol); scol);
GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol);
} }
@@ -632,7 +645,7 @@ static void particle_batch_cache_fill_segments_proc_pos(
} }
if (total_len > 0.0f) { if (total_len > 0.0f) {
/* Divide by total length to have a [0-1] number. */ /* Divide by total length to have a [0-1] number. */
for (int j = 0; j <= path->segments; j++, seg_data_first+=4) { for (int j = 0; j <= path->segments; j++, seg_data_first += 4) {
seg_data_first[3] /= total_len; seg_data_first[3] /= total_len;
} }
} }
@@ -675,11 +688,13 @@ static int particle_batch_cache_fill_strands_data(
const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN);
if (is_simple && *r_parent_uvs == NULL) { if (is_simple && *r_parent_uvs == NULL) {
/* TODO(sergey): For edit mode it should be edit->totcached. */ /* TODO(sergey): For edit mode it should be edit->totcached. */
*r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, *r_parent_uvs = MEM_callocN(
sizeof(*r_parent_uvs) * psys->totpart,
"Parent particle UVs"); "Parent particle UVs");
} }
if (is_simple && *r_parent_mcol == NULL) { if (is_simple && *r_parent_mcol == NULL) {
*r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, *r_parent_mcol = MEM_callocN(
sizeof(*r_parent_mcol) * psys->totpart,
"Parent particle MCol"); "Parent particle MCol");
} }
int curr_point = start_index; int curr_point = start_index;
@@ -689,7 +704,7 @@ static int particle_batch_cache_fill_strands_data(
continue; continue;
} }
unsigned int *seg_data = (unsigned int *)GWN_vertbuf_raw_step(data_step); uint *seg_data = (uint *)GWN_vertbuf_raw_step(data_step);
*seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24); *seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24);
curr_point += path->segments + 1; curr_point += path->segments + 1;
@@ -719,9 +734,9 @@ static int particle_batch_cache_fill_strands_data(
} }
for (int k = 0; k < num_col_layers; k++) { for (int k = 0; k < num_col_layers; k++) {
unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k); unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k);
particle_pack_mcol((is_simple && is_child) particle_pack_mcol(
? &(*r_parent_mcol)[psys->child[i].parent][k] (is_simple && is_child) ?
: &mcol[k], &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
scol); scol);
} }
if (!is_simple) { if (!is_simple) {
@@ -733,7 +748,8 @@ static int particle_batch_cache_fill_strands_data(
return curr_point; return curr_point;
} }
static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCache *cache, static void particle_batch_cache_ensure_procedural_final_points(
ParticleHairCache *cache,
int subdiv) int subdiv)
{ {
/* Same format as point_tex. */ /* Same format as point_tex. */
@@ -752,7 +768,8 @@ static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCach
cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_buf); cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_buf);
} }
static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit, static void particle_batch_cache_ensure_procedural_strand_data(
PTCacheEdit *edit,
ParticleSystem *psys, ParticleSystem *psys,
ModifierData *md, ModifierData *md,
ParticleHairCache *cache) ParticleHairCache *cache)
@@ -783,13 +800,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
MCol **parent_mcol = NULL; MCol **parent_mcol = NULL;
Gwn_VertFormat format_data = {0}; Gwn_VertFormat format_data = {0};
unsigned int data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT); uint data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT);
Gwn_VertFormat format_uv = {0}; Gwn_VertFormat format_uv = {0};
unsigned int uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); uint uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
Gwn_VertFormat format_col = {0}; Gwn_VertFormat format_col = {0};
unsigned int col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); uint col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names)); memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names));
memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names)); memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names));
@@ -806,7 +823,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]); GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]);
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i);
unsigned int hash = BLI_ghashutil_strhash_p(name); uint hash = BLI_ghashutil_strhash_p(name);
int n = 0; int n = 0;
BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash); BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash);
BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash);
@@ -822,7 +839,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]);
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i);
unsigned int hash = BLI_ghashutil_strhash_p(name); uint hash = BLI_ghashutil_strhash_p(name);
int n = 0; int n = 0;
BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash); BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash);
@@ -909,7 +926,8 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
} }
} }
static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, static void particle_batch_cache_ensure_procedural_indices(
PTCacheEdit *edit,
ParticleSystem *psys, ParticleSystem *psys,
ParticleHairCache *cache, ParticleHairCache *cache,
int thickness_res, int thickness_res,
@@ -917,7 +935,7 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit,
{ {
BLI_assert(thickness_res <= MAX_THICKRES); /* Cylinder strip not currently supported. */ BLI_assert(thickness_res <= MAX_THICKRES); /* Cylinder strip not currently supported. */
if (cache->final[subdiv].proc_hairs[thickness_res-1] != NULL) { if (cache->final[subdiv].proc_hairs[thickness_res - 1] != NULL) {
return; return;
} }
@@ -957,13 +975,15 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit,
} }
} }
cache->final[subdiv].proc_hairs[thickness_res-1] = GWN_batch_create_ex(prim_type, cache->final[subdiv].proc_hairs[thickness_res - 1] = GWN_batch_create_ex(
prim_type,
vbo, vbo,
GWN_indexbuf_build(&elb), GWN_indexbuf_build(&elb),
GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX);
} }
static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit, static void particle_batch_cache_ensure_procedural_pos(
PTCacheEdit *edit,
ParticleSystem *psys, ParticleSystem *psys,
ParticleHairCache *cache) ParticleHairCache *cache)
{ {
@@ -1011,7 +1031,8 @@ static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit,
cache->point_tex = GPU_texture_create_from_vertbuf(cache->proc_point_buf); cache->point_tex = GPU_texture_create_from_vertbuf(cache->proc_point_buf);
} }
static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, static void particle_batch_cache_ensure_pos_and_seg(
PTCacheEdit *edit,
ParticleSystem *psys, ParticleSystem *psys,
ModifierData *md, ModifierData *md,
ParticleHairCache *hair_cache) ParticleHairCache *hair_cache)
@@ -1090,7 +1111,8 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit,
GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count); GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count);
Gwn_IndexBufBuilder elb; Gwn_IndexBufBuilder elb;
GWN_indexbuf_init_ex(&elb, GWN_indexbuf_init_ex(
&elb,
GWN_PRIM_LINE_STRIP, GWN_PRIM_LINE_STRIP,
hair_cache->elems_count, hair_cache->point_count, hair_cache->elems_count, hair_cache->point_count,
true); true);
@@ -1163,7 +1185,8 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit,
hair_cache->indices = GWN_indexbuf_build(&elb); hair_cache->indices = GWN_indexbuf_build(&elb);
} }
static void particle_batch_cache_ensure_pos(Object *object, static void particle_batch_cache_ensure_pos(
Object *object,
ParticleSystem *psys, ParticleSystem *psys,
ParticlePointCache *point_cache) ParticlePointCache *point_cache)
{ {
@@ -1240,7 +1263,8 @@ static void particle_batch_cache_ensure_pos(Object *object,
} }
} }
static void drw_particle_update_ptcache_edit(Object *object_eval, static void drw_particle_update_ptcache_edit(
Object *object_eval,
ParticleSystem *psys, ParticleSystem *psys,
PTCacheEdit *edit) PTCacheEdit *edit)
{ {
@@ -1259,7 +1283,8 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
} }
if (edit->pathcache == NULL) { if (edit->pathcache == NULL) {
Depsgraph *depsgraph = draw_ctx->depsgraph; Depsgraph *depsgraph = draw_ctx->depsgraph;
psys_cache_edit_paths(depsgraph, psys_cache_edit_paths(
depsgraph,
scene_orig, object_orig, scene_orig, object_orig,
edit, edit,
DEG_get_ctime(depsgraph), DEG_get_ctime(depsgraph),
@@ -1267,7 +1292,8 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
} }
} }
static void drw_particle_update_ptcache(Object *object_eval, static void drw_particle_update_ptcache(
Object *object_eval,
ParticleSystem *psys) ParticleSystem *psys)
{ {
if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) { if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) {
@@ -1294,11 +1320,11 @@ Gwn_Batch *DRW_particles_batch_cache_get_hair(
drw_particle_update_ptcache(object, psys); drw_particle_update_ptcache(object, psys);
ensure_seg_pt_count(NULL, psys, &cache->hair); ensure_seg_pt_count(NULL, psys, &cache->hair);
particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair); particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair);
cache->hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, cache->hair.hairs = GWN_batch_create(
GWN_PRIM_LINE_STRIP,
cache->hair.pos, cache->hair.pos,
cache->hair.indices); cache->hair.indices);
} }
return cache->hair.hairs; return cache->hair.hairs;
} }
@@ -1326,13 +1352,15 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_strands(
drw_particle_update_ptcache_edit(object, psys, edit); drw_particle_update_ptcache_edit(object, psys, edit);
ensure_seg_pt_count(edit, psys, &cache->edit_hair); ensure_seg_pt_count(edit, psys, &cache->edit_hair);
particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair); particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair);
cache->edit_hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, cache->edit_hair.hairs = GWN_batch_create(
GWN_PRIM_LINE_STRIP,
cache->edit_hair.pos, cache->edit_hair.pos,
cache->edit_hair.indices); cache->edit_hair.indices);
return cache->edit_hair.hairs; return cache->edit_hair.hairs;
} }
static void ensure_edit_inner_points_count(const PTCacheEdit *edit, static void ensure_edit_inner_points_count(
const PTCacheEdit *edit,
ParticleBatchCache *cache) ParticleBatchCache *cache)
{ {
if (cache->edit_inner_pos != NULL) { if (cache->edit_inner_pos != NULL) {
@@ -1346,7 +1374,8 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit,
} }
} }
static void edit_colors_get(PTCacheEdit *edit, static void edit_colors_get(
PTCacheEdit *edit,
float selected_color[4], float selected_color[4],
float normal_color[4]) float normal_color[4])
{ {
@@ -1410,13 +1439,15 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_inner_points(
drw_particle_update_ptcache_edit(object, psys, edit); drw_particle_update_ptcache_edit(object, psys, edit);
ensure_edit_inner_points_count(edit, cache); ensure_edit_inner_points_count(edit, cache);
particle_batch_cache_ensure_edit_inner_pos(edit, cache); particle_batch_cache_ensure_edit_inner_pos(edit, cache);
cache->edit_inner_points = GWN_batch_create(GWN_PRIM_POINTS, cache->edit_inner_points = GWN_batch_create(
GWN_PRIM_POINTS,
cache->edit_inner_pos, cache->edit_inner_pos,
NULL); NULL);
return cache->edit_inner_points; return cache->edit_inner_points;
} }
static void ensure_edit_tip_points_count(const PTCacheEdit *edit, static void ensure_edit_tip_points_count(
const PTCacheEdit *edit,
ParticleBatchCache *cache) ParticleBatchCache *cache)
{ {
if (cache->edit_tip_pos != NULL) { if (cache->edit_tip_pos != NULL) {
@@ -1475,7 +1506,8 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_tip_points(
drw_particle_update_ptcache_edit(object, psys, edit); drw_particle_update_ptcache_edit(object, psys, edit);
ensure_edit_tip_points_count(edit, cache); ensure_edit_tip_points_count(edit, cache);
particle_batch_cache_ensure_edit_tip_pos(edit, cache); particle_batch_cache_ensure_edit_tip_pos(edit, cache);
cache->edit_tip_points = GWN_batch_create(GWN_PRIM_POINTS, cache->edit_tip_points = GWN_batch_create(
GWN_PRIM_POINTS,
cache->edit_tip_pos, cache->edit_tip_pos,
NULL); NULL);
return cache->edit_tip_points; return cache->edit_tip_points;
@@ -1515,7 +1547,7 @@ bool particles_ensure_procedural_data(
particle_batch_cache_ensure_procedural_final_points(&cache->hair, subdiv); particle_batch_cache_ensure_procedural_final_points(&cache->hair, subdiv);
need_ft_update = true; need_ft_update = true;
} }
if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res-1] == NULL) { if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res - 1] == NULL) {
particle_batch_cache_ensure_procedural_indices(NULL, psys, &cache->hair, thickness_res, subdiv); particle_batch_cache_ensure_procedural_indices(NULL, psys, &cache->hair, thickness_res, subdiv);
} }

View File

@@ -65,7 +65,7 @@ void DRW_debug_polygon_v3(const float (*v)[3], const int vert_len, const float c
BLI_assert(vert_len > 1); BLI_assert(vert_len > 1);
for (int i = 0; i < vert_len; ++i) { for (int i = 0; i < vert_len; ++i) {
DRW_debug_line_v3v3(v[i], v[(i+1)%vert_len], color); DRW_debug_line_v3v3(v[i], v[(i + 1) % vert_len], color);
} }
} }

View File

@@ -126,7 +126,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(
DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f); DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f);
DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", (part->shape_flag & PART_SHAPE_CLOSE_TIP) != 0); DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", (part->shape_flag & PART_SHAPE_CLOSE_TIP) != 0);
/* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling test. */ /* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling test. */
DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res-1], object); DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res - 1], object);
/* Transform Feedback subdiv. */ /* Transform Feedback subdiv. */
if (need_ft_update) { if (need_ft_update) {

View File

@@ -367,7 +367,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obm
} }
static void drw_shgroup_call_procedural_add_ex( static void drw_shgroup_call_procedural_add_ex(
DRWShadingGroup *shgroup, Gwn_PrimType prim_type, unsigned int prim_count, float (*obmat)[4]) DRWShadingGroup *shgroup, Gwn_PrimType prim_type, uint prim_count, float (*obmat)[4])
{ {
BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM)); BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM));
@@ -383,17 +383,17 @@ static void drw_shgroup_call_procedural_add_ex(
BLI_LINKS_APPEND(&shgroup->calls, call); BLI_LINKS_APPEND(&shgroup->calls, call);
} }
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, unsigned int point_count, float (*obmat)[4]) void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4])
{ {
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat); drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat);
} }
void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, unsigned int line_count, float (*obmat)[4]) void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4])
{ {
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_LINES, line_count, obmat); drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_LINES, line_count, obmat);
} }
void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, unsigned int tria_count, float (*obmat)[4]) void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, uint tria_count, float (*obmat)[4])
{ {
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_TRIS, tria_count, obmat); drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_TRIS, tria_count, obmat);
} }

View File

@@ -749,8 +749,9 @@ static void draw_matrices_model_prepare(DRWCallState *st)
/* No need to go further the call will not be used. */ /* No need to go further the call will not be used. */
if ((st->flag & DRW_CALL_CULLED) != 0 && if ((st->flag & DRW_CALL_CULLED) != 0 &&
(st->flag & DRW_CALL_BYPASS_CULLING) == 0) (st->flag & DRW_CALL_BYPASS_CULLING) == 0)
{
return; return;
}
/* Order matters */ /* Order matters */
if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE |
DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC))

View File

@@ -717,7 +717,7 @@ static void rna_View3DShading_studio_light_orientation_set(PointerRNA *UNUSED(pt
static int rna_View3DShading_studio_light_get(PointerRNA *ptr) static int rna_View3DShading_studio_light_get(PointerRNA *ptr)
{ {
View3D *v3d = (View3D *)ptr->data; View3D *v3d = (View3D *)ptr->data;
const int flag = v3d->drawtype == OB_MATERIAL? STUDIOLIGHT_ORIENTATION_WORLD: 0; const int flag = (v3d->drawtype == OB_MATERIAL) ? STUDIOLIGHT_ORIENTATION_WORLD : 0;
StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, flag); StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, flag);
BLI_strncpy(v3d->shading.studio_light, sl->name, FILE_MAXFILE); BLI_strncpy(v3d->shading.studio_light, sl->name, FILE_MAXFILE);
return sl->index; return sl->index;
@@ -747,7 +747,8 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(
if ((sl->flag & STUDIOLIGHT_EXTERNAL_FILE) == 0) { if ((sl->flag & STUDIOLIGHT_EXTERNAL_FILE) == 0) {
/* always show internal lights */ /* always show internal lights */
show_studiolight = true; show_studiolight = true;
} else { }
else {
switch (v3d->drawtype) { switch (v3d->drawtype) {
case OB_SOLID: case OB_SOLID:
case OB_TEXTURE: case OB_TEXTURE:

View File

@@ -415,7 +415,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, Mes
LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_CREATE_NO_DEG_TAG |
LIB_ID_COPY_NO_PREVIEW, LIB_ID_COPY_NO_PREVIEW,
false); false);
} else { }
else {
result = mesh; result = mesh;
} }