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.
23 changed files with 135 additions and 101 deletions
Showing only changes of commit b38f8a5701 - Show all commits

View File

@ -424,10 +424,9 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
processTrackpad();
/* PeekMessage above is allowed to dispatch messages to the wndproc without us
/* `PeekMessage` above is allowed to dispatch messages to the `wndproc` without us
* noticing, so we need to check the event manager here to see if there are
* events waiting in the queue.
*/
* events waiting in the queue. */
hasEventHandled |= this->m_eventManager->getNumEvents() > 0;
} while (waitForEvent && !hasEventHandled);

View File

@ -487,7 +487,7 @@ def disable_all():
def _blender_manual_url_prefix():
return "https://docs.blender.org/manual/en/%d.%d" % _bpy.app.version[:2]
return "https://docs.blender.org/manual/%s/%d.%d" % (_bpy.utils.manual_language_code(), *_bpy.app.version[:2])
def module_bl_info(mod, *, info_basis=None):

View File

@ -26,6 +26,7 @@ __all__ = (
"register_tool",
"make_rna_paths",
"manual_map",
"manual_language_code",
"previews",
"resource_path",
"script_path_user",
@ -1035,6 +1036,53 @@ def manual_map():
yield prefix, url_manual_mapping
# Languages which are supported by the user manual (commented when there is no translation).
_manual_language_codes = {
"ar_EG": "ar", # Arabic
# "bg_BG": "bg", # Bulgarian
# "ca_AD": "ca", # Catalan
# "cs_CZ": "cz", # Czech
"de_DE": "de", # German
# "el_GR": "el", # Greek
"es": "es", # Spanish
"fi_FI": "fi", # Finnish
"fr_FR": "fr", # French
"id_ID": "id", # Indonesian
"it_IT": "it", # Italian
"ja_JP": "ja", # Japanese
"ko_KR": "ko", # Korean
# "nb": "nb", # Norwegian
# "nl_NL": "nl", # Dutch
# "pl_PL": "pl", # Polish
"pt_PT": "pt", # Portuguese
# Portuguese - Brazil, for until we have a pt_BR version.
"pt_BR": "pt",
"ru_RU": "ru", # Russian
"sk_SK": "sk", # Slovak
# "sl": "sl", # Slovenian
"sr_RS": "sr", # Serbian
# "sv_SE": "sv", # Swedish
# "tr_TR": "th", # Thai
"uk_UA": "uk", # Ukrainian
"vi_VN": "vi", # Vietnamese
"zh_CN": "zh-hans", # Simplified Chinese
"zh_TW": "zh-hant", # Traditional Chinese
}
def manual_language_code(default="en"):
"""
:return:
The language code used for user manual URL component based on the current language user-preference,
falling back to the ``default`` when unavailable.
:rtype: str
"""
language = _bpy.context.preferences.view.language
if language == 'DEFAULT':
language = _os.getenv("LANG", "").split(".")[0]
return _manual_language_codes.get(language, default)
# Build an RNA path from struct/property/enum names.
def make_rna_paths(struct_name, prop_name, enum_name):
"""

View File

@ -4,38 +4,10 @@
# autopep8: off
import bpy
manual_version = '%d.%d' % bpy.app.version[:2]
url_manual_prefix = "https://docs.blender.org/manual/en/" + manual_version + "/"
language = bpy.context.preferences.view.language
if language == 'DEFAULT':
import os
language = os.getenv('LANG', '').split('.')[0]
LANG = {
"ar_EG": "ar",
"de_DE": "de",
"es": "es",
"fi_FI": "fi",
"fr_FR": "fr",
"id_ID": "id",
"it_IT": "it",
"ja_JP": "ja",
"ko_KR": "ko",
"pt_PT": "pt",
"pt_BR": "pt",
"ru_RU": "ru",
"sk_SK": "sk",
"sr_RS": "sr",
"uk_UA": "uk",
"vi_VN": "vi",
"zh_CN": "zh-hans",
"zh_TW": "zh-hant",
}.get(language)
if LANG is not None:
url_manual_prefix = url_manual_prefix.replace("manual/en", "manual/" + LANG)
url_manual_prefix = "https://docs.blender.org/manual/%s/%d.%d/" % (
bpy.utils.manual_language_code(),
*bpy.app.version[:2],
)
url_manual_mapping = (
("bpy.types.movietrackingsettings.refine_intrinsics_tangential_distortion*", "movie_clip/tracking/clip/toolbar/solve.html#bpy-types-movietrackingsettings-refine-intrinsics-tangential-distortion"),

View File

@ -1056,7 +1056,7 @@ class WM_OT_url_open_preset(Operator):
return "https://www.blender.org/download/releases/%d-%d/" % bpy.app.version[:2]
def _url_from_manual(self, _context):
return "https://docs.blender.org/manual/en/%d.%d/" % bpy.app.version[:2]
return "https://docs.blender.org/manual/%s/%d.%d/" % (bpy.utils.manual_language_code(), *bpy.app.version[:2])
def _url_from_api(self, _context):
return "https://docs.blender.org/api/%d.%d/" % bpy.app.version[:2]

View File

@ -63,7 +63,7 @@ typedef struct FModifierTypeInfo {
/** #eFMI_Action_Types. */
short acttype;
/** #eFMI_Requirement_Flags. */
short requires;
short requires_flag;
/** name of modifier in interface. */
char name[64];
/** name of struct for SDNA. */

View File

@ -229,7 +229,6 @@ void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigne
void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth);
void BKE_mesh_auto_smooth_flag_set(struct Mesh *me, bool use_auto_smooth, float auto_smooth_angle);
/**
* Used for unit testing; compares two meshes, checking only
* differences we care about. should be usable with leaf's

View File

@ -176,7 +176,7 @@ struct MeshRuntime {
/**
* A bit vector the size of the number of edges, set to true for edges that should be drawn in
* the viewport. Created by the "Optimimal Display" feature of the subdivision surface modifier.
* the viewport. Created by the "Optimal Display" feature of the subdivision surface modifier.
* Otherwise it will be empty.
*/
BitVector<> subsurf_optimal_display_edges;

View File

@ -772,7 +772,7 @@ bool get_effector_data(EffectorCache *eff,
if (eff->pd->forcefield == PFIELD_VORTEX || eff->pd->shape == PFIELD_SHAPE_LINE) {
add_v3_v3v3(efd->loc, ob->object_to_world[3], translate);
}
else { /* normally efd->loc is closest point on effector xy-plane */
else { /* Normally `efd->loc` is closest point on effector XY-plane. */
sub_v3_v3v3(efd->loc, point->loc, translate);
}
}
@ -1125,31 +1125,31 @@ void BKE_effectors_apply(ListBase *effectors,
/* WARNING(@ideasman42): historic comment?
* Many of these parameters don't exist!
*
* scene = scene where it runs in, for time and stuff.
* lb = listbase with objects that take part in effecting.
* opco = global coord, as input.
* force = accumulator for force.
* wind_force = accumulator for force only acting perpendicular to a surface.
* speed = actual current speed which can be altered.
* cur_time = "external" time in frames, is constant for static particles.
* loc_time = "local" time in frames, range <0-1> for the lifetime of particle.
* par_layer = layer the caller is in.
* flags = only used for soft-body wind now.
* guide = old speed of particle.
* `scene` = scene where it runs in, for time and stuff.
* `lb` = listbase with objects that take part in effecting.
* `opco` = global coord, as input.
* `force` = accumulator for force.
* `wind_force` = accumulator for force only acting perpendicular to a surface.
* `speed` = actual current speed which can be altered.
* `cur_time` = "external" time in frames, is constant for static particles.
* `loc_time` = "local" time in frames, range <0-1> for the lifetime of particle.
* `par_layer` = layer the caller is in.
* `flags` = only used for soft-body wind now.
* `guide` = old speed of particle.
*/
/*
* Modifies the force on a particle according to its
* relation with the effector object
* Different kind of effectors include:
* Force-fields: Gravity-like attractor
* (force power is related to the inverse of distance to the power of a falloff value)
* Vortex fields: swirling effectors
* (particles rotate around Z-axis of the object. otherwise, same relation as)
* (Force-fields, but this is not done through a force/acceleration)
* Guide: particles on a path
* (particles are guided along a curve bezier or old nurbs)
* (is independent of other effectors)
* - Force-fields: Gravity-like attractor
* (force power is related to the inverse of distance to the power of a falloff value)
* - Vortex fields: swirling effectors
* (particles rotate around Z-axis of the object. otherwise, same relation as)
* (Force-fields, but this is not done through a force/acceleration)
* - Guide: particles on a path
* (particles are guided along a curve bezier or old nurbs)
* (is independent of other effectors)
*/
EffectorCache *eff;
EffectorData efd;

View File

@ -64,7 +64,7 @@ static FModifierTypeInfo FMI_MODNAME = {
/*type*/ FMODIFIER_TYPE_MODNAME,
/*size*/ sizeof(FMod_ModName),
/*acttype*/ FMI_TYPE_SOME_ACTION,
/*requires*/ FMI_REQUIRES_SOME_REQUIREMENT,
/*requires_flag*/ FMI_REQUIRES_SOME_REQUIREMENT,
/*name*/ "Modifier Name",
/*structName*/ "FMod_ModName",
/*storage_size*/ 0,
@ -228,7 +228,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
/*type*/ FMODIFIER_TYPE_GENERATOR,
/*size*/ sizeof(FMod_Generator),
/*acttype*/ FMI_TYPE_GENERATE_CURVE,
/*requires*/ FMI_REQUIRES_NOTHING,
/*requires_flag*/ FMI_REQUIRES_NOTHING,
/*name*/ N_("Generator"),
/*structName*/ "FMod_Generator",
/*storage_size*/ 0,
@ -358,7 +358,7 @@ static FModifierTypeInfo FMI_FN_GENERATOR = {
/*type*/ FMODIFIER_TYPE_FN_GENERATOR,
/*size*/ sizeof(FMod_FunctionGenerator),
/*acttype*/ FMI_TYPE_GENERATE_CURVE,
/*requires*/ FMI_REQUIRES_NOTHING,
/*requires_flag*/ FMI_REQUIRES_NOTHING,
/*name*/ N_("Built-In Function"),
/*structName*/ "FMod_FunctionGenerator",
/*storage_size*/ 0,
@ -471,7 +471,7 @@ static FModifierTypeInfo FMI_ENVELOPE = {
/*type*/ FMODIFIER_TYPE_ENVELOPE,
/*size*/ sizeof(FMod_Envelope),
/*acttype*/ FMI_TYPE_REPLACE_VALUES,
/*requires*/ 0,
/*requires_flag*/ 0,
/*name*/ N_("Envelope"),
/*structName*/ "FMod_Envelope",
/*storage_size*/ 0,
@ -770,7 +770,7 @@ static FModifierTypeInfo FMI_CYCLES = {
/*type*/ FMODIFIER_TYPE_CYCLES,
/*size*/ sizeof(FMod_Cycles),
/*acttype*/ FMI_TYPE_EXTRAPOLATION,
/*requires*/ FMI_REQUIRES_ORIGINAL_DATA,
/*requires_flag*/ FMI_REQUIRES_ORIGINAL_DATA,
/*name*/ CTX_N_(BLT_I18NCONTEXT_ID_ACTION, "Cycles"),
/*structName*/ "FMod_Cycles",
/*storage_size*/ sizeof(tFCMED_Cycles),
@ -832,7 +832,7 @@ static FModifierTypeInfo FMI_NOISE = {
/*type*/ FMODIFIER_TYPE_NOISE,
/*size*/ sizeof(FMod_Noise),
/*acttype*/ FMI_TYPE_REPLACE_VALUES,
/*requires*/ 0,
/*requires_flag*/ 0,
/*name*/ N_("Noise"),
/*structName*/ "FMod_Noise",
/*storage_size*/ 0,
@ -890,7 +890,7 @@ static FModifierTypeInfo FMI_PYTHON = {
/*type*/ FMODIFIER_TYPE_PYTHON,
/*size*/ sizeof(FMod_Python),
/*acttype*/ FMI_TYPE_GENERATE_CURVE,
/*requires*/ FMI_REQUIRES_RUNTIME_CHECK,
/*requires_flag*/ FMI_REQUIRES_RUNTIME_CHECK,
/*name*/ N_("Python"),
/*structName*/ "FMod_Python",
/*storage_size*/ 0,
@ -945,7 +945,7 @@ static FModifierTypeInfo FMI_LIMITS = {
/*type*/ FMODIFIER_TYPE_LIMITS,
/*size*/ sizeof(FMod_Limits),
/*acttype*/ FMI_TYPE_GENERATE_CURVE,
/*requires*/ FMI_REQUIRES_RUNTIME_CHECK, /* XXX... err... */
/*requires_flag*/ FMI_REQUIRES_RUNTIME_CHECK, /* XXX... err... */
/*name*/ N_("Limits"),
/*structName*/ "FMod_Limits",
/*storage_size*/ 0,
@ -1005,7 +1005,7 @@ static FModifierTypeInfo FMI_STEPPED = {
/*type*/ FMODIFIER_TYPE_STEPPED,
/*size*/ sizeof(FMod_Limits),
/*acttype*/ FMI_TYPE_GENERATE_CURVE,
/*requires*/ FMI_REQUIRES_RUNTIME_CHECK, /* XXX... err... */
/*requires_flag*/ FMI_REQUIRES_RUNTIME_CHECK, /* XXX... err... */
/*name*/ N_("Stepped"),
/*structName*/ "FMod_Stepped",
/*storage_size*/ 0,

View File

@ -117,7 +117,7 @@ struct DupliContext {
* decisions. However, new code uses geometry instances in places that weren't using the dupli
* system previously. To fix this, keep track of the last dupli generator type that wasn't a
* geometry set instance.
* */
*/
Vector<short> *dupli_gen_type_stack;
int persistent_id[MAX_DUPLI_RECUR];

View File

@ -590,7 +590,7 @@ static void initialize_all_particles(ParticleSimulationData *sim)
{
ParticleSystem *psys = sim->psys;
ParticleSettings *part = psys->part;
/* Grid distributionsets UNEXIST flag, need to take care of
/* Grid distribution-sets UNEXIST flag, need to take care of
* it here because later this flag is being reset.
*
* We can't do it for any distribution, because it'll then
@ -1931,7 +1931,7 @@ static void sphclassical_density_accum_cb(void *userdata,
return;
}
/* Smoothing factor. Utilize the Wendland kernel. gnuplot:
/* Smoothing factor. Utilize the Wendland kernel. `gnuplot`:
* q1(x) = (2.0 - x)**4 * ( 1.0 + 2.0 * x)
* plot [0:2] q1(x) */
q = qfac / pow3f(pfr->h) * pow4f(2.0f - rij_h) * (1.0f + 2.0f * rij_h);
@ -2021,7 +2021,7 @@ static void sphclassical_force_cb(void *sphdata_v,
NULL, psys, state->co, &pfr, interaction_radius, sphclassical_neighbor_accum_cb);
pressure = stiffness * (pow7f(pa->sphdensity / rest_density) - 1.0f);
/* multiply by mass so that we return a force, not accel */
/* Multiply by mass so that we return a force, not acceleration. */
qfac2 *= sphdata->mass / pow3f(pfr.h);
pfn = pfr.neighbors;
@ -2047,7 +2047,7 @@ static void sphclassical_force_cb(void *sphdata_v,
npressure = stiffness * (pow7f(npa->sphdensity / rest_density) - 1.0f);
/* First derivative of smoothing factor. Utilize the Wendland kernel.
* gnuplot:
* `gnuplot`:
* q2(x) = 2.0 * (2.0 - x)**4 - 4.0 * (2.0 - x)**3 * (1.0 + 2.0 * x)
* plot [0:2] q2(x)
* Particles > 2h away are excluded above. */
@ -2438,15 +2438,17 @@ static float nr_distance_to_vert(float *p,
{
return len_v3v3(p, pce->x0) - radius;
}
/**
* \param t: is the current time for newton rhapson.
* \param fac: is the starting factor for current collision iteration.
* \param col: The particle collision, `col->fac's` are factors for the
* particle sub-frame step start and end during collision modifier step.
*/
static void collision_interpolate_element(ParticleCollisionElement *pce,
float t,
float fac,
ParticleCollision *col)
{
/* t is the current time for newton rhapson */
/* fac is the starting factor for current collision iteration */
/* The col->fac's are factors for the particle subframe step start
* and end during collision modifier step. */
float f = fac + t * (1.0f - fac);
float mul = col->fac1 + f * (col->fac2 - col->fac1);
if (pce->tot > 0) {
@ -3598,19 +3600,21 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
psys_sim_data_free(sim);
}
/* Code for an adaptive time step based on the Courant-Friedrichs-Lewy
* condition. */
/** Code for an adaptive time step based on the Courant-Friedrichs-Lewy condition. */
static const float MIN_TIMESTEP = 1.0f / 101.0f;
/* Tolerance of 1.5 means the last subframe neither favors growing nor
* shrinking (e.g if it were 1.3, the last subframe would tend to be too
* small). */
/**
* Tolerance of 1.5 means the last sub-frame neither favors growing nor shrinking
* (e.g if it were 1.3, the last sub-frame would tend to be too small).
*/
static const float TIMESTEP_EXPANSION_FACTOR = 0.1f;
static const float TIMESTEP_EXPANSION_TOLERANCE = 1.5f;
/* Calculate the speed of the particle relative to the local scale of the
/**
* Calculate the speed of the particle relative to the local scale of the
* simulation. This should be called once per particle during a simulation
* step, after the velocity has been updated. element_size defines the scale of
* the simulation, and is typically the distance to neighboring particles. */
* the simulation, and is typically the distance to neighboring particles.
*/
static void update_courant_num(
ParticleSimulationData *sim, ParticleData *pa, float dtime, SPHData *sphdata, SpinLock *spin)
{

View File

@ -12,7 +12,7 @@ namespace blender::lazy_threading {
* deadlocks.
*/
using HintReceivers = RawStack<RawVector<FunctionRef<void()>, 0>, 0>;
thread_local HintReceivers hint_receivers = []() {
static thread_local HintReceivers hint_receivers = []() {
HintReceivers receivers;
/* Make sure there is always at least one vector. */
receivers.push_as();

View File

@ -1467,7 +1467,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
for (me = bmain->meshes.first; me; me = me->id.next) {
if (!me->medge) {
BKE_mesh_calc_edges_legacy(me);
BKE_mesh_calc_edges_legacy(me);
}
else {
BKE_mesh_strip_loose_faces(me);

View File

@ -449,7 +449,7 @@ void ShadowDirectional::cascade_tilemaps_distribution(Light &light, const Camera
}
/************************************************************************
* Clipmap Distribution *
* Clip-map Distribution *
************************************************************************/
IndexRange ShadowDirectional::clipmap_level_range(const Camera &camera)
@ -593,7 +593,7 @@ void ShadowDirectional::end_sync(Light &light, const Camera &camera, float lod_b
for (int64_t i = 0; i < before_range; i++) {
tilemaps_.append(tilemap_pool.acquire());
}
/* Keep cached lods. */
/* Keep cached LOD's. */
tilemaps_.extend(cached_tilemaps);
for (int64_t i = 0; i < after_range; i++) {
tilemaps_.append(tilemap_pool.acquire());

View File

@ -268,7 +268,7 @@ class ShadowModule {
/** \name Debugging
* \{ */
/** Display informations about the virtual shadows. */
/** Display information about the virtual shadows. */
PassSimple debug_draw_ps_ = {"Shadow.Debug"};
/** \} */

View File

@ -103,7 +103,7 @@ static void fmodifier_reorder(bContext *C, Panel *panel, int new_index)
const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(fcm->type);
/* Cycles modifier has to be the first, so make sure it's kept that way. */
if (fmi->requires & FMI_REQUIRES_ORIGINAL_DATA) {
if (fmi->requires_flag & FMI_REQUIRES_ORIGINAL_DATA) {
WM_report(RPT_ERROR, "Modifier requires original data");
return;
}
@ -113,7 +113,7 @@ static void fmodifier_reorder(bContext *C, Panel *panel, int new_index)
/* Again, make sure we don't move a modifier before a cycles modifier. */
FModifier *fcm_first = modifiers->first;
const FModifierTypeInfo *fmi_first = get_fmodifier_typeinfo(fcm_first->type);
if (fmi_first->requires & FMI_REQUIRES_ORIGINAL_DATA && new_index == 0) {
if (fmi_first->requires_flag & FMI_REQUIRES_ORIGINAL_DATA && new_index == 0) {
WM_report(RPT_ERROR, "Modifier requires original data");
return;
}

View File

@ -25,8 +25,11 @@ struct AssetMetaData *ED_asset_handle_get_metadata(const struct AssetHandle *ass
struct ID *ED_asset_handle_get_local_id(const struct AssetHandle *asset);
ID_Type ED_asset_handle_get_id_type(const struct AssetHandle *asset);
int ED_asset_handle_get_preview_icon_id(const struct AssetHandle *asset);
void ED_asset_handle_get_full_library_path(const struct AssetHandle *asset,
char r_full_lib_path[]);
void ED_asset_handle_get_full_library_path(
const struct AssetHandle *asset,
/* `1090` for #FILE_MAX_LIBEXTRA,
* rely on warnings to let us know if this gets out of sync. */
char r_full_lib_path[1090]);
#ifdef __cplusplus
}

View File

@ -150,12 +150,12 @@ bool select_pick(const ViewContext &vc,
const int2 mval);
/**
* Select points or curves in a (screenspace) rectangle.
* Select points or curves in a (screen-space) rectangle.
*/
bool select_box(const ViewContext &vc,
bke::CurvesGeometry &curves,
const eAttrDomain selection_domain,
const rcti& rect,
const rcti &rect,
const eSelectOp sel_op);
/** \} */

View File

@ -205,9 +205,11 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
int len;
int *zval;
if (BIG_LONG(1) == 1) {
return;
}
/* `BIG_LONG(1) == 1`, no change needed. */
#ifdef __BIG_ENDIAN__
return;
#endif
if (ibuf->zbuf == NULL) {
return;
}

View File

@ -21,7 +21,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(N_("Index of the face group inside each boundary edge region"));
}
/* Join all uinque unordered combinations of indices. */
/** Join all unique unordered combinations of indices. */
static void join_indices(AtomicDisjointSet &set, const Span<int> indices)
{
for (const int i : indices.index_range()) {

View File

@ -584,9 +584,13 @@ int main(int argc,
}
WM_main(C);
}
#endif /* WITH_PYTHON_MODULE */
/* Neither #WM_exit, #WM_main return, this quiets CLANG's `unreachable-code-return` warning. */
BLI_assert_unreachable();
#endif /* !WITH_PYTHON_MODULE */
return 0;
} /* End of `int main(...)` function. */
#ifdef WITH_PYTHON_MODULE

View File

@ -478,6 +478,7 @@ static int arg_handle_print_version(int UNUSED(argc),
{
print_version_full();
exit(0);
BLI_assert_unreachable();
return 0;
}
@ -684,6 +685,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
# endif
exit(0);
BLI_assert_unreachable();
return 0;
}
@ -1236,6 +1238,7 @@ static int arg_handle_env_system_set(int argc, const char **argv, void *UNUSED(d
if (argc < 2) {
fprintf(stderr, "%s requires one argument\n", argv[0]);
exit(1);
BLI_assert_unreachable();
}
for (; *ch_src; ch_src++, ch_dst++) {