Nodes: Panel declarations for grouping sockets #108649
|
@ -149,7 +149,11 @@ void BlenderSync::sync_light(BL::Object &b_parent,
|
|||
light->set_is_shadow_catcher(b_ob_info.real_object.is_shadow_catcher());
|
||||
|
||||
/* Light group and linking. */
|
||||
light->set_lightgroup(ustring(b_ob_info.real_object.lightgroup()));
|
||||
string lightgroup = b_ob_info.real_object.lightgroup();
|
||||
if (lightgroup.empty()) {
|
||||
lightgroup = b_parent.lightgroup();
|
||||
}
|
||||
light->set_lightgroup(ustring(lightgroup));
|
||||
light->set_light_set_membership(
|
||||
BlenderLightLink::get_light_set_membership(PointerRNA_NULL, b_ob_info.real_object));
|
||||
light->set_shadow_set_membership(
|
||||
|
|
|
@ -350,7 +350,11 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
|||
}
|
||||
|
||||
/* Light group and linking. */
|
||||
object->set_lightgroup(ustring(b_ob.lightgroup()));
|
||||
string lightgroup = b_ob.lightgroup();
|
||||
if (lightgroup.empty()) {
|
||||
lightgroup = b_parent.lightgroup();
|
||||
}
|
||||
object->set_lightgroup(ustring(lightgroup));
|
||||
|
||||
object->set_light_set_membership(BlenderLightLink::get_light_set_membership(b_parent, b_ob));
|
||||
object->set_receiver_light_set(BlenderLightLink::get_receiver_light_set(b_parent, b_ob));
|
||||
|
|
|
@ -215,6 +215,7 @@ class GHOST_DeviceVK {
|
|||
device_features.geometryShader = VK_TRUE;
|
||||
device_features.dualSrcBlend = VK_TRUE;
|
||||
device_features.logicOp = VK_TRUE;
|
||||
device_features.imageCubeArray = VK_TRUE;
|
||||
#endif
|
||||
|
||||
VkDeviceCreateInfo device_create_info = {};
|
||||
|
@ -309,7 +310,7 @@ static GHOST_TSuccess ensure_vulkan_device(VkInstance vk_instance,
|
|||
|
||||
#if STRICT_REQUIREMENTS
|
||||
if (!device_vk.features.geometryShader || !device_vk.features.dualSrcBlend ||
|
||||
!device_vk.features.logicOp)
|
||||
!device_vk.features.logicOp || !device_vk.features.imageCubeArray)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4508,6 +4508,11 @@ def km_grease_pencil_edit(params):
|
|||
|
||||
items.extend([
|
||||
*_template_items_select_actions(params, "grease_pencil.select_all"),
|
||||
# Select linked
|
||||
("grease_pencil.select_linked", {"type": 'L', "value": 'PRESS'}, None),
|
||||
("grease_pencil.select_linked", {"type": 'L', "value": 'PRESS', "ctrl": True}, None),
|
||||
("grease_pencil.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
|
||||
("grease_pencil.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True, "repeat": True}, None),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -109,9 +109,6 @@ class MESH_UL_vgroups(UIList):
|
|||
layout.label(text="", icon_value=icon)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MESH_UL_shape_keys(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, active_data, _active_propname, index):
|
||||
# assert(isinstance(item, bpy.types.ShapeKey))
|
||||
|
|
|
@ -2030,6 +2030,13 @@ class VIEW3D_MT_select_edit_gpencil(Menu):
|
|||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("grease_pencil.select_linked", text="Linked")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("grease_pencil.select_more")
|
||||
layout.operator("grease_pencil.select_less")
|
||||
|
||||
|
||||
class VIEW3D_MT_select_paint_mask(Menu):
|
||||
bl_label = "Select"
|
||||
|
@ -2103,7 +2110,7 @@ class VIEW3D_MT_select_edit_curves(Menu):
|
|||
layout.separator()
|
||||
|
||||
layout.operator("curves.select_random", text="Random")
|
||||
layout.operator("curves.select_end", text="Endpoints")
|
||||
layout.operator("curves.select_ends", text="Endpoints")
|
||||
layout.operator("curves.select_linked", text="Linked")
|
||||
|
||||
layout.separator()
|
||||
|
@ -2121,7 +2128,7 @@ class VIEW3D_MT_select_sculpt_curves(Menu):
|
|||
layout.operator("curves.select_all", text="None").action = 'DESELECT'
|
||||
layout.operator("curves.select_all", text="Invert").action = 'INVERT'
|
||||
layout.operator("sculpt_curves.select_random", text="Random")
|
||||
layout.operator("curves.select_end", text="Endpoints")
|
||||
layout.operator("curves.select_ends", text="Endpoints")
|
||||
layout.operator("sculpt_curves.select_grow", text="Grow")
|
||||
|
||||
|
||||
|
|
|
@ -612,8 +612,8 @@ int CustomData_layertype_layers_max(eCustomDataType type);
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** \return The maximum length for a layer name with the given prefix. */
|
||||
int CustomData_name_max_length_calc(blender::StringRef name);
|
||||
/** \return The maximum size in bytes needed for a layer name with the given prefix. */
|
||||
int CustomData_name_maxncpy_calc(blender::StringRef name);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -733,7 +733,7 @@ enum {
|
|||
typedef struct CustomDataTransferLayerMap {
|
||||
struct CustomDataTransferLayerMap *next, *prev;
|
||||
|
||||
eCustomDataType data_type;
|
||||
int data_type;
|
||||
int mix_mode;
|
||||
float mix_factor;
|
||||
/** If non-NULL, array of weights, one for each dest item, replaces mix_factor. */
|
||||
|
|
|
@ -180,7 +180,6 @@ struct Mesh *BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob,
|
|||
|
||||
bool BKE_mesh_attribute_required(const char *name);
|
||||
|
||||
|
||||
float (*BKE_mesh_orco_verts_get(struct Object *ob))[3];
|
||||
void BKE_mesh_orco_verts_transform(struct Mesh *me, float (*orco)[3], int totvert, int invert);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ struct CornerNormalSpaceArray {
|
|||
*/
|
||||
Array<Array<int>> corners_by_space;
|
||||
/** Whether to create the above map when calculating normals. */
|
||||
bool create_corners_by_space;
|
||||
bool create_corners_by_space = false;
|
||||
};
|
||||
|
||||
void lnor_space_custom_normal_to_data(const CornerNormalSpace *lnor_space,
|
||||
|
|
|
@ -255,7 +255,7 @@ typedef struct PanelType {
|
|||
|
||||
char idname[BKE_ST_MAXNAME]; /* unique name */
|
||||
char label[BKE_ST_MAXNAME]; /* for panel header */
|
||||
char *description; /* for panel tooltip */
|
||||
const char *description; /* for panel tooltip */
|
||||
char translation_context[BKE_ST_MAXNAME];
|
||||
char context[BKE_ST_MAXNAME]; /* for buttons window */
|
||||
char category[BKE_ST_MAXNAME]; /* for category tabs */
|
||||
|
|
|
@ -59,11 +59,6 @@ void texttool_suggest_select(SuggItem *sel);
|
|||
SuggItem *texttool_suggest_selected(void);
|
||||
int *texttool_suggest_top(void);
|
||||
|
||||
/* Documentation */
|
||||
void texttool_docs_show(const char *docs);
|
||||
char *texttool_docs_get(void);
|
||||
void texttool_docs_clear(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -74,7 +74,7 @@ static void pchan_deform_accumulate(const DualQuat *deform_dq,
|
|||
mdq.trans[1] += .5f * (mdq.quat[0] * dst[0] + mdq.quat[2] * dst[2] - mdq.quat[3] * dst[1]);
|
||||
mdq.trans[2] += .5f * (mdq.quat[0] * dst[1] + mdq.quat[3] * dst[0] - mdq.quat[1] * dst[2]);
|
||||
mdq.trans[3] += .5f * (mdq.quat[0] * dst[2] + mdq.quat[1] * dst[1] - mdq.quat[2] * dst[0]);
|
||||
mdq.scale_weight = 0.f;
|
||||
mdq.scale_weight = 0.0f;
|
||||
add_weighted_dq_dq(dq_accum, &mdq, weight);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -174,7 +174,7 @@ bool BKE_id_attribute_rename(ID *id,
|
|||
* is clamped to it's maximum length, otherwise assigning an over-long name multiple times
|
||||
* will add `.001` suffix unnecessarily. */
|
||||
{
|
||||
const int new_name_maxncpy = CustomData_name_max_length_calc(new_name);
|
||||
const int new_name_maxncpy = CustomData_name_maxncpy_calc(new_name);
|
||||
/* NOTE: A function that performs a clamped comparison without copying would be handy here. */
|
||||
char new_name_clamped[MAX_CUSTOMDATA_LAYER_NAME];
|
||||
BLI_strncpy_utf8(new_name_clamped, new_name, new_name_maxncpy);
|
||||
|
@ -255,7 +255,7 @@ static bool unique_name_cb(void *arg, const char *name)
|
|||
bool BKE_id_attribute_calc_unique_name(ID *id, const char *name, char *outname)
|
||||
{
|
||||
AttrUniqueData data{id};
|
||||
const int name_maxncpy = CustomData_name_max_length_calc(name);
|
||||
const int name_maxncpy = CustomData_name_maxncpy_calc(name);
|
||||
|
||||
/* Set default name if none specified.
|
||||
* NOTE: We only call IFACE_() if needed to avoid locale lookup overhead. */
|
||||
|
|
|
@ -4353,7 +4353,7 @@ static bool customdata_unique_check(void *arg, const char *name)
|
|||
return cd_layer_find_dupe(data_arg->data, name, data_arg->type, data_arg->index);
|
||||
}
|
||||
|
||||
int CustomData_name_max_length_calc(const blender::StringRef name)
|
||||
int CustomData_name_maxncpy_calc(const blender::StringRef name)
|
||||
{
|
||||
if (name.startswith(".")) {
|
||||
return MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX;
|
||||
|
@ -4379,7 +4379,7 @@ void CustomData_set_layer_unique_name(CustomData *data, const int index)
|
|||
return;
|
||||
}
|
||||
|
||||
const int max_length = CustomData_name_max_length_calc(nlayer->name);
|
||||
const int name_maxncpy = CustomData_name_maxncpy_calc(nlayer->name);
|
||||
|
||||
/* Set default name if none specified. Note we only call DATA_() when
|
||||
* needed to avoid overhead of locale lookups in the depsgraph. */
|
||||
|
@ -4388,7 +4388,7 @@ void CustomData_set_layer_unique_name(CustomData *data, const int index)
|
|||
}
|
||||
|
||||
const char *defname = ""; /* Dummy argument, never used as `name` is never zero length. */
|
||||
BLI_uniquename_cb(customdata_unique_check, &data_arg, defname, '.', nlayer->name, max_length);
|
||||
BLI_uniquename_cb(customdata_unique_check, &data_arg, defname, '.', nlayer->name, name_maxncpy);
|
||||
}
|
||||
|
||||
void CustomData_validate_layer_name(const CustomData *data,
|
||||
|
@ -4865,7 +4865,7 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
|
|||
* more than 0.5 of weight. */
|
||||
int best_src_idx = 0;
|
||||
|
||||
const eCustomDataType data_type = laymap->data_type;
|
||||
const int data_type = laymap->data_type;
|
||||
const int mix_mode = laymap->mix_mode;
|
||||
|
||||
size_t data_size;
|
||||
|
@ -4883,7 +4883,7 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
|
|||
data_size = laymap->data_size;
|
||||
}
|
||||
else {
|
||||
const LayerTypeInfo *type_info = layerType_getInfo(data_type);
|
||||
const LayerTypeInfo *type_info = layerType_getInfo(eCustomDataType(data_type));
|
||||
|
||||
data_size = size_t(type_info->size);
|
||||
interp_cd = type_info->interp;
|
||||
|
@ -4952,7 +4952,7 @@ static void customdata_data_transfer_interp_generic(const CustomDataTransferLaye
|
|||
}
|
||||
}
|
||||
else if (!(int(data_type) & CD_FAKE)) {
|
||||
CustomData_data_mix_value(data_type, tmp_dst, data_dst, mix_mode, mix_factor);
|
||||
CustomData_data_mix_value(eCustomDataType(data_type), tmp_dst, data_dst, mix_mode, mix_factor);
|
||||
}
|
||||
/* Else we can do nothing by default, needs custom interp func!
|
||||
* Note this is here only for sake of consistency, not expected to be used much actually? */
|
||||
|
@ -4975,7 +4975,8 @@ void customdata_data_transfer_interp_normal_normals(const CustomDataTransferLaye
|
|||
BLI_assert(weights != nullptr);
|
||||
BLI_assert(count > 0);
|
||||
|
||||
const eCustomDataType data_type = laymap->data_type;
|
||||
const eCustomDataType data_type = eCustomDataType(laymap->data_type);
|
||||
BLI_assert(data_type == CD_NORMAL);
|
||||
const int mix_mode = laymap->mix_mode;
|
||||
|
||||
SpaceTransform *space_transform = static_cast<SpaceTransform *>(laymap->interp_data);
|
||||
|
@ -4985,8 +4986,6 @@ void customdata_data_transfer_interp_normal_normals(const CustomDataTransferLaye
|
|||
|
||||
float tmp_dst[3];
|
||||
|
||||
BLI_assert(data_type == CD_NORMAL);
|
||||
|
||||
if (!sources) {
|
||||
/* Not supported here, abort. */
|
||||
return;
|
||||
|
@ -5007,7 +5006,7 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
|
|||
MeshPairRemapItem *mapit = me_remap->items;
|
||||
const int totelem = me_remap->items_num;
|
||||
|
||||
const eCustomDataType data_type = laymap->data_type;
|
||||
const int data_type = laymap->data_type;
|
||||
const void *data_src = laymap->data_src;
|
||||
void *data_dst = laymap->data_dst;
|
||||
|
||||
|
@ -5036,7 +5035,7 @@ void CustomData_data_transfer(const MeshPairRemap *me_remap,
|
|||
data_offset = laymap->data_offset;
|
||||
}
|
||||
else {
|
||||
const LayerTypeInfo *type_info = layerType_getInfo(data_type);
|
||||
const LayerTypeInfo *type_info = layerType_getInfo(eCustomDataType(data_type));
|
||||
|
||||
/* NOTE: we can use 'fake' CDLayers for crease :/. */
|
||||
data_size = size_t(type_info->size);
|
||||
|
|
|
@ -675,8 +675,8 @@ static void grid_cell_points_cb_ex(void *__restrict userdata,
|
|||
int co[3];
|
||||
|
||||
for (int j = 3; j--;) {
|
||||
co[j] = (int)floorf((bData->realCoord[bData->s_pos[i]].v[j] - grid->grid_bounds.min[j]) /
|
||||
bData->dim[j] * grid->dim[j]);
|
||||
co[j] = int(floorf((bData->realCoord[bData->s_pos[i]].v[j] - grid->grid_bounds.min[j]) /
|
||||
bData->dim[j] * grid->dim[j]));
|
||||
CLAMP(co[j], 0, grid->dim[j] - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -628,7 +628,7 @@ void BKE_mesh_remap_calc_verts_from_mesh(const int mode,
|
|||
|
||||
if (mesh_remap_bvhtree_query_nearest(
|
||||
&treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
|
||||
const int poly_index = looptri_polys[rayhit.index];
|
||||
const int poly_index = looptri_polys[nearest.index];
|
||||
|
||||
if (mode == MREMAP_MODE_VERT_POLY_NEAREST) {
|
||||
int index;
|
||||
|
@ -886,7 +886,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
|
|||
|
||||
if (mesh_remap_bvhtree_query_nearest(&treedata, &nearest, tmp_co, max_dist_sq, &hit_dist))
|
||||
{
|
||||
const int poly_index = looptri_polys[rayhit.index];
|
||||
const int poly_index = looptri_polys[nearest.index];
|
||||
const blender::IndexRange poly_src = polys_src[poly_index];
|
||||
const int *corner_edge_src = &corner_edges_src[poly_src.start()];
|
||||
int nloops = int(poly_src.size());
|
||||
|
|
|
@ -70,15 +70,8 @@ bool multiresModifier_reshapeFromObject(Depsgraph *depsgraph,
|
|||
return false;
|
||||
}
|
||||
|
||||
int num_deformed_verts;
|
||||
float(*deformed_verts)[3] = BKE_mesh_vert_coords_alloc(src_mesh_eval, &num_deformed_verts);
|
||||
|
||||
const bool result = multiresModifier_reshapeFromVertcos(
|
||||
depsgraph, dst, mmd, deformed_verts, num_deformed_verts);
|
||||
|
||||
MEM_freeN(deformed_verts);
|
||||
|
||||
return result;
|
||||
return multiresModifier_reshapeFromVertcos(
|
||||
depsgraph, dst, mmd, BKE_mesh_vert_positions(src_mesh_eval), src_mesh_eval->totvert);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -3449,7 +3449,6 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
|
|||
EffectorWeights *clmd_effweights;
|
||||
int totpoint;
|
||||
int totedge;
|
||||
float(*deformedVerts)[3];
|
||||
bool realloc_roots;
|
||||
|
||||
if (!psys->clmd) {
|
||||
|
@ -3505,12 +3504,14 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
|
|||
psys->clmd->sim_parms->effector_weights = psys->part->effector_weights;
|
||||
|
||||
BKE_id_copy_ex(NULL, &psys->hair_in_mesh->id, (ID **)&psys->hair_out_mesh, LIB_ID_COPY_LOCALIZE);
|
||||
deformedVerts = BKE_mesh_vert_coords_alloc(psys->hair_out_mesh, NULL);
|
||||
clothModifier_do(
|
||||
psys->clmd, sim->depsgraph, sim->scene, sim->ob, psys->hair_in_mesh, deformedVerts);
|
||||
BKE_mesh_vert_coords_apply(psys->hair_out_mesh, deformedVerts);
|
||||
|
||||
MEM_freeN(deformedVerts);
|
||||
clothModifier_do(psys->clmd,
|
||||
sim->depsgraph,
|
||||
sim->scene,
|
||||
sim->ob,
|
||||
psys->hair_in_mesh,
|
||||
BKE_mesh_vert_positions_for_write(psys->hair_out_mesh));
|
||||
BKE_mesh_tag_positions_changed(psys->hair_out_mesh);
|
||||
|
||||
/* restore cloth effector weights */
|
||||
psys->clmd->sim_parms->effector_weights = clmd_effweights;
|
||||
|
@ -5005,6 +5006,8 @@ static void particlesystem_modifiersForeachIDLink(void *user_data,
|
|||
void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
|
||||
{
|
||||
ParticleTarget *pt;
|
||||
LibraryForeachIDData *foreachid_data = userdata;
|
||||
const int foreachid_data_flags = BKE_lib_query_foreachid_process_flags_get(foreachid_data);
|
||||
|
||||
func(psys, (ID **)&psys->part, userdata, IDWALK_CB_USER | IDWALK_CB_NEVER_NULL);
|
||||
func(psys, (ID **)&psys->target_ob, userdata, IDWALK_CB_NOP);
|
||||
|
@ -5024,14 +5027,19 @@ void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func,
|
|||
func(psys, (ID **)&pt->ob, userdata, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
/* Even though psys->part should never be NULL, this can happen as an exception during deletion.
|
||||
* See ID_REMAP_SKIP/FORCE/FLAG_NEVER_NULL_USAGE in BKE_library_remap. */
|
||||
if (psys->part && psys->part->phystype == PART_PHYS_BOIDS) {
|
||||
/* In case `psys->part` is NULL (See ID_REMAP_SKIP/FORCE/FLAG_NEVER_NULL_USAGE in
|
||||
* #BKE_library_remap), or accessing it is forbidden, always handle particles for potential boids
|
||||
* data. Unfortunate, but for now there is no other proper way to do this. */
|
||||
if (!(psys->part && (foreachid_data_flags & IDWALK_NO_ORIG_POINTERS_ACCESS) == 0) ||
|
||||
psys->part->phystype == PART_PHYS_BOIDS)
|
||||
{
|
||||
ParticleData *pa;
|
||||
int p;
|
||||
|
||||
for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) {
|
||||
func(psys, (ID **)&pa->boid->ground, userdata, IDWALK_CB_NOP);
|
||||
if (pa->boid != NULL) {
|
||||
func(psys, (ID **)&pa->boid->ground, userdata, IDWALK_CB_NOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,7 +513,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex(void *__restrict userdata,
|
|||
|
||||
const float proj_limit_squared = calc->smd->projLimit * calc->smd->projLimit;
|
||||
float *co = calc->vertexCos[i];
|
||||
float tmp_co[3], tmp_no[3];
|
||||
const float *tmp_co, *tmp_no;
|
||||
float weight = BKE_defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
|
||||
|
||||
if (calc->invert_vgroup) {
|
||||
|
@ -530,12 +530,12 @@ static void shrinkwrap_calc_normal_projection_cb_ex(void *__restrict userdata,
|
|||
/* These coordinates are deformed by vertexCos only for normal projection
|
||||
* (to get correct normals) for other cases calc->verts contains undeformed coordinates and
|
||||
* vertexCos should be used */
|
||||
copy_v3_v3(tmp_co, calc->vert_positions[i]);
|
||||
copy_v3_v3(tmp_no, calc->vert_normals[i]);
|
||||
tmp_co = calc->vert_positions[i];
|
||||
tmp_no = calc->vert_normals[i];
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(tmp_co, co);
|
||||
copy_v3_v3(tmp_no, proj_axis);
|
||||
tmp_co = co;
|
||||
tmp_no = proj_axis;
|
||||
}
|
||||
|
||||
hit->index = -1;
|
||||
|
@ -1568,7 +1568,6 @@ void BKE_shrinkwrap_mesh_nearest_surface_deform(bContext *C, Object *ob_source,
|
|||
void BKE_shrinkwrap_remesh_target_project(Mesh *src_me, Mesh *target_me, Object *ob_target)
|
||||
{
|
||||
ShrinkwrapModifierData ssmd = {{nullptr}};
|
||||
int totvert;
|
||||
|
||||
ssmd.target = ob_target;
|
||||
ssmd.shrinkType = MOD_SHRINKWRAP_PROJECT;
|
||||
|
@ -1581,13 +1580,11 @@ void BKE_shrinkwrap_remesh_target_project(Mesh *src_me, Mesh *target_me, Object
|
|||
const float projLimitTolerance = 5.0f;
|
||||
ssmd.projLimit = target_me->remesh_voxel_size * projLimitTolerance;
|
||||
|
||||
float(*vertexCos)[3] = BKE_mesh_vert_coords_alloc(src_me, &totvert);
|
||||
|
||||
ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
|
||||
|
||||
calc.smd = &ssmd;
|
||||
calc.numVerts = src_me->totvert;
|
||||
calc.vertexCos = vertexCos;
|
||||
calc.vertexCos = BKE_mesh_vert_positions_for_write(src_me);
|
||||
calc.vert_normals = src_me->vert_normals();
|
||||
calc.vgroup = -1;
|
||||
calc.target = target_me;
|
||||
|
@ -1602,7 +1599,5 @@ void BKE_shrinkwrap_remesh_target_project(Mesh *src_me, Mesh *target_me, Object
|
|||
BKE_shrinkwrap_free_tree(&tree);
|
||||
}
|
||||
|
||||
BKE_mesh_vert_coords_apply(src_me, vertexCos);
|
||||
|
||||
MEM_freeN(vertexCos);
|
||||
BKE_mesh_tag_positions_changed(src_me);
|
||||
}
|
||||
|
|
|
@ -207,42 +207,3 @@ int *texttool_suggest_top(void)
|
|||
{
|
||||
return &suggestions.top;
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/* Documentation methods */
|
||||
/*************************/
|
||||
|
||||
void texttool_docs_show(const char *docs)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!docs) {
|
||||
return;
|
||||
}
|
||||
|
||||
len = strlen(docs);
|
||||
|
||||
MEM_SAFE_FREE(documentation);
|
||||
|
||||
/* Ensure documentation ends with a '\n' */
|
||||
if (docs[len - 1] != '\n') {
|
||||
documentation = MEM_mallocN(len + 2, "Documentation");
|
||||
memcpy(documentation, docs, len);
|
||||
documentation[len++] = '\n';
|
||||
}
|
||||
else {
|
||||
documentation = MEM_mallocN(len + 1, "Documentation");
|
||||
memcpy(documentation, docs, len);
|
||||
}
|
||||
documentation[len] = '\0';
|
||||
}
|
||||
|
||||
char *texttool_docs_get(void)
|
||||
{
|
||||
return documentation;
|
||||
}
|
||||
|
||||
void texttool_docs_clear(void)
|
||||
{
|
||||
txttl_free_docs();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ size_t BLI_string_flip_side_name(char *name_dst,
|
|||
* \param defname: To initialize name if latter is empty
|
||||
* \param delim: Delimits numeric suffix in name
|
||||
* \param name: Name to be ensured unique
|
||||
* \param name_len: Maximum length of name area
|
||||
* \param name_maxncpy: Maximum length of name area
|
||||
* \return true if there if the name was changed
|
||||
*/
|
||||
bool BLI_uniquename_cb(UniquenameCheckCallback unique_check,
|
||||
|
@ -97,7 +97,7 @@ bool BLI_uniquename_cb(UniquenameCheckCallback unique_check,
|
|||
const char *defname,
|
||||
char delim,
|
||||
char *name,
|
||||
size_t name_len) ATTR_NONNULL(1, 3, 5);
|
||||
size_t name_maxncpy) ATTR_NONNULL(1, 3, 5);
|
||||
/**
|
||||
* Ensures that the specified block has a unique name within the containing list,
|
||||
* incrementing its numeric suffix as necessary. Returns true if name had to be adjusted.
|
||||
|
@ -107,14 +107,14 @@ bool BLI_uniquename_cb(UniquenameCheckCallback unique_check,
|
|||
* \param defname: To initialize block name if latter is empty
|
||||
* \param delim: Delimits numeric suffix in name
|
||||
* \param name_offset: Offset of name within block structure
|
||||
* \param name_len: Maximum length of name area
|
||||
* \param name_maxncpy: Maximum length of name area
|
||||
*/
|
||||
bool BLI_uniquename(struct ListBase *list,
|
||||
void *vlink,
|
||||
const char *defname,
|
||||
char delim,
|
||||
int name_offset,
|
||||
size_t name_len) ATTR_NONNULL(1, 3);
|
||||
size_t name_maxncpy) ATTR_NONNULL(1, 3);
|
||||
|
||||
/* Expand array functions. */
|
||||
|
||||
|
|
|
@ -4422,7 +4422,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 306, 11)) {
|
||||
BKE_animdata_main_cb(bmain, version_liboverride_nla_frame_start_end, NULL);
|
||||
BKE_animdata_main_cb(bmain, version_liboverride_nla_frame_start_end, nullptr);
|
||||
|
||||
/* Store simulation bake directory in geometry nodes modifier. */
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
|
|
|
@ -1365,46 +1365,49 @@ static bool write_file_handle(Main *mainvar,
|
|||
return mywrite_end(wd);
|
||||
}
|
||||
|
||||
/* do reverse file history: .blend1 -> .blend2, .blend -> .blend1 */
|
||||
/* return: success(0), failure(1) */
|
||||
static bool do_history(const char *name, ReportList *reports)
|
||||
/**
|
||||
* Do reverse file history: `.blend1` -> `.blend2`, `.blend` -> `.blend1` ... etc.
|
||||
* \return True on success.
|
||||
*/
|
||||
static bool do_history(const char *filepath, ReportList *reports)
|
||||
{
|
||||
char tempname1[FILE_MAX], tempname2[FILE_MAX];
|
||||
int hisnr = U.versions;
|
||||
/* Add 2 because version number maximum is double-digits. */
|
||||
char filepath_tmp1[FILE_MAX + 2], filepath_tmp2[FILE_MAX + 2];
|
||||
int version_number = min_ii(99, U.versions);
|
||||
|
||||
if (U.versions == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen(name) < 2) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
|
||||
if (version_number == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
while (hisnr > 1) {
|
||||
SNPRINTF(tempname1, "%s%d", name, hisnr - 1);
|
||||
if (BLI_exists(tempname1)) {
|
||||
SNPRINTF(tempname2, "%s%d", name, hisnr);
|
||||
if (strlen(filepath) < 2) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BLI_rename_overwrite(tempname1, tempname2)) {
|
||||
while (version_number > 1) {
|
||||
SNPRINTF(filepath_tmp1, "%s%d", filepath, version_number - 1);
|
||||
if (BLI_exists(filepath_tmp1)) {
|
||||
SNPRINTF(filepath_tmp2, "%s%d", filepath, version_number);
|
||||
|
||||
if (BLI_rename_overwrite(filepath_tmp1, filepath_tmp2)) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
hisnr--;
|
||||
version_number--;
|
||||
}
|
||||
|
||||
/* is needed when hisnr==1 */
|
||||
if (BLI_exists(name)) {
|
||||
SNPRINTF(tempname1, "%s%d", name, hisnr);
|
||||
/* Needed when `version_number == 1`. */
|
||||
if (BLI_exists(filepath)) {
|
||||
SNPRINTF(filepath_tmp1, "%s%d", filepath, version_number);
|
||||
|
||||
if (BLI_rename_overwrite(name, tempname1)) {
|
||||
if (BLI_rename_overwrite(filepath, filepath_tmp1)) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -1558,8 +1561,7 @@ bool BLO_write_file(Main *mainvar,
|
|||
/* file save to temporary file was successful */
|
||||
/* now do reverse file history (move .blend1 -> .blend2, .blend -> .blend1) */
|
||||
if (use_save_versions) {
|
||||
const bool err_hist = do_history(filepath, reports);
|
||||
if (err_hist) {
|
||||
if (!do_history(filepath, reports)) {
|
||||
BKE_report(reports, RPT_ERROR, "Version backup failed (file saved with @)");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ static bool mdisp_in_mdispquad(BMLoop *l_src,
|
|||
return 0;
|
||||
}
|
||||
|
||||
mul_v2_fl(r_uv, (float)(res - 1));
|
||||
mul_v2_fl(r_uv, float(res - 1));
|
||||
|
||||
mdisp_axis_from_quad(v1, v2, v3, v4, r_axis_x, r_axis_y);
|
||||
|
||||
|
@ -509,7 +509,7 @@ void BM_loop_interp_multires_ex(BMesh * /*bm*/,
|
|||
|
||||
mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y);
|
||||
|
||||
const int res = (int)sqrt(md_dst->totdisp);
|
||||
const int res = int(sqrt(md_dst->totdisp));
|
||||
BMLoopInterpMultiresData data = {};
|
||||
data.l_dst = l_dst;
|
||||
data.l_src_first = BM_FACE_FIRST_LOOP(f_src);
|
||||
|
@ -523,7 +523,7 @@ void BM_loop_interp_multires_ex(BMesh * /*bm*/,
|
|||
data.e1 = e1;
|
||||
data.e2 = e2;
|
||||
data.res = res;
|
||||
data.d = 1.0f / (float)(res - 1);
|
||||
data.d = 1.0f / float(res - 1);
|
||||
|
||||
TaskParallelSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
|
@ -609,7 +609,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
|
|||
* </pre>
|
||||
*/
|
||||
|
||||
sides = (int)sqrt(mdp->totdisp);
|
||||
sides = int(sqrt(mdp->totdisp));
|
||||
for (y = 0; y < sides; y++) {
|
||||
mid_v3_v3v3(co1, mdn->disps[y * sides], mdl->disps[y]);
|
||||
|
||||
|
@ -652,7 +652,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
|
|||
BM_ELEM_CD_GET_VOID_P(l->radial_next->next, cd_loop_mdisp_offset));
|
||||
}
|
||||
|
||||
sides = (int)sqrt(mdl1->totdisp);
|
||||
sides = int(sqrt(mdl1->totdisp));
|
||||
for (y = 0; y < sides; y++) {
|
||||
int a1, a2, o1, o2;
|
||||
|
||||
|
@ -1117,7 +1117,7 @@ struct LoopGroupCD {
|
|||
int data_len;
|
||||
};
|
||||
|
||||
static void bm_loop_walk_add(struct LoopWalkCtx *lwc, BMLoop *l)
|
||||
static void bm_loop_walk_add(LoopWalkCtx *lwc, BMLoop *l)
|
||||
{
|
||||
const int i = BM_elem_index_get(l);
|
||||
const float w = lwc->loop_weights[i];
|
||||
|
@ -1135,7 +1135,7 @@ static void bm_loop_walk_add(struct LoopWalkCtx *lwc, BMLoop *l)
|
|||
*
|
||||
* \note called for fan matching so we're pretty much safe not to break the stack
|
||||
*/
|
||||
static void bm_loop_walk_data(struct LoopWalkCtx *lwc, BMLoop *l_walk)
|
||||
static void bm_loop_walk_data(LoopWalkCtx *lwc, BMLoop *l_walk)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ static void bm_loop_walk_data(struct LoopWalkCtx *lwc, BMLoop *l_walk)
|
|||
LinkNode *BM_vert_loop_groups_data_layer_create(
|
||||
BMesh *bm, BMVert *v, const int layer_n, const float *loop_weights, MemArena *arena)
|
||||
{
|
||||
struct LoopWalkCtx lwc;
|
||||
LoopWalkCtx lwc;
|
||||
LinkNode *groups = nullptr;
|
||||
BMLoop *l;
|
||||
BMIter liter;
|
||||
|
@ -1196,8 +1196,7 @@ LinkNode *BM_vert_loop_groups_data_layer_create(
|
|||
|
||||
BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
|
||||
if (BM_elem_flag_test(l, BM_ELEM_INTERNAL_TAG)) {
|
||||
struct LoopGroupCD *lf = static_cast<LoopGroupCD *>(
|
||||
BLI_memarena_alloc(lwc.arena, sizeof(*lf)));
|
||||
LoopGroupCD *lf = static_cast<LoopGroupCD *>(BLI_memarena_alloc(lwc.arena, sizeof(*lf)));
|
||||
int len_prev = lwc.data_len;
|
||||
|
||||
lwc.data_ref = BM_ELEM_CD_GET_VOID_P(l, lwc.cd_layer_offset);
|
||||
|
@ -1216,7 +1215,7 @@ LinkNode *BM_vert_loop_groups_data_layer_create(
|
|||
mul_vn_fl(lf->data_weights, lf->data_len, 1.0f / lwc.weight_accum);
|
||||
}
|
||||
else {
|
||||
copy_vn_fl(lf->data_weights, lf->data_len, 1.0f / (float)lf->data_len);
|
||||
copy_vn_fl(lf->data_weights, lf->data_len, 1.0f / float(lf->data_len));
|
||||
}
|
||||
|
||||
BLI_linklist_prepend_arena(&groups, lf, lwc.arena);
|
||||
|
@ -1233,7 +1232,7 @@ static void bm_vert_loop_groups_data_layer_merge__single(BMesh *bm,
|
|||
int layer_n,
|
||||
void *data_tmp)
|
||||
{
|
||||
struct LoopGroupCD *lf = static_cast<LoopGroupCD *>(lf_p);
|
||||
LoopGroupCD *lf = static_cast<LoopGroupCD *>(lf_p);
|
||||
const int type = bm->ldata.layers[layer_n].type;
|
||||
int i;
|
||||
const float *data_weights;
|
||||
|
@ -1251,7 +1250,7 @@ static void bm_vert_loop_groups_data_layer_merge__single(BMesh *bm,
|
|||
static void bm_vert_loop_groups_data_layer_merge_weights__single(
|
||||
BMesh *bm, void *lf_p, const int layer_n, void *data_tmp, const float *loop_weights)
|
||||
{
|
||||
struct LoopGroupCD *lf = static_cast<LoopGroupCD *>(lf_p);
|
||||
LoopGroupCD *lf = static_cast<LoopGroupCD *>(lf_p);
|
||||
const int type = bm->ldata.layers[layer_n].type;
|
||||
int i;
|
||||
const float *data_weights;
|
||||
|
|
|
@ -394,8 +394,7 @@ Schedule compute_schedule(const Context &context, const DerivedNodeTree &tree)
|
|||
int insertion_position = 0;
|
||||
for (int i = 0; i < sorted_dependency_nodes.size(); i++) {
|
||||
if (needed_buffers.lookup(doutput.node()) >
|
||||
needed_buffers.lookup(sorted_dependency_nodes[i]))
|
||||
{
|
||||
needed_buffers.lookup(sorted_dependency_nodes[i])) {
|
||||
insertion_position++;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -10,7 +10,19 @@ GPU_SHADER_CREATE_INFO(compositor_read_pass_shared)
|
|||
.sampler(0, ImageType::FLOAT_2D, "input_tx")
|
||||
.compute_source("compositor_read_pass.glsl");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_read_pass)
|
||||
GPU_SHADER_CREATE_INFO(compositor_read_pass_float)
|
||||
.additional_info("compositor_read_pass_shared")
|
||||
.image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
|
||||
.define("READ_EXPRESSION(pass_color)", "vec4(pass_color.r, vec3(0.0))")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_read_pass_vector)
|
||||
.additional_info("compositor_read_pass_shared")
|
||||
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
|
||||
.define("READ_EXPRESSION(pass_color)", "pass_color")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_CREATE_INFO(compositor_read_pass_color)
|
||||
.additional_info("compositor_read_pass_shared")
|
||||
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
|
||||
.define("READ_EXPRESSION(pass_color)", "pass_color")
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_collection.h"
|
||||
|
||||
#include "RNA_prototypes.h"
|
||||
|
||||
|
@ -183,6 +184,14 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
|||
flag |= ID_RECALC_NTREE_OUTPUT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Collection content might have changed (children collection might have been added or
|
||||
* removed from the graph based on their inclusion and visibility flags). */
|
||||
const ID_Type id_type = GS(id_node->id_cow->name);
|
||||
if (id_type == ID_GR) {
|
||||
BKE_collection_object_cache_free(reinterpret_cast<Collection *>(id_node->id_cow));
|
||||
}
|
||||
}
|
||||
/* Restore recalc flags from original ID, which could possibly contain recalc flags set by
|
||||
* an operator and then were carried on by the undo system. */
|
||||
flag |= id_orig->recalc;
|
||||
|
|
|
@ -24,7 +24,7 @@ bool ED_asset_filter_matches_asset(const AssetFilterSettings *filter,
|
|||
ID_Type asset_type = asset.get_id_type();
|
||||
uint64_t asset_id_filter = BKE_idtype_idcode_to_idfilter(asset_type);
|
||||
|
||||
if ((filter->id_types & asset_id_filter) == 0) {
|
||||
if (filter->id_types && (filter->id_types & asset_id_filter) == 0) {
|
||||
return false;
|
||||
}
|
||||
/* Not very efficient (O(n^2)), could be improved quite a bit. */
|
||||
|
|
|
@ -100,7 +100,7 @@ bool ED_asset_can_mark_single_from_context(const bContext *C)
|
|||
return ED_asset_type_is_supported(id);
|
||||
}
|
||||
|
||||
bool ED_asset_copy_to_id(const struct AssetMetaData *asset_data, struct ID *destination)
|
||||
bool ED_asset_copy_to_id(const AssetMetaData *asset_data, ID *destination)
|
||||
{
|
||||
if (!BKE_id_can_be_asset(destination)) {
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "BLI_utildefines.h"
|
||||
#include "BLI_vector_set.hh"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "ED_curves.h"
|
||||
#include "ED_object.h"
|
||||
#include "ED_screen.h"
|
||||
|
@ -938,15 +940,15 @@ static void CURVES_OT_select_random(wmOperatorType *ot)
|
|||
1.0f);
|
||||
}
|
||||
|
||||
static int select_end_exec(bContext *C, wmOperator *op)
|
||||
static int select_ends_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
VectorSet<Curves *> unique_curves = curves::get_unique_editable_curves(*C);
|
||||
const bool end_points = RNA_boolean_get(op->ptr, "end_points");
|
||||
const int amount = RNA_int_get(op->ptr, "amount");
|
||||
const int amount_start = RNA_int_get(op->ptr, "amount_start");
|
||||
const int amount_end = RNA_int_get(op->ptr, "amount_end");
|
||||
|
||||
for (Curves *curves_id : unique_curves) {
|
||||
CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
select_ends(curves, amount, end_points);
|
||||
select_ends(curves, amount_start, amount_end);
|
||||
|
||||
/* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is handled as a generic
|
||||
* attribute for now. */
|
||||
|
@ -957,24 +959,48 @@ static int select_end_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void CURVES_OT_select_end(wmOperatorType *ot)
|
||||
static void select_ends_ui(bContext * /*C*/, wmOperator *op)
|
||||
{
|
||||
ot->name = "Select End";
|
||||
uiLayout *layout = op->layout;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, true);
|
||||
uiLayoutSetPropDecorate(col, false);
|
||||
uiItemR(col, op->ptr, "amount_start", 0, IFACE_("Amount Start"), ICON_NONE);
|
||||
uiItemR(col, op->ptr, "amount_end", 0, IFACE_("End"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void CURVES_OT_select_ends(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Select Ends";
|
||||
ot->idname = __func__;
|
||||
ot->description = "Select end points of curves";
|
||||
|
||||
ot->exec = select_end_exec;
|
||||
ot->exec = select_ends_exec;
|
||||
ot->ui = select_ends_ui;
|
||||
ot->poll = editable_curves_point_domain_poll;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna,
|
||||
"end_points",
|
||||
true,
|
||||
"End Points",
|
||||
"Select points at the end of the curve as opposed to the beginning");
|
||||
RNA_def_int(
|
||||
ot->srna, "amount", 1, 0, INT32_MAX, "Amount", "Number of points to select", 0, INT32_MAX);
|
||||
RNA_def_int(ot->srna,
|
||||
"amount_start",
|
||||
0,
|
||||
0,
|
||||
INT32_MAX,
|
||||
"Amount Front",
|
||||
"Number of points to select from the front",
|
||||
0,
|
||||
INT32_MAX);
|
||||
RNA_def_int(ot->srna,
|
||||
"amount_end",
|
||||
1,
|
||||
0,
|
||||
INT32_MAX,
|
||||
"Amount Back",
|
||||
"Number of points to select from the back",
|
||||
0,
|
||||
INT32_MAX);
|
||||
}
|
||||
|
||||
static int select_linked_exec(bContext *C, wmOperator * /*op*/)
|
||||
|
@ -1181,7 +1207,7 @@ void ED_operatortypes_curves()
|
|||
WM_operatortype_append(CURVES_OT_set_selection_domain);
|
||||
WM_operatortype_append(CURVES_OT_select_all);
|
||||
WM_operatortype_append(CURVES_OT_select_random);
|
||||
WM_operatortype_append(CURVES_OT_select_end);
|
||||
WM_operatortype_append(CURVES_OT_select_ends);
|
||||
WM_operatortype_append(CURVES_OT_select_linked);
|
||||
WM_operatortype_append(CURVES_OT_select_more);
|
||||
WM_operatortype_append(CURVES_OT_select_less);
|
||||
|
|
|
@ -222,7 +222,7 @@ void select_all(bke::CurvesGeometry &curves, const eAttrDomain selection_domain,
|
|||
}
|
||||
}
|
||||
|
||||
void select_ends(bke::CurvesGeometry &curves, int amount, bool end_points)
|
||||
void select_ends(bke::CurvesGeometry &curves, int amount_start, int amount_end)
|
||||
{
|
||||
const bool was_anything_selected = has_anything_selected(curves);
|
||||
const OffsetIndices points_by_curve = curves.points_by_curve();
|
||||
|
@ -240,12 +240,9 @@ void select_ends(bke::CurvesGeometry &curves, int amount, bool end_points)
|
|||
MutableSpan<T> selection_typed = selection.span.typed<T>();
|
||||
threading::parallel_for(curves.curves_range(), 256, [&](const IndexRange range) {
|
||||
for (const int curve_i : range) {
|
||||
if (end_points) {
|
||||
selection_typed.slice(points_by_curve[curve_i].drop_back(amount)).fill(T(0));
|
||||
}
|
||||
else {
|
||||
selection_typed.slice(points_by_curve[curve_i].drop_front(amount)).fill(T(0));
|
||||
}
|
||||
selection_typed
|
||||
.slice(points_by_curve[curve_i].drop_front(amount_start).drop_back(amount_end))
|
||||
.fill(T(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -76,6 +76,102 @@ static void GREASE_PENCIL_OT_select_all(wmOperatorType *ot)
|
|||
WM_operator_properties_select_all(ot);
|
||||
}
|
||||
|
||||
static int select_more_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *object = CTX_data_active_object(C);
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
|
||||
|
||||
grease_pencil.foreach_editable_drawing(
|
||||
scene->r.cfra, [](int /*drawing_index*/, GreasePencilDrawing &drawing) {
|
||||
// TODO: Support different selection domains.
|
||||
blender::ed::curves::select_adjacent(drawing.geometry.wrap(), false);
|
||||
});
|
||||
|
||||
/* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is handled as a generic
|
||||
* attribute for now. */
|
||||
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_select_more(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Select More";
|
||||
ot->idname = "GREASE_PENCIL_OT_select_more";
|
||||
ot->description = "Grow the selection by one point";
|
||||
|
||||
ot->exec = select_more_exec;
|
||||
ot->poll = editable_grease_pencil_poll;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int select_less_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *object = CTX_data_active_object(C);
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
|
||||
|
||||
grease_pencil.foreach_editable_drawing(
|
||||
scene->r.cfra, [](int /*drawing_index*/, GreasePencilDrawing &drawing) {
|
||||
// TODO: Support different selection domains.
|
||||
blender::ed::curves::select_adjacent(drawing.geometry.wrap(), true);
|
||||
});
|
||||
|
||||
/* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is handled as a generic
|
||||
* attribute for now. */
|
||||
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_select_less(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Select Less";
|
||||
ot->idname = "GREASE_PENCIL_OT_select_less";
|
||||
ot->description = "Shrink the selection by one point";
|
||||
|
||||
ot->exec = select_less_exec;
|
||||
ot->poll = editable_grease_pencil_poll;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static int select_linked_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *object = CTX_data_active_object(C);
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(object->data);
|
||||
|
||||
grease_pencil.foreach_editable_drawing(
|
||||
scene->r.cfra, [](int /*drawing_index*/, GreasePencilDrawing &drawing) {
|
||||
// TODO: Support different selection domains.
|
||||
blender::ed::curves::select_linked(drawing.geometry.wrap());
|
||||
});
|
||||
|
||||
/* Use #ID_RECALC_GEOMETRY instead of #ID_RECALC_SELECT because it is handled as a generic
|
||||
* attribute for now. */
|
||||
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &grease_pencil);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_select_linked(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Select Linked";
|
||||
ot->idname = "GREASE_PENCIL_OT_select_linked";
|
||||
ot->description = "Select all points in curves with any point selection";
|
||||
|
||||
ot->exec = select_linked_exec;
|
||||
ot->poll = editable_grease_pencil_poll;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
static void keymap_grease_pencil_editing(wmKeyConfig *keyconf)
|
||||
{
|
||||
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Edit Mode", 0, 0);
|
||||
|
@ -88,6 +184,9 @@ void ED_operatortypes_grease_pencil(void)
|
|||
{
|
||||
using namespace blender::ed::greasepencil;
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_select_all);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_select_more);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_select_less);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_select_linked);
|
||||
}
|
||||
|
||||
void ED_keymap_grease_pencil(wmKeyConfig *keyconf)
|
||||
|
|
|
@ -150,10 +150,10 @@ void select_all(bke::CurvesGeometry &curves, eAttrDomain selection_domain, int a
|
|||
/**
|
||||
* Select the ends (front or back) of all the curves.
|
||||
*
|
||||
* \param amount: The amount of points to select from the front or back.
|
||||
* \param end_points: If true, select the last point(s), if false, select the first point(s).
|
||||
* \param amount_start: The amount of points to select from the front.
|
||||
* \param amount_end: The amount of points to select from the back.
|
||||
*/
|
||||
void select_ends(bke::CurvesGeometry &curves, int amount, bool end_points);
|
||||
void select_ends(bke::CurvesGeometry &curves, int amount_start, int amount_end);
|
||||
|
||||
/**
|
||||
* Select the points of all curves that have at least one point selected.
|
||||
|
|
|
@ -1056,7 +1056,6 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d);
|
|||
struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
|
||||
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
|
||||
|
||||
|
||||
struct RenderEngineType *ED_view3d_engine_type(const struct Scene *scene, int drawtype);
|
||||
|
||||
bool ED_view3d_context_activate(struct bContext *C);
|
||||
|
|
|
@ -933,10 +933,10 @@ void UI_but_execute(const struct bContext *C, struct ARegion *region, uiBut *but
|
|||
|
||||
bool UI_but_online_manual_id(const uiBut *but,
|
||||
char *r_str,
|
||||
size_t maxlength) ATTR_WARN_UNUSED_RESULT;
|
||||
size_t str_maxncpy) ATTR_WARN_UNUSED_RESULT;
|
||||
bool UI_but_online_manual_id_from_active(const struct bContext *C,
|
||||
char *r_str,
|
||||
size_t maxlength) ATTR_WARN_UNUSED_RESULT;
|
||||
size_t str_maxncpy) ATTR_WARN_UNUSED_RESULT;
|
||||
bool UI_but_is_userdef(const uiBut *but);
|
||||
|
||||
/* Buttons
|
||||
|
|
|
@ -2699,7 +2699,7 @@ void ui_but_value_set(uiBut *but, double value)
|
|||
ui_but_update_select_flag(but, &value);
|
||||
}
|
||||
|
||||
int ui_but_string_get_max_length(uiBut *but)
|
||||
int ui_but_string_get_maxncpy(uiBut *but)
|
||||
{
|
||||
if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
|
||||
return but->hardmax;
|
||||
|
@ -4937,20 +4937,20 @@ static int findBitIndex(uint x)
|
|||
|
||||
/* Auto-complete helper functions. */
|
||||
struct AutoComplete {
|
||||
size_t maxlen;
|
||||
size_t maxncpy;
|
||||
int matches;
|
||||
char *truncate;
|
||||
const char *startname;
|
||||
};
|
||||
|
||||
AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxlen)
|
||||
AutoComplete *UI_autocomplete_begin(const char *startname, size_t maxncpy)
|
||||
{
|
||||
AutoComplete *autocpl;
|
||||
|
||||
autocpl = MEM_cnew<AutoComplete>(__func__);
|
||||
autocpl->maxlen = maxlen;
|
||||
autocpl->maxncpy = maxncpy;
|
||||
autocpl->matches = 0;
|
||||
autocpl->truncate = static_cast<char *>(MEM_callocN(sizeof(char) * maxlen, __func__));
|
||||
autocpl->truncate = static_cast<char *>(MEM_callocN(sizeof(char) * maxncpy, __func__));
|
||||
autocpl->startname = startname;
|
||||
|
||||
return autocpl;
|
||||
|
@ -4961,7 +4961,7 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
|
|||
char *truncate = autocpl->truncate;
|
||||
const char *startname = autocpl->startname;
|
||||
int match_index = 0;
|
||||
for (int a = 0; a < autocpl->maxlen - 1; a++) {
|
||||
for (int a = 0; a < autocpl->maxncpy - 1; a++) {
|
||||
if (startname[a] == 0 || startname[a] != name[a]) {
|
||||
match_index = a;
|
||||
break;
|
||||
|
@ -4973,11 +4973,11 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
|
|||
autocpl->matches++;
|
||||
/* first match */
|
||||
if (truncate[0] == 0) {
|
||||
BLI_strncpy(truncate, name, autocpl->maxlen);
|
||||
BLI_strncpy(truncate, name, autocpl->maxncpy);
|
||||
}
|
||||
else {
|
||||
/* remove from truncate what is not in bone->name */
|
||||
for (int a = 0; a < autocpl->maxlen - 1; a++) {
|
||||
for (int a = 0; a < autocpl->maxncpy - 1; a++) {
|
||||
if (name[a] == 0) {
|
||||
truncate[a] = 0;
|
||||
break;
|
||||
|
@ -5000,11 +5000,11 @@ int UI_autocomplete_end(AutoComplete *autocpl, char *autoname)
|
|||
else {
|
||||
match = AUTOCOMPLETE_PARTIAL_MATCH;
|
||||
}
|
||||
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
|
||||
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxncpy);
|
||||
}
|
||||
else {
|
||||
if (autoname != autocpl->startname) { /* don't copy a string over itself */
|
||||
BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
|
||||
BLI_strncpy(autoname, autocpl->startname, autocpl->maxncpy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6271,7 +6271,7 @@ uiBut *uiDefSearchBut(uiBlock *block,
|
|||
void *arg,
|
||||
int retval,
|
||||
int icon,
|
||||
int maxlen,
|
||||
int maxncpy,
|
||||
int x,
|
||||
int y,
|
||||
short width,
|
||||
|
@ -6280,8 +6280,20 @@ uiBut *uiDefSearchBut(uiBlock *block,
|
|||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but(
|
||||
block, UI_BTYPE_SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip);
|
||||
uiBut *but = ui_def_but(block,
|
||||
UI_BTYPE_SEARCH_MENU,
|
||||
retval,
|
||||
"",
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
arg,
|
||||
0.0,
|
||||
maxncpy,
|
||||
a1,
|
||||
a2,
|
||||
tip);
|
||||
|
||||
ui_def_but_icon(but, icon, UI_HAS_ICON);
|
||||
|
||||
|
@ -6466,7 +6478,7 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block,
|
|||
void *arg,
|
||||
int retval,
|
||||
int icon,
|
||||
int maxlen,
|
||||
int maxncpy,
|
||||
int x,
|
||||
int y,
|
||||
short width,
|
||||
|
@ -6475,7 +6487,7 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block,
|
|||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = uiDefSearchBut(block, arg, retval, icon, maxlen, x, y, width, height, a1, a2, tip);
|
||||
uiBut *but = uiDefSearchBut(block, arg, retval, icon, maxncpy, x, y, width, height, a1, a2, tip);
|
||||
UI_but_func_search_set(but,
|
||||
ui_searchbox_create_generic,
|
||||
operator_enum_search_update_fn,
|
||||
|
|
|
@ -2489,23 +2489,23 @@ static void ui_but_set_float_array(
|
|||
static void float_array_to_string(const float *values,
|
||||
const int values_len,
|
||||
char *output,
|
||||
int output_len_max)
|
||||
int output_maxncpy)
|
||||
{
|
||||
const int values_end = values_len - 1;
|
||||
int ofs = 0;
|
||||
output[ofs++] = '[';
|
||||
for (int i = 0; i < values_len; i++) {
|
||||
ofs += BLI_snprintf_rlen(
|
||||
output + ofs, output_len_max - ofs, (i != values_end) ? "%f, " : "%f]", values[i]);
|
||||
output + ofs, output_maxncpy - ofs, (i != values_end) ? "%f, " : "%f]", values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_but_copy_numeric_array(uiBut *but, char *output, int output_len_max)
|
||||
static void ui_but_copy_numeric_array(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
const int values_len = get_but_property_array_length(but);
|
||||
blender::Array<float, 16> values(values_len);
|
||||
RNA_property_float_get_array(&but->rnapoin, but->rnaprop, values.data());
|
||||
float_array_to_string(values.data(), values_len, output, output_len_max);
|
||||
float_array_to_string(values.data(), values_len, output, output_maxncpy);
|
||||
}
|
||||
|
||||
static bool parse_float_array(char *text, float *values, int values_len_expected)
|
||||
|
@ -2545,11 +2545,11 @@ static void ui_but_paste_numeric_array(bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
static void ui_but_copy_numeric_value(uiBut *but, char *output, int output_len_max)
|
||||
static void ui_but_copy_numeric_value(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
/* Get many decimal places, then strip trailing zeros.
|
||||
* NOTE: too high values start to give strange results. */
|
||||
ui_but_string_get_ex(but, output, output_len_max, UI_PRECISION_FLOAT_MAX, false, nullptr);
|
||||
ui_but_string_get_ex(but, output, output_maxncpy, UI_PRECISION_FLOAT_MAX, false, nullptr);
|
||||
BLI_str_rstrip_float_zero(output, '\0');
|
||||
}
|
||||
|
||||
|
@ -2588,7 +2588,7 @@ static void ui_but_paste_normalized_vector(bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
static void ui_but_copy_color(uiBut *but, char *output, int output_len_max)
|
||||
static void ui_but_copy_color(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
float rgba[4];
|
||||
|
||||
|
@ -2606,7 +2606,7 @@ static void ui_but_copy_color(uiBut *but, char *output, int output_len_max)
|
|||
srgb_to_linearrgb_v3_v3(rgba, rgba);
|
||||
}
|
||||
|
||||
float_array_to_string(rgba, 4, output, output_len_max);
|
||||
float_array_to_string(rgba, 4, output, output_maxncpy);
|
||||
}
|
||||
|
||||
static void ui_but_paste_color(bContext *C, uiBut *but, char *buf_paste)
|
||||
|
@ -2630,9 +2630,9 @@ static void ui_but_paste_color(bContext *C, uiBut *but, char *buf_paste)
|
|||
}
|
||||
}
|
||||
|
||||
static void ui_but_copy_text(uiBut *but, char *output, int output_len_max)
|
||||
static void ui_but_copy_text(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
ui_but_string_get(but, output, output_len_max);
|
||||
ui_but_string_get(but, output, output_maxncpy);
|
||||
}
|
||||
|
||||
static void ui_but_paste_text(bContext *C, uiBut *but, uiHandleButtonData *data, char *buf_paste)
|
||||
|
@ -2708,31 +2708,31 @@ static void ui_but_paste_CurveProfile(bContext *C, uiBut *but)
|
|||
}
|
||||
}
|
||||
|
||||
static void ui_but_copy_operator(bContext *C, uiBut *but, char *output, int output_len_max)
|
||||
static void ui_but_copy_operator(bContext *C, uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
PointerRNA *opptr = UI_but_operator_ptr_get(but);
|
||||
|
||||
char *str;
|
||||
str = WM_operator_pystring_ex(C, nullptr, false, true, but->optype, opptr);
|
||||
BLI_strncpy(output, str, output_len_max);
|
||||
BLI_strncpy(output, str, output_maxncpy);
|
||||
MEM_freeN(str);
|
||||
}
|
||||
|
||||
static bool ui_but_copy_menu(uiBut *but, char *output, int output_len_max)
|
||||
static bool ui_but_copy_menu(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
MenuType *mt = UI_but_menutype_get(but);
|
||||
if (mt) {
|
||||
BLI_snprintf(output, output_len_max, "bpy.ops.wm.call_menu(name=\"%s\")", mt->idname);
|
||||
BLI_snprintf(output, output_maxncpy, "bpy.ops.wm.call_menu(name=\"%s\")", mt->idname);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ui_but_copy_popover(uiBut *but, char *output, int output_len_max)
|
||||
static bool ui_but_copy_popover(uiBut *but, char *output, int output_maxncpy)
|
||||
{
|
||||
PanelType *pt = UI_but_paneltype_get(but);
|
||||
if (pt) {
|
||||
BLI_snprintf(output, output_len_max, "bpy.ops.wm.call_panel(name=\"%s\")", pt->idname);
|
||||
BLI_snprintf(output, output_maxncpy, "bpy.ops.wm.call_panel(name=\"%s\")", pt->idname);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -2746,7 +2746,7 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
|
||||
/* Arbitrary large value (allow for paths: 'PATH_MAX') */
|
||||
char buf[4096] = {0};
|
||||
const int buf_max_len = sizeof(buf);
|
||||
const int buf_maxncpy = sizeof(buf);
|
||||
|
||||
/* Left false for copying internal data (color-band for eg). */
|
||||
bool is_buf_set = false;
|
||||
|
@ -2760,10 +2760,10 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
break;
|
||||
}
|
||||
if (copy_array && ui_but_has_array_value(but)) {
|
||||
ui_but_copy_numeric_array(but, buf, buf_max_len);
|
||||
ui_but_copy_numeric_array(but, buf, buf_maxncpy);
|
||||
}
|
||||
else {
|
||||
ui_but_copy_numeric_value(but, buf, buf_max_len);
|
||||
ui_but_copy_numeric_value(but, buf, buf_maxncpy);
|
||||
}
|
||||
is_buf_set = true;
|
||||
break;
|
||||
|
@ -2772,7 +2772,7 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
if (!has_required_data) {
|
||||
break;
|
||||
}
|
||||
ui_but_copy_numeric_array(but, buf, buf_max_len);
|
||||
ui_but_copy_numeric_array(but, buf, buf_maxncpy);
|
||||
is_buf_set = true;
|
||||
break;
|
||||
|
||||
|
@ -2780,7 +2780,7 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
if (!has_required_data) {
|
||||
break;
|
||||
}
|
||||
ui_but_copy_color(but, buf, buf_max_len);
|
||||
ui_but_copy_color(but, buf, buf_maxncpy);
|
||||
is_buf_set = true;
|
||||
break;
|
||||
|
||||
|
@ -2789,7 +2789,7 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
if (!has_required_data) {
|
||||
break;
|
||||
}
|
||||
ui_but_copy_text(but, buf, buf_max_len);
|
||||
ui_but_copy_text(but, buf, buf_maxncpy);
|
||||
is_buf_set = true;
|
||||
break;
|
||||
|
||||
|
@ -2809,18 +2809,18 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
|
|||
if (!but->optype) {
|
||||
break;
|
||||
}
|
||||
ui_but_copy_operator(C, but, buf, buf_max_len);
|
||||
ui_but_copy_operator(C, but, buf, buf_maxncpy);
|
||||
is_buf_set = true;
|
||||
break;
|
||||
|
||||
case UI_BTYPE_MENU:
|
||||
case UI_BTYPE_PULLDOWN:
|
||||
if (ui_but_copy_menu(but, buf, buf_max_len)) {
|
||||
if (ui_but_copy_menu(but, buf, buf_maxncpy)) {
|
||||
is_buf_set = true;
|
||||
}
|
||||
break;
|
||||
case UI_BTYPE_POPOVER:
|
||||
if (ui_but_copy_popover(but, buf, buf_max_len)) {
|
||||
if (ui_but_copy_popover(but, buf, buf_maxncpy)) {
|
||||
is_buf_set = true;
|
||||
}
|
||||
break;
|
||||
|
@ -3425,7 +3425,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
|
|||
#endif
|
||||
|
||||
/* retrieve string */
|
||||
data->str_maxncpy = ui_but_string_get_max_length(but);
|
||||
data->str_maxncpy = ui_but_string_get_maxncpy(but);
|
||||
if (data->str_maxncpy != 0) {
|
||||
data->str = static_cast<char *>(MEM_callocN(sizeof(char) * data->str_maxncpy, "textedit str"));
|
||||
/* We do not want to truncate precision to default here, it's nice to show value,
|
||||
|
|
|
@ -675,7 +675,7 @@ void ui_but_string_get_ex(uiBut *but,
|
|||
void ui_but_string_get(uiBut *but, char *str, size_t str_maxncpy) ATTR_NONNULL();
|
||||
/**
|
||||
* A version of #ui_but_string_get_ex for dynamic buffer sizes
|
||||
* (where #ui_but_string_get_max_length returns 0).
|
||||
* (where #ui_but_string_get_maxncpy returns 0).
|
||||
*
|
||||
* \param r_str_size: size of the returned string (including terminator).
|
||||
*/
|
||||
|
@ -687,7 +687,7 @@ void ui_but_convert_to_unit_alt_name(uiBut *but, char *str, size_t str_maxncpy)
|
|||
bool ui_but_string_set(bContext *C, uiBut *but, const char *str) ATTR_NONNULL();
|
||||
bool ui_but_string_eval_number(bContext *C, const uiBut *but, const char *str, double *value)
|
||||
ATTR_NONNULL();
|
||||
int ui_but_string_get_max_length(uiBut *but);
|
||||
int ui_but_string_get_maxncpy(uiBut *but);
|
||||
/**
|
||||
* Clear & exit the active button's string..
|
||||
*/
|
||||
|
|
|
@ -1751,7 +1751,7 @@ static int editsource_text_edit(bContext *C,
|
|||
RNA_int_set(&op_props, "line", line - 1);
|
||||
RNA_int_set(&op_props, "column", 0);
|
||||
|
||||
int result = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props, NULL);
|
||||
int result = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props, nullptr);
|
||||
WM_operator_properties_free(&op_props);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *st
|
|||
BLI_assert(but->type == UI_BTYPE_SEARCH_MENU);
|
||||
|
||||
if (str[0]) {
|
||||
data->items.autocpl = UI_autocomplete_begin(str, ui_but_string_get_max_length(but));
|
||||
data->items.autocpl = UI_autocomplete_begin(str, ui_but_string_get_maxncpy(but));
|
||||
|
||||
ui_searchbox_update_fn(C, search_but, but->editstr, &data->items);
|
||||
|
||||
|
|
|
@ -827,11 +827,11 @@ int UI_calc_float_precision(int prec, double value)
|
|||
return prec;
|
||||
}
|
||||
|
||||
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
|
||||
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t str_maxncpy)
|
||||
{
|
||||
if (but->rnapoin.owner_id && but->rnapoin.data && but->rnaprop) {
|
||||
BLI_snprintf(r_str,
|
||||
maxlength,
|
||||
str_maxncpy,
|
||||
"%s.%s",
|
||||
RNA_struct_identifier(but->rnapoin.type),
|
||||
RNA_property_identifier(but->rnaprop));
|
||||
|
@ -846,12 +846,12 @@ bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool UI_but_online_manual_id_from_active(const bContext *C, char *r_str, size_t maxlength)
|
||||
bool UI_but_online_manual_id_from_active(const bContext *C, char *r_str, size_t str_maxncpy)
|
||||
{
|
||||
uiBut *but = UI_context_active_but_get(C);
|
||||
|
||||
if (but) {
|
||||
return UI_but_online_manual_id(but, r_str, maxlength);
|
||||
return UI_but_online_manual_id(but, r_str, str_maxncpy);
|
||||
}
|
||||
|
||||
*r_str = '\0';
|
||||
|
|
|
@ -473,7 +473,7 @@ void WM_OT_alembic_export(wmOperatorType *ot)
|
|||
/* TODO(kevin): check on de-duplicating all this with code in image_ops.c */
|
||||
|
||||
struct CacheFrame {
|
||||
struct CacheFrame *next, *prev;
|
||||
CacheFrame *next, *prev;
|
||||
int framenr;
|
||||
};
|
||||
|
||||
|
|
|
@ -226,8 +226,6 @@ void ED_operatortypes_object(void)
|
|||
WM_operatortype_append(OBJECT_OT_vertex_weight_normalize_active_vertex);
|
||||
WM_operatortype_append(OBJECT_OT_vertex_weight_copy);
|
||||
|
||||
|
||||
|
||||
WM_operatortype_append(TRANSFORM_OT_vertex_warp);
|
||||
|
||||
WM_operatortype_append(OBJECT_OT_move_to_collection);
|
||||
|
|
|
@ -123,8 +123,10 @@ void PaintOperation::on_stroke_done(const bContext &C)
|
|||
/* Set position, radius and opacity attribute. */
|
||||
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
|
||||
MutableSpan<float3> positions = curves.positions_for_write();
|
||||
SpanAttributeWriter<float> radii = attributes.lookup_for_write_span<float>("radius");
|
||||
SpanAttributeWriter<float> opacities = attributes.lookup_for_write_span<float>("opacity");
|
||||
SpanAttributeWriter<float> radii = attributes.lookup_or_add_for_write_span<float>(
|
||||
"radius", ATTR_DOMAIN_POINT);
|
||||
SpanAttributeWriter<float> opacities = attributes.lookup_or_add_for_write_span<float>(
|
||||
"opacity", ATTR_DOMAIN_POINT);
|
||||
for (const int i : IndexRange(stroke_points.size())) {
|
||||
const bke::greasepencil::StrokePoint &point = stroke_points[i];
|
||||
const int point_i = new_points_range[i];
|
||||
|
@ -135,7 +137,9 @@ void PaintOperation::on_stroke_done(const bContext &C)
|
|||
|
||||
/* Set material index attribute. */
|
||||
int material_index = 0;
|
||||
SpanAttributeWriter<int> materials = attributes.lookup_for_write_span<int>("material_index");
|
||||
SpanAttributeWriter<int> materials = attributes.lookup_or_add_for_write_span<int>(
|
||||
"material_index", ATTR_DOMAIN_CURVE);
|
||||
|
||||
materials.span.slice(new_curves_range).fill(material_index);
|
||||
|
||||
/* Set curve_type attribute. */
|
||||
|
|
|
@ -37,6 +37,7 @@ typedef struct GizmoGroup_retime {
|
|||
wmGizmo *add_handle_gizmo;
|
||||
wmGizmo *move_handle_gizmo;
|
||||
wmGizmo *remove_handle_gizmo;
|
||||
wmGizmo *speed_set_gizmo;
|
||||
} GizmoGroup_retime;
|
||||
|
||||
static bool gizmogroup_retime_poll(const bContext *C, wmGizmoGroupType *gzgt)
|
||||
|
@ -81,6 +82,8 @@ static void gizmogroup_retime_setup(const bContext * /* C */, wmGizmoGroup *gzgr
|
|||
ggd->remove_handle_gizmo = WM_gizmo_new_ptr(gzt_remove_handle, gzgroup, nullptr);
|
||||
const wmGizmoType *gzt_move_handle = WM_gizmotype_find("GIZMO_GT_retime_handle_move", true);
|
||||
ggd->move_handle_gizmo = WM_gizmo_new_ptr(gzt_move_handle, gzgroup, nullptr);
|
||||
const wmGizmoType *gzt_speed_set = WM_gizmotype_find("GIZMO_GT_retime_speed_set", true);
|
||||
ggd->speed_set_gizmo = WM_gizmo_new_ptr(gzt_speed_set, gzgroup, nullptr);
|
||||
gzgroup->customdata = ggd;
|
||||
|
||||
/* Assign operators. */
|
||||
|
@ -90,6 +93,8 @@ static void gizmogroup_retime_setup(const bContext * /* C */, wmGizmoGroup *gzgr
|
|||
WM_gizmo_operator_set(ggd->add_handle_gizmo, 0, ot, nullptr);
|
||||
ot = WM_operatortype_find("SEQUENCER_OT_retiming_handle_remove", true);
|
||||
WM_gizmo_operator_set(ggd->remove_handle_gizmo, 0, ot, nullptr);
|
||||
ot = WM_operatortype_find("SEQUENCER_OT_retiming_segment_speed_set", true);
|
||||
WM_gizmo_operator_set(ggd->speed_set_gizmo, 0, ot, nullptr);
|
||||
}
|
||||
|
||||
void SEQUENCER_GGT_gizmo_retime(wmGizmoGroupType *gzgt)
|
||||
|
|
|
@ -403,61 +403,6 @@ static void retime_handle_draw(const bContext *C,
|
|||
immEnd();
|
||||
}
|
||||
|
||||
static void retime_speed_text_draw(const bContext *C,
|
||||
const Sequence *seq,
|
||||
const SeqRetimingHandle *handle)
|
||||
{
|
||||
SeqRetimingHandle *last_handle = SEQ_retiming_last_handle_get(seq);
|
||||
if (handle == last_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const int start_frame = SEQ_time_left_handle_frame_get(scene, seq);
|
||||
const int end_frame = SEQ_time_right_handle_frame_get(scene, seq);
|
||||
|
||||
int next_handle_index = SEQ_retiming_handle_index_get(seq, handle) + 1;
|
||||
const SeqRetimingHandle *next_handle = &SEQ_retiming_handles_get(seq)[next_handle_index];
|
||||
if (handle_x_get(scene, seq, next_handle) < start_frame ||
|
||||
handle_x_get(scene, seq, handle) > end_frame)
|
||||
{
|
||||
return; /* Label out of strip bounds. */
|
||||
}
|
||||
|
||||
char label_str[40];
|
||||
size_t label_len;
|
||||
|
||||
if (SEQ_retiming_handle_is_transition_type(handle)) {
|
||||
const float prev_speed = SEQ_retiming_handle_speed_get(seq, handle - 1);
|
||||
const float next_speed = SEQ_retiming_handle_speed_get(seq, next_handle + 1);
|
||||
label_len = SNPRINTF_RLEN(label_str,
|
||||
"%d%% - %d%%",
|
||||
round_fl_to_int(prev_speed * 100.0f),
|
||||
round_fl_to_int(next_speed * 100.0f));
|
||||
}
|
||||
else {
|
||||
const float speed = SEQ_retiming_handle_speed_get(seq, next_handle);
|
||||
label_len = SNPRINTF_RLEN(label_str, "%d%%", round_fl_to_int(speed * 100.0f));
|
||||
}
|
||||
|
||||
const float width = pixels_to_view_width(C, BLF_width(BLF_default(), label_str, label_len));
|
||||
|
||||
const float xmin = max_ff(SEQ_time_left_handle_frame_get(scene, seq),
|
||||
handle_x_get(scene, seq, handle));
|
||||
const float xmax = min_ff(SEQ_time_right_handle_frame_get(scene, seq),
|
||||
handle_x_get(scene, seq, next_handle));
|
||||
|
||||
const float text_x = (xmin + xmax - width) / 2;
|
||||
const float text_y = strip_y_rescale(seq, 0) + pixels_to_view_height(C, 5);
|
||||
|
||||
if (width > xmax - xmin) {
|
||||
return; /* Not enough space to draw label. */
|
||||
}
|
||||
|
||||
const uchar col[4] = {255, 255, 255, 255};
|
||||
UI_view2d_text_cache_add(UI_view2d_fromcontext(C), text_x, text_y, label_str, label_len, col);
|
||||
}
|
||||
|
||||
static void gizmo_retime_handle_draw(const bContext *C, wmGizmo *gz)
|
||||
{
|
||||
RetimeHandleMoveGizmo *gizmo = (RetimeHandleMoveGizmo *)gz;
|
||||
|
@ -488,8 +433,6 @@ static void gizmo_retime_handle_draw(const bContext *C, wmGizmo *gz)
|
|||
MutableSpan handles = SEQ_retiming_handles_get(seq);
|
||||
|
||||
for (const SeqRetimingHandle &handle : handles) {
|
||||
retime_speed_text_draw(C, seq, &handle);
|
||||
|
||||
if (&handle == handles.begin()) {
|
||||
continue; /* Ignore first handle. */
|
||||
}
|
||||
|
@ -646,3 +589,183 @@ void GIZMO_GT_retime_remove(wmGizmoType *gzt)
|
|||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Retiming Speed Set Gizmo
|
||||
* \{ */
|
||||
|
||||
size_t label_str_get(const Sequence *seq,
|
||||
const SeqRetimingHandle *handle,
|
||||
size_t str_len,
|
||||
char *r_label_str)
|
||||
{
|
||||
const SeqRetimingHandle *next_handle = handle + 1;
|
||||
if (SEQ_retiming_handle_is_transition_type(handle)) {
|
||||
const float prev_speed = SEQ_retiming_handle_speed_get(seq, handle - 1);
|
||||
const float next_speed = SEQ_retiming_handle_speed_get(seq, next_handle + 1);
|
||||
return BLI_snprintf_rlen(r_label_str,
|
||||
str_len,
|
||||
"%d%% - %d%%",
|
||||
round_fl_to_int(prev_speed * 100.0f),
|
||||
round_fl_to_int(next_speed * 100.0f));
|
||||
}
|
||||
const float speed = SEQ_retiming_handle_speed_get(seq, next_handle);
|
||||
return BLI_snprintf_rlen(r_label_str, str_len, "%d%%", round_fl_to_int(speed * 100.0f));
|
||||
}
|
||||
|
||||
static bool label_rect_get(const bContext *C,
|
||||
const Sequence *seq,
|
||||
const SeqRetimingHandle *handle,
|
||||
char *label_str,
|
||||
size_t label_len,
|
||||
rctf *rect)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const SeqRetimingHandle *next_handle = handle + 1;
|
||||
const float width = pixels_to_view_width(C, BLF_width(BLF_default(), label_str, label_len));
|
||||
const float height = pixels_to_view_height(C, BLF_height(BLF_default(), label_str, label_len));
|
||||
|
||||
const float xmin = max_ff(SEQ_time_left_handle_frame_get(scene, seq),
|
||||
handle_x_get(scene, seq, handle));
|
||||
const float xmax = min_ff(SEQ_time_right_handle_frame_get(scene, seq),
|
||||
handle_x_get(scene, seq, next_handle));
|
||||
|
||||
rect->xmin = (xmin + xmax - width) / 2;
|
||||
rect->xmax = rect->xmin + width;
|
||||
rect->ymin = strip_y_rescale(seq, 0) + pixels_to_view_height(C, 5);
|
||||
rect->ymax = rect->ymin + height;
|
||||
|
||||
return width < xmax - xmin;
|
||||
}
|
||||
|
||||
static void label_rect_apply_mouseover_offset(const View2D *v2d, rctf *rect)
|
||||
{
|
||||
float scale_x, scale_y;
|
||||
UI_view2d_scale_get_inverse(v2d, &scale_x, &scale_y);
|
||||
rect->xmin -= RETIME_HANDLE_MOUSEOVER_THRESHOLD * scale_x;
|
||||
rect->xmax += RETIME_HANDLE_MOUSEOVER_THRESHOLD * scale_x;
|
||||
rect->ymax += RETIME_HANDLE_MOUSEOVER_THRESHOLD * scale_y;
|
||||
}
|
||||
|
||||
static void retime_speed_text_draw(const bContext *C,
|
||||
const Sequence *seq,
|
||||
const SeqRetimingHandle *handle)
|
||||
{
|
||||
SeqRetimingHandle *last_handle = SEQ_retiming_last_handle_get(seq);
|
||||
if (handle == last_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const int start_frame = SEQ_time_left_handle_frame_get(scene, seq);
|
||||
const int end_frame = SEQ_time_right_handle_frame_get(scene, seq);
|
||||
|
||||
const SeqRetimingHandle *next_handle = handle + 1;
|
||||
if (handle_x_get(scene, seq, next_handle) < start_frame ||
|
||||
handle_x_get(scene, seq, handle) > end_frame)
|
||||
{
|
||||
return; /* Label out of strip bounds. */
|
||||
}
|
||||
|
||||
char label_str[40];
|
||||
rctf label_rect;
|
||||
size_t label_len = label_str_get(seq, handle, sizeof(label_str), label_str);
|
||||
|
||||
if (!label_rect_get(C, seq, handle, label_str, label_len, &label_rect)) {
|
||||
return; /* Not enough space to draw label. */
|
||||
}
|
||||
|
||||
const uchar col[4] = {255, 255, 255, 255};
|
||||
UI_view2d_text_cache_add(
|
||||
UI_view2d_fromcontext(C), label_rect.xmin, label_rect.ymin, label_str, label_len, col);
|
||||
}
|
||||
|
||||
static void gizmo_retime_speed_set_draw(const bContext *C, wmGizmo * /* gz */)
|
||||
{
|
||||
const View2D *v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
wmOrtho2_region_pixelspace(CTX_wm_region(C));
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
Sequence *seq = active_seq_from_context(C);
|
||||
SEQ_retiming_data_ensure(seq);
|
||||
MutableSpan handles = SEQ_retiming_handles_get(seq);
|
||||
|
||||
for (const SeqRetimingHandle &handle : handles) {
|
||||
retime_speed_text_draw(C, seq, &handle);
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
UI_view2d_text_cache_draw(CTX_wm_region(C));
|
||||
UI_view2d_view_ortho(v2d); /* 'UI_view2d_text_cache_draw()' messes up current view. */
|
||||
}
|
||||
|
||||
static int gizmo_retime_speed_set_test_select(bContext *C, wmGizmo *gz, const int mval[2])
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
wmGizmoOpElem *op_elem = WM_gizmo_operator_get(gz, 0);
|
||||
const View2D *v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
Sequence *seq = active_seq_from_context(C);
|
||||
SEQ_retiming_data_ensure(seq);
|
||||
|
||||
for (const SeqRetimingHandle &handle : SEQ_retiming_handles_get(seq)) {
|
||||
if (SEQ_retiming_handle_is_transition_type(&handle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
char label_str[40];
|
||||
rctf label_rect;
|
||||
size_t label_len = label_str_get(seq, &handle, sizeof(label_str), label_str);
|
||||
|
||||
if (!label_rect_get(C, seq, &handle, label_str, label_len, &label_rect)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
label_rect_apply_mouseover_offset(v2d, &label_rect);
|
||||
|
||||
float mouse_view[2];
|
||||
UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouse_view[0], &mouse_view[1]);
|
||||
|
||||
if (!BLI_rctf_isect_pt(&label_rect, mouse_view[0], mouse_view[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Store next handle in RNA property, since label rect uses first handle as reference. */
|
||||
const int handle_index = SEQ_retiming_handle_index_get(seq, &handle) + 1;
|
||||
RNA_int_set(&op_elem->ptr, "handle_index", handle_index);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int gizmo_retime_speed_set_cursor_get(wmGizmo *gz)
|
||||
{
|
||||
if (RNA_boolean_get(gz->ptr, "show_drag")) {
|
||||
return WM_CURSOR_TEXT_EDIT;
|
||||
}
|
||||
return WM_CURSOR_DEFAULT;
|
||||
}
|
||||
|
||||
void GIZMO_GT_speed_set_remove(wmGizmoType *gzt)
|
||||
{
|
||||
/* Identifiers. */
|
||||
gzt->idname = "GIZMO_GT_retime_speed_set";
|
||||
|
||||
/* Api callbacks. */
|
||||
gzt->draw = gizmo_retime_speed_set_draw;
|
||||
gzt->test_select = gizmo_retime_speed_set_test_select;
|
||||
gzt->cursor_get = gizmo_retime_speed_set_cursor_get;
|
||||
gzt->struct_size = sizeof(wmGizmo);
|
||||
|
||||
/* Currently only used for cursor display. */
|
||||
RNA_def_boolean(gzt->srna, "show_drag", true, "Show Drag", "");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -312,6 +312,7 @@ void SEQUENCER_OT_retiming_reset(struct wmOperatorType *ot);
|
|||
void SEQUENCER_OT_retiming_handle_move(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_retiming_handle_add(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_retiming_handle_remove(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_retiming_segment_speed_set(struct wmOperatorType *ot);
|
||||
|
||||
/* sequencer_gizmo_retime.c */
|
||||
void SEQUENCER_GGT_gizmo_retime(struct wmGizmoGroupType *gzgt);
|
||||
|
@ -320,6 +321,7 @@ void SEQUENCER_GGT_gizmo_retime(struct wmGizmoGroupType *gzgt);
|
|||
void GIZMO_GT_retime_handle_add(struct wmGizmoType *gzt);
|
||||
void GIZMO_GT_retime_handle(struct wmGizmoType *gzt);
|
||||
void GIZMO_GT_retime_remove(struct wmGizmoType *gzt);
|
||||
void GIZMO_GT_speed_set_remove(struct wmGizmoType *gzt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ void sequencer_operatortypes(void)
|
|||
WM_operatortype_append(SEQUENCER_OT_retiming_handle_move);
|
||||
WM_operatortype_append(SEQUENCER_OT_retiming_handle_add);
|
||||
WM_operatortype_append(SEQUENCER_OT_retiming_handle_remove);
|
||||
WM_operatortype_append(SEQUENCER_OT_retiming_segment_speed_set);
|
||||
|
||||
/* sequencer_select.c */
|
||||
WM_operatortype_append(SEQUENCER_OT_select_all);
|
||||
|
|
|
@ -461,3 +461,95 @@ void SEQUENCER_OT_retiming_handle_remove(wmOperatorType *ot)
|
|||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Retiming Set Segment Speed
|
||||
* \{ */
|
||||
|
||||
static int sequencer_retiming_segment_speed_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const Editing *ed = SEQ_editing_get(scene);
|
||||
Sequence *seq = ed->act_seq;
|
||||
MutableSpan handles = SEQ_retiming_handles_get(seq);
|
||||
SeqRetimingHandle *handle = &handles[RNA_int_get(op->ptr, "handle_index")];
|
||||
|
||||
SEQ_retiming_handle_speed_set(scene, seq, handle, RNA_float_get(op->ptr, "speed"));
|
||||
SEQ_relations_invalidate_cache_raw(scene, seq);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int sequencer_retiming_segment_speed_set_invoke(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const Editing *ed = SEQ_editing_get(scene);
|
||||
const Sequence *seq = ed->act_seq;
|
||||
|
||||
if (seq == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
MutableSpan handles = SEQ_retiming_handles_get(seq);
|
||||
SeqRetimingHandle *handle = nullptr;
|
||||
|
||||
if (RNA_struct_property_is_set(op->ptr, "handle_index")) {
|
||||
const int handle_index = RNA_int_get(op->ptr, "handle_index");
|
||||
BLI_assert(handle_index < handles.size());
|
||||
handle = &handles[handle_index];
|
||||
}
|
||||
else {
|
||||
handle = closest_retiming_handle_get(C, seq, event->mval[0]);
|
||||
}
|
||||
|
||||
if (handle == nullptr) {
|
||||
BKE_report(op->reports, RPT_ERROR, "No handle available");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
RNA_float_set(op->ptr, "speed", SEQ_retiming_handle_speed_get(seq, handle) * 100.0f);
|
||||
RNA_int_set(op->ptr, "handle_index", SEQ_retiming_handle_index_get(seq, handle));
|
||||
return WM_operator_props_popup(C, op, event);
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_retiming_segment_speed_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set Speed";
|
||||
ot->description = "Set speed of retimed segment";
|
||||
ot->idname = "SEQUENCER_OT_retiming_segment_speed_set";
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke = sequencer_retiming_segment_speed_set_invoke;
|
||||
ot->exec = sequencer_retiming_segment_speed_set_exec;
|
||||
ot->poll = retiming_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties */
|
||||
PropertyRNA *prop = RNA_def_int(ot->srna,
|
||||
"handle_index",
|
||||
0,
|
||||
0,
|
||||
INT_MAX,
|
||||
"Handle Index",
|
||||
"Index of handle to be removed",
|
||||
0,
|
||||
INT_MAX);
|
||||
RNA_def_property_flag(prop, PROP_HIDDEN);
|
||||
|
||||
prop = RNA_def_float(ot->srna,
|
||||
"speed",
|
||||
100.0f,
|
||||
0.001f,
|
||||
FLT_MAX,
|
||||
"Speed",
|
||||
"New speed of retimed segment",
|
||||
0.1f,
|
||||
INT_MAX);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -430,6 +430,7 @@ static void sequencer_gizmos(void)
|
|||
WM_gizmotype_append(GIZMO_GT_retime_handle_add);
|
||||
WM_gizmotype_append(GIZMO_GT_retime_handle);
|
||||
WM_gizmotype_append(GIZMO_GT_retime_remove);
|
||||
WM_gizmotype_append(GIZMO_GT_speed_set_remove);
|
||||
|
||||
WM_gizmogrouptype_append(SEQUENCER_GGT_gizmo2d);
|
||||
WM_gizmogrouptype_append(SEQUENCER_GGT_gizmo2d_translate);
|
||||
|
|
|
@ -27,7 +27,6 @@ set(SRC
|
|||
text_autocomplete.cc
|
||||
text_draw.cc
|
||||
text_format.cc
|
||||
text_format_lua.cc
|
||||
text_format_osl.cc
|
||||
text_format_pov.cc
|
||||
text_format_pov_ini.cc
|
||||
|
|
|
@ -481,7 +481,6 @@ void ED_spacetype_text(void)
|
|||
/* register formatters */
|
||||
ED_text_format_register_py();
|
||||
ED_text_format_register_osl();
|
||||
ED_text_format_register_lua();
|
||||
ED_text_format_register_pov();
|
||||
ED_text_format_register_pov_ini();
|
||||
}
|
||||
|
|
|
@ -316,8 +316,6 @@ static int text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
static int doc_scroll = 0;
|
||||
|
||||
static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
/* NOTE(@ideasman42): this code could be refactored or rewritten. */
|
||||
|
@ -332,9 +330,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
if (texttool_suggest_first()) {
|
||||
tools |= TOOL_SUGG_LIST;
|
||||
}
|
||||
if (texttool_docs_get()) {
|
||||
tools |= TOOL_DOCUMENT;
|
||||
}
|
||||
}
|
||||
|
||||
switch (event->type) {
|
||||
|
@ -356,21 +351,12 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
swallow = 1;
|
||||
draw = 1;
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
draw = 1;
|
||||
}
|
||||
retval = OPERATOR_FINISHED;
|
||||
}
|
||||
else {
|
||||
if (tools & TOOL_SUGG_LIST) {
|
||||
texttool_suggest_clear();
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
}
|
||||
retval = OPERATOR_CANCELLED;
|
||||
}
|
||||
draw = 1;
|
||||
|
@ -382,10 +368,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
if (tools & TOOL_SUGG_LIST) {
|
||||
texttool_suggest_clear();
|
||||
}
|
||||
else if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
}
|
||||
else {
|
||||
draw = swallow = 0;
|
||||
}
|
||||
|
@ -403,11 +385,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
swallow = 1;
|
||||
draw = 1;
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
draw = 1;
|
||||
}
|
||||
retval = OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
|
@ -443,10 +420,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
}
|
||||
}
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVT_RIGHTARROWKEY:
|
||||
|
@ -480,10 +453,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
}
|
||||
}
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVT_PAGEDOWNKEY:
|
||||
|
@ -492,12 +461,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
case WHEELDOWNMOUSE:
|
||||
case EVT_DOWNARROWKEY:
|
||||
if (event->val == KM_PRESS) {
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
doc_scroll++;
|
||||
swallow = 1;
|
||||
draw = 1;
|
||||
}
|
||||
else if (tools & TOOL_SUGG_LIST) {
|
||||
if (tools & TOOL_SUGG_LIST) {
|
||||
SuggItem *sel = texttool_suggest_selected();
|
||||
if (!sel) {
|
||||
texttool_suggest_select(texttool_suggest_first());
|
||||
|
@ -526,14 +490,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
case WHEELUPMOUSE:
|
||||
case EVT_UPARROWKEY:
|
||||
if (event->val == KM_PRESS) {
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
if (doc_scroll > 0) {
|
||||
doc_scroll--;
|
||||
}
|
||||
swallow = 1;
|
||||
draw = 1;
|
||||
}
|
||||
else if (tools & TOOL_SUGG_LIST) {
|
||||
if (tools & TOOL_SUGG_LIST) {
|
||||
SuggItem *sel = texttool_suggest_selected();
|
||||
while (sel && scroll--) {
|
||||
if (sel != texttool_suggest_first() && sel->prev) {
|
||||
|
@ -560,11 +517,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
|
|||
texttool_suggest_clear();
|
||||
draw = 1;
|
||||
}
|
||||
if (tools & TOOL_DOCUMENT) {
|
||||
texttool_docs_clear();
|
||||
doc_scroll = 0;
|
||||
draw = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1031,120 +1031,6 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back)
|
|||
/** \name Draw Documentation
|
||||
* \{ */
|
||||
|
||||
#if 0
|
||||
|
||||
static void draw_documentation(const SpaceText *st, ARegion *region)
|
||||
{
|
||||
TextDrawContext tdc = {0};
|
||||
TextLine *tmp;
|
||||
char *docs, buf[DOC_WIDTH + 1], *p;
|
||||
int i, br, lines;
|
||||
int boxw, boxh, l, x, y /* , top */ /* UNUSED */;
|
||||
|
||||
if (!st || !st->text) {
|
||||
return;
|
||||
}
|
||||
if (!texttool_text_is_active(st->text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
docs = texttool_docs_get();
|
||||
|
||||
if (!docs) {
|
||||
return;
|
||||
}
|
||||
|
||||
text_draw_context_init(st, &tdc);
|
||||
|
||||
/* Count the visible lines to the cursor */
|
||||
for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) {
|
||||
/* pass */
|
||||
}
|
||||
|
||||
if (l < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
x = TXT_BODY_LEFT(st) + (st->runtime.cwidth_px * (st->text->curc - st->left));
|
||||
if (texttool_suggest_first()) {
|
||||
x += SUGG_LIST_WIDTH * st->runtime.cwidth_px + 50;
|
||||
}
|
||||
|
||||
/* top = */ /* UNUSED */ y = region->winy - st->runtime.lheight_px * l - 2;
|
||||
boxw = DOC_WIDTH * st->runtime.cwidth_px + 20;
|
||||
boxh = (DOC_HEIGHT + 1) * TXT_LINE_HEIGHT(st);
|
||||
|
||||
/* Draw panel */
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformThemeColor(TH_BACK);
|
||||
immRecti(pos, x, y, x + boxw, y - boxh);
|
||||
immUniformThemeColor(TH_SHADE1);
|
||||
immBegin(GPU_PRIM_LINE_LOOP, 4);
|
||||
immVertex2i(pos, x, y);
|
||||
immVertex2i(pos, x + boxw, y);
|
||||
immVertex2i(pos, x + boxw, y - boxh);
|
||||
immVertex2i(pos, x, y - boxh);
|
||||
immEnd();
|
||||
immBegin(GPU_PRIM_LINE_LOOP, 3);
|
||||
immVertex2i(pos, x + boxw - 10, y - 7);
|
||||
immVertex2i(pos, x + boxw - 4, y - 7);
|
||||
immVertex2i(pos, x + boxw - 7, y - 2);
|
||||
immEnd();
|
||||
immBegin(GPU_PRIM_LINE_LOOP, 3);
|
||||
immVertex2i(pos, x + boxw - 10, y - boxh + 7);
|
||||
immVertex2i(pos, x + boxw - 4, y - boxh + 7);
|
||||
immVertex2i(pos, x + boxw - 7, y - boxh + 2);
|
||||
immEnd();
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
UI_FontThemeColor(tdc.font_id, TH_TEXT);
|
||||
|
||||
i = 0;
|
||||
br = DOC_WIDTH;
|
||||
lines = 0; /* XXX -doc_scroll; */
|
||||
for (p = docs; *p; p++) {
|
||||
if (*p == '\r' && *(++p) != '\n') {
|
||||
*(--p) = '\n'; /* Fix line endings */
|
||||
}
|
||||
if (ELEM(*p, ' ', '\t')) {
|
||||
br = i;
|
||||
}
|
||||
else if (*p == '\n') {
|
||||
buf[i] = '\0';
|
||||
if (lines >= 0) {
|
||||
y -= st->runtime.lheight_px;
|
||||
text_draw(st, &tdc, buf, 0, 0, x + 4, y - 3, nullptr);
|
||||
}
|
||||
i = 0;
|
||||
br = DOC_WIDTH;
|
||||
lines++;
|
||||
}
|
||||
buf[i++] = *p;
|
||||
if (i == DOC_WIDTH) { /* Reached the width, go to last break and wrap there */
|
||||
buf[br] = '\0';
|
||||
if (lines >= 0) {
|
||||
y -= st->runtime.lheight_px;
|
||||
text_draw(st, &tdc, buf, 0, 0, x + 4, y - 3, nullptr);
|
||||
}
|
||||
p -= i - br - 1; /* Rewind pointer to last break */
|
||||
i = 0;
|
||||
br = DOC_WIDTH;
|
||||
lines++;
|
||||
}
|
||||
if (lines >= DOC_HEIGHT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Draw Suggestion List
|
||||
* \{ */
|
||||
|
|
|
@ -112,7 +112,6 @@ void ED_text_format_register(TextFormatType *tft);
|
|||
/* formatters */
|
||||
void ED_text_format_register_py();
|
||||
void ED_text_format_register_osl();
|
||||
void ED_text_format_register_lua();
|
||||
void ED_text_format_register_pov();
|
||||
void ED_text_format_register_pov_ini();
|
||||
|
||||
|
|
|
@ -1,350 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup sptext
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_text_types.h"
|
||||
|
||||
#include "BKE_text.h"
|
||||
|
||||
#include "text_format.hh"
|
||||
|
||||
/* *** Lua Keywords (for format_line) *** */
|
||||
|
||||
/**
|
||||
* Checks the specified source string for a Lua keyword (minus boolean & 'nil').
|
||||
* This name must start at the beginning of the source string and must be
|
||||
* followed by a non-identifier (see #text_check_identifier(char)) or null char.
|
||||
*
|
||||
* If a keyword is found, the length of the matching word is returned.
|
||||
* Otherwise, -1 is returned.
|
||||
*
|
||||
* See:
|
||||
* http://www.lua.org/manual/5.1/manual.html#2.1
|
||||
*/
|
||||
static int txtfmt_lua_find_keyword(const char *string)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "do", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "end", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "function", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "in", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "local", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "not", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "or", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "then", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "until", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
/* If next source char is an identifier (eg. 'i' in "definite") no match */
|
||||
if (i == 0 || text_check_identifier(string[i])) {
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the specified source string for a Lua special name/function. This
|
||||
* name must start at the beginning of the source string and must be followed
|
||||
* by a non-identifier (see *text_check_identifier(char)) or null character.
|
||||
*
|
||||
* If a special name is found, the length of the matching name is returned.
|
||||
* Otherwise, -1 is returned.
|
||||
*
|
||||
* See:
|
||||
* http://www.lua.org/manual/5.1/manual.html#5.1
|
||||
*/
|
||||
static int txtfmt_lua_find_specialvar(const char *string)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "collectgarbage", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "dofile", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "error", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "_G", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "getfenv", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "getmetatable", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "__index", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "ipairs", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "load", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "loadfile", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "loadstring", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "next", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "pairs", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "pcall", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "print", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "rawequal", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "rawget", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "rawset", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "select", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "setfenv", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "setmetatable", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "tonumber", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "tostring", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "type", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "unpack", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "_VERSION", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
/* If next source char is an identifier (eg. 'i' in "definite") no match */
|
||||
if (i == 0 || text_check_identifier(string[i])) {
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static int txtfmt_lua_find_bool(const char *string)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (STR_LITERAL_STARTSWITH(string, "nil", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "true", len)) { i = len;
|
||||
} else if (STR_LITERAL_STARTSWITH(string, "false", len)) { i = len;
|
||||
} else { i = 0;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
/* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */
|
||||
if (i == 0 || text_check_identifier(string[i])) {
|
||||
return -1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static char txtfmt_lua_format_identifier(const char *str)
|
||||
{
|
||||
char fmt;
|
||||
|
||||
/* Keep aligned args for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
if (txtfmt_lua_find_specialvar(str) != -1) { fmt = FMT_TYPE_SPECIAL;
|
||||
} else if (txtfmt_lua_find_keyword(str) != -1) { fmt = FMT_TYPE_KEYWORD;
|
||||
} else { fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_next)
|
||||
{
|
||||
FlattenString fs;
|
||||
const char *str;
|
||||
char *fmt;
|
||||
char cont_orig, cont, find, prev = ' ';
|
||||
int len, i;
|
||||
|
||||
/* Get continuation from previous line */
|
||||
if (line->prev && line->prev->format != nullptr) {
|
||||
fmt = line->prev->format;
|
||||
cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
|
||||
BLI_assert((FMT_CONT_ALL & cont) == cont);
|
||||
}
|
||||
else {
|
||||
cont = FMT_CONT_NOP;
|
||||
}
|
||||
|
||||
/* Get original continuation from this line */
|
||||
if (line->format != nullptr) {
|
||||
fmt = line->format;
|
||||
cont_orig = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
|
||||
BLI_assert((FMT_CONT_ALL & cont_orig) == cont_orig);
|
||||
}
|
||||
else {
|
||||
cont_orig = 0xFF;
|
||||
}
|
||||
|
||||
len = flatten_string(st, &fs, line->line);
|
||||
str = fs.buf;
|
||||
if (!text_check_format_len(line, len)) {
|
||||
flatten_string_free(&fs);
|
||||
return;
|
||||
}
|
||||
fmt = line->format;
|
||||
|
||||
while (*str) {
|
||||
/* Handle escape sequences by skipping both \ and next char */
|
||||
if (*str == '\\') {
|
||||
*fmt = prev;
|
||||
fmt++;
|
||||
str++;
|
||||
if (*str == '\0') {
|
||||
break;
|
||||
}
|
||||
*fmt = prev;
|
||||
fmt++;
|
||||
str += BLI_str_utf8_size_safe(str);
|
||||
continue;
|
||||
}
|
||||
/* Handle continuations */
|
||||
if (cont) {
|
||||
/* Multi-line comments */
|
||||
if (cont & FMT_CONT_COMMENT_C) {
|
||||
if (*str == ']' && *(str + 1) == ']') {
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
fmt++;
|
||||
str++;
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
cont = FMT_CONT_NOP;
|
||||
}
|
||||
else {
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
}
|
||||
/* Handle other comments */
|
||||
}
|
||||
else {
|
||||
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
|
||||
if (*str == find) {
|
||||
cont = 0;
|
||||
}
|
||||
*fmt = FMT_TYPE_STRING;
|
||||
}
|
||||
|
||||
str += BLI_str_utf8_size_safe(str) - 1;
|
||||
}
|
||||
/* Not in a string... */
|
||||
else {
|
||||
/* Multi-line comments */
|
||||
if (*str == '-' && *(str + 1) == '-' && *(str + 2) == '[' && *(str + 3) == '[') {
|
||||
cont = FMT_CONT_COMMENT_C;
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
fmt++;
|
||||
str++;
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
fmt++;
|
||||
str++;
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
fmt++;
|
||||
str++;
|
||||
*fmt = FMT_TYPE_COMMENT;
|
||||
}
|
||||
/* Single line comment */
|
||||
else if (*str == '-' && *(str + 1) == '-') {
|
||||
text_format_fill(&str, &fmt, FMT_TYPE_COMMENT, len - int(fmt - line->format));
|
||||
}
|
||||
else if (ELEM(*str, '"', '\'')) {
|
||||
/* Strings */
|
||||
find = *str;
|
||||
cont = (*str == '"') ? FMT_CONT_QUOTEDOUBLE : FMT_CONT_QUOTESINGLE;
|
||||
*fmt = FMT_TYPE_STRING;
|
||||
}
|
||||
/* White-space (all white-space has been converted to spaces). */
|
||||
else if (*str == ' ') {
|
||||
*fmt = FMT_TYPE_WHITESPACE;
|
||||
}
|
||||
/* Numbers (digits not part of an identifier and periods followed by digits) */
|
||||
else if ((prev != FMT_TYPE_DEFAULT && text_check_digit(*str)) ||
|
||||
(*str == '.' && text_check_digit(*(str + 1))))
|
||||
{
|
||||
*fmt = FMT_TYPE_NUMERAL;
|
||||
}
|
||||
/* Booleans */
|
||||
else if (prev != FMT_TYPE_DEFAULT && (i = txtfmt_lua_find_bool(str)) != -1) {
|
||||
if (i > 0) {
|
||||
text_format_fill_ascii(&str, &fmt, FMT_TYPE_NUMERAL, i);
|
||||
}
|
||||
else {
|
||||
str += BLI_str_utf8_size_safe(str) - 1;
|
||||
*fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
}
|
||||
/* Punctuation */
|
||||
else if ((*str != '#') && text_check_delim(*str)) {
|
||||
*fmt = FMT_TYPE_SYMBOL;
|
||||
}
|
||||
/* Identifiers and other text (no previous white-space/delimiters so text continues). */
|
||||
else if (prev == FMT_TYPE_DEFAULT) {
|
||||
str += BLI_str_utf8_size_safe(str) - 1;
|
||||
*fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
/* Not white-space, a digit, punctuation, or continuing text.
|
||||
* Must be new, check for special words. */
|
||||
else {
|
||||
/* Keep aligned arguments for readability. */
|
||||
/* clang-format off */
|
||||
|
||||
/* Special `vars(v)` or built-in `keywords(b)` */
|
||||
/* keep in sync with `txtfmt_osl_format_identifier()`. */
|
||||
if ((i = txtfmt_lua_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
|
||||
} else if ((i = txtfmt_lua_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
|
||||
}
|
||||
|
||||
/* clang-format on */
|
||||
|
||||
if (i > 0) {
|
||||
text_format_fill_ascii(&str, &fmt, prev, i);
|
||||
}
|
||||
else {
|
||||
str += BLI_str_utf8_size_safe(str) - 1;
|
||||
*fmt = FMT_TYPE_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
prev = *fmt;
|
||||
fmt++;
|
||||
str++;
|
||||
}
|
||||
|
||||
/* Terminate and add continuation char */
|
||||
*fmt = '\0';
|
||||
fmt++;
|
||||
*fmt = cont;
|
||||
|
||||
/* If continuation has changed and we're allowed, process the next line */
|
||||
if (cont != cont_orig && do_next && line->next) {
|
||||
txtfmt_lua_format_line(st, line->next, do_next);
|
||||
}
|
||||
|
||||
flatten_string_free(&fs);
|
||||
}
|
||||
|
||||
void ED_text_format_register_lua()
|
||||
{
|
||||
static TextFormatType tft = {nullptr};
|
||||
static const char *ext[] = {"lua", nullptr};
|
||||
|
||||
tft.format_identifier = txtfmt_lua_format_identifier;
|
||||
tft.format_line = txtfmt_lua_format_line;
|
||||
tft.ext = ext;
|
||||
tft.comment_line = "--";
|
||||
|
||||
ED_text_format_register(&tft);
|
||||
}
|
|
@ -63,7 +63,6 @@ void text_update_cursor_moved(struct bContext *C);
|
|||
#define DOC_HEIGHT 10
|
||||
|
||||
#define TOOL_SUGG_LIST 0x01
|
||||
#define TOOL_DOCUMENT 0x02
|
||||
|
||||
int wrap_width(const struct SpaceText *st, struct ARegion *region);
|
||||
/**
|
||||
|
|
|
@ -590,6 +590,9 @@ static void handle_armature_parent_orientation(Object *ob, float r_mat[3][3])
|
|||
if (active_pchan && active_pchan->parent) {
|
||||
/* For child, show parent local regardless if "local location" is set for parent bone. */
|
||||
transform_orientations_create_from_axis(r_mat, UNPACK3(active_pchan->parent->pose_mat));
|
||||
float ob_orientations_mat[3][3];
|
||||
transform_orientations_create_from_axis(ob_orientations_mat, UNPACK3(ob->object_to_world));
|
||||
mul_m3_m3_pre(r_mat, ob_orientations_mat);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -690,10 +690,10 @@ void Controller::ComputeSteerableViewMap()
|
|||
img[i] = new GrayImage(_pView->width(), _pView->height());
|
||||
for (unsigned int y = 0; y < img[i]->height(); ++y) {
|
||||
for (unsigned int x = 0; x < img[i]->width(); ++x) {
|
||||
//img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y)) / 255.0f);
|
||||
img[i]->setPixel(x, y, (float)qGray(qimg.pixel(x, y)));
|
||||
// img[i]->setPixel(x, y, float(qGray(qimg.pixel(x, y))) / 255.0f);
|
||||
img[i]->setPixel(x, y, float(qGray(qimg.pixel(x, y))));
|
||||
// float c = qGray(qimg.pixel(x, y));
|
||||
//img[i]->setPixel(x, y, qGray(qimg.pixel(x, y)));
|
||||
// img[i]->setPixel(x, y, qGray(qimg.pixel(x, y)));
|
||||
}
|
||||
}
|
||||
offscreenBuffer.DetachNode(ng[i]);
|
||||
|
|
|
@ -755,7 +755,8 @@ inline size_t to_bytesize(eGPUTextureFormat tex_format, eGPUDataFormat data_form
|
|||
* Standard component len calculation does not apply, as the texture formats contain multiple
|
||||
* channels, but associated data format contains several compacted components. */
|
||||
if ((tex_format == GPU_R11F_G11F_B10F && data_format == GPU_DATA_10_11_11_REV) ||
|
||||
(tex_format == GPU_RGB10_A2 && data_format == GPU_DATA_2_10_10_10_REV))
|
||||
((tex_format == GPU_RGB10_A2 || tex_format == GPU_RGB10_A2UI) &&
|
||||
data_format == GPU_DATA_2_10_10_10_REV))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
|
|
@ -3113,6 +3113,14 @@ std::string MSLGeneratorInterface::generate_msl_fragment_input_population()
|
|||
<< this->vertex_output_varyings[0].name << ";" << std::endl;
|
||||
}
|
||||
|
||||
/* Assign default gl_FragDepth.
|
||||
* If gl_FragDepth is used, it should default to the original depth value. Resolves #107159 where
|
||||
* overlay_wireframe_frag may not write to gl_FragDepth. */
|
||||
if (this->uses_gl_FragDepth) {
|
||||
out << "\t" << shader_stage_inst_name << ".gl_FragDepth = " << shader_stage_inst_name
|
||||
<< ".gl_FragCoord.z;" << std::endl;
|
||||
}
|
||||
|
||||
/* NOTE: We will only assign to the intersection of the vertex output and fragment input.
|
||||
* Fragment input represents varying variables which are declared (but are not necessarily
|
||||
* used). The Vertex out defines the set which is passed into the fragment shader, which
|
||||
|
|
|
@ -484,6 +484,7 @@ inline std::string tex_data_format_to_msl_type_str(eGPUDataFormat type)
|
|||
case GPU_DATA_UINT_24_8:
|
||||
return "uint"; /* Problematic type - but will match alignment. */
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
case GPU_DATA_2_10_10_10_REV:
|
||||
return "float"; /* Problematic type - each component will be read as a float. */
|
||||
default:
|
||||
BLI_assert(false);
|
||||
|
@ -509,6 +510,7 @@ inline std::string tex_data_format_to_msl_texture_template_type(eGPUDataFormat t
|
|||
case GPU_DATA_UINT_24_8:
|
||||
return "uint"; /* Problematic type. */
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
case GPU_DATA_2_10_10_10_REV:
|
||||
return "float"; /* Problematic type. */
|
||||
default:
|
||||
BLI_assert(false);
|
||||
|
|
|
@ -580,7 +580,8 @@ void gpu::MTLTexture::update_sub(
|
|||
}
|
||||
|
||||
/* Safety Checks. */
|
||||
if (type == GPU_DATA_UINT_24_8 || type == GPU_DATA_10_11_11_REV) {
|
||||
if (type == GPU_DATA_UINT_24_8 || type == GPU_DATA_10_11_11_REV ||
|
||||
type == GPU_DATA_2_10_10_10_REV) {
|
||||
BLI_assert(can_use_direct_blit &&
|
||||
"Special input data type must be a 1-1 mapping with destination texture as it "
|
||||
"cannot easily be split");
|
||||
|
@ -747,7 +748,7 @@ void gpu::MTLTexture::update_sub(
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(texture_handle, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(extent[0], 1, 1) /* Width, Height, Layer */
|
||||
|
@ -767,7 +768,7 @@ void gpu::MTLTexture::update_sub(
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(texture_handle, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(extent[0], extent[1], 1) /* Width, layers, nil */
|
||||
|
@ -827,7 +828,7 @@ void gpu::MTLTexture::update_sub(
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(texture_handle, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(
|
||||
|
@ -848,7 +849,7 @@ void gpu::MTLTexture::update_sub(
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(texture_handle, 0);
|
||||
[compute_encoder dispatchThreads:MTLSizeMake(extent[0],
|
||||
extent[1],
|
||||
|
@ -891,7 +892,7 @@ void gpu::MTLTexture::update_sub(
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(staging_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(texture_handle, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(
|
||||
|
@ -1454,9 +1455,13 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
BLI_assert(validate_data_format(format_, data_format));
|
||||
}
|
||||
|
||||
/* SPECIAL Workaround for R11G11B10 textures requesting a read using: GPU_DATA_10_11_11_REV. */
|
||||
if (desired_output_format == GPU_DATA_10_11_11_REV) {
|
||||
BLI_assert(format_ == GPU_R11F_G11F_B10F);
|
||||
/* SPECIAL Workaround for R11G11B10, GPU_RGB10_A2, GPU_RGB10_A2UI textures requesting a read
|
||||
* using: GPU_DATA_10_11_11_REV. */
|
||||
if (desired_output_format == GPU_DATA_10_11_11_REV ||
|
||||
desired_output_format == GPU_DATA_2_10_10_10_REV)
|
||||
{
|
||||
BLI_assert(format_ == GPU_R11F_G11F_B10F || format_ == GPU_RGB10_A2 ||
|
||||
format_ == GPU_RGB10_A2UI);
|
||||
|
||||
/* override parameters - we'll be able to use simple copy, as bpp will match at 4 bytes. */
|
||||
image_bpp = sizeof(int);
|
||||
|
@ -1537,12 +1542,54 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
|
||||
/* Perform per-texture type read. */
|
||||
switch (type_) {
|
||||
case GPU_TEXTURE_1D: {
|
||||
if (can_use_simple_read) {
|
||||
/* Use Blit Encoder READ. */
|
||||
id<MTLBlitCommandEncoder> enc = ctx->main_command_buffer.ensure_begin_blit_encoder();
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
[enc insertDebugSignpost:@"GPUTextureRead1D"];
|
||||
}
|
||||
[enc copyFromTexture:read_texture
|
||||
sourceSlice:0
|
||||
sourceLevel:mip
|
||||
sourceOrigin:MTLOriginMake(x_off, 0, 0)
|
||||
sourceSize:MTLSizeMake(width, 1, 1)
|
||||
toBuffer:destination_buffer
|
||||
destinationOffset:0
|
||||
destinationBytesPerRow:bytes_per_row
|
||||
destinationBytesPerImage:bytes_per_image];
|
||||
copy_successful = true;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Use Compute READ. */
|
||||
id<MTLComputeCommandEncoder> compute_encoder =
|
||||
ctx->main_command_buffer.ensure_begin_compute_encoder();
|
||||
id<MTLComputePipelineState> pso = texture_read_1d_get_kernel(
|
||||
compute_specialization_kernel);
|
||||
TextureReadParams params = {
|
||||
mip,
|
||||
{width, 1, 1},
|
||||
{x_off, 0, 0},
|
||||
};
|
||||
|
||||
/* Bind resources via compute state for optimal state caching performance. */
|
||||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(read_texture, 0);
|
||||
[compute_encoder dispatchThreads:MTLSizeMake(width, 1, 1) /* Width, Height, Layer */
|
||||
threadsPerThreadgroup:MTLSizeMake(8, 8, 1)];
|
||||
copy_successful = true;
|
||||
}
|
||||
} break;
|
||||
case GPU_TEXTURE_2D: {
|
||||
if (can_use_simple_read) {
|
||||
/* Use Blit Encoder READ. */
|
||||
id<MTLBlitCommandEncoder> enc = ctx->main_command_buffer.ensure_begin_blit_encoder();
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
[enc insertDebugSignpost:@"GPUTextureRead"];
|
||||
[enc insertDebugSignpost:@"GPUTextureRead2D"];
|
||||
}
|
||||
[enc copyFromTexture:read_texture
|
||||
sourceSlice:0
|
||||
|
@ -1572,7 +1619,7 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(read_texture, 0);
|
||||
[compute_encoder dispatchThreads:MTLSizeMake(width, height, 1) /* Width, Height, Layer */
|
||||
threadsPerThreadgroup:MTLSizeMake(8, 8, 1)];
|
||||
|
@ -1585,7 +1632,7 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
/* Use Blit Encoder READ. */
|
||||
id<MTLBlitCommandEncoder> enc = ctx->main_command_buffer.ensure_begin_blit_encoder();
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
[enc insertDebugSignpost:@"GPUTextureRead"];
|
||||
[enc insertDebugSignpost:@"GPUTextureRead2DArray"];
|
||||
}
|
||||
int base_slice = z_off;
|
||||
int final_slice = base_slice + depth;
|
||||
|
@ -1622,7 +1669,7 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(read_texture, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(width, height, depth) /* Width, Height, Layer */
|
||||
|
@ -1631,11 +1678,55 @@ void gpu::MTLTexture::read_internal(int mip,
|
|||
}
|
||||
} break;
|
||||
|
||||
case GPU_TEXTURE_3D: {
|
||||
if (can_use_simple_read) {
|
||||
/* Use Blit Encoder READ. */
|
||||
id<MTLBlitCommandEncoder> enc = ctx->main_command_buffer.ensure_begin_blit_encoder();
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
[enc insertDebugSignpost:@"GPUTextureRead3D"];
|
||||
}
|
||||
[enc copyFromTexture:read_texture
|
||||
sourceSlice:0
|
||||
sourceLevel:mip
|
||||
sourceOrigin:MTLOriginMake(x_off, y_off, z_off)
|
||||
sourceSize:MTLSizeMake(width, height, depth)
|
||||
toBuffer:destination_buffer
|
||||
destinationOffset:0
|
||||
destinationBytesPerRow:bytes_per_row
|
||||
destinationBytesPerImage:bytes_per_image];
|
||||
copy_successful = true;
|
||||
}
|
||||
else {
|
||||
|
||||
/* Use Compute READ. */
|
||||
id<MTLComputeCommandEncoder> compute_encoder =
|
||||
ctx->main_command_buffer.ensure_begin_compute_encoder();
|
||||
id<MTLComputePipelineState> pso = texture_read_3d_get_kernel(
|
||||
compute_specialization_kernel);
|
||||
TextureReadParams params = {
|
||||
mip,
|
||||
{width, height, depth},
|
||||
{x_off, y_off, z_off},
|
||||
};
|
||||
|
||||
/* Bind resources via compute state for optimal state caching performance. */
|
||||
MTLComputeState &cs = ctx->main_command_buffer.get_compute_state();
|
||||
cs.bind_pso(pso);
|
||||
cs.bind_compute_bytes(¶ms, sizeof(params), 0);
|
||||
cs.bind_compute_buffer(destination_buffer, 0, 1, true);
|
||||
cs.bind_compute_texture(read_texture, 0);
|
||||
[compute_encoder
|
||||
dispatchThreads:MTLSizeMake(width, height, depth) /* Width, Height, Layer */
|
||||
threadsPerThreadgroup:MTLSizeMake(4, 4, 4)];
|
||||
copy_successful = true;
|
||||
}
|
||||
} break;
|
||||
|
||||
case GPU_TEXTURE_CUBE_ARRAY: {
|
||||
if (can_use_simple_read) {
|
||||
id<MTLBlitCommandEncoder> enc = ctx->main_command_buffer.ensure_begin_blit_encoder();
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
[enc insertDebugSignpost:@"GPUTextureRead"];
|
||||
[enc insertDebugSignpost:@"GPUTextureReadCubeArray"];
|
||||
}
|
||||
int base_slice = z_off;
|
||||
int final_slice = base_slice + depth;
|
||||
|
|
|
@ -191,6 +191,9 @@ size_t get_mtl_format_bytesize(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRGBA8Uint:
|
||||
case MTLPixelFormatRGBA8Sint:
|
||||
case MTLPixelFormatRGBA8Unorm:
|
||||
case MTLPixelFormatRGBA8Snorm:
|
||||
case MTLPixelFormatRGB10A2Uint:
|
||||
case MTLPixelFormatRGB10A2Unorm:
|
||||
return 4;
|
||||
case MTLPixelFormatRGBA32Uint:
|
||||
case MTLPixelFormatRGBA32Sint:
|
||||
|
@ -200,10 +203,13 @@ size_t get_mtl_format_bytesize(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRGBA16Sint:
|
||||
case MTLPixelFormatRGBA16Float:
|
||||
case MTLPixelFormatRGBA16Unorm:
|
||||
case MTLPixelFormatRGBA16Snorm:
|
||||
return 8;
|
||||
case MTLPixelFormatRG8Uint:
|
||||
case MTLPixelFormatRG8Sint:
|
||||
case MTLPixelFormatRG8Unorm:
|
||||
case MTLPixelFormatRG8Snorm:
|
||||
case MTLPixelFormatRG8Unorm_sRGB:
|
||||
return 2;
|
||||
case MTLPixelFormatRG32Uint:
|
||||
case MTLPixelFormatRG32Sint:
|
||||
|
@ -212,6 +218,8 @@ size_t get_mtl_format_bytesize(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRG16Uint:
|
||||
case MTLPixelFormatRG16Sint:
|
||||
case MTLPixelFormatRG16Float:
|
||||
case MTLPixelFormatRG16Unorm:
|
||||
case MTLPixelFormatRG16Snorm:
|
||||
return 4;
|
||||
case MTLPixelFormatR8Uint:
|
||||
case MTLPixelFormatR8Sint:
|
||||
|
@ -225,6 +233,7 @@ size_t get_mtl_format_bytesize(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatR16Sint:
|
||||
case MTLPixelFormatR16Float:
|
||||
case MTLPixelFormatR16Snorm:
|
||||
case MTLPixelFormatR16Unorm:
|
||||
return 2;
|
||||
case MTLPixelFormatRG11B10Float:
|
||||
return 4;
|
||||
|
@ -249,6 +258,7 @@ int get_mtl_format_num_components(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRGBA8Uint:
|
||||
case MTLPixelFormatRGBA8Sint:
|
||||
case MTLPixelFormatRGBA8Unorm:
|
||||
case MTLPixelFormatRGBA8Snorm:
|
||||
case MTLPixelFormatRGBA32Uint:
|
||||
case MTLPixelFormatRGBA32Sint:
|
||||
case MTLPixelFormatRGBA32Float:
|
||||
|
@ -256,7 +266,10 @@ int get_mtl_format_num_components(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRGBA16Sint:
|
||||
case MTLPixelFormatRGBA16Float:
|
||||
case MTLPixelFormatRGBA16Unorm:
|
||||
case MTLPixelFormatRGBA16Snorm:
|
||||
case MTLPixelFormatRGBA8Unorm_sRGB:
|
||||
case MTLPixelFormatRGB10A2Uint:
|
||||
case MTLPixelFormatRGB10A2Unorm:
|
||||
return 4;
|
||||
|
||||
case MTLPixelFormatRG11B10Float:
|
||||
|
@ -272,17 +285,21 @@ int get_mtl_format_num_components(MTLPixelFormat tex_format)
|
|||
case MTLPixelFormatRG16Sint:
|
||||
case MTLPixelFormatRG16Float:
|
||||
case MTLPixelFormatDepth32Float_Stencil8:
|
||||
case MTLPixelFormatRG16Snorm:
|
||||
case MTLPixelFormatRG16Unorm:
|
||||
return 2;
|
||||
|
||||
case MTLPixelFormatR8Uint:
|
||||
case MTLPixelFormatR8Sint:
|
||||
case MTLPixelFormatR8Unorm:
|
||||
case MTLPixelFormatR8Snorm:
|
||||
case MTLPixelFormatR32Uint:
|
||||
case MTLPixelFormatR32Sint:
|
||||
case MTLPixelFormatR32Float:
|
||||
case MTLPixelFormatR16Uint:
|
||||
case MTLPixelFormatR16Sint:
|
||||
case MTLPixelFormatR16Float:
|
||||
case MTLPixelFormatR16Unorm:
|
||||
case MTLPixelFormatR16Snorm:
|
||||
case MTLPixelFormatDepth32Float:
|
||||
case MTLPixelFormatDepth16Unorm:
|
||||
|
|
|
@ -650,11 +650,11 @@ mat4x4 normalize_and_get_size(mat4x4 mat, out vec4 r_size)
|
|||
|
||||
mat2x2 adjoint(mat2x2 mat)
|
||||
{
|
||||
mat2x2 adj;
|
||||
mat2x2 adj = mat2x2(0.0);
|
||||
for (int c = 0; c < 2; c++) {
|
||||
for (int r = 0; r < 2; r++) {
|
||||
/* Copy other cells except the "cross" to compute the determinant. */
|
||||
float tmp;
|
||||
float tmp = 0.0;
|
||||
for (int m_c = 0; m_c < 2; m_c++) {
|
||||
for (int m_r = 0; m_r < 2; m_r++) {
|
||||
if (m_c != c && m_r != r) {
|
||||
|
@ -671,11 +671,11 @@ mat2x2 adjoint(mat2x2 mat)
|
|||
}
|
||||
mat3x3 adjoint(mat3x3 mat)
|
||||
{
|
||||
mat3x3 adj;
|
||||
mat3x3 adj = mat3x3(0.0);
|
||||
for (int c = 0; c < 3; c++) {
|
||||
for (int r = 0; r < 3; r++) {
|
||||
/* Copy other cells except the "cross" to compute the determinant. */
|
||||
mat2x2 tmp;
|
||||
mat2x2 tmp = mat2x2(0.0);
|
||||
for (int m_c = 0; m_c < 3; m_c++) {
|
||||
for (int m_r = 0; m_r < 3; m_r++) {
|
||||
if (m_c != c && m_r != r) {
|
||||
|
@ -694,11 +694,11 @@ mat3x3 adjoint(mat3x3 mat)
|
|||
}
|
||||
mat4x4 adjoint(mat4x4 mat)
|
||||
{
|
||||
mat4x4 adj;
|
||||
mat4x4 adj = mat4x4(0.0);
|
||||
for (int c = 0; c < 4; c++) {
|
||||
for (int r = 0; r < 4; r++) {
|
||||
/* Copy other cells except the "cross" to compute the determinant. */
|
||||
mat3x3 tmp;
|
||||
mat3x3 tmp = mat3x3(0.0);
|
||||
for (int m_c = 0; m_c < 4; m_c++) {
|
||||
for (int m_r = 0; m_r < 4; m_r++) {
|
||||
if (m_c != c && m_r != r) {
|
||||
|
|
|
@ -146,7 +146,7 @@ int g_test_id = 0;
|
|||
|
||||
# define EXPECT_OP(OP, val1, val2) \
|
||||
out_test[g_test_id++] = test_output( \
|
||||
as_raw_data(val1), as_raw_data(val2), bool(OP), int(__LINE__), to_type(val1))
|
||||
as_raw_data(val1), as_raw_data(val2), bool(all(OP)), int(__LINE__), to_type(val1))
|
||||
#else
|
||||
|
||||
/** WORKAROUND: Fragment shader variant for older platform. */
|
||||
|
@ -158,7 +158,7 @@ int g_test_id = 0;
|
|||
} \
|
||||
if (int(gl_FragCoord.y) == g_test_id - 1) { \
|
||||
TestOutput to = test_output( \
|
||||
as_raw_data(val1), as_raw_data(val2), bool(OP), int(__LINE__), to_type(val1)); \
|
||||
as_raw_data(val1), as_raw_data(val2), bool(all(OP)), int(__LINE__), to_type(val1)); \
|
||||
switch (int(gl_FragCoord.x)) { \
|
||||
case 0: \
|
||||
out_test = uvec4( \
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "testing/testing.h"
|
||||
|
||||
#include "GPU_context.h"
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "gpu_testing.hh"
|
||||
|
||||
|
@ -199,4 +200,52 @@ static void test_framebuffer_scissor_test()
|
|||
}
|
||||
GPU_TEST(framebuffer_scissor_test);
|
||||
|
||||
/* Color each side of a cubemap with a different color. */
|
||||
static void test_framebuffer_cube()
|
||||
{
|
||||
const int SIZE = 32;
|
||||
GPU_render_begin();
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ;
|
||||
GPUTexture *tex = GPU_texture_create_cube("tex", SIZE, 1, GPU_RGBA32F, usage, nullptr);
|
||||
|
||||
const float4 clear_colors[6] = {
|
||||
{0.5f, 0.0f, 0.0f, 1.0f},
|
||||
{1.0f, 0.0f, 0.0f, 1.0f},
|
||||
{0.0f, 0.5f, 0.0f, 1.0f},
|
||||
{0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{0.0f, 0.0f, 0.5f, 1.0f},
|
||||
{0.0f, 0.0f, 1.0f, 1.0f},
|
||||
};
|
||||
GPUFrameBuffer *framebuffers[6] = {nullptr};
|
||||
|
||||
for (int i : IndexRange(6)) {
|
||||
GPU_framebuffer_ensure_config(&framebuffers[i],
|
||||
{
|
||||
GPU_ATTACHMENT_NONE,
|
||||
GPU_ATTACHMENT_TEXTURE_CUBEFACE(tex, i),
|
||||
});
|
||||
GPU_framebuffer_bind(framebuffers[i]);
|
||||
GPU_framebuffer_clear_color(framebuffers[i], clear_colors[i]);
|
||||
};
|
||||
|
||||
float4 *data = (float4 *)GPU_texture_read(tex, GPU_DATA_FLOAT, 0);
|
||||
for (int side : IndexRange(6)) {
|
||||
for (int pixel_index : IndexRange(SIZE * SIZE)) {
|
||||
int index = pixel_index + (SIZE * SIZE) * side;
|
||||
EXPECT_EQ(clear_colors[side], data[index]);
|
||||
}
|
||||
}
|
||||
MEM_freeN(data);
|
||||
|
||||
GPU_texture_free(tex);
|
||||
|
||||
for (int i : IndexRange(6)) {
|
||||
GPU_FRAMEBUFFER_FREE_SAFE(framebuffers[i]);
|
||||
}
|
||||
|
||||
GPU_render_end();
|
||||
}
|
||||
GPU_TEST(framebuffer_cube)
|
||||
|
||||
} // namespace blender::gpu::tests
|
||||
|
|
|
@ -63,6 +63,52 @@ static void test_texture_read()
|
|||
}
|
||||
GPU_TEST(texture_read)
|
||||
|
||||
static void test_texture_cube()
|
||||
{
|
||||
const int SIZE = 32;
|
||||
GPU_render_begin();
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ;
|
||||
GPUTexture *tex = GPU_texture_create_cube("tex", SIZE, 1, GPU_RGBA32F, usage, nullptr);
|
||||
float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f);
|
||||
GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color);
|
||||
|
||||
float4 *data = (float4 *)GPU_texture_read(tex, GPU_DATA_FLOAT, 0);
|
||||
for (int index : IndexRange(SIZE * SIZE * 6)) {
|
||||
EXPECT_EQ(clear_color, data[index]);
|
||||
}
|
||||
MEM_freeN(data);
|
||||
|
||||
GPU_texture_free(tex);
|
||||
|
||||
GPU_render_end();
|
||||
}
|
||||
GPU_TEST(texture_cube)
|
||||
|
||||
static void test_texture_cube_array()
|
||||
{
|
||||
const int SIZE = 32;
|
||||
const int ARRAY = 2;
|
||||
GPU_render_begin();
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ;
|
||||
GPUTexture *tex = GPU_texture_create_cube_array(
|
||||
"tex", SIZE, ARRAY, 1, GPU_RGBA32F, usage, nullptr);
|
||||
float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f);
|
||||
GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color);
|
||||
|
||||
float4 *data = (float4 *)GPU_texture_read(tex, GPU_DATA_FLOAT, 0);
|
||||
for (int index : IndexRange(SIZE * SIZE * 6 * ARRAY)) {
|
||||
EXPECT_EQ(clear_color, data[index]);
|
||||
}
|
||||
MEM_freeN(data);
|
||||
|
||||
GPU_texture_free(tex);
|
||||
|
||||
GPU_render_end();
|
||||
}
|
||||
GPU_TEST(texture_cube_array)
|
||||
|
||||
static void test_texture_copy()
|
||||
{
|
||||
const int SIZE = 128;
|
||||
|
|
|
@ -108,7 +108,10 @@ void VKBackend::compute_dispatch(int groups_x_len, int groups_y_len, int groups_
|
|||
command_buffer.dispatch(groups_x_len, groups_y_len, groups_z_len);
|
||||
}
|
||||
|
||||
void VKBackend::compute_dispatch_indirect(StorageBuf * /*indirect_buf*/) {}
|
||||
void VKBackend::compute_dispatch_indirect(StorageBuf * /*indirect_buf*/)
|
||||
{
|
||||
NOT_YET_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Context *VKBackend::context_alloc(void *ghost_window, void *ghost_context)
|
||||
{
|
||||
|
|
|
@ -585,17 +585,22 @@ VkFormat to_vk_format(const GPUVertCompType type, const uint32_t size, GPUVertFe
|
|||
|
||||
VkImageType to_vk_image_type(const eGPUTextureType type)
|
||||
{
|
||||
/* See
|
||||
* https://vulkan.lunarg.com/doc/view/1.3.243.0/linux/1.3-extensions/vkspec.html#resources-image-views-compatibility
|
||||
* for reference */
|
||||
switch (type) {
|
||||
case GPU_TEXTURE_1D:
|
||||
case GPU_TEXTURE_BUFFER:
|
||||
case GPU_TEXTURE_1D_ARRAY:
|
||||
return VK_IMAGE_TYPE_1D;
|
||||
|
||||
case GPU_TEXTURE_2D:
|
||||
case GPU_TEXTURE_2D_ARRAY:
|
||||
return VK_IMAGE_TYPE_2D;
|
||||
case GPU_TEXTURE_3D:
|
||||
case GPU_TEXTURE_CUBE:
|
||||
case GPU_TEXTURE_CUBE_ARRAY:
|
||||
return VK_IMAGE_TYPE_2D;
|
||||
|
||||
case GPU_TEXTURE_3D:
|
||||
return VK_IMAGE_TYPE_3D;
|
||||
|
||||
case GPU_TEXTURE_ARRAY:
|
||||
|
@ -607,7 +612,7 @@ VkImageType to_vk_image_type(const eGPUTextureType type)
|
|||
return VK_IMAGE_TYPE_1D;
|
||||
}
|
||||
|
||||
VkImageViewType to_vk_image_view_type(const eGPUTextureType type)
|
||||
VkImageViewType to_vk_image_view_type(const eGPUTextureType type, const eImageViewUsage view_type)
|
||||
{
|
||||
switch (type) {
|
||||
case GPU_TEXTURE_1D:
|
||||
|
@ -618,13 +623,15 @@ VkImageViewType to_vk_image_view_type(const eGPUTextureType type)
|
|||
case GPU_TEXTURE_3D:
|
||||
return VK_IMAGE_VIEW_TYPE_3D;
|
||||
case GPU_TEXTURE_CUBE:
|
||||
return VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
return view_type == eImageViewUsage::Attachment ? VK_IMAGE_VIEW_TYPE_2D_ARRAY :
|
||||
VK_IMAGE_VIEW_TYPE_CUBE;
|
||||
case GPU_TEXTURE_1D_ARRAY:
|
||||
return VK_IMAGE_VIEW_TYPE_1D_ARRAY;
|
||||
case GPU_TEXTURE_2D_ARRAY:
|
||||
return VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
case GPU_TEXTURE_CUBE_ARRAY:
|
||||
return VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
return view_type == eImageViewUsage::Attachment ? VK_IMAGE_VIEW_TYPE_2D_ARRAY :
|
||||
VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
|
||||
|
||||
case GPU_TEXTURE_ARRAY:
|
||||
/* GPU_TEXTURE_ARRAY should always be used together with 1D, 2D, or CUBE*/
|
||||
|
|
|
@ -23,13 +23,27 @@
|
|||
|
||||
namespace blender::gpu {
|
||||
|
||||
/**
|
||||
* Based on the usage of an Image View a different image view type should be created.
|
||||
*
|
||||
* When using a GPU_TEXTURE_CUBE as an frame buffer attachment it will be used as a
|
||||
* GPU_TEXTURE_2D_ARRAY. eg only a single side of the cube map will be attached. But when bound as
|
||||
* a shader resource the cubemap will be used.
|
||||
*/
|
||||
enum class eImageViewUsage {
|
||||
/** Image View will be used as a bindable shader resource. */
|
||||
ShaderBinding,
|
||||
/** Image View will be used as an framebuffer attachment. */
|
||||
Attachment,
|
||||
};
|
||||
|
||||
VkImageAspectFlagBits to_vk_image_aspect_flag_bits(const eGPUTextureFormat format);
|
||||
VkFormat to_vk_format(const eGPUTextureFormat format);
|
||||
VkFormat to_vk_format(const GPUVertCompType type,
|
||||
const uint32_t size,
|
||||
const GPUVertFetchMode fetch_mode);
|
||||
VkComponentMapping to_vk_component_mapping(const eGPUTextureFormat format);
|
||||
VkImageViewType to_vk_image_view_type(const eGPUTextureType type);
|
||||
VkImageViewType to_vk_image_view_type(const eGPUTextureType type, eImageViewUsage view_type);
|
||||
VkImageType to_vk_image_type(const eGPUTextureType type);
|
||||
VkClearColorValue to_vk_clear_color_value(const eGPUDataFormat format, const void *data);
|
||||
VkIndexType to_vk_index_type(const GPUIndexBufType index_type);
|
||||
|
|
|
@ -404,7 +404,7 @@ void VKFrameBuffer::render_pass_create()
|
|||
/* Ensure texture is allocated to ensure the image view. */
|
||||
VKTexture &texture = *static_cast<VKTexture *>(unwrap(attachment.tex));
|
||||
texture.ensure_allocated();
|
||||
image_views_.append(VKImageView(texture, attachment.mip, name_));
|
||||
image_views_.append(VKImageView(texture, attachment.layer, attachment.mip, name_));
|
||||
image_views[attachment_location] = image_views_.last().vk_handle();
|
||||
|
||||
VkAttachmentDescription &attachment_description =
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
namespace blender::gpu {
|
||||
|
||||
VKImageView::VKImageView(VKTexture &texture, int mip_level, StringRefNull name)
|
||||
: vk_image_view_(create_vk_image_view(texture, mip_level, name))
|
||||
VKImageView::VKImageView(VKTexture &texture, int layer, int mip_level, StringRefNull name)
|
||||
: vk_image_view_(create_vk_image_view(texture, layer, mip_level, name))
|
||||
{
|
||||
BLI_assert(vk_image_view_ != VK_NULL_HANDLE);
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ VKImageView::~VKImageView()
|
|||
}
|
||||
}
|
||||
VkImageView VKImageView::create_vk_image_view(VKTexture &texture,
|
||||
int layer,
|
||||
int mip_level,
|
||||
StringRefNull name)
|
||||
{
|
||||
|
@ -49,14 +50,15 @@ VkImageView VKImageView::create_vk_image_view(VKTexture &texture,
|
|||
VkImageViewCreateInfo image_view_info = {};
|
||||
image_view_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
image_view_info.image = texture.vk_image_handle();
|
||||
image_view_info.viewType = to_vk_image_view_type(texture.type_get());
|
||||
image_view_info.viewType = to_vk_image_view_type(texture.type_get(),
|
||||
eImageViewUsage::Attachment);
|
||||
image_view_info.format = to_vk_format(texture.format_get());
|
||||
image_view_info.components = to_vk_component_mapping(texture.format_get());
|
||||
image_view_info.subresourceRange.aspectMask = to_vk_image_aspect_flag_bits(texture.format_get());
|
||||
image_view_info.subresourceRange.baseMipLevel = mip_level;
|
||||
image_view_info.subresourceRange.levelCount = 1;
|
||||
image_view_info.subresourceRange.baseArrayLayer = 0;
|
||||
image_view_info.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
image_view_info.subresourceRange.baseArrayLayer = layer == -1 ? 0 : layer;
|
||||
image_view_info.subresourceRange.layerCount = 1;
|
||||
|
||||
const VKDevice &device = VKBackend::get().device_get();
|
||||
VkImageView image_view = VK_NULL_HANDLE;
|
||||
|
|
|
@ -20,7 +20,7 @@ class VKImageView : NonCopyable {
|
|||
VkImageView vk_image_view_ = VK_NULL_HANDLE;
|
||||
|
||||
public:
|
||||
VKImageView(VKTexture &texture, int mip_level, StringRefNull name);
|
||||
VKImageView(VKTexture &texture, int layer, int mip_level, StringRefNull name);
|
||||
|
||||
/**
|
||||
* Wrap the given vk_image_view handle. Note that the vk_image_view handle ownership is
|
||||
|
@ -38,7 +38,10 @@ class VKImageView : NonCopyable {
|
|||
}
|
||||
|
||||
private:
|
||||
static VkImageView create_vk_image_view(VKTexture &texture, int mip_level, StringRefNull name);
|
||||
static VkImageView create_vk_image_view(VKTexture &texture,
|
||||
int layer,
|
||||
int mip_level,
|
||||
StringRefNull name);
|
||||
};
|
||||
|
||||
} // namespace blender::gpu
|
||||
|
|
|
@ -157,6 +157,15 @@ void VKTexture::mip_range_set(int min, int max)
|
|||
flags_ |= IMAGE_VIEW_DIRTY;
|
||||
}
|
||||
|
||||
int VKTexture::layer_count()
|
||||
{
|
||||
int layers = 1;
|
||||
if (ELEM(type_, GPU_TEXTURE_CUBE, GPU_TEXTURE_CUBE_ARRAY)) {
|
||||
layers = d_;
|
||||
}
|
||||
return layers;
|
||||
}
|
||||
|
||||
void VKTexture::read_sub(int mip, eGPUDataFormat format, const int area[4], void *r_data)
|
||||
{
|
||||
VKContext &context = *VKContext::get();
|
||||
|
@ -165,7 +174,7 @@ void VKTexture::read_sub(int mip, eGPUDataFormat format, const int area[4], void
|
|||
/* Vulkan images cannot be directly mapped to host memory and requires a staging buffer. */
|
||||
VKBuffer staging_buffer;
|
||||
|
||||
size_t sample_len = area[2] * area[3];
|
||||
size_t sample_len = area[2] * area[3] * layer_count();
|
||||
size_t device_memory_size = sample_len * to_bytesize(format_);
|
||||
|
||||
staging_buffer.create(
|
||||
|
@ -179,7 +188,7 @@ void VKTexture::read_sub(int mip, eGPUDataFormat format, const int area[4], void
|
|||
region.imageExtent.depth = 1;
|
||||
region.imageSubresource.aspectMask = to_vk_image_aspect_flag_bits(format_);
|
||||
region.imageSubresource.mipLevel = mip;
|
||||
region.imageSubresource.layerCount = 1;
|
||||
region.imageSubresource.layerCount = layer_count();
|
||||
|
||||
VKCommandBuffer &command_buffer = context.command_buffer_get();
|
||||
command_buffer.copy(staging_buffer, *this, Span<VkBufferImageCopy>(®ion, 1));
|
||||
|
@ -192,7 +201,7 @@ void *VKTexture::read(int mip, eGPUDataFormat format)
|
|||
{
|
||||
int mip_size[3] = {1, 1, 1};
|
||||
mip_size_get(mip, mip_size);
|
||||
size_t sample_len = mip_size[0] * mip_size[1];
|
||||
size_t sample_len = mip_size[0] * mip_size[1] * layer_count();
|
||||
size_t host_memory_size = sample_len * to_bytesize(format_, format);
|
||||
|
||||
void *data = MEM_mallocN(host_memory_size, __func__);
|
||||
|
@ -372,6 +381,17 @@ static VkImageUsageFlagBits to_vk_image_usage(const eGPUTextureUsage usage,
|
|||
return result;
|
||||
}
|
||||
|
||||
static VkImageCreateFlagBits to_vk_image_create(const eGPUTextureType texture_type)
|
||||
{
|
||||
VkImageCreateFlagBits result = static_cast<VkImageCreateFlagBits>(0);
|
||||
|
||||
if (ELEM(texture_type, GPU_TEXTURE_CUBE, GPU_TEXTURE_CUBE_ARRAY)) {
|
||||
result = static_cast<VkImageCreateFlagBits>(result | VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool VKTexture::allocate()
|
||||
{
|
||||
BLI_assert(vk_image_ == VK_NULL_HANDLE);
|
||||
|
@ -379,17 +399,23 @@ bool VKTexture::allocate()
|
|||
|
||||
int extent[3] = {1, 1, 1};
|
||||
mip_size_get(0, extent);
|
||||
int layers = 1;
|
||||
if (ELEM(type_, GPU_TEXTURE_CUBE, GPU_TEXTURE_CUBE_ARRAY)) {
|
||||
layers = extent[2];
|
||||
extent[2] = 1;
|
||||
}
|
||||
|
||||
VKContext &context = *VKContext::get();
|
||||
const VKDevice &device = VKBackend::get().device_get();
|
||||
VkImageCreateInfo image_info = {};
|
||||
image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
image_info.flags = to_vk_image_create(type_);
|
||||
image_info.imageType = to_vk_image_type(type_);
|
||||
image_info.extent.width = extent[0];
|
||||
image_info.extent.height = extent[1];
|
||||
image_info.extent.depth = extent[2];
|
||||
image_info.mipLevels = max_ii(mipmaps_, 1);
|
||||
image_info.arrayLayers = 1;
|
||||
image_info.arrayLayers = layers;
|
||||
image_info.format = to_vk_format(format_);
|
||||
/* Some platforms (NVIDIA) requires that attached textures are always tiled optimal.
|
||||
*
|
||||
|
@ -536,14 +562,15 @@ void VKTexture::image_view_update()
|
|||
VkImageViewCreateInfo image_view_info = {};
|
||||
image_view_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
image_view_info.image = vk_image_;
|
||||
image_view_info.viewType = to_vk_image_view_type(type_);
|
||||
image_view_info.viewType = to_vk_image_view_type(type_, eImageViewUsage::ShaderBinding);
|
||||
image_view_info.format = to_vk_format(format_);
|
||||
image_view_info.components = to_vk_component_mapping(format_);
|
||||
image_view_info.subresourceRange.aspectMask = to_vk_image_aspect_flag_bits(format_);
|
||||
IndexRange mip_range = mip_map_range();
|
||||
image_view_info.subresourceRange.baseMipLevel = mip_range.first();
|
||||
image_view_info.subresourceRange.levelCount = mip_range.size();
|
||||
image_view_info.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
image_view_info.subresourceRange.layerCount =
|
||||
ELEM(type_, GPU_TEXTURE_CUBE, GPU_TEXTURE_CUBE_ARRAY) ? d_ : VK_REMAINING_ARRAY_LAYERS;
|
||||
|
||||
const VKDevice &device = VKBackend::get().device_get();
|
||||
VkImageView image_view = VK_NULL_HANDLE;
|
||||
|
|
|
@ -86,6 +86,8 @@ class VKTexture : public Texture {
|
|||
*/
|
||||
bool allocate();
|
||||
|
||||
int layer_count();
|
||||
|
||||
VkImageViewType vk_image_view_type() const;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -250,19 +250,19 @@ static void rna_def_latticepoint(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "LatticePoint", NULL);
|
||||
srna = RNA_def_struct(brna, "LatticePoint", nullptr);
|
||||
RNA_def_struct_sdna(srna, "BPoint");
|
||||
RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
|
||||
RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
|
||||
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "f1", SELECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "f1", SELECT);
|
||||
RNA_def_property_ui_text(prop, "Point selected", "Selection status");
|
||||
|
||||
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_float_funcs(prop, "rna_LatticePoint_co_get", NULL, NULL);
|
||||
RNA_def_property_float_funcs(prop, "rna_LatticePoint_co_get", nullptr, nullptr);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Location",
|
||||
|
@ -270,13 +270,13 @@ static void rna_def_latticepoint(BlenderRNA *brna)
|
|||
"(edit/animate the Deformed Location instead)");
|
||||
|
||||
prop = RNA_def_property(srna, "co_deform", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "vec");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "vec");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Deformed Location", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "weight");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "weight");
|
||||
RNA_def_property_range(prop, 0.01f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
|
||||
|
@ -287,10 +287,10 @@ static void rna_def_latticepoint(BlenderRNA *brna)
|
|||
"rna_iterator_array_next",
|
||||
"rna_iterator_array_end",
|
||||
"rna_iterator_array_get",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_struct_type(prop, "VertexGroupElement");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Groups", "Weights for the vertex groups this point is member of");
|
||||
|
@ -307,8 +307,8 @@ static void rna_def_lattice(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);
|
||||
|
||||
prop = RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "pntsu");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "pntsu");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Lattice_points_u_set", nullptr);
|
||||
RNA_def_property_range(prop, 1, 64);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -317,8 +317,8 @@ static void rna_def_lattice(BlenderRNA *brna)
|
|||
RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
|
||||
|
||||
prop = RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "pntsv");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "pntsv");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Lattice_points_v_set", nullptr);
|
||||
RNA_def_property_range(prop, 1, 64);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -327,8 +327,8 @@ static void rna_def_lattice(BlenderRNA *brna)
|
|||
RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
|
||||
|
||||
prop = RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "pntsw");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "pntsw");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Lattice_points_w_set", nullptr);
|
||||
RNA_def_property_range(prop, 1, 64);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -337,39 +337,39 @@ static void rna_def_lattice(BlenderRNA *brna)
|
|||
RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "typeu");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "typeu");
|
||||
RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation Type U", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "typev");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "typev");
|
||||
RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation Type V", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "typew");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "typew");
|
||||
RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
|
||||
RNA_def_property_ui_text(prop, "Interpolation Type W", "");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
|
||||
|
||||
prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LT_OUTSIDE);
|
||||
RNA_def_property_boolean_funcs(prop, nullptr, "rna_Lattice_use_outside_set");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Outside", "Only display and take into account the outer vertices");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
|
||||
|
||||
prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_sdna(prop, NULL, "vgroup");
|
||||
RNA_def_property_string_sdna(prop, nullptr, "vgroup");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
|
||||
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Lattice_vg_name_set");
|
||||
RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
|
||||
|
||||
prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "key");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "key");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_clear_flag(prop, PROP_PTR_NO_OWNERSHIP);
|
||||
RNA_def_property_ui_text(prop, "Shape Keys", "");
|
||||
|
@ -381,14 +381,14 @@ static void rna_def_lattice(BlenderRNA *brna)
|
|||
"rna_iterator_array_next",
|
||||
"rna_iterator_array_end",
|
||||
"rna_iterator_array_get",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
|
||||
|
||||
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Lattice_is_editmode_get", NULL);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Lattice_is_editmode_get", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void RNA_api_lattice(StructRNA *srna)
|
|||
|
||||
func = RNA_def_function(srna, "transform", "rna_Lattice_transform");
|
||||
RNA_def_function_ui_description(func, "Transform lattice by a matrix");
|
||||
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
||||
parm = RNA_def_float_matrix(func, "matrix", 4, 4, nullptr, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
||||
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
|
||||
RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
|
||||
|
||||
|
|
|
@ -607,16 +607,16 @@ static void rna_def_maskParent(BlenderRNA *brna)
|
|||
|
||||
static const EnumPropertyItem mask_id_type_items[] = {
|
||||
{ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem parent_type_items[] = {
|
||||
{MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
|
||||
{MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskParent", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskParent", nullptr);
|
||||
RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
|
||||
|
||||
/* Target Properties - ID-block to Drive */
|
||||
|
@ -626,16 +626,16 @@ static void rna_def_maskParent(BlenderRNA *brna)
|
|||
// RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
|
||||
/* NOTE: custom set function is ONLY to avoid rna setting a user for this. */
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, NULL, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", NULL);
|
||||
prop, nullptr, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", nullptr);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "ID", "ID-block to which masking element would be parented to or to its property");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
|
||||
|
||||
prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "id_type");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "id_type");
|
||||
RNA_def_property_enum_items(prop, mask_id_type_items);
|
||||
RNA_def_property_enum_default(prop, ID_MC);
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_MaskParent_id_type_set", NULL);
|
||||
RNA_def_property_enum_funcs(prop, nullptr, "rna_MaskParent_id_type_set", nullptr);
|
||||
// RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
|
||||
RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
|
||||
|
@ -668,27 +668,27 @@ static void rna_def_maskSplinePointUW(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplinePointUW", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskSplinePointUW", nullptr);
|
||||
RNA_def_struct_ui_text(
|
||||
srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
|
||||
|
||||
/* u */
|
||||
prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "u");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "u");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
/* weight */
|
||||
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "w");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "w");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
/* select */
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SELECT);
|
||||
RNA_def_property_ui_text(prop, "Select", "Selection status");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
}
|
||||
|
@ -704,12 +704,12 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||
{HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
|
||||
{HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
|
||||
{HD_FREE, "FREE", 0, "Free", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
rna_def_maskSplinePointUW(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplinePoint", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskSplinePoint", nullptr);
|
||||
RNA_def_struct_ui_text(
|
||||
srna, "Mask Spline Point", "Single point in spline used for defining mask");
|
||||
|
||||
|
@ -717,28 +717,28 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_array(prop, 2);
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
|
||||
prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", nullptr);
|
||||
RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_array(prop, 2);
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
|
||||
prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", nullptr);
|
||||
RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_array(prop, 2);
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
|
||||
prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", nullptr);
|
||||
RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
/* handle_type */
|
||||
prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_funcs(
|
||||
prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", NULL);
|
||||
prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", nullptr);
|
||||
RNA_def_property_enum_items(prop, handle_type_items);
|
||||
RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
@ -748,7 +748,7 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||
RNA_def_property_enum_funcs(prop,
|
||||
"rna_MaskSplinePoint_handle_left_type_get",
|
||||
"rna_MaskSplinePoint_handle_left_type_set",
|
||||
NULL);
|
||||
nullptr);
|
||||
RNA_def_property_enum_items(prop, handle_type_items);
|
||||
RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
@ -758,21 +758,21 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||
RNA_def_property_enum_funcs(prop,
|
||||
"rna_MaskSplinePoint_handle_right_type_get",
|
||||
"rna_MaskSplinePoint_handle_right_type_set",
|
||||
NULL);
|
||||
nullptr);
|
||||
RNA_def_property_enum_items(prop, handle_type_items);
|
||||
RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
/* weight */
|
||||
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "bezt.weight");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "bezt.weight");
|
||||
RNA_def_property_range(prop, 0.0, 1.0);
|
||||
RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
/* select */
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "bezt.f1", SELECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f1", SELECT);
|
||||
RNA_def_property_ui_text(prop, "Select", "Selection status");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
|
||||
|
@ -783,7 +783,7 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||
/* feather points */
|
||||
prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskSplinePointUW");
|
||||
RNA_def_property_collection_sdna(prop, NULL, "uw", "tot_uw");
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "uw", "tot_uw");
|
||||
RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
|
||||
}
|
||||
|
||||
|
@ -794,7 +794,7 @@ static void rna_def_mask_splines(BlenderRNA *brna)
|
|||
PropertyRNA *prop;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplines", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskSplines", nullptr);
|
||||
RNA_def_struct_sdna(srna, "MaskLayer");
|
||||
RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
|
||||
|
||||
|
@ -817,8 +817,11 @@ static void rna_def_mask_splines(BlenderRNA *brna)
|
|||
/* active spline */
|
||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskSpline");
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, "rna_MaskLayer_active_spline_get", "rna_MaskLayer_active_spline_set", NULL, NULL);
|
||||
RNA_def_property_pointer_funcs(prop,
|
||||
"rna_MaskLayer_active_spline_get",
|
||||
"rna_MaskLayer_active_spline_set",
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
|
||||
|
||||
|
@ -828,8 +831,8 @@ static void rna_def_mask_splines(BlenderRNA *brna)
|
|||
RNA_def_property_pointer_funcs(prop,
|
||||
"rna_MaskLayer_active_spline_point_get",
|
||||
"rna_MaskLayer_active_spline_point_set",
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Point", "Active point of masking layer");
|
||||
}
|
||||
|
@ -840,7 +843,7 @@ static void rna_def_maskSplinePoints(BlenderRNA *brna)
|
|||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSplinePoints", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskSplinePoints", nullptr);
|
||||
RNA_def_struct_sdna(srna, "MaskSpline");
|
||||
RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
|
||||
|
||||
|
@ -867,7 +870,7 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
static const EnumPropertyItem spline_interpolation_items[] = {
|
||||
{MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
|
||||
{MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem spline_offset_mode_items[] = {
|
||||
|
@ -877,7 +880,7 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
0,
|
||||
"Smooth",
|
||||
"Calculate feather offset as a second curve"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
StructRNA *srna;
|
||||
|
@ -885,12 +888,12 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
|
||||
rna_def_maskSplinePoint(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskSpline", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskSpline", nullptr);
|
||||
RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
|
||||
|
||||
/* offset mode */
|
||||
prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "offset_mode");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "offset_mode");
|
||||
RNA_def_property_enum_items(prop, spline_offset_mode_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Feather Offset", "The method used for calculating the feather offset");
|
||||
|
@ -898,7 +901,7 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
|
||||
/* weight interpolation */
|
||||
prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "weight_interp");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "weight_interp");
|
||||
RNA_def_property_enum_items(prop, spline_interpolation_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Weight Interpolation", "The type of weight interpolation for spline");
|
||||
|
@ -907,14 +910,14 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
/* cyclic */
|
||||
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MASK_SPLINE_CYCLIC);
|
||||
RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
|
||||
|
||||
/* fill */
|
||||
prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", MASK_SPLINE_NOFILL);
|
||||
RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MASK);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
|
||||
|
@ -922,14 +925,14 @@ static void rna_def_maskSpline(BlenderRNA *brna)
|
|||
/* self-intersection check */
|
||||
prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_NOINTERSECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MASK_SPLINE_NOINTERSECT);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Self Intersection Check", "Prevent feather from self-intersections");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskSplinePoint");
|
||||
RNA_def_property_collection_sdna(prop, NULL, "points", "tot_point");
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "points", "tot_point");
|
||||
RNA_def_property_ui_text(prop, "Points", "Collection of points");
|
||||
RNA_def_property_srna(prop, "MaskSplinePoints");
|
||||
}
|
||||
|
@ -946,7 +949,7 @@ static void rna_def_mask_layer(BlenderRNA *brna)
|
|||
{MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
|
||||
{MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
|
||||
{MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
StructRNA *srna;
|
||||
|
@ -956,14 +959,14 @@ static void rna_def_mask_layer(BlenderRNA *brna)
|
|||
rna_def_mask_splines(brna);
|
||||
rna_def_maskSplinePoints(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "MaskLayer", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskLayer", nullptr);
|
||||
RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
|
||||
RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
|
||||
|
||||
/* name */
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskLayer_name_set");
|
||||
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_MaskLayer_name_set");
|
||||
RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
@ -975,79 +978,79 @@ static void rna_def_mask_layer(BlenderRNA *brna)
|
|||
"rna_iterator_listbase_next",
|
||||
"rna_iterator_listbase_end",
|
||||
"rna_iterator_listbase_get",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_struct_type(prop, "MaskSpline");
|
||||
RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
|
||||
RNA_def_property_srna(prop, "MaskSplines");
|
||||
|
||||
/* restrict */
|
||||
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_VIEW);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_VIEW);
|
||||
RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_SELECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_SELECT);
|
||||
RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_RENDER);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_RENDER);
|
||||
RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
|
||||
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
/* Select (for dope-sheet). */
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_SELECT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MASK_LAYERFLAG_SELECT);
|
||||
RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
|
||||
// RNA_def_property_update(prop, NC_SCREEN | ND_MASK, NULL);
|
||||
|
||||
/* render settings */
|
||||
prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "alpha");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "alpha");
|
||||
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
|
||||
RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
/* weight interpolation */
|
||||
prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "blend");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "blend");
|
||||
RNA_def_property_enum_items(prop, masklay_blend_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
|
||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MASK_BLENDFLAG_INVERT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MASK_BLENDFLAG_INVERT);
|
||||
RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "falloff");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "falloff");
|
||||
RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
|
||||
RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
|
||||
RNA_def_property_translation_context(prop,
|
||||
BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
/* filling options */
|
||||
prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_DISCRETE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", MASK_LAYERFLAG_FILL_DISCRETE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_OVERLAP);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MASK_LAYERFLAG_FILL_OVERLAP);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Calculate Overlap", "Calculate self intersections and overlap before filling");
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
|
||||
}
|
||||
|
||||
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
@ -1059,13 +1062,13 @@ static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "MaskLayers");
|
||||
srna = RNA_def_struct(brna, "MaskLayers", NULL);
|
||||
srna = RNA_def_struct(brna, "MaskLayers", nullptr);
|
||||
RNA_def_struct_sdna(srna, "Mask");
|
||||
RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
|
||||
|
||||
func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
|
||||
RNA_def_function_ui_description(func, "Add layer to this mask");
|
||||
RNA_def_string(func, "name", NULL, 0, "Name", "Name of new layer");
|
||||
RNA_def_string(func, "name", nullptr, 0, "Name", "Name of new layer");
|
||||
parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
|
@ -1084,7 +1087,7 @@ static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "MaskLayer");
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL);
|
||||
prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", nullptr, nullptr);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
||||
RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
|
||||
}
|
||||
|
@ -1107,17 +1110,17 @@ static void rna_def_mask(BlenderRNA *brna)
|
|||
"rna_iterator_listbase_next",
|
||||
"rna_iterator_listbase_end",
|
||||
"rna_iterator_listbase_get",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_struct_type(prop, "MaskLayer");
|
||||
RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
|
||||
rna_def_masklayers(brna, prop);
|
||||
|
||||
/* active masklay index */
|
||||
prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "masklay_act");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "masklay_act");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_funcs(prop,
|
||||
"rna_Mask_layer_active_index_get",
|
||||
|
@ -1125,24 +1128,24 @@ static void rna_def_mask(BlenderRNA *brna)
|
|||
"rna_Mask_layer_active_index_range");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
|
||||
|
||||
/* frame range */
|
||||
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "sfra");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Mask_start_frame_set", NULL);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "sfra");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_start_frame_set", nullptr);
|
||||
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
||||
RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "efra");
|
||||
RNA_def_property_int_funcs(prop, NULL, "rna_Mask_end_frame_set", NULL);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "efra");
|
||||
RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_end_frame_set", nullptr);
|
||||
RNA_def_property_range(prop, MINFRAME, MAXFRAME);
|
||||
RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
|
||||
RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
|
||||
|
||||
/* pointers */
|
||||
rna_def_animdata_common(srna);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
static int rna_Meta_texspace_editable(PointerRNA *ptr, const char ** /*r_info*/)
|
||||
{
|
||||
MetaBall *mb = (MetaBall *)ptr->data;
|
||||
return (mb->texspace_flag & MB_TEXSPACE_FLAG_AUTO) ? 0 : PROP_EDITABLE;
|
||||
return (mb->texspace_flag & MB_TEXSPACE_FLAG_AUTO) ? 0 : int(PROP_EDITABLE);
|
||||
}
|
||||
|
||||
static void rna_Meta_texspace_location_get(PointerRNA *ptr, float *values)
|
||||
|
@ -182,7 +182,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "MetaElement", NULL);
|
||||
srna = RNA_def_struct(brna, "MetaElement", nullptr);
|
||||
RNA_def_struct_sdna(srna, "MetaElem");
|
||||
RNA_def_struct_ui_text(srna, "Metaball Element", "Blobby element in a metaball data-block");
|
||||
RNA_def_struct_path_func(srna, "rna_MetaElement_path");
|
||||
|
@ -196,24 +196,24 @@ static void rna_def_metaelement(BlenderRNA *brna)
|
|||
|
||||
/* number values */
|
||||
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "x");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "x");
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Location", "");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "quat");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "quat");
|
||||
RNA_def_property_ui_text(prop, "Rotation", "Normalized quaternion rotation");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_rotation");
|
||||
|
||||
prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED | PROP_UNIT_LENGTH);
|
||||
RNA_def_property_float_sdna(prop, NULL, "rad");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "rad");
|
||||
RNA_def_property_ui_text(prop, "Radius", "");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "expx");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "expx");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_range(prop, 0.0f, 20.0f);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -221,7 +221,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "expy");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "expy");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_range(prop, 0.0f, 20.0f);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -229,7 +229,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "expz");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "expz");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_range(prop, 0.0f, 20.0f);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -237,29 +237,29 @@ static void rna_def_metaelement(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "s");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "s");
|
||||
RNA_def_property_range(prop, 0.0f, 10.0f);
|
||||
RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
/* flags */
|
||||
prop = RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MB_NEGATIVE);
|
||||
RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "use_scale_stiffness", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MB_SCALE_RAD);
|
||||
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", MB_SCALE_RAD);
|
||||
RNA_def_property_ui_text(prop, "Scale Stiffness", "Scale stiffness instead of radius");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_redraw_data");
|
||||
|
||||
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", 1); /* SELECT */
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", 1); /* SELECT */
|
||||
RNA_def_property_ui_text(prop, "Select", "Select element");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_redraw_data");
|
||||
|
||||
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", MB_HIDE);
|
||||
RNA_def_property_ui_text(prop, "Hide", "Hide element");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "MetaBallElements");
|
||||
srna = RNA_def_struct(brna, "MetaBallElements", NULL);
|
||||
srna = RNA_def_struct(brna, "MetaBallElements", nullptr);
|
||||
RNA_def_struct_sdna(srna, "MetaBall");
|
||||
RNA_def_struct_ui_text(srna, "Metaball Elements", "Collection of metaball elements");
|
||||
|
||||
|
@ -300,7 +300,7 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
RNA_def_function_ui_description(func, "Remove all elements from the metaball");
|
||||
|
||||
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "lastelem");
|
||||
RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ static void rna_def_metaball(BlenderRNA *brna)
|
|||
"While editing, update metaball in half resolution"},
|
||||
{MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
|
||||
{MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
srna = RNA_def_struct(brna, "MetaBall", "ID");
|
||||
|
@ -325,42 +325,42 @@ static void rna_def_metaball(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_icon(srna, ICON_META_DATA);
|
||||
|
||||
prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "elems", nullptr);
|
||||
RNA_def_property_struct_type(prop, "MetaElement");
|
||||
RNA_def_property_ui_text(prop, "Elements", "Metaball elements");
|
||||
rna_def_metaball_elements(brna, prop);
|
||||
|
||||
/* enums */
|
||||
prop = RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "flag");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "flag");
|
||||
RNA_def_property_enum_items(prop, prop_update_items);
|
||||
RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
/* number values */
|
||||
prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "wiresize");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "wiresize");
|
||||
RNA_def_property_range(prop, 0.005f, 10000.0f);
|
||||
RNA_def_property_ui_range(prop, 0.05f, 1000.0f, 2.5f, 3);
|
||||
RNA_def_property_ui_text(prop, "Viewport Size", "Polygonization resolution in the 3D viewport");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "rendersize");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "rendersize");
|
||||
RNA_def_property_range(prop, 0.005f, 10000.0f);
|
||||
RNA_def_property_ui_range(prop, 0.025f, 1000.0f, 2.5f, 3);
|
||||
RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "thresh");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "thresh");
|
||||
RNA_def_property_range(prop, 0.0f, 5.0f);
|
||||
RNA_def_property_ui_text(prop, "Threshold", "Influence of metaball elements");
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
/* texture space */
|
||||
prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "texspace_flag", MB_TEXSPACE_FLAG_AUTO);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "texspace_flag", MB_TEXSPACE_FLAG_AUTO);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Auto Texture Space",
|
||||
|
@ -371,7 +371,7 @@ static void rna_def_metaball(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
|
||||
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_Meta_texspace_location_get", "rna_Meta_texspace_location_set", NULL);
|
||||
prop, "rna_Meta_texspace_location_get", "rna_Meta_texspace_location_set", nullptr);
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
|
||||
|
@ -380,7 +380,7 @@ static void rna_def_metaball(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
|
||||
RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
|
||||
prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", nullptr);
|
||||
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
|
||||
|
||||
/* not supported yet */
|
||||
|
@ -395,15 +395,22 @@ static void rna_def_metaball(BlenderRNA *brna)
|
|||
|
||||
/* materials */
|
||||
prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "mat", "totcol");
|
||||
RNA_def_property_struct_type(prop, "Material");
|
||||
RNA_def_property_ui_text(prop, "Materials", "");
|
||||
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
|
||||
RNA_def_property_collection_funcs(
|
||||
prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
|
||||
RNA_def_property_collection_funcs(prop,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"rna_IDMaterials_assign_int");
|
||||
|
||||
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", NULL);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ const EnumPropertyItem rna_enum_color_sets_items[] = {
|
|||
{19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
|
||||
{20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
|
||||
{-1, "CUSTOM", 0, "Custom Color Set", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
@ -871,14 +871,14 @@ void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const cha
|
|||
|
||||
/* color set + colors */
|
||||
prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "customCol");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "customCol");
|
||||
RNA_def_property_enum_items(prop, rna_enum_color_sets_items);
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_ActionGroup_colorset_set", NULL);
|
||||
RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionGroup_colorset_set", nullptr);
|
||||
RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
|
||||
RNA_def_property_update(prop, update_flag, update_cb);
|
||||
|
||||
prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", NULL);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
|
||||
|
@ -888,7 +888,7 @@ void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const cha
|
|||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
|
||||
/* NOTE: the DNA data is not really a pointer, but this code works :) */
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "cs");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "cs");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Colors", "Copy of the colors associated with the group's color set");
|
||||
RNA_def_property_update(prop, update_flag, update_cb);
|
||||
|
@ -900,7 +900,7 @@ static void rna_def_bone_group(BlenderRNA *brna)
|
|||
PropertyRNA *prop;
|
||||
|
||||
/* struct */
|
||||
srna = RNA_def_struct(brna, "BoneGroup", NULL);
|
||||
srna = RNA_def_struct(brna, "BoneGroup", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bActionGroup");
|
||||
RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
|
||||
RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
|
||||
|
@ -908,7 +908,7 @@ static void rna_def_bone_group(BlenderRNA *brna)
|
|||
/* name */
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Name", "");
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set");
|
||||
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_BoneGroup_name_set");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
||||
/* TODO: add some runtime-collections stuff to access grouped bones. */
|
||||
|
@ -920,13 +920,13 @@ static void rna_def_bone_group(BlenderRNA *brna)
|
|||
static const EnumPropertyItem prop_iksolver_items[] = {
|
||||
{IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
|
||||
{IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_solver_items[] = {
|
||||
{ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
|
||||
{ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
@ -938,7 +938,7 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
|||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "PoseBoneConstraints");
|
||||
srna = RNA_def_struct(brna, "PoseBoneConstraints", NULL);
|
||||
srna = RNA_def_struct(brna, "PoseBoneConstraints", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bPoseChannel");
|
||||
RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
|
||||
|
||||
|
@ -948,8 +948,8 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
|
|||
RNA_def_property_pointer_funcs(prop,
|
||||
"rna_PoseChannel_active_constraint_get",
|
||||
"rna_PoseChannel_active_constraint_set",
|
||||
NULL,
|
||||
NULL);
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "PoseBone", NULL);
|
||||
srna = RNA_def_struct(brna, "PoseBone", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bPoseChannel");
|
||||
RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
|
||||
RNA_def_struct_path_func(srna, "rna_PoseBone_path");
|
||||
|
@ -1018,13 +1018,14 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_override_flag(
|
||||
prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY | PROPOVERRIDE_LIBRARY_INSERTION);
|
||||
RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this pose channel");
|
||||
RNA_def_property_override_funcs(prop, NULL, NULL, "rna_PoseChannel_constraints_override_apply");
|
||||
RNA_def_property_override_funcs(
|
||||
prop, nullptr, nullptr, "rna_PoseChannel_constraints_override_apply");
|
||||
|
||||
rna_def_pose_channel_constraints(brna, prop);
|
||||
|
||||
/* Name + Selection Status */
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
|
||||
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_PoseChannel_name_set");
|
||||
RNA_def_property_ui_text(prop, "Name", "");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
|
@ -1037,7 +1038,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "Bone");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_get", NULL, NULL, NULL);
|
||||
RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_get", nullptr, nullptr, nullptr);
|
||||
RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
|
||||
|
@ -1056,7 +1057,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* Transformation settings */
|
||||
prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "loc");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "loc");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
|
||||
RNA_def_property_ui_text(prop, "Location", "");
|
||||
|
@ -1064,7 +1065,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "size");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "size");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
|
||||
|
@ -1073,7 +1074,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "quat");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "quat");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
|
||||
RNA_def_property_float_array_default(prop, rna_default_quaternion);
|
||||
|
@ -1089,7 +1090,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_float_funcs(prop,
|
||||
"rna_PoseChannel_rotation_axis_angle_get",
|
||||
"rna_PoseChannel_rotation_axis_angle_set",
|
||||
NULL);
|
||||
nullptr);
|
||||
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
|
||||
RNA_def_property_float_array_default(prop, rna_default_axis_angle);
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -1097,7 +1098,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
|
||||
RNA_def_property_float_sdna(prop, NULL, "eul");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "eul");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
|
||||
RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
|
||||
|
@ -1105,10 +1106,10 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
|
||||
RNA_def_property_enum_funcs(prop, nullptr, "rna_PoseChannel_rotation_mode_set", nullptr);
|
||||
/* XXX... disabled, since proxy-locked layers are currently
|
||||
* used for ensuring proxy-syncing too */
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
|
@ -1120,7 +1121,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* Custom BBone next/prev sources */
|
||||
prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "bbone_prev");
|
||||
RNA_def_property_struct_type(prop, "PoseBone");
|
||||
RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
||||
|
@ -1129,7 +1130,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
|
||||
|
||||
prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "bbone_next");
|
||||
RNA_def_property_struct_type(prop, "PoseBone");
|
||||
RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
||||
|
@ -1139,7 +1140,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
|
||||
prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
|
||||
RNA_def_property_float_sdna(prop, NULL, "chan_mat");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "chan_mat");
|
||||
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
@ -1155,15 +1156,15 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
"Basis Matrix",
|
||||
"Alternative access to location/scale/rotation relative to the parent and own rest bone");
|
||||
RNA_def_property_float_funcs(
|
||||
prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
|
||||
prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
/* final matrix */
|
||||
prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
|
||||
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "pose_mat");
|
||||
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
||||
RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
|
||||
RNA_def_property_float_funcs(prop, nullptr, "rna_PoseChannel_matrix_set", nullptr);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Pose Matrix",
|
||||
|
@ -1172,160 +1173,160 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
|
||||
prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "pose_head");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "pose_head");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
|
||||
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
||||
|
||||
prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
|
||||
RNA_def_property_float_sdna(prop, NULL, "pose_tail");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "pose_tail");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
|
||||
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
|
||||
|
||||
prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_funcs(prop, "rna_PoseChannel_length_get", NULL, NULL);
|
||||
RNA_def_property_float_funcs(prop, "rna_PoseChannel_length_get", nullptr, nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Length", "Length of the bone");
|
||||
|
||||
/* IK Settings */
|
||||
prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
|
||||
RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_XDOF);
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
|
||||
RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_YDOF);
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
|
||||
RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_ZDOF);
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
|
||||
RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_XLIMIT);
|
||||
RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_YLIMIT);
|
||||
RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ZLIMIT);
|
||||
RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ROTCTL);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ROTCTL);
|
||||
RNA_def_property_ui_text(prop, "IK Rotation Control", "Apply channel rotation as IK constraint");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_LINCTL);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_LINCTL);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "IK Linear Control", "Apply channel size as IK constraint if stretching is enabled");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmin[0]");
|
||||
RNA_def_property_range(prop, -M_PI, 0.0f);
|
||||
RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmax[0]");
|
||||
RNA_def_property_range(prop, 0.0f, M_PI);
|
||||
RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmin[1]");
|
||||
RNA_def_property_range(prop, -M_PI, 0.0f);
|
||||
RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmax[1]");
|
||||
RNA_def_property_range(prop, 0.0f, M_PI);
|
||||
RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmin[2]");
|
||||
RNA_def_property_range(prop, -M_PI, 0.0f);
|
||||
RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "limitmax[2]");
|
||||
RNA_def_property_range(prop, 0.0f, M_PI);
|
||||
RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "stiffness[0]");
|
||||
RNA_def_property_range(prop, 0.0f, 0.99f);
|
||||
RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "stiffness[1]");
|
||||
RNA_def_property_range(prop, 0.0f, 0.99f);
|
||||
RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "stiffness[2]");
|
||||
RNA_def_property_range(prop, 0.0f, 0.99f);
|
||||
RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ikstretch");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "ikstretch");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "ikrotweight");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "IK Rotation Weight", "Weight of rotation constraint for IK");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "iklinweight");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "iklinweight");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
|
@ -1333,7 +1334,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* custom bone shapes */
|
||||
prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "custom");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "custom");
|
||||
RNA_def_property_struct_type(prop, "Object");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
|
@ -1343,14 +1344,14 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
|
||||
|
||||
prop = RNA_def_property(srna, "custom_shape_scale_xyz", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "custom_scale_xyz");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "custom_scale_xyz");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_float_array_default(prop, rna_default_scale_3d);
|
||||
RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "custom_shape_translation", PROP_FLOAT, PROP_XYZ);
|
||||
RNA_def_property_float_sdna(prop, NULL, "custom_translation");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "custom_translation");
|
||||
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Custom Shape Translation", "Adjust the location of the custom shape");
|
||||
|
@ -1358,20 +1359,21 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "custom_shape_rotation_euler", PROP_FLOAT, PROP_EULER);
|
||||
RNA_def_property_float_sdna(prop, NULL, "custom_rotation_euler");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "custom_rotation_euler");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape");
|
||||
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, RNA_TRANSLATION_PREC_DEFAULT);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Scale to Bone Length", "Scale the custom object by the bone length");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "custom_tx");
|
||||
RNA_def_property_struct_type(prop, "PoseBone");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
||||
|
@ -1380,12 +1382,12 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
"Bone that defines the display transform of this custom shape");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, NULL, "rna_PoseChannel_custom_shape_transform_set", NULL, NULL);
|
||||
prop, nullptr, "rna_PoseChannel_custom_shape_transform_set", nullptr, nullptr);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
/* bone groups */
|
||||
prop = RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "agrp_index");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "agrp_index");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_int_funcs(prop,
|
||||
|
@ -1401,14 +1403,14 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
|
||||
prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", nullptr, nullptr);
|
||||
RNA_def_property_ui_text(prop, "Bone Group", "Bone group this pose channel belongs to");
|
||||
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
/* transform locks */
|
||||
prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_LOCX);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
|
||||
|
@ -1416,7 +1418,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTX);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
|
||||
|
@ -1426,7 +1428,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
/* XXX this is sub-optimal - it really should be included above, but due to technical reasons
|
||||
* we can't do this! */
|
||||
prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTW);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Lock Rotation (4D Angle)",
|
||||
|
@ -1437,7 +1439,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
|
||||
/* XXX this needs a better name */
|
||||
prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROT4D);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Lock Rotations (4D)",
|
||||
|
@ -1446,7 +1448,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_SCALEX);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
|
||||
RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
|
||||
|
@ -1470,7 +1472,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
"Simulation",
|
||||
"State-full solver running in real-time context and ignoring actions "
|
||||
"and non-IK constraints"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
static const EnumPropertyItem prop_itasc_reiteration_items[] = {
|
||||
{0,
|
||||
|
@ -1489,7 +1491,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
0,
|
||||
"Always",
|
||||
"The solver reiterates (converges) on all frames"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
StructRNA *srna;
|
||||
|
@ -1500,38 +1502,38 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
|
||||
|
||||
prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "precision");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "precision");
|
||||
RNA_def_property_range(prop, 0.0f, 0.1f);
|
||||
RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "numiter");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "numiter");
|
||||
RNA_def_property_range(prop, 0, 1000);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "numstep");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "numstep");
|
||||
RNA_def_property_range(prop, 1.0f, 50.0f);
|
||||
RNA_def_property_ui_text(prop, "Num Steps", "Divide the frame interval into this many steps");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "translate_root_bones", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_TRANSLATE_ROOT_BONES);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ITASC_TRANSLATE_ROOT_BONES);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Translate Roots", "Translate root (i.e. parentless) bones to the armature origin");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
|
||||
RNA_def_property_enum_items(prop, prop_itasc_mode_items);
|
||||
RNA_def_property_ui_text(prop, "Mode", NULL);
|
||||
RNA_def_property_ui_text(prop, "Mode", nullptr);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
|
||||
|
||||
prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
||||
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
|
||||
RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Reiteration",
|
||||
|
@ -1540,7 +1542,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ITASC_AUTO_STEP);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Auto Step",
|
||||
"Automatically determine the optimal number of steps for best "
|
||||
|
@ -1548,21 +1550,21 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "minstep");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "minstep");
|
||||
RNA_def_property_range(prop, 0.0f, 0.1f);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Min Step", "Lower bound for timestep in second in case of automatic substeps");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "maxstep");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "maxstep");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Max Step", "Higher bound for timestep in second in case of automatic substeps");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "feedback");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "feedback");
|
||||
RNA_def_property_range(prop, 0.0f, 100.0f);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
|
@ -1571,20 +1573,20 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, NULL, "maxvel");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "maxvel");
|
||||
RNA_def_property_range(prop, 0.0f, 100.0f);
|
||||
RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in radians/second");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "solver");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "solver");
|
||||
RNA_def_property_enum_items(prop, prop_solver_items);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Solver", "Solving method selection: automatic damping or manual damping");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
|
||||
|
||||
prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "dampmax");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "dampmax");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Damp",
|
||||
|
@ -1593,7 +1595,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
|
|||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
|
||||
|
||||
prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, NULL, "dampeps");
|
||||
RNA_def_property_float_sdna(prop, nullptr, "dampeps");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Epsilon",
|
||||
|
@ -1607,13 +1609,13 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "IKParam", NULL);
|
||||
srna = RNA_def_struct(brna, "IKParam", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bIKParam");
|
||||
RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
|
||||
RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
|
||||
|
||||
prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_enum_items(prop, prop_iksolver_items);
|
||||
RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
|
||||
|
@ -1629,7 +1631,7 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
PropertyRNA *parm;
|
||||
|
||||
RNA_def_property_srna(cprop, "BoneGroups");
|
||||
srna = RNA_def_struct(brna, "BoneGroups", NULL);
|
||||
srna = RNA_def_struct(brna, "BoneGroups", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bPose");
|
||||
RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
|
||||
|
||||
|
@ -1653,12 +1655,12 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
|
||||
prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", nullptr, nullptr);
|
||||
RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
|
||||
|
||||
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "active_group");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "active_group");
|
||||
RNA_def_property_int_funcs(prop,
|
||||
"rna_Pose_active_bone_group_index_get",
|
||||
"rna_Pose_active_bone_group_index_set",
|
||||
|
@ -1673,32 +1675,39 @@ static void rna_def_pose(BlenderRNA *brna)
|
|||
PropertyRNA *prop;
|
||||
|
||||
/* struct definition */
|
||||
srna = RNA_def_struct(brna, "Pose", NULL);
|
||||
srna = RNA_def_struct(brna, "Pose", nullptr);
|
||||
RNA_def_struct_sdna(srna, "bPose");
|
||||
RNA_def_struct_ui_text(
|
||||
srna, "Pose", "A collection of pose channels, including settings for animating bones");
|
||||
|
||||
/* pose channels */
|
||||
prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "chanbase", nullptr);
|
||||
RNA_def_property_struct_type(prop, "PoseBone");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
|
||||
/* can be removed, only for fast lookup */
|
||||
RNA_def_property_collection_funcs(
|
||||
prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
|
||||
RNA_def_property_collection_funcs(prop,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
"rna_PoseBones_lookup_string",
|
||||
nullptr);
|
||||
|
||||
/* bone groups */
|
||||
prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
|
||||
RNA_def_property_collection_sdna(prop, nullptr, "agroups", nullptr);
|
||||
RNA_def_property_struct_type(prop, "BoneGroup");
|
||||
RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
|
||||
rna_def_bone_groups(brna, prop);
|
||||
|
||||
/* ik solvers */
|
||||
prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
|
||||
RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
|
||||
RNA_def_property_enum_funcs(prop, nullptr, "rna_Pose_ik_solver_set", nullptr);
|
||||
RNA_def_property_enum_items(prop, prop_iksolver_items);
|
||||
RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
|
||||
|
@ -1706,7 +1715,7 @@ static void rna_def_pose(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "IKParam");
|
||||
RNA_def_property_pointer_funcs(
|
||||
prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
|
||||
prop, "rna_Pose_ikparam_get", nullptr, "rna_Pose_ikparam_typef", nullptr);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
|
||||
|
||||
|
@ -1714,7 +1723,7 @@ static void rna_def_pose(BlenderRNA *brna)
|
|||
|
||||
/* pose edit options */
|
||||
prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_MIRROR_EDIT);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_MIRROR_EDIT);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
|
||||
RNA_def_struct_path_func(srna, "rna_Pose_path");
|
||||
|
@ -1722,7 +1731,7 @@ static void rna_def_pose(BlenderRNA *brna)
|
|||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_MIRROR_RELATIVE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_MIRROR_RELATIVE);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Relative Mirror",
|
||||
|
@ -1732,7 +1741,7 @@ static void rna_def_pose(BlenderRNA *brna)
|
|||
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
|
||||
|
||||
prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", POSE_AUTO_IK);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_AUTO_IK);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
|
||||
RNA_def_struct_path_func(srna, "rna_Pose_path");
|
||||
|
|
|
@ -664,7 +664,7 @@ static void correctivesmooth_modifier_do(ModifierData *md,
|
|||
me_numVerts = me->totvert;
|
||||
}
|
||||
|
||||
BLI_assert((uint)me_numVerts == verts_num);
|
||||
BLI_assert(uint(me_numVerts) == verts_num);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TIME
|
||||
|
|
|
@ -72,7 +72,9 @@
|
|||
|
||||
struct Vert2GeomData {
|
||||
/* Read-only data */
|
||||
float (*v_cos)[3];
|
||||
const float (*v_cos)[3];
|
||||
|
||||
const int *indices;
|
||||
|
||||
const SpaceTransform *loc2trgt;
|
||||
|
||||
|
@ -106,7 +108,7 @@ static void vert2geom_task_cb_ex(void *__restrict userdata,
|
|||
int i;
|
||||
|
||||
/* Convert the vertex to tree coordinates. */
|
||||
copy_v3_v3(tmp_co, data->v_cos[iter]);
|
||||
copy_v3_v3(tmp_co, data->v_cos[data->indices ? data->indices[iter] : iter]);
|
||||
BLI_space_transform_apply(data->loc2trgt, tmp_co);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(data->dist); i++) {
|
||||
|
@ -145,7 +147,8 @@ static void vert2geom_task_cb_ex(void *__restrict userdata,
|
|||
* Find nearest vertex and/or edge and/or face, for each vertex (adapted from shrinkwrap.c).
|
||||
*/
|
||||
static void get_vert2geom_distance(int verts_num,
|
||||
float (*v_cos)[3],
|
||||
const float (*v_cos)[3],
|
||||
const int *indices,
|
||||
float *dist_v,
|
||||
float *dist_e,
|
||||
float *dist_f,
|
||||
|
@ -185,6 +188,7 @@ static void get_vert2geom_distance(int verts_num,
|
|||
}
|
||||
|
||||
data.v_cos = v_cos;
|
||||
data.indices = indices;
|
||||
data.loc2trgt = loc2trgt;
|
||||
data.treeData[0] = &treeData_v;
|
||||
data.treeData[1] = &treeData_e;
|
||||
|
@ -215,8 +219,12 @@ static void get_vert2geom_distance(int verts_num,
|
|||
* Returns the real distance between a vertex and another reference object.
|
||||
* Note that it works in final world space (i.e. with constraints etc. applied).
|
||||
*/
|
||||
static void get_vert2ob_distance(
|
||||
int verts_num, float (*v_cos)[3], float *dist, Object *ob, Object *obr)
|
||||
static void get_vert2ob_distance(int verts_num,
|
||||
const float (*v_cos)[3],
|
||||
const int *indices,
|
||||
float *dist,
|
||||
Object *ob,
|
||||
Object *obr)
|
||||
{
|
||||
/* Vertex and ref object coordinates. */
|
||||
float v_wco[3];
|
||||
|
@ -224,7 +232,7 @@ static void get_vert2ob_distance(
|
|||
|
||||
while (i-- > 0) {
|
||||
/* Get world-coordinates of the vertex (constraints and anim included). */
|
||||
mul_v3_m4v3(v_wco, ob->object_to_world, v_cos[i]);
|
||||
mul_v3_m4v3(v_wco, ob->object_to_world, v_cos[indices ? indices[i] : i]);
|
||||
/* Return distance between both coordinates. */
|
||||
dist[i] = len_v3v3(v_wco, obr->object_to_world[3]);
|
||||
}
|
||||
|
@ -421,7 +429,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
|
||||
MDeformWeight **dw, **tdw;
|
||||
float(*v_cos)[3] = nullptr; /* The vertices coordinates. */
|
||||
const float(*v_cos)[3] = nullptr; /* The vertices coordinates. */
|
||||
Object *ob = ctx->object;
|
||||
Object *obr = nullptr; /* Our target object. */
|
||||
int defgrp_index;
|
||||
|
@ -516,16 +524,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
MEM_freeN(tidx);
|
||||
|
||||
/* Get our vertex coordinates. */
|
||||
if (index_num != verts_num) {
|
||||
const float(*tv_cos)[3] = BKE_mesh_vert_positions(mesh);
|
||||
v_cos = static_cast<float(*)[3]>(MEM_malloc_arrayN(index_num, sizeof(float[3]), __func__));
|
||||
for (i = 0; i < index_num; i++) {
|
||||
copy_v3_v3(v_cos[i], tv_cos[indices[i]]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
v_cos = BKE_mesh_vert_coords_alloc(mesh, nullptr);
|
||||
}
|
||||
v_cos = BKE_mesh_vert_positions(mesh);
|
||||
|
||||
/* Compute wanted distances. */
|
||||
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
|
||||
|
@ -562,7 +561,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
BLI_SPACE_TRANSFORM_SETUP(&loc2trgt, ob, obr);
|
||||
get_vert2geom_distance(
|
||||
index_num, v_cos, dists_v, dists_e, dists_f, target_mesh, &loc2trgt);
|
||||
index_num, v_cos, indices, dists_v, dists_e, dists_f, target_mesh, &loc2trgt);
|
||||
for (i = 0; i < index_num; i++) {
|
||||
new_w[i] = dists_v ? dists_v[i] : FLT_MAX;
|
||||
if (dists_e) {
|
||||
|
@ -579,11 +578,11 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
}
|
||||
/* Else, fall back to default obj2vert behavior. */
|
||||
else {
|
||||
get_vert2ob_distance(index_num, v_cos, new_w, ob, obr);
|
||||
get_vert2ob_distance(index_num, v_cos, indices, new_w, ob, obr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
get_vert2ob_distance(index_num, v_cos, new_w, ob, obr);
|
||||
get_vert2ob_distance(index_num, v_cos, indices, new_w, ob, obr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,7 +631,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
MEM_freeN(org_w);
|
||||
MEM_freeN(new_w);
|
||||
MEM_freeN(dw);
|
||||
MEM_freeN(v_cos);
|
||||
MEM_SAFE_FREE(indices);
|
||||
|
||||
#ifdef USE_TIMEIT
|
||||
|
|
|
@ -825,36 +825,47 @@ class RenderLayerOperation : public NodeOperation {
|
|||
void execute() override
|
||||
{
|
||||
const int view_layer = bnode().custom1;
|
||||
GPUTexture *pass_texture = context().get_input_texture(view_layer, RE_PASSNAME_COMBINED);
|
||||
GPUTexture *combined_texture = context().get_input_texture(view_layer, RE_PASSNAME_COMBINED);
|
||||
|
||||
execute_image(pass_texture);
|
||||
execute_alpha(pass_texture);
|
||||
execute_pass("Image", combined_texture, "compositor_read_pass_color");
|
||||
execute_pass("Alpha", combined_texture, "compositor_read_pass_alpha");
|
||||
|
||||
/* Other output passes are not supported for now, so allocate them as invalid. */
|
||||
for (const bNodeSocket *output : this->node()->output_sockets()) {
|
||||
if (!STR_ELEM(output->identifier, "Image", "Alpha")) {
|
||||
Result &unsupported_result = get_result(output->identifier);
|
||||
if (unsupported_result.should_compute()) {
|
||||
unsupported_result.allocate_invalid();
|
||||
context().set_info_message("Viewport compositor setup not fully supported");
|
||||
}
|
||||
if (STR_ELEM(output->identifier, "Image", "Alpha")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GPUTexture *pass_texture = context().get_input_texture(view_layer, output->identifier);
|
||||
if (output->type == SOCK_FLOAT) {
|
||||
execute_pass(output->identifier, pass_texture, "compositor_read_pass_float");
|
||||
}
|
||||
else if (output->type == SOCK_VECTOR) {
|
||||
execute_pass(output->identifier, pass_texture, "compositor_read_pass_vector");
|
||||
}
|
||||
else if (output->type == SOCK_RGBA) {
|
||||
execute_pass(output->identifier, pass_texture, "compositor_read_pass_color");
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void execute_image(GPUTexture *pass_texture)
|
||||
void execute_pass(const char *pass_name, GPUTexture *pass_texture, const char *shader_name)
|
||||
{
|
||||
Result &image_result = get_result("Image");
|
||||
Result &image_result = get_result(pass_name);
|
||||
if (!image_result.should_compute()) {
|
||||
return;
|
||||
}
|
||||
if (pass_texture == nullptr) {
|
||||
/* Pass not rendered (yet). */
|
||||
/* Pass not rendered yet, or not supported by viewport. */
|
||||
image_result.allocate_invalid();
|
||||
context().set_info_message("Viewport compositor setup not fully supported");
|
||||
return;
|
||||
}
|
||||
|
||||
GPUShader *shader = shader_manager().get("compositor_read_pass");
|
||||
GPUShader *shader = shader_manager().get(shader_name);
|
||||
GPU_shader_bind(shader);
|
||||
|
||||
/* The compositing space might be limited to a subset of the pass texture, so only read that
|
||||
|
@ -876,41 +887,6 @@ class RenderLayerOperation : public NodeOperation {
|
|||
GPU_texture_unbind(pass_texture);
|
||||
image_result.unbind_as_image();
|
||||
}
|
||||
|
||||
void execute_alpha(GPUTexture *pass_texture)
|
||||
{
|
||||
Result &alpha_result = get_result("Alpha");
|
||||
if (!alpha_result.should_compute()) {
|
||||
return;
|
||||
}
|
||||
if (pass_texture == nullptr) {
|
||||
/* Pass not rendered (yet). */
|
||||
alpha_result.allocate_invalid();
|
||||
return;
|
||||
}
|
||||
|
||||
GPUShader *shader = shader_manager().get("compositor_read_pass_alpha");
|
||||
GPU_shader_bind(shader);
|
||||
|
||||
/* The compositing space might be limited to a subset of the pass texture, so only read that
|
||||
* compositing region into an appropriately sized texture. */
|
||||
const rcti compositing_region = context().get_compositing_region();
|
||||
const int2 lower_bound = int2(compositing_region.xmin, compositing_region.ymin);
|
||||
GPU_shader_uniform_2iv(shader, "compositing_region_lower_bound", lower_bound);
|
||||
|
||||
const int input_unit = GPU_shader_get_sampler_binding(shader, "input_tx");
|
||||
GPU_texture_bind(pass_texture, input_unit);
|
||||
|
||||
const int2 compositing_region_size = context().get_compositing_region_size();
|
||||
alpha_result.allocate_texture(Domain(compositing_region_size));
|
||||
alpha_result.bind_as_image(shader, "output_img");
|
||||
|
||||
compute_dispatch_threads_at_least(shader, compositing_region_size);
|
||||
|
||||
GPU_shader_unbind();
|
||||
GPU_texture_unbind(pass_texture);
|
||||
alpha_result.unbind_as_image();
|
||||
}
|
||||
};
|
||||
|
||||
static NodeOperation *get_compositor_operation(Context &context, DNode node)
|
||||
|
|
|
@ -49,7 +49,7 @@ class TexturePool : public realtime_compositor::TexturePool {
|
|||
return DRW_texture_pool_query_2d(size.x, size.y, format, owner);
|
||||
#else
|
||||
GPUTexture *texture = GPU_texture_create_2d(
|
||||
"compositor_texture_pool", size.x, size.y, 1, format, GPU_TEXTURE_USAGE_GENERAL, NULL);
|
||||
"compositor_texture_pool", size.x, size.y, 1, format, GPU_TEXTURE_USAGE_GENERAL, nullptr);
|
||||
textures_.append(texture);
|
||||
return texture;
|
||||
#endif
|
||||
|
@ -148,7 +148,7 @@ class Context : public realtime_compositor::Context {
|
|||
1,
|
||||
GPU_RGBA16F,
|
||||
GPU_TEXTURE_USAGE_GENERAL,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
|
||||
return output_texture_;
|
||||
|
@ -167,7 +167,7 @@ class Context : public realtime_compositor::Context {
|
|||
1,
|
||||
GPU_RGBA16F,
|
||||
GPU_TEXTURE_USAGE_GENERAL,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
|
||||
return viewer_output_texture_;
|
||||
|
@ -209,7 +209,7 @@ class Context : public realtime_compositor::Context {
|
|||
/* TODO: conversion could be done as part of GPU upload somehow? */
|
||||
const float *rgb_buffer = rpass->buffer.data;
|
||||
Vector<float> rgba_buffer(4 * size.x * size.y);
|
||||
for (size_t i = 0; i < (size_t)size.x * (size_t)size.y; i++) {
|
||||
for (size_t i = 0; i < size_t(size.x) * size_t(size.y); i++) {
|
||||
rgba_buffer[i * 4 + 0] = rgb_buffer[i * 3 + 0];
|
||||
rgba_buffer[i * 4 + 1] = rgb_buffer[i * 3 + 1];
|
||||
rgba_buffer[i * 4 + 2] = rgb_buffer[i * 3 + 2];
|
||||
|
|
|
@ -48,6 +48,10 @@ void SEQ_retiming_offset_handle(const struct Scene *scene,
|
|||
const int offset);
|
||||
float SEQ_retiming_handle_speed_get(const struct Sequence *seq,
|
||||
const struct SeqRetimingHandle *handle);
|
||||
void SEQ_retiming_handle_speed_set(const struct Scene *scene,
|
||||
struct Sequence *seq,
|
||||
struct SeqRetimingHandle *handle,
|
||||
const float speed);
|
||||
int SEQ_retiming_handle_index_get(const struct Sequence *seq,
|
||||
const struct SeqRetimingHandle *handle);
|
||||
void SEQ_retiming_sound_animation_data_set(const struct Scene *scene, const struct Sequence *seq);
|
||||
|
|
|
@ -535,6 +535,29 @@ float SEQ_retiming_handle_speed_get(const Sequence *seq, const SeqRetimingHandle
|
|||
return speed;
|
||||
}
|
||||
|
||||
void SEQ_retiming_handle_speed_set(const Scene *scene,
|
||||
Sequence *seq,
|
||||
SeqRetimingHandle *handle,
|
||||
const float speed)
|
||||
{
|
||||
if (handle->strip_frame_index == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const SeqRetimingHandle *handle_prev = handle - 1;
|
||||
const float speed_fac = 100.0f / speed;
|
||||
|
||||
const int frame_index_max = seq->len;
|
||||
const int frame_retimed_prev = round_fl_to_int(handle_prev->retiming_factor * frame_index_max);
|
||||
const int frame_retimed = round_fl_to_int(handle->retiming_factor * frame_index_max);
|
||||
|
||||
const int segment_duration = frame_retimed - frame_retimed_prev;
|
||||
const int new_duration = segment_duration * speed_fac;
|
||||
|
||||
const int offset = (handle_prev->strip_frame_index + new_duration) - handle->strip_frame_index;
|
||||
SEQ_retiming_offset_handle(scene, seq, handle, offset);
|
||||
}
|
||||
|
||||
enum eRangeType {
|
||||
LINEAR = 0,
|
||||
TRANSITION = 1,
|
||||
|
|
Loading…
Reference in New Issue