Merge commit 'master' into blender-v2.80-release

This commit is contained in:
Brecht Van Lommel 2019-07-18 16:09:26 +02:00
commit 3176328a88
58 changed files with 506 additions and 151 deletions

View File

@ -300,7 +300,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
)
min_transparent_bounces: IntProperty(
name="Min Transparent Bounces",
description="Minimum number of transparnet bounces. Setting this higher reduces noise in the first bounces, "
description="Minimum number of transparent bounces. Setting this higher reduces noise in the first bounces, "
"but can also be less efficient for more complex geometry like hair and volumes",
min=0, max=1024,
default=0,

View File

@ -1,34 +1,50 @@
Bundling guide:
Have your signing identity ready, you can check it by running:
macOS app bundling guide
========================
$ secruity find-identity -v -p codesign
Install Code Signing Certificate
--------------------------------
Check that your appleID has two step verification and app specified password generated. https://support.apple.com/en-us/HT204397
Add it to the login keychain so it won't be in cleartext.
* Go to https://developer.apple.com/account/resources/certificates/list
* Download the Developer ID Application certifate.
* Double click the file and add to key chain (default options).
* Delete the file from the Downloads folder.
$ security add-generic-password -a "AC_USERNAME" -w <secret> -s "AC_PASSWORD"
Find the codesigning identity by running:
You need then to make sure altool can access your keychain. First time run, there is popup, always allow. Or you can also add it on Keychain Access.
$ security find-identity -v -p codesigning
Then you can make neat bundle using ./bundle.sh by
"Developer ID Application: Stichting Blender Foundation" is the identity needed.
The long code at the start of the line is used as <identity> below.
$ ./bundle.sh --source <sourcedir> --dmg <dmg> --bundle-id <bundleid> --username <username> --password <password> --codesign <identity>
Setup Apple ID
--------------
where:
* The Apple ID must have two step verification enabled.
* Create an app specific password for the code signing app (label can be anything):
https://support.apple.com/en-us/HT204397
* Add the app specific password to keychain:
<sourcedir> directory where built Blender.app is
<dmg> location and name of the final disk image
<bundleid> id on notarization, you choose (for example org.blender.release)
<username> your appleid
<password> your password. having it in keychain, use "@keychain:AC_PASSWORD"
<identity> codesigning identity
$ security add-generic-password -a <apple-id> -w <app-specific-password> -s altool-password
Only --sourcedir and --dmg are required flags.
When running the bundle script, there will be a popup. To avoid that either:
* Click Always Allow in the popup
* In the Keychain Access app, change the Access Control settings on altool-password
Bundle
------
Then the bundle is created as follows:
$ ./bundle.sh --source <sourcedir> --dmg <dmg> --bundle-id <bundleid> --username <apple-id> --password "@keychain:altool-password" --codesign <identity>
<sourcedir> directory where built Blender.app is
<dmg> location and name of the final disk image
<bundleid> id on notarization, for example org.blenderfoundation.blender.release
<apple-id> your appleid email
<identity> codesigning identity
When specifying only --sourcedir and --dmg, the build will not be signed.
Example :
$ ./bundle.sh --source /data/build --dmg /data/Blender-2.8-alpha-macOS-10.11.dmg --bundle-id org.blender.alpha --username "foo@mac.com" --password "@keychain:AC_PASSWORD" --codesign AE825E26F12D08B692F360133210AF46F4CF7B97
$ ./bundle.sh --source /data/build/bin --dmg /data/Blender-2.8-alpha-macOS-10.11.dmg --bundle-id org.blenderfoundation.blender.release --username "foo@mac.com" --password "@keychain:altool-password" --codesign AE825E26F12D08B692F360133210AF46F4CF7B97

View File

@ -18,6 +18,7 @@ _tmp_dir="$(mktemp -d)"
_tmp_dmg="/tmp/blender-tmp.dmg"
_background_image="${_script_dir}/background.tif"
_mount_dir="/Volumes/${_volume_name}"
_entitlements="${_script_dir}/entitlements.plist"
# Handle arguments.
while [[ $# -gt 0 ]]; do
@ -124,12 +125,21 @@ sleep 5
if [ ! -z "${C_CERT}" ]; then
# Codesigning requires all libs and binaries to be signed separately.
# TODO: use find to get the list automatically
echo -n "Codesigning..."
codesign --timestamp --options runtime --sign "${C_CERT}" "${_mount_dir}/Blender.app/Contents/Resources/*/python/bin/python*"
codesign --timestamp --options runtime --sign "${C_CERT}" "${_mount_dir}/Blender.app/Contents/Resources/*/python/lib/python*/site-packages/libextern_draco.dylib"
codesign --timestamp --options runtime --sign "${C_CERT}" "${_mount_dir}/Blender.app/Contents/Resources/lib/libomp.dylib"
codesign --timestamp --options runtime --sign "${C_CERT}" "${_mount_dir}/Blender.app"
echo -n "Codesigning Python"
for f in $(find "${_mount_dir}/Blender.app/Contents/Resources" -name "python*"); do
if [ -x ${f} ] && [ ! -d ${f} ]; then
codesign --remove-signature "${f}"
codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${f}"
fi
done
echo ; echo -n "Codesigning .dylib and .so libraries"
for f in $(find "${_mount_dir}/Blender.app" -name "*.dylib" -o -name "*.so"); do
codesign --remove-signature "${f}"
codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${f}"
done
echo ; echo -n "Codesigning Blender.app"
codesign --remove-signature "${_mount_dir}/Blender.app"
codesign --timestamp --options runtime --entitlements="${_entitlements}" --sign "${C_CERT}" "${_mount_dir}/Blender.app"
echo
else
echo "No codesigning cert given, skipping..."
@ -161,6 +171,7 @@ if [ ! -z "${N_USERNAME}" ] && [ ! -z "${N_PASSWORD}" ] && [ ! -z "${N_BUNDLE_ID
# Send to Apple
echo -n "Sending ${DEST_DMG} for notarization..."
_tmpout=$(mktemp)
echo xcrun altool --notarize-app -f "${DEST_DMG}" --primary-bundle-id "${N_BUNDLE_ID}" --username "${N_USERNAME}" --password "${N_PASSWORD}"
xcrun altool --notarize-app -f "${DEST_DMG}" --primary-bundle-id "${N_BUNDLE_ID}" --username "${N_USERNAME}" --password "${N_PASSWORD}" >${_tmpout} 2>&1
# Parse request uuid

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- For Python ctypes to work. -->
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<!-- For loading unsigned dylib plugins. -->
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<!-- For LLVM. -->
<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>

View File

@ -143,9 +143,18 @@ _km_hierarchy = [
('Timeline', 'TIMELINE', 'WINDOW', []),
('Image', 'IMAGE_EDITOR', 'WINDOW', [
('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image)
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
# Image (reverse order, UVEdit before Image).
('UV Editor', 'EMPTY', 'WINDOW', [
_km_expand_from_toolsystem('IMAGE_EDITOR', 'UV'),
]),
('UV Sculpt', 'EMPTY', 'WINDOW', []),
# Image and view3d.
('Image Paint', 'EMPTY', 'WINDOW', [
_km_expand_from_toolsystem('IMAGE_EDITOR', 'PAINT'),
]),
('Image View', 'IMAGE_EDITOR', 'WINDOW', [
_km_expand_from_toolsystem('IMAGE_EDITOR', 'VIEW'),
]),
('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [
_km_expand_from_toolsystem('IMAGE_EDITOR', None),
]),

View File

@ -279,7 +279,10 @@ def _template_items_proportional_editing(*, connected=False):
def _template_items_tool_select(params, operator, cursor_operator):
if params.select_mouse == 'LEFTMOUSE':
# Immediate select without quick delay.
return [(operator, {"type": 'LEFTMOUSE', "value": 'PRESS'}, None)]
return [
(operator, {"type": 'LEFTMOUSE', "value": 'PRESS'},
{"properties": [("deselect_all", True)]}),
]
else:
# For right mouse, set the cursor.
return [
@ -337,7 +340,7 @@ def km_window(params):
)
if params.legacy:
# Old shorctus
# Old shortcuts
items.extend([
("wm.save_homefile", {"type": 'U', "value": 'PRESS', "ctrl": True}, None),
("wm.open_mainfile", {"type": 'F1', "value": 'PRESS'}, None),

View File

@ -483,7 +483,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
col = layout.column()
col.enabled = (obj.mode != 'EDIT')
col.enabled = obj is not None and obj.mode != 'EDIT'
col.prop(me, "use_customdata_vertex_bevel")
col.prop(me, "use_customdata_edge_bevel")
col.prop(me, "use_customdata_edge_crease")

View File

@ -240,6 +240,7 @@ class TEXT_MT_templates_py(Menu):
bpy.utils.script_paths("templates_py"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".py")
)
@ -251,6 +252,7 @@ class TEXT_MT_templates_osl(Menu):
bpy.utils.script_paths("templates_osl"),
"text.open",
props_default={"internal": True},
filter_ext=lambda ext: (ext.lower() == ".osl")
)

View File

@ -40,17 +40,22 @@ class USERPREF_HT_header(Header):
row = layout.row()
row.menu("USERPREF_MT_save_load", text="", icon='COLLAPSEMENU')
# Use '_is_startup' so once factory settings are loaded
# this display option will show, since it's confusing if disabling
# the option makes it dissapiers.
if prefs.use_preferences_save:
if bpy.app.use_userpref_skip_save_on_exit:
# We should have an 'alert' icon, for now use 'error'.
use_userpref_skip_save_on_exit = bpy.app.use_userpref_skip_save_on_exit
if use_userpref_skip_save_on_exit or getattr(USERPREF_HT_header, "_is_startup", False):
USERPREF_HT_header._is_startup = True
sub = row.row(align=True)
sub.alignment = 'LEFT'
props = sub.operator(
"wm.context_toggle",
"preferences.autosave_override_toggle",
text="Skip Auto-Save",
icon='CHECKBOX_HLT',
emboss=False,
icon='CHECKBOX_HLT' if use_userpref_skip_save_on_exit else 'CHECKBOX_DEHLT',
)
props.module = "bpy.app"
props.data_path = "use_userpref_skip_save_on_exit"
else:
sub = row.row(align=True)
sub.active = prefs.is_dirty

View File

@ -3224,11 +3224,6 @@ class VIEW3D_MT_pose_context_menu(Menu):
layout.separator()
layout.operator("pose.paths_calculate", text="Calculate")
layout.operator("pose.paths_clear", text="Clear")
layout.separator()
layout.operator("pose.push")
layout.operator("pose.relax")
layout.operator("pose.breakdown")

View File

@ -44,7 +44,7 @@ def example_function(text, save_path, render_path):
# Light
light_data = bpy.data.lights.new("MyLight", 'POINT')
light_ob = bpy.data.objects.new(name="MyCam", object_data=light_data)
light_ob = bpy.data.objects.new(name="MyLight", object_data=light_data)
scene.collection.objects.link(light_ob)
light_ob.location = 2.0, 2.0, 5.0

View File

@ -71,7 +71,6 @@ typedef struct Global {
* * -1: Disable faster motion paths computation (since 08/2018).
* * 1 - 30: EEVEE debug/stats values (01/2018).
* * 101: Enable UI debug drawing of fullscreen area's corner widget (10/2014).
* * 474: Disable sleeping in `gpu_select_query_end`.
* * 527: Old mysterious switch in behavior of MeshDeform modifier (before 04/2010).
* * 666: Use quicker batch delete for outliners' delete hierarchy (01/2019).
* * 777: Enable UI node panel's sockets polling (11/2011).

View File

@ -729,6 +729,21 @@ void BKE_pose_channels_hash_free(bPose *pose)
}
}
static void pose_channels_remove_internal_links(Object *ob, bPoseChannel *unlinked_pchan)
{
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
if (pchan->bbone_prev == unlinked_pchan) {
pchan->bbone_prev = NULL;
}
if (pchan->bbone_next == unlinked_pchan) {
pchan->bbone_next = NULL;
}
if (pchan->custom_tx == unlinked_pchan) {
pchan->custom_tx = NULL;
}
}
}
/**
* Selectively remove pose channels.
*/
@ -747,6 +762,7 @@ void BKE_pose_channels_remove(Object *ob,
if (filter_fn(pchan->name, user_data)) {
/* Bone itself is being removed */
BKE_pose_channel_free(pchan);
pose_channels_remove_internal_links(ob, pchan);
if (ob->pose->chanhash) {
BLI_ghash_remove(ob->pose->chanhash, pchan->name, NULL, NULL);
}

View File

@ -1216,9 +1216,11 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
{
/* Init modifier */
tpmd->type = pmd->type;
if ((pmd->canvas && pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) ||
(pmd->brush && pmd->type == MOD_DYNAMICPAINT_TYPE_BRUSH)) {
dynamicPaint_createType(tpmd, pmd->type, NULL);
if (pmd->canvas) {
dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_CANVAS, NULL);
}
if (pmd->brush) {
dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_BRUSH, NULL);
}
/* Copy data */
@ -1230,6 +1232,8 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
dynamicPaint_freeSurface(tpmd, tpmd->canvas->surfaces.first);
}
tpmd->canvas->active_sur = pmd->canvas->active_sur;
/* copy existing surfaces */
for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
DynamicPaintSurface *t_surface = dynamicPaint_createNewSurface(tpmd->canvas, NULL);
@ -1296,7 +1300,7 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
BLI_strncpy(t_surface->output_name2, surface->output_name2, sizeof(t_surface->output_name2));
}
}
else if (tpmd->brush) {
if (tpmd->brush) {
DynamicPaintBrushSettings *brush = pmd->brush, *t_brush = tpmd->brush;
t_brush->pmd = tpmd;
@ -2019,6 +2023,8 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
if (defgrp_index != -1 && !dvert && (surface->output_name[0] != '\0')) {
dvert = CustomData_add_layer(
&result->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, sData->total_points);
/* Make the dvert layer easily accessible from the mesh data. */
result->dvert = dvert;
}
if (defgrp_index != -1 && dvert) {
int i;

View File

@ -1144,7 +1144,8 @@ static void id_delete(Main *bmain, const bool do_tagged_deletion)
#ifdef DEBUG_PRINT
printf("%s: deleting %s (%d)\n", __func__, id->name, id->us);
#endif
BLI_assert(id->us == 0);
/* Text always has a single user, skip assert in this case. */
BLI_assert((id->us == 0) || ELEM(GS(id->name), ID_TXT));
}
BKE_id_free_ex(bmain, id, free_flag, !do_tagged_deletion);
}

View File

@ -1645,7 +1645,7 @@ static int psys_map_index_on_dm(Mesh *mesh,
* to their new location, which means a different index, and for faces
* also a new face interpolation weights */
if (from == PART_FROM_VERT) {
if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > mesh->totvert) {
if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache >= mesh->totvert) {
return 0;
}

View File

@ -962,15 +962,31 @@ static void subdiv_ccg_average_inner_face_grids(SubdivCCG *subdiv_ccg,
const int num_face_grids = face->num_grids;
const int grid_size = subdiv_ccg->grid_size;
CCGElem *prev_grid = grids[face->start_grid_index + num_face_grids - 1];
/* Average boundary between neighbor grid. */
for (int corner = 0; corner < num_face_grids; corner++) {
CCGElem *grid = grids[face->start_grid_index + corner];
for (int i = 0; i < grid_size; i++) {
for (int i = 1; i < grid_size; i++) {
CCGElem *prev_grid_element = CCG_grid_elem(key, prev_grid, i, 0);
CCGElem *grid_element = CCG_grid_elem(key, grid, 0, i);
average_grid_element(subdiv_ccg, key, prev_grid_element, grid_element);
}
prev_grid = grid;
}
/* Average all grids centers into a single accumulator, and share it.
* Guarantees corrent and smooth averaging in the center. */
GridElementAccumulator center_accumulator;
element_accumulator_init(&center_accumulator);
for (int corner = 0; corner < num_face_grids; corner++) {
CCGElem *grid = grids[face->start_grid_index + corner];
CCGElem *grid_center_element = CCG_grid_elem(key, grid, 0, 0);
element_accumulator_add(&center_accumulator, subdiv_ccg, key, grid_center_element);
}
element_accumulator_mul_fl(&center_accumulator, 1.0f / (float)num_face_grids);
for (int corner = 0; corner < num_face_grids; corner++) {
CCGElem *grid = grids[face->start_grid_index + corner];
CCGElem *grid_center_element = CCG_grid_elem(key, grid, 0, 0);
element_accumulator_copy(subdiv_ccg, key, grid_center_element, &center_accumulator);
}
}
static void subdiv_ccg_average_inner_grids_task(void *__restrict userdata_v,

View File

@ -427,7 +427,7 @@ void BKE_undosys_stack_limit_steps_and_memory(UndoStack *ustack, int steps, size
/* Hack, we need to keep at least one BKE_UNDOSYS_TYPE_MEMFILE. */
if (us->type != BKE_UNDOSYS_TYPE_MEMFILE) {
us_exclude = us->prev;
while (us_exclude && us->type != BKE_UNDOSYS_TYPE_MEMFILE) {
while (us_exclude && us_exclude->type != BKE_UNDOSYS_TYPE_MEMFILE) {
us_exclude = us_exclude->prev;
}
if (us_exclude) {

View File

@ -303,12 +303,24 @@ void *BLI_file_read_text_as_mem(const char *filepath, size_t pad_bytes, size_t *
void *mem = NULL;
if (fp) {
fseek(fp, 0L, SEEK_END);
struct stat st;
if (fstat(fileno(fp), &st) == -1) {
goto finally;
}
if (S_ISDIR(st.st_mode)) {
goto finally;
}
if (fseek(fp, 0L, SEEK_END) == -1) {
goto finally;
}
/* Don't use the 'st_size' because it may be the symlink. */
const long int filelen = ftell(fp);
if (filelen == -1) {
goto finally;
}
fseek(fp, 0L, SEEK_SET);
if (fseek(fp, 0L, SEEK_SET) == -1) {
goto finally;
}
mem = MEM_mallocN(filelen + pad_bytes, __func__);
if (mem == NULL) {
@ -344,12 +356,24 @@ void *BLI_file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t
void *mem = NULL;
if (fp) {
fseek(fp, 0L, SEEK_END);
struct stat st;
if (fstat(fileno(fp), &st) == -1) {
goto finally;
}
if (S_ISDIR(st.st_mode)) {
goto finally;
}
if (fseek(fp, 0L, SEEK_END) == -1) {
goto finally;
}
/* Don't use the 'st_size' because it may be the symlink. */
const long int filelen = ftell(fp);
if (filelen == -1) {
goto finally;
}
fseek(fp, 0L, SEEK_SET);
if (fseek(fp, 0L, SEEK_SET) == -1) {
goto finally;
}
mem = MEM_mallocN(filelen + pad_bytes, __func__);
if (mem == NULL) {

View File

@ -3504,6 +3504,30 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
COLLECTION_RESTRICT_SELECT |
COLLECTION_RESTRICT_RENDER);
}
UnitSettings *unit = &scene->unit;
if (unit->system == USER_UNIT_NONE) {
unit->length_unit = (char)USER_UNIT_ADAPTIVE;
unit->mass_unit = (char)USER_UNIT_ADAPTIVE;
}
RenderData *render_data = &scene->r;
switch (render_data->ffcodecdata.ffmpeg_preset) {
case FFM_PRESET_ULTRAFAST:
case FFM_PRESET_SUPERFAST:
render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_REALTIME;
break;
case FFM_PRESET_VERYFAST:
case FFM_PRESET_FASTER:
case FFM_PRESET_FAST:
case FFM_PRESET_MEDIUM:
render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_GOOD;
break;
case FFM_PRESET_SLOW:
case FFM_PRESET_SLOWER:
case FFM_PRESET_VERYSLOW:
render_data->ffcodecdata.ffmpeg_preset = FFM_PRESET_BEST;
}
}
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {

View File

@ -804,7 +804,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
matNode.set_alpha(ef->getOpaqueMode(), ef->getTransparent(), ef->getTransparency());
/* following mapping still needs to be verified */
#if 0
// needs rework to be done for 2.81
matNode.set_shininess(ef->getShininess());
#endif
matNode.set_reflectivity(ef->getReflectivity());
/* not supported by principled BSDF */

View File

@ -208,21 +208,20 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
COLLADASW::EffectProfile ep(mSW);
ep.setProfileType(COLLADASW::EffectProfile::COMMON);
ep.openProfile();
set_shader_type(ep, ma);
set_shader_type(ep, ma); // creates a Lambert Shader for now
COLLADASW::ColorOrTexture cot;
set_diffuse_color(ep, ma);
set_emission(ep, ma);
set_ior(ep, ma);
set_shininess(ep, ma);
set_reflectivity(ep, ma);
set_transparency(ep, ma);
/* TODO: from where to get ambient, specular and reflective? */
/* TODO: */
// set_shininess(ep, ma); shininess not supported for lambert
// set_ambient(ep, ma);
// set_specular(ep, ma);
// set_reflective(ep, ma);
get_images(ma, material_image_map);
std::string active_uv(getActiveUVLayerName(ob));

View File

@ -131,18 +131,24 @@ void MaterialNode::add_link(bNode *from_node, int from_index, bNode *to_node, in
void MaterialNode::set_reflectivity(COLLADAFW::FloatOrParam &val)
{
float reflectivity = val.getFloatValue();
bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Metallic");
((bNodeSocketValueFloat *)socket->default_value)->value = reflectivity;
material->metallic = reflectivity;
if (reflectivity >= 0) {
bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Metallic");
((bNodeSocketValueFloat *)socket->default_value)->value = reflectivity;
material->metallic = reflectivity;
}
}
#if 0
// needs rework to be done for 2.81
void MaterialNode::set_shininess(COLLADAFW::FloatOrParam &val)
{
float roughness = val.getFloatValue();
bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Roughness");
((bNodeSocketValueFloat *)socket->default_value)->value = roughness;
if (roughness >= 0) {
bNodeSocket *socket = nodeFindSocket(shader_node, SOCK_IN, "Roughness");
((bNodeSocketValueFloat *)socket->default_value)->value = roughness;
}
}
#endif
void MaterialNode::set_ior(COLLADAFW::FloatOrParam &val)
{

View File

@ -1528,6 +1528,19 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask)
NodeType::PARAMETERS,
OperationCode::MASK_EVAL,
function_bind(BKE_mask_eval_update, _1, mask_cow));
/* Build parents. */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
MaskParent *parent = &point->parent;
if (parent == NULL || parent->id == NULL) {
continue;
}
build_id(parent->id);
}
}
}
}
void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip)

View File

@ -2329,6 +2329,24 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask)
/* Final mask evaluation. */
OperationKey mask_eval_key(mask_id, NodeType::PARAMETERS, OperationCode::MASK_EVAL);
add_relation(mask_animation_key, mask_eval_key, "Mask Animation -> Mask Eval");
/* Build parents. */
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
MaskParent *parent = &point->parent;
if (parent == NULL || parent->id == NULL) {
continue;
}
build_id(parent->id);
if (parent->id_type == ID_MC) {
OperationKey movieclip_eval_key(
parent->id, NodeType::PARAMETERS, OperationCode::MOVIECLIP_EVAL);
add_relation(movieclip_eval_key, mask_eval_key, "Movie Clip -> Mask Eval");
}
}
}
}
}
void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip)

View File

@ -578,6 +578,7 @@ void update_armature_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
const bArmature *armature_orig = (const bArmature *)id_orig;
bArmature *armature_cow = (bArmature *)id_cow;
armature_cow->edbo = armature_orig->edbo;
armature_cow->act_edbone = armature_orig->act_edbone;
}
void update_curve_edit_mode_pointers(const Depsgraph * /*depsgraph*/,
@ -684,8 +685,13 @@ void set_particle_system_modifiers_loaded(Object *object_cow)
}
}
void reset_particle_system_edit_eval(Object *object_cow)
void reset_particle_system_edit_eval(const Depsgraph *depsgraph, Object *object_cow)
{
/* Inactive (and render) dependency graphs are living in own little bubble, should not care about
* edit mode at all. */
if (!DEG_is_active(reinterpret_cast<const ::Depsgraph *>(depsgraph))) {
return;
}
LISTBASE_FOREACH (ParticleSystem *, psys, &object_cow->particlesystem) {
ParticleSystem *orig_psys = psys->orig_psys;
if (orig_psys->edit != NULL) {
@ -695,11 +701,13 @@ void reset_particle_system_edit_eval(Object *object_cow)
}
}
void update_particles_after_copy(const Object *object_orig, Object *object_cow)
void update_particles_after_copy(const Depsgraph *depsgraph,
const Object *object_orig,
Object *object_cow)
{
update_particle_system_orig_pointers(object_orig, object_cow);
set_particle_system_modifiers_loaded(object_cow);
reset_particle_system_edit_eval(object_cow);
reset_particle_system_edit_eval(depsgraph, object_cow);
}
void update_pose_orig_pointers(const bPose *pose_orig, bPose *pose_cow)
@ -778,7 +786,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
}
BKE_pose_pchan_index_rebuild(object_cow->pose);
}
update_particles_after_copy(object_orig, object_cow);
update_particles_after_copy(depsgraph, object_orig, object_cow);
update_modifiers_orig_pointers(object_orig, object_cow);
break;
}

View File

@ -97,6 +97,9 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata),
int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2};
buffer_size[0] = max_ii(1, buffer_size[0]);
buffer_size[1] = max_ii(1, buffer_size[1]);
eGPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
effects->dof_down_near = DRW_texture_pool_query_2d(

View File

@ -71,6 +71,8 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
View3D *v3d = draw_ctx->v3d;
Scene *scene = draw_ctx->scene;
effects->lookdev_view = NULL;
if (LOOK_DEV_OVERLAY_ENABLED(v3d)) {
/* Viewport / Spheres size. */
rcti rect;

View File

@ -159,6 +159,9 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
const bool high_qual_input = true; /* TODO dither low quality input */
const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
tracing_res[0] = max_ii(1, tracing_res[0]);
tracing_res[1] = max_ii(1, tracing_res[1]);
/* MRT for the shading pass in order to output needed data for the SSR pass. */
effects->ssr_specrough_input = DRW_texture_pool_query_2d(
size_fs[0], size_fs[1], format, &draw_engine_eevee_type);

View File

@ -173,7 +173,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera)
}
const float *full_size = DRW_viewport_size_get();
int size[2] = {full_size[0] / 2, full_size[1] / 2};
int size[2] = {max_ii(1, (int)full_size[0] / 2), max_ii(1, (int)full_size[1] / 2)};
#if 0
/* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */
int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]};

View File

@ -883,7 +883,7 @@ static void update_color(const Object *ob, const float const_color[4])
#define NO_ALPHA(c) (((c)[3] = 1.0f), (c))
UI_GetThemeColor3fv(TH_SELECT, NO_ALPHA(g_theme.select_color));
UI_GetThemeColor3fv(TH_EDGE_SELECT, NO_ALPHA(g_theme.edge_select_color));
UI_GetThemeColorShade3fv(TH_EDGE_SELECT, 60, NO_ALPHA(g_theme.edge_select_color));
UI_GetThemeColorShade3fv(TH_EDGE_SELECT, -20, NO_ALPHA(g_theme.bone_select_color));
UI_GetThemeColor3fv(TH_WIRE, NO_ALPHA(g_theme.wire_color));
UI_GetThemeColor3fv(TH_WIRE_EDIT, NO_ALPHA(g_theme.wire_edit_color));
@ -1886,19 +1886,23 @@ static void draw_armature_edit(Object *ob)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
EditBone *eBone;
bArmature *arm = ob->data;
int index;
const bool is_select = DRW_state_is_select();
update_color(ob, NULL);
edbo_compute_bbone_child(arm);
const bool show_text = DRW_state_show_text();
const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
const Object *orig_object = DEG_get_original_object(ob);
const Object *ob_orig = DEG_get_original_object(ob);
/* FIXME(campbell): We should be able to use the CoW object,
* however the active bone isn't updated. Long term solution is an 'EditArmature' struct.
* for now we can draw from the original armature. See: T66773. */
// bArmature *arm = ob->data;
bArmature *arm = ob_orig->data;
for (eBone = arm->edbo->first, index = orig_object->runtime.select_id; eBone;
update_color(ob, NULL);
edbo_compute_bbone_child(arm);
for (eBone = arm->edbo->first, index = ob_orig->runtime.select_id; eBone;
eBone = eBone->next, index += 0x10000) {
if (eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A) == 0) {
@ -1993,8 +1997,8 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
}
if (arm->flag & ARM_POSEMODE) {
const Object *orig_object = DEG_get_original_object(ob);
index = orig_object->runtime.select_id;
const Object *ob_orig = DEG_get_original_object(ob);
index = ob_orig->runtime.select_id;
}
}

View File

@ -3018,7 +3018,7 @@ static void mesh_create_loop_edge_fac(MeshRenderData *rdata, GPUVertBuf *vbo)
BM_ITER_ELEM (loop, &iter_loop, efa, BM_LOOPS_OF_FACE) {
float ratio = mesh_loop_edge_factor_get(
efa->no, loop->v->co, loop->v->no, loop->next->v->co);
vertbuf_raw_step(&wd_step, ratio * 255);
vertbuf_raw_step(&wd_step, ratio * 253 + 1);
}
}
BLI_assert(GPU_vertbuf_raw_used(&wd_step) == loop_len);

View File

@ -141,7 +141,8 @@ GPUBatch *DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist,
GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_instancing);
bool is_compatible = (batch->gl_prim_type == geom->gl_prim_type) && (batch->inst == buf) &&
(buf->vbo_id != 0) && (batch->phase == GPU_BATCH_READY_TO_DRAW);
(buf->vbo_id != 0) && (batch->phase == GPU_BATCH_READY_TO_DRAW) &&
(batch->elem == geom->elem);
for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) {
if (batch->verts[i] != geom->verts[i]) {
is_compatible = false;

View File

@ -1521,8 +1521,10 @@ static int gp_stroke_lock_color_exec(bContext *C, wmOperator *UNUSED(op))
/* first lock all colors */
for (short i = 0; i < *totcol; i++) {
Material *tmp_ma = give_current_material(ob, i + 1);
tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
if (tmp_ma) {
tmp_ma->gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&tmp_ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* loop all selected strokes and unlock any color */
@ -2433,10 +2435,12 @@ static int gpencil_lock_layer_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
gp_style->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
gp_style->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* loop all selected strokes and unlock any color used in active layer */
@ -2515,7 +2519,7 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
/* Skip if this is the active one */
if (ma == active_ma) {
if ((ma == NULL) || (ma == active_ma)) {
continue;
}
@ -2534,6 +2538,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
/* Set flags on all "other" colors */
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
if (ma == NULL) {
continue;
}
gp_style = ma->gp_style;
if (gp_style == active_color) {
continue;
@ -2548,6 +2555,9 @@ static int gpencil_color_isolate_exec(bContext *C, wmOperator *op)
/* Clear flags - Restore everything else */
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
if (ma == NULL) {
continue;
}
gp_style = ma->gp_style;
gp_style->flag &= ~flags;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
@ -2610,10 +2620,12 @@ static int gpencil_color_hide_exec(bContext *C, wmOperator *op)
MaterialGPencilStyle *color = NULL;
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
color = ma->gp_style;
if (active_color != color) {
color->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
if (ma) {
color = ma->gp_style;
if (active_color != color) {
color->flag |= GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
}
}
@ -2671,9 +2683,11 @@ static int gpencil_color_reveal_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_HIDE;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* updates */
@ -2722,9 +2736,11 @@ static int gpencil_color_lock_all_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag |= GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* updates */
@ -2773,9 +2789,11 @@ static int gpencil_color_unlock_all_exec(bContext *C, wmOperator *UNUSED(op))
for (short i = 0; i < *totcol; i++) {
ma = give_current_material(ob, i + 1);
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
if (ma) {
gp_style = ma->gp_style;
gp_style->flag &= ~GP_STYLE_COLOR_LOCKED;
DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
}
}
/* updates */

View File

@ -996,8 +996,9 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
float factor;
/* get interpolation factor */
factor = (float)(cframe - prevFrame->framenum) /
(nextFrame->framenum - prevFrame->framenum + 1);
float framerange = nextFrame->framenum - prevFrame->framenum;
CLAMP_MIN(framerange, 1.0f);
factor = (float)(cframe - prevFrame->framenum) / framerange;
if (ipo_settings->type == GP_IPO_CURVEMAP) {
/* custom curvemap */

View File

@ -393,6 +393,9 @@ bool ED_mesh_color_remove_named(struct Mesh *me, const char *name);
void ED_mesh_report_mirror(struct wmOperator *op, int totmirr, int totfail);
void ED_mesh_report_mirror_ex(struct wmOperator *op, int totmirr, int totfail, char selectmode);
/* Returns the pinned mesh, the mesh from the pinned object, or the mesh from the active object. */
struct Mesh *ED_mesh_context(struct bContext *C);
/* mesh backup */
typedef struct BMBackup {
struct BMesh *bmcopy;

View File

@ -337,6 +337,7 @@ bool ED_operator_object_active(struct bContext *C);
bool ED_operator_object_active_editable(struct bContext *C);
bool ED_operator_object_active_editable_mesh(struct bContext *C);
bool ED_operator_object_active_editable_font(struct bContext *C);
bool ED_operator_editable_mesh(struct bContext *C);
bool ED_operator_editmesh(struct bContext *C);
bool ED_operator_editmesh_view3d(struct bContext *C);
bool ED_operator_editmesh_region_view3d(struct bContext *C);

View File

@ -31,6 +31,7 @@
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_object_types.h"
#include "DNA_camera_types.h"
#include "DNA_view3d_types.h"
#include "BLI_string.h"
@ -102,8 +103,9 @@ static int depthdropper_init(bContext *C, wmOperator *op)
if (rv3d && rv3d->persp == RV3D_CAMOB) {
View3D *v3d = CTX_wm_view3d(C);
if (v3d->camera && v3d->camera->data && !ID_IS_LINKED(v3d->camera->data)) {
RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
Camera *camera = (Camera *)v3d->camera->data;
RNA_pointer_create(&camera->id, &RNA_CameraDOFSettings, &camera->dof, &ddr->ptr);
ddr->prop = RNA_struct_find_property(&ddr->ptr, "focus_distance");
ddr->is_undo = true;
}
}

View File

@ -758,9 +758,17 @@ static void ui_apply_but_undo(uiBut *but)
/* Optionally override undo when undo system doesn't support storing properties. */
if (but->rnapoin.id.data) {
ID *id = but->rnapoin.id.data;
if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) {
str = "";
/* Exception for renaming ID data, we always need undo pushes in this case,
* because undo systems track data by their ID, see: T67002. */
extern PropertyRNA rna_ID_name;
if (but->rnaprop == &rna_ID_name) {
/* pass */
}
else {
ID *id = but->rnapoin.id.data;
if (!ED_undo_is_legacy_compatible_for_property(but->block->evil_C, id)) {
str = "";
}
}
}

View File

@ -27,6 +27,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BLI_string.h"
@ -231,6 +232,11 @@ ARegionType *ED_area_type_hud(int space_type)
art->init = hud_region_init;
art->free = hud_region_free;
/* We need to indicate a preferred size to avoid false `RGN_FLAG_TOO_SMALL`
* the first time the region is created. */
art->prefsizex = AREAMINX;
art->prefsizey = HEADERY;
hud_panels_register(art, space_type, art->regionid);
art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */

View File

@ -355,7 +355,7 @@ uiPopover *UI_popover_begin(bContext *C, int ui_size_x)
}
pup->ui_size_x = ui_size_x;
/* Opertor context default same as menus, change if needed. */
/* Operator context default same as menus, change if needed. */
ui_popover_create_block(C, pup, WM_OP_EXEC_REGION_WIN);
/* create in advance so we can let buttons point to retval already */
@ -404,7 +404,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
/* TODO(campbell): we may want to make this configurable.
* The begin/end stype of calling popups doesn't allow to 'can_refresh' to be set.
* For now close this style of popvers when accessed. */
* For now close this style of popovers when accessed. */
UI_block_flag_disable(pup->block, UI_BLOCK_KEEP_OPEN);
/* panels are created flipped (from event handling pov) */

View File

@ -7418,7 +7418,7 @@ void MESH_OT_symmetry_snap(struct wmOperatorType *ot)
#ifdef WITH_FREESTYLE
/* -------------------------------------------------------------------- */
/** \name Mark Edge (FreeStyle) Operator
/** \name Mark Edge (Freestyle) Operator
* \{ */
static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op)
@ -7498,7 +7498,7 @@ void MESH_OT_mark_freestyle_edge(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Mark Face (FreeStyle) Operator
/** \name Mark Face (Freestyle) Operator
* \{ */
static int edbm_mark_freestyle_face_exec(bContext *C, wmOperator *op)

View File

@ -41,6 +41,7 @@
#include "DEG_depsgraph.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
@ -629,8 +630,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot)
static int mesh_customdata_clear_exec__internal(bContext *C, char htype, int type)
{
Object *obedit = ED_object_context(C);
Mesh *me = obedit->data;
Mesh *me = ED_mesh_context(C);
int tot;
CustomData *data = mesh_customdata_get_type(me, htype, &tot);
@ -788,8 +788,7 @@ void MESH_OT_customdata_skin_clear(wmOperatorType *ot)
/* Clear custom loop normals */
static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
Mesh *me = ED_mesh_context(C);
if (!BKE_mesh_has_custom_loop_normals(me)) {
CustomData *data = GET_CD_DATA(me, ldata);
@ -853,7 +852,7 @@ void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = mesh_customdata_custom_splitnormals_add_exec;
ot->poll = ED_operator_object_active_editable_mesh;
ot->poll = ED_operator_editable_mesh;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -861,8 +860,7 @@ void MESH_OT_customdata_custom_splitnormals_add(wmOperatorType *ot)
static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
Mesh *me = ED_mesh_context(C);
if (BKE_mesh_has_custom_loop_normals(me)) {
return mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_CUSTOMLOOPNORMAL);
@ -879,7 +877,7 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = mesh_customdata_custom_splitnormals_clear_exec;
ot->poll = ED_operator_object_active_editable_mesh;
ot->poll = ED_operator_editable_mesh;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@ -1289,3 +1287,23 @@ void ED_mesh_report_mirror(wmOperator *op, int totmirr, int totfail)
{
ED_mesh_report_mirror_ex(op, totmirr, totfail, SCE_SELECT_VERTEX);
}
Mesh *ED_mesh_context(struct bContext *C)
{
Mesh *mesh = CTX_data_pointer_get_type(C, "mesh", &RNA_Mesh).data;
if (mesh != NULL) {
return mesh;
}
Object *ob = ED_object_active_context(C);
if (ob == NULL) {
return NULL;
}
ID *data = (ID *)ob->data;
if (data == NULL || GS(data->name) != ID_ME) {
return NULL;
}
return (Mesh *)data;
}

View File

@ -337,10 +337,13 @@ static PTCacheEdit *pe_get_current(Depsgraph *depsgraph, Scene *scene, Object *o
}
}
if (edit) {
/* Don't consider inactive or render dependency graphs, since they might be evaluated for a
* different number of childrem. or have different pointer to evaluated particle system or
* modifier which will also cause troubles. */
if (edit && DEG_is_active(depsgraph)) {
edit->pid = *pid;
if (edit->flags & PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL) {
if (edit->psys != NULL) {
if (edit->psys != NULL && edit->psys_eval != NULL) {
psys_copy_particles(edit->psys, edit->psys_eval);
pe_update_hair_particle_edit_pointers(edit);
}

View File

@ -74,6 +74,7 @@
#include "ED_clip.h"
#include "ED_image.h"
#include "ED_keyframes_draw.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_screen_types.h"
@ -371,6 +372,12 @@ bool ED_operator_object_active_editable_font(bContext *C)
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT));
}
bool ED_operator_editable_mesh(bContext *C)
{
Mesh *mesh = ED_mesh_context(C);
return (mesh != NULL) && !ID_IS_LINKED(mesh);
}
bool ED_operator_editmesh(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);

View File

@ -2271,7 +2271,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
vwpaint_update_cache_variants(C, wp, ob, itemptr);
float mat[4][4];
float mval[2];
const float brush_alpha_value = BKE_brush_alpha_get(scene, brush);
@ -2321,7 +2320,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* calculate pivot for rotation around seletion if needed */
/* also needed for "View Selected" on last stroke */
paint_last_stroke_update(scene, vc->ar, mval);
paint_last_stroke_update(scene, vc->ar, ss->cache->mouse);
BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
@ -3273,12 +3272,12 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
VPaint *vp = ts->vpaint;
ViewContext *vc = &vpd->vc;
Object *ob = vc->obact;
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
vwpaint_update_cache_variants(C, vp, ob, itemptr);
float mat[4][4];
float mval[2];
ED_view3d_init_mats_rv3d(ob, vc->rv3d);
@ -3300,7 +3299,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* calculate pivot for rotation around seletion if needed */
/* also needed for "View Selected" on last stroke */
paint_last_stroke_update(scene, vc->ar, mval);
paint_last_stroke_update(scene, vc->ar, ss->cache->mouse);
ED_region_tag_redraw(vc->ar);

View File

@ -797,6 +797,11 @@ void draw_image_main(const bContext *C, ARegion *ar)
ima = ED_space_image(sima);
ED_space_image_get_zoom(sima, ar, &zoomx, &zoomy);
/* Tag image as in active use for garbage collector. */
if (ima) {
BKE_image_tag_time(ima);
}
show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0;
show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0;
show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) &&

View File

@ -210,6 +210,7 @@ static void compo_initjob(void *cjv)
/* NOTE: Don't update animation to preserve unkeyed changes, this means can not use
* evaluate_on_framechange. */
DEG_graph_flush_update(bmain, cj->compositor_depsgraph);
DEG_evaluate_on_refresh(cj->compositor_depsgraph);
bNodeTree *ntree_eval = (bNodeTree *)DEG_get_evaluated_id(cj->compositor_depsgraph,

View File

@ -109,8 +109,9 @@ static void set_operation_types(SpaceOutliner *soops,
}
}
else {
int idcode = GS(tselem->id->name);
switch (idcode) {
const int idcode = (int)GS(tselem->id->name);
bool is_standard_id = false;
switch ((ID_Type)idcode) {
case ID_SCE:
*scenelevel = 1;
break;
@ -134,21 +135,47 @@ static void set_operation_types(SpaceOutliner *soops,
case ID_KE:
case ID_WO:
case ID_AC:
case ID_NLA:
case ID_TXT:
case ID_GR:
case ID_LS:
case ID_LI:
if (*idlevel == 0) {
*idlevel = idcode;
}
else if (*idlevel != idcode) {
*idlevel = -1;
}
if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
*datalevel = 0;
}
case ID_VF:
case ID_NT:
case ID_BR:
case ID_PA:
case ID_GD:
case ID_MC:
case ID_MSK:
case ID_PAL:
case ID_PC:
case ID_CF:
case ID_WS:
case ID_LP:
is_standard_id = true;
break;
case ID_WM:
case ID_SCR:
/* Those are ignored here. */
/* Note: while Screens should be manageable here, deleting a screen used by a workspace
* will cause crashes when trying to use that workspace, so for now let's play minimal,
* safe change. */
break;
}
if (idcode == ID_NLA) {
/* Fake one, not an actual ID type... */
is_standard_id = true;
}
if (is_standard_id) {
if (*idlevel == 0) {
*idlevel = idcode;
}
else if (*idlevel != idcode) {
*idlevel = -1;
}
if (ELEM(*datalevel, TSE_VIEW_COLLECTION_BASE, TSE_SCENE_COLLECTION_BASE)) {
*datalevel = 0;
}
}
}
}

View File

@ -26,6 +26,7 @@
#include "DNA_screen_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_report.h"
@ -71,7 +72,39 @@ static void PREFERENCES_OT_reset_default_theme(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Toggle Auto-Save Override
*
* This operator only exists so there is a useful tool-tip for for adjusting the global flag.
* \{ */
static int preferences_autosave_override_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
{
G.f ^= G_FLAG_USERPREF_NO_SAVE_ON_EXIT;
return OPERATOR_FINISHED;
}
static void PREFERENCES_OT_autosave_override_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Toggle Override Auto-Save";
ot->idname = "PREFERENCES_OT_autosave_override_toggle";
ot->description =
"The current session has \"Factory Preferences\" loaded "
"which disables automatically saving.\n"
"Disable this to auto-save the preferences";
/* callbacks */
ot->exec = preferences_autosave_override_toggle_exec;
/* flags */
ot->flag = OPTYPE_REGISTER;
}
/** \} */
void ED_operatortypes_userpref(void)
{
WM_operatortype_append(PREFERENCES_OT_reset_default_theme);
WM_operatortype_append(PREFERENCES_OT_autosave_override_toggle);
}

View File

@ -2319,6 +2319,7 @@ static bool ed_object_select_pick(bContext *C,
retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
/* in weightpaint, we use selected bone to select vertexgroup,
* so no switch to new active object */

View File

@ -1289,7 +1289,6 @@ static void createTransPose(TransInfo *t)
bPose *pose = ob->pose;
bArmature *arm;
short ik_on = 0;
/* check validity of state */
arm = BKE_armature_from_object(tc->poseobj);
@ -1315,8 +1314,7 @@ static void createTransPose(TransInfo *t)
/* do we need to add temporal IK chains? */
if ((pose->flag & POSE_AUTO_IK) && t->mode == TFM_TRANSLATION) {
ik_on = pose_grab_with_ik(bmain, ob);
if (ik_on) {
if (pose_grab_with_ik(bmain, ob)) {
t->flag |= T_AUTOIK;
has_translate_rotate[0] = true;
}
@ -1359,7 +1357,6 @@ static void createTransPose(TransInfo *t)
Object *ob = tc->poseobj;
TransData *td;
TransDataExtension *tdx;
short ik_on = 0;
int i;
PoseInitData_Mirror *pid = tc->custom.type.data;
@ -1407,7 +1404,7 @@ static void createTransPose(TransInfo *t)
}
/* initialize initial auto=ik chainlen's? */
if (ik_on) {
if (t->flag & T_AUTOIK) {
transform_autoik_update(t, 0);
}
}
@ -2537,6 +2534,7 @@ void flushTransParticles(TransInfo *t)
}
PE_update_object(t->depsgraph, scene, OBACT(view_layer), 1);
BKE_particle_batch_cache_dirty_tag(psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
DEG_id_tag_update(&ob->id, ID_RECALC_PSYS_REDO);
}
}

View File

@ -475,6 +475,9 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int textarget
ima->gpuflag &= ~IMA_GPU_REFRESH;
}
/* Tag as in active use for garbage collector. */
BKE_image_tag_time(ima);
/* Test if we already have a texture. */
GPUTexture **tex = gpu_get_image_gputexture(ima, textarget);
if (*tex) {

View File

@ -378,7 +378,11 @@ void gpu_extensions_init(void)
GG.dfdyfactors[1] = 1.0;
}
if (strstr(renderer, "HD Graphics 4000")) {
if (strstr(version, "Build 10.18.10.3379") || strstr(version, "Build 10.18.10.3574") ||
strstr(version, "Build 10.18.10.4252") || strstr(version, "Build 10.18.10.4358") ||
strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 10.18.10.5069") ||
strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 10.18.14.4432") ||
strstr(version, "Build 10.18.14.5067")) {
GG.context_local_shaders_workaround = true;
}
}

View File

@ -365,6 +365,11 @@ void GPU_vertformat_from_interface(GPUVertFormat *format, const GPUShaderInterfa
input = next;
next = input->next;
/* OpenGL attributes such as `gl_VertexID` have a location of -1. */
if (input->location < 0) {
continue;
}
format->name_len++; /* multiname support */
format->attr_len++;

View File

@ -634,7 +634,17 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* confusing this global... */
G.relbase_valid = 1;
retval = BKE_blendfile_read(C, filepath, &(const struct BlendFileReadParams){0}, reports);
retval = BKE_blendfile_read(
C,
filepath,
/* Loading preferences when the user intended to load a regular file is a security risk,
* because the excluded path list is also loaded.
* Further it's just confusing if a user loads a file and various preferences change. */
&(const struct BlendFileReadParams){
.is_startup = false,
.skip_flags = BLO_READ_SKIP_USERDEF,
},
reports);
/* BKE_file_read sets new Main into context. */
Main *bmain = CTX_data_main(C);

View File

@ -1600,7 +1600,7 @@ static ImBuf *wm_block_splash_image(void)
BLI_join_dirfile(splash_filepath,
sizeof(splash_filepath),
template_directory,
(U.pixelsize == 2) ? "splash_2x.png" : "splash.png");
(U.dpi_fac > 1.0) ? "splash_2x.png" : "splash.png");
ibuf_template = IMB_loadiffname(splash_filepath, IB_rect, NULL);
if (ibuf_template) {
const int x_expect = ibuf->x;

View File

@ -926,7 +926,7 @@ static const char arg_handle_debug_mode_generic_set_doc_ffmpeg[] =
# ifdef WITH_FREESTYLE
static const char arg_handle_debug_mode_generic_set_doc_freestyle[] =
"\n\t"
"Enable debug messages for FreeStyle.";
"Enable debug messages for Freestyle.";
# endif
static const char arg_handle_debug_mode_generic_set_doc_python[] =
"\n\t"