Merge remote-tracking branch 'origin/main' into zoom_optimize
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "util/log.h"
|
||||
#include "util/math.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const TileSize &tile_size)
|
||||
|
||||
@@ -55,6 +55,18 @@ class BakeOptions:
|
||||
do_clean: bool
|
||||
"""Remove redundant keyframes after baking."""
|
||||
|
||||
do_location: bool
|
||||
"""Bake location channels"""
|
||||
|
||||
do_rotation: bool
|
||||
"""Bake rotation channels"""
|
||||
|
||||
do_scale: bool
|
||||
"""Bake scale channels"""
|
||||
|
||||
do_bbone: bool
|
||||
"""Bake b-bone channels"""
|
||||
|
||||
|
||||
def bake_action(
|
||||
obj,
|
||||
@@ -307,13 +319,17 @@ def bake_action_iter(
|
||||
paths_bbprops = [(base_fcurve_path + bbprop) for bbprop in BBONE_PROPS]
|
||||
|
||||
keyframes = KeyframesCo()
|
||||
keyframes.add_paths(path_location, 3)
|
||||
keyframes.add_paths(path_quaternion, 4)
|
||||
keyframes.add_paths(path_axis_angle, 4)
|
||||
keyframes.add_paths(path_euler, 3)
|
||||
keyframes.add_paths(path_scale, 3)
|
||||
|
||||
if pbone.bone.bbone_segments > 1:
|
||||
if bake_options.do_location:
|
||||
keyframes.add_paths(path_location, 3)
|
||||
if bake_options.do_rotation:
|
||||
keyframes.add_paths(path_quaternion, 4)
|
||||
keyframes.add_paths(path_axis_angle, 4)
|
||||
keyframes.add_paths(path_euler, 3)
|
||||
if bake_options.do_scale:
|
||||
keyframes.add_paths(path_scale, 3)
|
||||
|
||||
if bake_options.do_bbone and pbone.bone.bbone_segments > 1:
|
||||
for prop_name, path in zip(BBONE_PROPS, paths_bbprops):
|
||||
keyframes.add_paths(path, BBONE_PROPS_LENGTHS[prop_name])
|
||||
|
||||
@@ -322,32 +338,35 @@ def bake_action_iter(
|
||||
for (f, matrix, bbones) in pose_info:
|
||||
pbone.matrix_basis = matrix[name].copy()
|
||||
|
||||
keyframes.extend_co_values(path_location, 3, f, pbone.location)
|
||||
if bake_options.do_location:
|
||||
keyframes.extend_co_values(path_location, 3, f, pbone.location)
|
||||
|
||||
if rotation_mode == 'QUATERNION':
|
||||
if quat_prev is not None:
|
||||
quat = pbone.rotation_quaternion.copy()
|
||||
quat.make_compatible(quat_prev)
|
||||
pbone.rotation_quaternion = quat
|
||||
quat_prev = quat
|
||||
del quat
|
||||
else:
|
||||
quat_prev = pbone.rotation_quaternion.copy()
|
||||
keyframes.extend_co_values(path_quaternion, 4, f, pbone.rotation_quaternion)
|
||||
elif rotation_mode == 'AXIS_ANGLE':
|
||||
keyframes.extend_co_values(path_axis_angle, 4, f, pbone.rotation_axis_angle)
|
||||
else: # euler, XYZ, ZXY etc
|
||||
if euler_prev is not None:
|
||||
euler = pbone.matrix_basis.to_euler(pbone.rotation_mode, euler_prev)
|
||||
pbone.rotation_euler = euler
|
||||
del euler
|
||||
euler_prev = pbone.rotation_euler.copy()
|
||||
keyframes.extend_co_values(path_euler, 3, f, pbone.rotation_euler)
|
||||
if bake_options.do_rotation:
|
||||
if rotation_mode == 'QUATERNION':
|
||||
if quat_prev is not None:
|
||||
quat = pbone.rotation_quaternion.copy()
|
||||
quat.make_compatible(quat_prev)
|
||||
pbone.rotation_quaternion = quat
|
||||
quat_prev = quat
|
||||
del quat
|
||||
else:
|
||||
quat_prev = pbone.rotation_quaternion.copy()
|
||||
keyframes.extend_co_values(path_quaternion, 4, f, pbone.rotation_quaternion)
|
||||
elif rotation_mode == 'AXIS_ANGLE':
|
||||
keyframes.extend_co_values(path_axis_angle, 4, f, pbone.rotation_axis_angle)
|
||||
else: # euler, XYZ, ZXY etc
|
||||
if euler_prev is not None:
|
||||
euler = pbone.matrix_basis.to_euler(pbone.rotation_mode, euler_prev)
|
||||
pbone.rotation_euler = euler
|
||||
del euler
|
||||
euler_prev = pbone.rotation_euler.copy()
|
||||
keyframes.extend_co_values(path_euler, 3, f, pbone.rotation_euler)
|
||||
|
||||
keyframes.extend_co_values(path_scale, 3, f, pbone.scale)
|
||||
if bake_options.do_scale:
|
||||
keyframes.extend_co_values(path_scale, 3, f, pbone.scale)
|
||||
|
||||
# Bendy Bones
|
||||
if pbone.bone.bbone_segments > 1:
|
||||
if bake_options.do_bbone and pbone.bone.bbone_segments > 1:
|
||||
bbone_shape = bbones[name]
|
||||
for prop_index, prop_name in enumerate(BBONE_PROPS):
|
||||
prop_len = BBONE_PROPS_LENGTHS[prop_name]
|
||||
@@ -382,11 +401,14 @@ def bake_action_iter(
|
||||
path_scale = "scale"
|
||||
|
||||
keyframes = KeyframesCo()
|
||||
keyframes.add_paths(path_location, 3)
|
||||
keyframes.add_paths(path_quaternion, 4)
|
||||
keyframes.add_paths(path_axis_angle, 4)
|
||||
keyframes.add_paths(path_euler, 3)
|
||||
keyframes.add_paths(path_scale, 3)
|
||||
if bake_options.do_location:
|
||||
keyframes.add_paths(path_location, 3)
|
||||
if bake_options.do_rotation:
|
||||
keyframes.add_paths(path_quaternion, 4)
|
||||
keyframes.add_paths(path_axis_angle, 4)
|
||||
keyframes.add_paths(path_euler, 3)
|
||||
if bake_options.do_scale:
|
||||
keyframes.add_paths(path_scale, 3)
|
||||
|
||||
rotation_mode = obj.rotation_mode
|
||||
total_new_keys = len(obj_info)
|
||||
@@ -394,28 +416,31 @@ def bake_action_iter(
|
||||
name = "Action Bake" # XXX: placeholder
|
||||
obj.matrix_basis = matrix
|
||||
|
||||
keyframes.extend_co_values(path_location, 3, f, obj.location)
|
||||
if bake_options.do_location:
|
||||
keyframes.extend_co_values(path_location, 3, f, obj.location)
|
||||
|
||||
if rotation_mode == 'QUATERNION':
|
||||
if quat_prev is not None:
|
||||
quat = obj.rotation_quaternion.copy()
|
||||
quat.make_compatible(quat_prev)
|
||||
obj.rotation_quaternion = quat
|
||||
quat_prev = quat
|
||||
del quat
|
||||
else:
|
||||
quat_prev = obj.rotation_quaternion.copy()
|
||||
keyframes.extend_co_values(path_quaternion, 4, f, obj.rotation_quaternion)
|
||||
if bake_options.do_rotation:
|
||||
if rotation_mode == 'QUATERNION':
|
||||
if quat_prev is not None:
|
||||
quat = obj.rotation_quaternion.copy()
|
||||
quat.make_compatible(quat_prev)
|
||||
obj.rotation_quaternion = quat
|
||||
quat_prev = quat
|
||||
del quat
|
||||
else:
|
||||
quat_prev = obj.rotation_quaternion.copy()
|
||||
keyframes.extend_co_values(path_quaternion, 4, f, obj.rotation_quaternion)
|
||||
|
||||
elif rotation_mode == 'AXIS_ANGLE':
|
||||
keyframes.extend_co_values(path_axis_angle, 4, f, obj.rotation_axis_angle)
|
||||
else: # euler, XYZ, ZXY etc
|
||||
if euler_prev is not None:
|
||||
obj.rotation_euler = matrix.to_euler(obj.rotation_mode, euler_prev)
|
||||
euler_prev = obj.rotation_euler.copy()
|
||||
keyframes.extend_co_values(path_euler, 3, f, obj.rotation_euler)
|
||||
elif rotation_mode == 'AXIS_ANGLE':
|
||||
keyframes.extend_co_values(path_axis_angle, 4, f, obj.rotation_axis_angle)
|
||||
else: # euler, XYZ, ZXY etc
|
||||
if euler_prev is not None:
|
||||
obj.rotation_euler = matrix.to_euler(obj.rotation_mode, euler_prev)
|
||||
euler_prev = obj.rotation_euler.copy()
|
||||
keyframes.extend_co_values(path_euler, 3, f, obj.rotation_euler)
|
||||
|
||||
keyframes.extend_co_values(path_scale, 3, f, obj.scale)
|
||||
if bake_options.do_scale:
|
||||
keyframes.extend_co_values(path_scale, 3, f, obj.scale)
|
||||
|
||||
if is_new_action:
|
||||
keyframes.insert_keyframes_into_new_action(total_new_keys, action, name)
|
||||
|
||||
@@ -252,6 +252,18 @@ class NLA_OT_bake(Operator):
|
||||
),
|
||||
default={'POSE'},
|
||||
)
|
||||
channel_types: EnumProperty(
|
||||
name="Channels",
|
||||
description="Which channels to bake",
|
||||
options={'ENUM_FLAG'},
|
||||
items=(
|
||||
('LOCATION', "Location", "Bake location channels"),
|
||||
('ROTATION', "Rotation", "Bake rotation channels"),
|
||||
('SCALE', "Scale", "Bake scale channels"),
|
||||
('BBONE', "B-Bone", "Bake b-bone channels"),
|
||||
),
|
||||
default={'LOCATION', 'ROTATION', 'SCALE', 'BBONE'},
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
from bpy_extras import anim_utils
|
||||
@@ -263,7 +275,11 @@ class NLA_OT_bake(Operator):
|
||||
do_visual_keying=self.visual_keying,
|
||||
do_constraint_clear=self.clear_constraints,
|
||||
do_parents_clear=self.clear_parents,
|
||||
do_clean=self.clean_curves
|
||||
do_clean=self.clean_curves,
|
||||
do_location = 'LOCATION' in self.channel_types,
|
||||
do_rotation = 'ROTATION' in self.channel_types,
|
||||
do_scale = 'SCALE' in self.channel_types,
|
||||
do_bbone = 'BBONE' in self.channel_types,
|
||||
)
|
||||
|
||||
if bake_options.do_pose and self.only_selected:
|
||||
|
||||
@@ -235,6 +235,7 @@ class USERPREF_PT_interface_text(InterfacePanel, CenterAlignMixIn, Panel):
|
||||
flow.prop(view, "use_text_antialiasing", text="Anti-Aliasing")
|
||||
sub = flow.column()
|
||||
sub.active = view.use_text_antialiasing
|
||||
sub.prop(view, "use_text_render_subpixelaa", text="Subpixel Anti-Aliasing")
|
||||
sub.prop(view, "text_hinting", text="Hinting")
|
||||
|
||||
flow.prop(view, "font_path_ui")
|
||||
|
||||
@@ -349,6 +349,8 @@ enum {
|
||||
BLF_BAD_FONT = 1 << 16,
|
||||
/** This font is managed by the FreeType cache subsystem. */
|
||||
BLF_CACHED = 1 << 17,
|
||||
/** At small sizes glyphs are rendered at multiple subpixel positions. */
|
||||
BLF_RENDER_SUBPIXELAA = 1 << 18,
|
||||
};
|
||||
|
||||
#define BLF_DRAW_STR_DUMMY_MAX 1024
|
||||
|
||||
@@ -1121,8 +1121,8 @@ GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, const uint charcode
|
||||
#ifdef BLF_SUBPIXEL_AA
|
||||
GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x)
|
||||
{
|
||||
if ((font->flags & (BLF_HINTING_NONE | BLF_MONOCHROME)) != 0) {
|
||||
/* Not if we are in mono mode (aliased) or if not hinting. */
|
||||
if (!(font->flags & BLF_RENDER_SUBPIXELAA) || (font->flags & BLF_MONOCHROME)) {
|
||||
/* Not if we are in mono mode (aliased) or the feature is turned off. */
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ template<typename T> static inline T decltype_helper(T x)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define BLI_NOINLINE __attribute__((noinline))
|
||||
#elif defined(_MSC_VER)
|
||||
# define BLI_NOINLINE __declspec(noinline)
|
||||
#else
|
||||
# define BLI_NOINLINE
|
||||
#endif
|
||||
|
||||
@@ -881,6 +881,10 @@ void blo_do_versions_userdef(UserDef *userdef)
|
||||
userdef->animation_flag |= USER_ANIM_SHOW_CHANNEL_GROUP_COLORS;
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(400, 32)) {
|
||||
userdef->text_render |= USER_TEXT_RENDER_SUBPIXELAA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
||||
@@ -440,7 +440,7 @@ void uiStyleInit()
|
||||
/* Set default flags based on UI preferences (not render fonts) */
|
||||
{
|
||||
const int flag_disable = (BLF_MONOCHROME | BLF_HINTING_NONE | BLF_HINTING_SLIGHT |
|
||||
BLF_HINTING_FULL);
|
||||
BLF_HINTING_FULL | BLF_RENDER_SUBPIXELAA);
|
||||
int flag_enable = 0;
|
||||
|
||||
if (U.text_render & USER_TEXT_HINTING_NONE) {
|
||||
@@ -456,6 +456,9 @@ void uiStyleInit()
|
||||
if (U.text_render & USER_TEXT_DISABLE_AA) {
|
||||
flag_enable |= BLF_MONOCHROME;
|
||||
}
|
||||
if (U.text_render & USER_TEXT_RENDER_SUBPIXELAA) {
|
||||
flag_enable |= BLF_RENDER_SUBPIXELAA;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (uiFont *, font, &U.uifonts) {
|
||||
if (font->blf_id != -1) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "DNA_node_tree_interface_types.h"
|
||||
|
||||
#include "ED_node.hh"
|
||||
#include "ED_undo.hh"
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_prototypes.h"
|
||||
@@ -390,6 +391,7 @@ bool NodeSocketDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const
|
||||
|
||||
/* General update */
|
||||
ED_node_tree_propagate_change(C, CTX_data_main(C), &nodetree);
|
||||
ED_undo_push(C, "Insert node group item");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -480,6 +482,7 @@ bool NodePanelDropTarget::on_drop(bContext *C, const DragInfo &drag_info) const
|
||||
|
||||
/* General update */
|
||||
ED_node_tree_propagate_change(C, CTX_data_main(C), &nodetree);
|
||||
ED_undo_push(C, "Insert node group item");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2888,14 +2888,40 @@ void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot)
|
||||
/** \name Vertex Group Normalize All Operator
|
||||
* \{ */
|
||||
|
||||
/*
|
||||
* For a given object, determine which target vertex group to normalize.
|
||||
*/
|
||||
static eVGroupSelect normalize_vertex_group_target(Object *ob)
|
||||
{
|
||||
/* Default to All Groups. */
|
||||
eVGroupSelect target_group = WT_VGROUP_ALL;
|
||||
|
||||
/* If armature is present, and armature is actively deforming the object
|
||||
(i.e armature modifier isn't disabled) use BONE DEFORM. */
|
||||
if (BKE_modifiers_is_deformed_by_armature(ob)) {
|
||||
|
||||
int defgroup_tot = BKE_object_defgroup_count(ob);
|
||||
bool *defgroup_validmap = BKE_object_defgroup_validmap_get(ob, defgroup_tot);
|
||||
|
||||
for (int i = 0; i < defgroup_tot; i++) {
|
||||
if (defgroup_validmap[i] == true) {
|
||||
target_group = WT_VGROUP_BONE_DEFORM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MEM_freeN(defgroup_validmap);
|
||||
}
|
||||
|
||||
return target_group;
|
||||
}
|
||||
|
||||
static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
|
||||
/* If armature is present, default to `Deform Bones` otherwise `All Groups`. */
|
||||
RNA_enum_set(op->ptr,
|
||||
"group_select_mode",
|
||||
BKE_modifiers_is_deformed_by_armature(ob) ? WT_VGROUP_BONE_DEFORM : WT_VGROUP_ALL);
|
||||
eVGroupSelect target_group = normalize_vertex_group_target(ob);
|
||||
|
||||
RNA_enum_set(op->ptr, "group_select_mode", target_group);
|
||||
|
||||
bool lock_active = RNA_boolean_get(op->ptr, "lock_active");
|
||||
eVGroupSelect subset_type = static_cast<eVGroupSelect>(
|
||||
|
||||
@@ -95,6 +95,7 @@ static void add_group_input_node_fn(nodes::LinkSearchOpParams ¶ms)
|
||||
NODE_INTERFACE_SOCKET_INPUT,
|
||||
nullptr);
|
||||
socket_iface->init_from_socket_instance(¶ms.socket);
|
||||
params.node_tree.tree_interface.active_item_set(&socket_iface->item);
|
||||
|
||||
bNode &group_input = params.add_node("NodeGroupInput");
|
||||
|
||||
|
||||
@@ -192,15 +192,19 @@ static Vector<CornerGroup> calc_corner_groups_for_vertex(const OffsetIndices<int
|
||||
return groups;
|
||||
}
|
||||
|
||||
/* Calculate groups of corners that are contiguously connected to each input vertex. */
|
||||
static Array<Vector<CornerGroup>> calc_all_corner_groups(const OffsetIndices<int> faces,
|
||||
const Span<int> corner_verts,
|
||||
const Span<int> corner_edges,
|
||||
const GroupedSpan<int> vert_to_corner_map,
|
||||
const GroupedSpan<int> edge_to_corner_map,
|
||||
const Span<int> corner_to_face_map,
|
||||
const BitSpan split_edges,
|
||||
const IndexMask &affected_verts)
|
||||
/* Calculate groups of corners that are contiguously connected to each input vertex.
|
||||
* BLI_NOINLINE because MSVC 17.7 has a codegen bug here, given there is only a single call to this
|
||||
* function, not inlining it for all platforms won't affect performance. See
|
||||
* https://developercommunity.visualstudio.com/t/10448291 for details. */
|
||||
BLI_NOINLINE static Array<Vector<CornerGroup>> calc_all_corner_groups(
|
||||
const OffsetIndices<int> faces,
|
||||
const Span<int> corner_verts,
|
||||
const Span<int> corner_edges,
|
||||
const GroupedSpan<int> vert_to_corner_map,
|
||||
const GroupedSpan<int> edge_to_corner_map,
|
||||
const Span<int> corner_to_face_map,
|
||||
const BitSpan split_edges,
|
||||
const IndexMask &affected_verts)
|
||||
{
|
||||
Array<Vector<CornerGroup>> corner_groups(affected_verts.size(), NoInitialization());
|
||||
affected_verts.foreach_index(GrainSize(512), [&](const int vert, const int mask) {
|
||||
|
||||
@@ -1338,6 +1338,8 @@ typedef enum eText_Draw_Options {
|
||||
USER_TEXT_HINTING_NONE = (1 << 1),
|
||||
USER_TEXT_HINTING_SLIGHT = (1 << 2),
|
||||
USER_TEXT_HINTING_FULL = (1 << 3),
|
||||
|
||||
USER_TEXT_RENDER_SUBPIXELAA = (1 << 4),
|
||||
} eText_Draw_Options;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3798,6 +3798,12 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Channel", "Nonlinear Animation Channel");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "ds_subchannel");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Sub-channel", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "nla_track", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "nla_track");
|
||||
RNA_def_property_array(prop, 3);
|
||||
@@ -5174,6 +5180,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
prop, "Text Anti-Aliasing", "Smooth jagged edges of user interface text");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_text_render_subpixelaa", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "text_render", USER_TEXT_RENDER_SUBPIXELAA);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Text Subpixel Anti-Aliasing", "Render text for optimal horizontal placement");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
|
||||
|
||||
prop = RNA_def_property(srna, "text_hinting", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "text_render");
|
||||
RNA_def_property_enum_items(prop, text_hinting_items);
|
||||
|
||||
Reference in New Issue
Block a user