Grease Pencil: Set Layers' 'Use Lights' Default to False #104550

Closed
Kevin C. Burke wants to merge 14 commits from (deleted):main into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
55 changed files with 128 additions and 114 deletions
Showing only changes of commit 67b1bd41ae - Show all commits

View File

@ -341,7 +341,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
hid_map_button_mask_ = int(~(UINT_MAX << hid_map_button_num_));
}
CLOG_INFO(LOG, 2, "%d buttons -> hex:%X", hid_map_button_num_, (uint)hid_map_button_mask_);
CLOG_INFO(LOG, 2, "%d buttons -> hex:%X", hid_map_button_num_, uint(hid_map_button_mask_));
return device_type_ != NDOF_UnknownDevice;
}
@ -445,14 +445,14 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
2,
"button=%d, press=%d (out of range %d, ignoring!)",
button_number,
(int)press,
int(press),
hid_map_button_num_);
return;
}
const NDOF_ButtonT button = hid_map_[button_number];
if (button == NDOF_BUTTON_NONE) {
CLOG_INFO(
LOG, 2, "button=%d, press=%d (mapped to none, ignoring!)", button_number, (int)press);
LOG, 2, "button=%d, press=%d (mapped to none, ignoring!)", button_number, int(press));
return;
}
@ -460,7 +460,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
2,
"button=%d, press=%d, name=%s",
button_number,
(int)press,
int(press),
ndof_button_names[button]);
GHOST_IWindow *window = system_.getWindowManager()->getActiveWindow();

View File

@ -3478,7 +3478,7 @@ def km_animation_channels(params):
# Selection.
*_template_items_select_actions(params, "anim.channels_select_all"),
("anim.channels_select_box", {"type": 'B', "value": 'PRESS'}, None),
("anim.channels_select_box", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'},
("anim.channels_select_box", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'},
{"properties": [("extend", False)]}),
("anim.channels_select_box", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG', "shift": True},
{"properties": [("extend", True)]}),

View File

@ -485,7 +485,6 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
layout.use_property_split = True
layout.use_property_decorate = False
obj = context.object
me = context.mesh
col = layout.column()

View File

@ -62,7 +62,6 @@ class PARTICLE_MT_context_menu(Menu):
def draw(self, context):
layout = self.layout
psys = context.particle_system
experimental = context.preferences.experimental
props = layout.operator(
"particle.copy_particle_systems",
@ -508,7 +507,7 @@ class PARTICLE_PT_hair_dynamics_structure(ParticleButtonsPanel, Panel):
sub.prop(psys.settings, "bending_random", text="Random")
col.prop(cloth, "bending_damping", text="Damping")
# XXX has no noticeable effect with stiff hair structure springs
#col.prop(cloth, "spring_damping", text="Damping")
# col.prop(cloth, "spring_damping", text="Damping")
class PARTICLE_PT_hair_dynamics_volume(ParticleButtonsPanel, Panel):
@ -1100,7 +1099,7 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
if part.physics_type == 'KEYED':
col = layout.column()
# doesn't work yet
#col.alert = key.valid
# col.alert = key.valid
col.prop(key, "object")
col.prop(key, "system", text="System")
sub = col.column(align=True)
@ -1110,7 +1109,7 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
elif part.physics_type == 'BOIDS':
sub = layout.column()
# doesn't work yet
#sub.alert = key.valid
# sub.alert = key.valid
sub.prop(key, "object")
sub.prop(key, "system", text="System")
layout.prop(key, "alliance")
@ -1157,7 +1156,7 @@ class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
if key:
sub = layout.column()
# doesn't work yet
#sub.alert = key.valid
# sub.alert = key.valid
sub.prop(key, "object")
sub.prop(key, "system", text="System")

View File

@ -641,7 +641,6 @@ class RENDER_PT_eevee_next_film(RenderButtonsPanel, Panel):
scene = context.scene
rd = scene.render
props = scene.eevee
col = layout.column()
col.prop(rd, "filter_size")

View File

@ -2329,8 +2329,8 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
({"property": "use_override_templates"},
("blender/blender/issues/73318",
"Milestone 4")),
({"property": "use_new_volume_nodes"},
("blender/blender/issues/103248",
({"property": "use_new_volume_nodes"},
("blender/blender/issues/103248",
"#103248")),
),
)

View File

@ -6707,13 +6707,12 @@ class VIEW3D_PT_overlay_sculpt(Panel):
def poll(cls, context):
return (
context.mode == 'SCULPT' and
(context.sculpt_object and context.tool_settings.sculpt)
context.sculpt_object
)
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
sculpt = tool_settings.sculpt
view = context.space_data
overlay = view.overlay

View File

@ -350,7 +350,7 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
BKE_mesh_calc_normals_split(subdiv_mesh);
}
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) {
if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv);
}

View File

@ -222,9 +222,9 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float
j1 = j1 % oc->_N;
# define BILERP(m) \
(interpf(interpf(m[i1 * oc->_N + j1], m[i0 * oc->_N + j1], frac_x), \
interpf(m[i1 * oc->_N + j0], m[i0 * oc->_N + j0], frac_x), \
frac_z))
interpf(interpf(m[i1 * oc->_N + j1], m[i0 * oc->_N + j1], frac_x), \
interpf(m[i1 * oc->_N + j0], m[i0 * oc->_N + j0], frac_x), \
frac_z)
{
if (oc->_do_disp_y) {

View File

@ -738,7 +738,7 @@ struct EdgeQueueContext {
/* Only tagged edges are in the queue. */
#ifdef USE_EDGEQUEUE_TAG
# define EDGE_QUEUE_TEST(e) (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG))
# define EDGE_QUEUE_TEST(e) BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
# define EDGE_QUEUE_ENABLE(e) \
BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
# define EDGE_QUEUE_DISABLE(e) \

View File

@ -49,7 +49,7 @@ static int primitive_get_other_uv_vertex(const MeshData &mesh_data,
mesh_loops[looptri.tri[2]].v));
for (const int loop : looptri.tri) {
const int vert = mesh_loops[loop].v;
if (vert != v1 && vert != v2) {
if (!ELEM(vert, v1, v2)) {
return vert;
}
}

View File

@ -3133,10 +3133,10 @@ static void ptcache_dt_to_str(char *str, double dtime)
if (dtime > 60.0) {
if (dtime > 3600.0) {
BLI_sprintf(
str, "%ih %im %is", (int)(dtime / 3600), ((int)(dtime / 60)) % 60, ((int)dtime) % 60);
str, "%ih %im %is", (int)(dtime / 3600), (int)(dtime / 60) % 60, ((int)dtime) % 60);
}
else {
BLI_sprintf(str, "%im %is", ((int)(dtime / 60)) % 60, ((int)dtime) % 60);
BLI_sprintf(str, "%im %is", (int)(dtime / 60) % 60, ((int)dtime) % 60);
}
}
else {

View File

@ -1363,7 +1363,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
gridFlagMats = static_cast<DMFlagMat *>(
MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats"));
ccgdm->gridHidden = static_cast<unsigned int **>(
ccgdm->gridHidden = static_cast<uint **>(
MEM_callocN(sizeof(*ccgdm->gridHidden) * numGrids, "ccgdm.gridHidden"));
for (gIndex = 0, index = 0; index < numFaces; index++) {

View File

@ -527,7 +527,7 @@ static const AVCodec *get_av1_encoder(
if (context->ffmpeg_crf >= 0) {
/* librav1e does not use `-crf`, but uses `-qp` in the range of 0-255.
* Calculates the roughly equivalent float, and truncates it to an integer. */
unsigned int qp_value = ((float)context->ffmpeg_crf) * 255.0F / 51.0F;
uint qp_value = ((float)context->ffmpeg_crf) * 255.0f / 51.0f;
if (qp_value > 255) {
qp_value = 255;
}

View File

@ -82,7 +82,7 @@ typedef struct BLI_memiter {
BLI_INLINE uint data_offset_from_size(uint size)
{
return (PADUP(size, (uint)sizeof(data_t))) / (uint)sizeof(data_t);
return PADUP(size, (uint)sizeof(data_t)) / (uint)sizeof(data_t);
}
static void memiter_set_rewind_offset(BLI_memiter *mi)

View File

@ -257,7 +257,7 @@ void shuffle_m4(float R[4][4], const int index[4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
{
if (R == A || R == B) {
if (ELEM(R, A, B)) {
float T[4][4];
mul_m4_m4m4(T, A, B);
copy_m4_m4(R, T);
@ -359,7 +359,7 @@ void mul_m3_m3_post(float R[3][3], const float B[3][3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
{
if (R == A || R == B) {
if (ELEM(R, A, B)) {
float T[3][3];
mul_m3_m3m3(T, A, B);
copy_m3_m3(R, T);

View File

@ -1235,7 +1235,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l
}
#define EDGE_SHARE_VERT(e1, e2) \
((ELEM((e1)[0], (e2)[0], (e2)[1])) || (ELEM((e1)[1], (e2)[0], (e2)[1])))
(ELEM((e1)[0], (e2)[0], (e2)[1]) || ELEM((e1)[1], (e2)[0], (e2)[1]))
/* do line crossing tests */
for (i = 0, i_prev = f->len - 1; i < f->len; i_prev = i++) {

View File

@ -1062,7 +1062,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
matched = 1;
for (j = 0; j < pat->len; j++) {
a = (j + i) % pat->len;
if ((!!BMO_edge_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) {
if (!!BMO_edge_flag_test(bm, edges[a], SUBD_SPLIT) != (!!pat->seledges[j])) {
matched = 0;
break;
}
@ -1095,7 +1095,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
matched = 1;
for (b = 0; b < pat->len; b++) {
j = (b + a) % pat->len;
if ((!!BMO_edge_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) {
if (!!BMO_edge_flag_test(bm, edges[j], SUBD_SPLIT) != (!!pat->seledges[b])) {
matched = 0;
break;
}

View File

@ -2265,7 +2265,7 @@ static void snap_to_superellipsoid(float co[3], const float super_r, bool midlin
co[2] = z;
}
#define BEV_EXTEND_EDGE_DATA_CHECK(eh, flag) (BM_elem_flag_test(eh->e, flag))
#define BEV_EXTEND_EDGE_DATA_CHECK(eh, flag) BM_elem_flag_test(eh->e, flag)
static void check_edge_data_seam_sharp_edges(BevVert *bv, int flag, bool neg)
{

View File

@ -1044,7 +1044,7 @@ void ShadowModule::debug_end_sync()
debug_draw_ps_.state_set(state);
debug_draw_ps_.shader_set(inst_.shaders.static_shader_get(SHADOW_DEBUG));
debug_draw_ps_.push_constant("debug_mode", (int)inst_.debug_mode);
debug_draw_ps_.push_constant("debug_mode", int(inst_.debug_mode));
debug_draw_ps_.push_constant("debug_tilemap_index", light.tilemap_index);
debug_draw_ps_.bind_ssbo("tilemaps_buf", &tilemap_pool.tilemaps_data);
debug_draw_ps_.bind_ssbo("tiles_buf", &tilemap_pool.tiles_data);

View File

@ -1184,7 +1184,7 @@ static void drw_engines_enable_from_engine(const RenderEngineType *engine_type,
case OB_WIRE:
case OB_SOLID:
if (U.experimental.enable_workbench_next &&
strcmp(engine_type->idname, "BLENDER_WORKBENCH_NEXT") == 0) {
STREQ(engine_type->idname, "BLENDER_WORKBENCH_NEXT")) {
use_drw_engine(DRW_engine_viewport_workbench_next_type.draw_engine);
break;
}

View File

@ -735,7 +735,7 @@ static void gpencil_create_extensions_radius(tGPDfill *tgpf)
float tan2[3];
float d1;
float d2;
float total_length = 0.f;
float total_length = 0.0f;
for (int i = 1; i < gps->totpoints; i++) {
if (i > 1) {
copy_v3_v3(tan1, tan2);
@ -751,7 +751,7 @@ static void gpencil_create_extensions_radius(tGPDfill *tgpf)
sub_v3_v3v3(curvature, tan2, tan1);
float k = normalize_v3(curvature);
k /= min_ff(d1, d2);
float radius = 1.f / k;
float radius = 1.0f / k;
/*
* The smaller the radius of curvature, the sharper the corner.
* The thicker the line, the larger the radius of curvature it

View File

@ -263,7 +263,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
/* pixel radius */
{
const int old_size = (!is_gpencil) ? BKE_brush_size_get(scene, brush) : brush->size;
int size = (int)(scalar * old_size);
int size = int(scalar * old_size);
if (abs(old_size - size) < U.pixelsize) {
if (scalar > 1) {
@ -461,11 +461,11 @@ static int palette_extract_img_exec(bContext *C, wmOperator *op)
if (ibuf && ibuf->rect) {
/* Extract all colors. */
const int range = (int)pow(10.0f, threshold);
const int range = int(pow(10.0f, threshold));
for (int row = 0; row < ibuf->y; row++) {
for (int col = 0; col < ibuf->x; col++) {
float color[4];
IMB_sampleImageAtLocation(ibuf, (float)col, (float)row, false, color);
IMB_sampleImageAtLocation(ibuf, float(col), float(row), false, color);
for (int i = 0; i < 3; i++) {
color[i] = truncf(color[i] * range) / range;
}
@ -1129,10 +1129,10 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
angle = atan2f(mdiff[1], mdiff[0]);
angle = scd->init_rot + angle - scd->init_angle;
if (angle < 0.0f) {
angle += (float)(2 * M_PI);
angle += float(2 * M_PI);
}
if (angle > (float)(2 * M_PI)) {
angle -= (float)(2 * M_PI);
if (angle > float(2 * M_PI)) {
angle -= float(2 * M_PI);
}
*scd->rot_target = angle;
break;

View File

@ -175,7 +175,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */
const float alpha = (float)paint->paint_cursor_col[3] / 255.0f;
const float alpha = float(paint->paint_cursor_col[3]) / 255.0f;
immUniform4f("color", 0.0f, 0.0f, 0.0f, alpha);
immUniform4f("color2", 1.0f, 1.0f, 1.0f, alpha);
immUniform1f("dash_width", 6.0f);
@ -394,7 +394,7 @@ static bool paint_brush_update(bContext *C,
ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy);
ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + (float)M_PI;
ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + float(M_PI);
if (brush->flag & BRUSH_EDGE_TO_EDGE) {
halfway[0] = dx * 0.5f + stroke->initial_mouse[0];
@ -454,8 +454,8 @@ static bool paint_brush_update(bContext *C,
if ((do_random || do_random_mask) && stroke->rng == nullptr) {
/* Lazy initialization. */
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
rng_seed ^= (uint)POINTER_AS_INT(brush);
uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX);
rng_seed ^= uint(POINTER_AS_INT(brush));
stroke->rng = BLI_rng_new(rng_seed);
}
@ -608,7 +608,7 @@ static void paint_brush_stroke_add_step(
bool add_step = true;
if (paint_stroke_use_dash(brush)) {
int dash_samples = stroke->tot_samples % brush->dash_samples;
float dash = (float)dash_samples / (float)brush->dash_samples;
float dash = float(dash_samples) / float(brush->dash_samples);
if (dash > brush->dash_ratio) {
add_step = false;
}
@ -938,7 +938,7 @@ PaintStroke *paint_stroke_new(bContext *C,
* ups->average_stroke_counter to 1.
*/
if (ups->average_stroke_counter) {
mul_v3_fl(ups->average_stroke_accum, 1.0f / (float)ups->average_stroke_counter);
mul_v3_fl(ups->average_stroke_accum, 1.0f / float(ups->average_stroke_counter));
ups->average_stroke_counter = 1;
}
@ -1402,17 +1402,17 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2])
len = len_v2(line);
/* divide angle by PI/4 */
angle = 4.0f * angle / (float)M_PI;
angle = 4.0f * angle / float(M_PI);
/* now take residue */
res = angle - floorf(angle);
/* residue decides how close we are at a certain angle */
if (res <= 0.5f) {
angle = floorf(angle) * (float)M_PI_4;
angle = floorf(angle) * float(M_PI_4);
}
else {
angle = (floorf(angle) + 1.0f) * (float)M_PI_4;
angle = (floorf(angle) + 1.0f) * float(M_PI_4);
}
mouse[0] = stroke->constrained_pos[0] = len * cosf(angle) + stroke->last_mouse_position[0];

View File

@ -495,7 +495,7 @@ static void dyntopo_detail_size_parallel_lines_draw(uint pos3d,
rotate_v2_v2fl(line_disp, spacing_disp, DEG2RAD(angle));
mul_v3_fl(spacing_disp, total_len / tot_lines_fl);
immBegin(GPU_PRIM_LINES, (uint)tot_lines * 2);
immBegin(GPU_PRIM_LINES, uint(tot_lines) * 2);
for (int i = 0; i < tot_lines; i++) {
float line_length;
if (flip) {

View File

@ -500,7 +500,7 @@ static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr),
void *UNUSED(user_data))
{
const char *prop_id = RNA_property_identifier(prop);
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
return !STR_ELEM(prop_id, "filepath", "directory", "filename");
}
static void sound_mixdown_draw(bContext *C, wmOperator *op)

View File

@ -3568,7 +3568,8 @@ static bool do_mesh_box_select(ViewContext *vc,
}
if (ts->selectmode & SCE_SELECT_EDGE) {
/* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */
struct BoxSelectUserData_ForMeshEdge cb_data {};
struct BoxSelectUserData_ForMeshEdge cb_data {
};
cb_data.data = &data;
cb_data.esel = use_zbuf ? esel : nullptr;
cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem(

View File

@ -40,7 +40,7 @@ GraphISO::GraphISO(int n)
* Better still is to use a different algorithm. See for example:
* https://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.190/Mitarbeiter/toran/beatcs09.pdf
*/
adjmat[i] = static_cast<unsigned char *>(MEM_callocN(n * sizeof *adjmat[i], __func__));
adjmat[i] = static_cast<uchar *>(MEM_callocN(n * sizeof *adjmat[i], __func__));
}
degree = nullptr;
}
@ -69,7 +69,7 @@ void GraphISO::calculate_degrees() const
if (degree) {
return;
}
degree = static_cast<unsigned int *>(MEM_mallocN(n * sizeof *degree, __func__));
degree = static_cast<uint *>(MEM_mallocN(n * sizeof *degree, __func__));
for (int v = 0; v < n; v++) {
int row_count = 0;
for (int w = 0; w < n; w++) {

View File

@ -1343,8 +1343,8 @@ void uvedit_deselect_flush(const Scene *scene, BMEditMesh *em)
continue;
}
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if ((!BM_ELEM_CD_GET_BOOL(l, offsets.select_vert)) ||
(!BM_ELEM_CD_GET_BOOL(l->next, offsets.select_vert))) {
if (!BM_ELEM_CD_GET_BOOL(l, offsets.select_vert) ||
!BM_ELEM_CD_GET_BOOL(l->next, offsets.select_vert)) {
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false);
}
}
@ -2283,14 +2283,14 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em)
continue;
}
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) {
if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) {
/* Use UV edge selection to find vertices and edges that must be selected. */
bool es = BM_ELEM_CD_GET_BOOL(l, offsets.select_edge);
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, !es);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false);
}
/* Use UV vertex selection to find vertices and edges that must be selected. */
else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) {
else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) {
bool vs = BM_ELEM_CD_GET_BOOL(l, offsets.select_vert);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, !vs);
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false);
@ -4564,7 +4564,7 @@ static float get_uv_vert_needle(const eUVSelectSimilar type,
}
} break;
case UV_SSIM_PIN:
return (BM_ELEM_CD_GET_BOOL(loop, offsets.pin)) ? 1.0f : 0.0f;
return BM_ELEM_CD_GET_BOOL(loop, offsets.pin) ? 1.0f : 0.0f;
default:
BLI_assert_unreachable();
return false;

View File

@ -2769,7 +2769,7 @@ static void uv_map_mirror(BMFace *efa,
pole_count++;
}
}
if (pole_count == 0 || pole_count == efa->len) {
if (ELEM(pole_count, 0, efa->len)) {
return;
}
for (int i = 0; i < efa->len; i++) {

View File

@ -120,7 +120,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/,
// Now allocate the cell table and fill it with default (empty) cells
_cells.resize(_cellsX * _cellsY);
for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
(*i) = NULL;
(*i) = nullptr;
}
// Identify cells that will be used, and set the dimensions for each
@ -182,7 +182,7 @@ void BoxGrid::reorganizeCells()
{
// Sort the occluders by shallowest point
for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
if (*i != NULL) {
if (*i != nullptr) {
(*i)->indexPolygons();
}
}

View File

@ -175,7 +175,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
// Either we have run out of FEdges, or we already have the one edge we need to determine
// visibility Cull all remaining edges.
while (!ELEM(fe, NULL, festart)) {
while (!ELEM(fe, nullptr, festart)) {
fe->setIsInImage(false);
fe = fe->nextEdge();
}
@ -237,7 +237,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
expandGridSpaceOccluderProscenium(fe);
}
fe = fe->nextEdge();
} while (!ELEM(fe, NULL, festart));
} while (!ELEM(fe, nullptr, festart));
}
}

View File

@ -117,7 +117,7 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/,
// Now allocate the cell table and fill it with default (empty) cells
_cells.resize(_cellsX * _cellsY);
for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
(*i) = NULL;
(*i) = nullptr;
}
// Identify cells that will be used, and set the dimensions for each
@ -178,7 +178,7 @@ void SphericalGrid::reorganizeCells()
{
// Sort the occluders by shallowest point
for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
if (*i != NULL) {
if (*i != nullptr) {
(*i)->indexPolygons();
}
}

View File

@ -822,7 +822,7 @@ void ViewEdge::UpdateFEdges()
do {
currentEdge->setViewEdge(this);
currentEdge = currentEdge->nextEdge();
} while (!ELEM(currentEdge, NULL, _FEdgeB));
} while (!ELEM(currentEdge, nullptr, _FEdgeB));
// last one
_FEdgeB->setViewEdge(this);
}

View File

@ -983,7 +983,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
wFace = nullptr;
}
else {
qi = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, NULL);
qi = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, nullptr);
}
// Store test results

View File

@ -388,7 +388,7 @@ static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout,
(!ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN)) &&
!ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN) &&
RNA_boolean_get(ptr, "use_custom_frame_range"));
col = uiLayoutColumn(layout, true);

View File

@ -647,21 +647,6 @@ char *GPU_material_split_sub_function(GPUMaterial *material,
SNPRINTF(func_link->name, "ntree_fn%d", material->generated_function_len++);
BLI_addtail(&material->graph.material_functions, func_link);
/* Set value to break the link with the main graph. */
switch (return_type) {
case GPU_FLOAT:
GPU_link(material, "set_value_one", link);
break;
case GPU_VEC3:
GPU_link(material, "set_rgb_one", link);
break;
case GPU_VEC4:
GPU_link(material, "set_rgba_one", link);
break;
default:
BLI_assert(0);
break;
}
return func_link->name;
}

View File

@ -77,6 +77,11 @@ template<> uint convert_type<uint>(float val)
return uint(val * float(0xFFFFFFFFu));
}
template<typename D, typename S> uint pack_depth_stencil(D depth, S stencil)
{
return (((uint(depth)) << 8) & (~(0xFFu - 1))) | (uint(stencil) & (0xFFu - 1));
}
struct TextureReadParams {
int mip_index;
int extent[3];
@ -118,8 +123,14 @@ kernel void compute_texture_read(constant TextureReadParams &params [[buffer(0)]
/* Read data */
# if IS_DEPTH_FORMAT == 1
output_data[index] = denormalize<OUTPUT_DATA_TYPE>(
OUTPUT_DATA_TYPE value = denormalize<OUTPUT_DATA_TYPE>(
read_tex.sample(pixelSampler, float2(params.offset[0], params.offset[1]) + float2(xx, yy)));
# if IS_DEPTHSTENCIL_24_8 == 1
/* Shift depth value into 24 bit region and mask out 8 bit stencil.
* NOTE: Stencil currently not read as no use cases exist for this. */
value = pack_depth_stencil(value, 0);
# endif
output_data[index] = value;
# else
read_colour = read_tex.read(uint2(params.offset[0], params.offset[1]) + uint2(xx, yy));
# endif
@ -156,10 +167,16 @@ kernel void compute_texture_read(constant TextureReadParams &params [[buffer(0)]
/* Read data */
# if IS_DEPTH_FORMAT == 1
output_data[index] = denormalize<OUTPUT_DATA_TYPE>(
OUTPUT_DATA_TYPE value = denormalize<OUTPUT_DATA_TYPE>(
read_tex.sample(pixelSampler,
float2(params.offset[0], params.offset[1]) + float2(xx, yy),
uint(params.offset[2] + layer)));
# if IS_DEPTHSTENCIL_24_8 == 1
/* Shift depth value into 24 bit region and mask out 8 bit stencil.
* NOTE: Stencil currently not read as no use cases exist for this. */
value = pack_depth_stencil(value, 0);
# endif
output_data[index] = value;
# else
read_colour = read_tex.read(uint2(params.offset[0], params.offset[1]) + uint2(xx, yy),
uint(params.offset[2] + layer));

View File

@ -647,7 +647,9 @@ id<MTLComputePipelineState> gpu::MTLTexture::mtl_texture_read_impl(
@"IS_DEPTH_FORMAT" :
[NSNumber numberWithInt:((specialization_params.depth_format_mode > 0) ? 1 : 0)],
@"DEPTH_SCALE_FACTOR" : [NSNumber numberWithLongLong:depth_scale_factor],
@"TEX_TYPE" : [NSNumber numberWithInt:((int)(texture_type))]
@"TEX_TYPE" : [NSNumber numberWithInt:((int)(texture_type))],
@"IS_DEPTHSTENCIL_24_8" :
[NSNumber numberWithInt:(specialization_params.depth_format_mode == 2) ? 1 : 0]
};
/* Prepare shader library for conversion routine. */

View File

@ -263,9 +263,7 @@ vec3 dF_impl(vec3 v)
g_derivative_flag = -1; \
result.y = (fn); \
g_derivative_flag = 0; \
result -= vec2((fn)); \
}
#endif
/* TODO(fclem): Remove. */

View File

@ -12,8 +12,13 @@ void differentiate_texco(vec4 v, out vec3 df)
df = v.xyz + dF_impl(v.xyz);
}
void node_bump(
float strength, float dist, float height, vec3 N, vec2 dHd, float invert, out vec3 result)
void node_bump(float strength,
float dist,
float height,
vec3 N,
vec2 height_xy,
float invert,
out vec3 result)
{
N = normalize(N);
dist *= FrontFacing ? invert : -invert;
@ -29,6 +34,7 @@ void node_bump(
/* Compute surface gradient and determinant. */
float det = dot(dPdx, Rx);
vec2 dHd = height_xy - vec2(height);
vec3 surfgrad = dHd.x * Rx + dHd.y * Ry;
strength = max(strength, 0.0);

View File

@ -84,7 +84,7 @@ AviError AVI_set_compress_option(
case AVI_OPTION_QUALITY:
for (i = 0; i < movie->header->Streams; i++) {
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
movie->streams[i].sh.Quality = (*((int *)opt_data)) * 100;
movie->streams[i].sh.Quality = *((int *)opt_data) * 100;
BLI_fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
awrite(movie,
movie->streams[i].sf,
@ -97,7 +97,7 @@ AviError AVI_set_compress_option(
break;
case AVI_OPTION_FRAMERATE:
useconds = (int)(1000000 / (*((double *)opt_data)));
useconds = (int)(1000000 / *((double *)opt_data));
if (useconds) {
movie->header->MicroSecPerFrame = useconds;
}

View File

@ -109,7 +109,7 @@ extern "C" char build_hash[];
#include <cerrno>
char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
const char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
{
int layer_index = CustomData_get_layer_index(data, type);
if (layer_index < 0) {
@ -119,7 +119,7 @@ char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int
return data->layers[layer_index + n].name;
}
char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
{
/* get the layer index of the active layer of type */
int layer_index = CustomData_get_active_layer_index(data, type);

View File

@ -312,7 +312,7 @@ static bool collect_vertex_counts_per_poly(Mesh *me,
return is_triangulated;
}
std::string GeometryExporter::makeVertexColorSourceId(std::string &geom_id, char *layer_name)
std::string GeometryExporter::makeVertexColorSourceId(std::string &geom_id, const char *layer_name)
{
std::string result = getIdBySemantics(geom_id, COLLADASW::InputSemantic::COLOR) + "-" +
layer_name;
@ -390,7 +390,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
int map_index = 0;
for (int a = 0; a < totlayer_mcol; a++) {
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
COLLADASW::Input input4(COLLADASW::InputSemantic::COLOR,
makeUrl(makeVertexColorSourceId(geom_id, layer_name)),
(has_uvs) ? 3 : 2, /* all color layers have same index order */
@ -489,7 +489,7 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
COLLADASW::FloatSourceF source(mSW);
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_BYTE_COLOR, a);
std::string layer_id = makeVertexColorSourceId(geom_id, layer_name);
source.setId(layer_id);

View File

@ -87,7 +87,7 @@ class GeometryExporter : COLLADASW::LibraryGeometries {
std::string getIdBySemantics(std::string geom_id,
COLLADASW::InputSemantic::Semantics type,
std::string other_suffix = "");
std::string makeVertexColorSourceId(std::string &geom_id, char *layer_name);
std::string makeVertexColorSourceId(std::string &geom_id, const char *layer_name);
COLLADASW::URI getUrlBySemantics(std::string geom_id,
COLLADASW::InputSemantic::Semantics type,

View File

@ -44,7 +44,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial &bind_materia
int active_uv_index = CustomData_get_active_layer_index(&me->ldata, CD_PROP_FLOAT2);
for (int b = 0; b < num_layers; b++) {
if (!active_uv_only || b == active_uv_index) {
char *name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, b);
const char *name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, b);
im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++));
}
}

View File

@ -1076,7 +1076,7 @@ static std::string bc_get_active_uvlayer_name(Mesh *me)
{
int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2);
if (num_layers) {
char *layer_name = bc_CustomData_get_active_layer_name(&me->ldata, CD_PROP_FLOAT2);
const char *layer_name = bc_CustomData_get_active_layer_name(&me->ldata, CD_PROP_FLOAT2);
if (layer_name) {
return std::string(layer_name);
}
@ -1101,7 +1101,7 @@ static std::string bc_get_uvlayer_name(Mesh *me, int layer)
{
int num_layers = CustomData_number_of_layers(&me->ldata, CD_PROP_FLOAT2);
if (num_layers && layer < num_layers) {
char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, layer);
const char *layer_name = bc_CustomData_get_layer_name(&me->ldata, CD_PROP_FLOAT2, layer);
if (layer_name) {
return std::string(layer_name);
}

View File

@ -125,8 +125,8 @@ extern Mesh *bc_get_mesh_copy(BlenderContext &blender_context,
extern Object *bc_get_assigned_armature(Object *ob);
extern bool bc_has_object_type(LinkNode *export_set, short obtype);
extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
extern const char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
extern const char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
/**

View File

@ -286,7 +286,7 @@ void MeshFromGeometry::create_uv_verts(Mesh *mesh)
added_uv = true;
}
else {
uv_map.span[tot_loop_idx] = {0.f, 0.f};
uv_map.span[tot_loop_idx] = {0.0f, 0.0f};
}
tot_loop_idx++;
}

View File

@ -10782,7 +10782,8 @@ static void def_geo_string_to_curves(StructRNA *srna)
RNA_def_property_enum_sdna(prop, NULL, "overflow");
RNA_def_property_enum_items(prop, rna_node_geometry_string_to_curves_overflow_items);
RNA_def_property_enum_default(prop, GEO_NODE_STRING_TO_CURVES_MODE_OVERFLOW);
RNA_def_property_ui_text(prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
RNA_def_property_ui_text(
prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);

View File

@ -285,7 +285,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
CustomData_set_layer_flag(&result->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
}
// BKE_subdiv_stats_print(&subdiv->stats);
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) {
if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv);
}
return result;
@ -317,7 +317,7 @@ static void deformMatrices(ModifierData *md,
return;
}
BKE_subdiv_deform_coarse_vertices(subdiv, mesh, vertex_cos, verts_num);
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) {
if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv);
}
}

View File

@ -59,6 +59,14 @@ static int gpu_shader_bump(GPUMaterial *mat,
const char *height_function = GPU_material_split_sub_function(mat, GPU_FLOAT, &in[2].link);
/* TODO (Miguel Pozo):
* Currently, this doesn't compute the actual differentials, just the height at dX and dY
* offsets. The actual differentials are computed inside the GLSL node_bump function by
* substracting the height input. This avoids redundant computations when the height input is
* also needed by regular nodes as part in the main function (See #103903 for context).
* A better option would be to add a "value" input socket (in this case the height) to the
* differentiate node, but currently this kind of intermediate nodes are pruned in the codegen
* process (see #104265), so we need to fix that first. */
GPUNodeLink *dheight = GPU_differentiate_float_function(height_function);
float invert = (node->custom1) ? -1.0 : 1.0;

View File

@ -504,7 +504,7 @@ static const char *wm_context_member_from_ptr(const bContext *C,
}
case ID_MA: {
# define ID_CAST_OBMATACT(id_pt) \
(BKE_object_material_get(((Object *)id_pt), ((Object *)id_pt)->actcol))
BKE_object_material_get(((Object *)id_pt), ((Object *)id_pt)->actcol)
CTX_TEST_PTR_ID_CAST(
C, "object", "object.active_material", ID_CAST_OBMATACT, ptr->owner_id);
break;

View File

@ -74,8 +74,6 @@ def test_lookup_coverage():
print("----------------------------------")
print("RNA Patterns Unknown to the Manual")
unknown_rna_list = []
for rna_group, rna_id in rna_ids():
# Correct but slower & doesn't track usage.
# url = wm.WM_OT_doc_view_manual._lookup_rna_url(rna_id, verbose=False)

View File

@ -29,6 +29,8 @@ def file_list_py(path):
for dirpath, dirnames, filenames in os.walk(path):
dirnames[:] = [d for d in dirnames if not d.startswith(".")]
for filename in filenames:
if filename.startswith("."):
continue
if filename.endswith((".py", ".cfg")):
yield os.path.join(dirpath, filename)