WIP: Mesh: Improve and simplify modifier evaluation logic #119968
|
@ -235,8 +235,8 @@ def enum_preview_denoiser(self, context):
|
|||
items = [
|
||||
('AUTO',
|
||||
"Automatic",
|
||||
("Use the fastest available denoiser for viewport rendering "
|
||||
"(OptiX if available, OpenImageDenoise otherwise)"),
|
||||
("Use GPU accelerated denoising if supported, for the best performance. "
|
||||
"Prefer OpenImageDenoise over OptiX"),
|
||||
0)]
|
||||
else:
|
||||
items = [('AUTO', "None", "Blender was compiled without a viewport denoiser", 0)]
|
||||
|
|
|
@ -124,7 +124,8 @@ class DeviceInfo {
|
|||
/* Multiple Devices with the same ID would be very bad. */
|
||||
assert(id != info.id ||
|
||||
(type == info.type && num == info.num && description == info.description));
|
||||
return id == info.id;
|
||||
return id == info.id && use_hardware_raytracing == info.use_hardware_raytracing &&
|
||||
kernel_optimization_level == info.kernel_optimization_level;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -492,13 +492,11 @@ ccl_device_forceinline bool area_light_tree_parameters(const ccl_global KernelLi
|
|||
ccl_private float2 &distance,
|
||||
ccl_private float3 &point_to_centroid)
|
||||
{
|
||||
if (!in_volume_segment) {
|
||||
/* TODO: a cheap substitute for minimal distance between point and primitive. Does it
|
||||
* worth the overhead to compute the accurate minimal distance? */
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = make_float2(min_distance, min_distance);
|
||||
}
|
||||
/* TODO: a cheap substitute for minimal distance between point and primitive. Does it worth the
|
||||
* overhead to compute the accurate minimal distance? */
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = make_float2(min_distance, min_distance);
|
||||
|
||||
cos_theta_u = FLT_MAX;
|
||||
|
||||
|
|
|
@ -196,21 +196,22 @@ ccl_device_forceinline bool point_light_tree_parameters(const ccl_global KernelL
|
|||
ccl_private float2 &distance,
|
||||
ccl_private float3 &point_to_centroid)
|
||||
{
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = min_distance * one_float2();
|
||||
|
||||
if (in_volume_segment) {
|
||||
cos_theta_u = 1.0f; /* Any value in [-1, 1], irrelevant since theta = 0 */
|
||||
return true;
|
||||
}
|
||||
|
||||
float dist_point_to_centroid;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &dist_point_to_centroid);
|
||||
|
||||
const float radius = klight->spot.radius;
|
||||
|
||||
if (klight->spot.is_sphere) {
|
||||
if (dist_point_to_centroid > radius) {
|
||||
if (min_distance > radius) {
|
||||
/* Equivalent to a disk light with the same angular span. */
|
||||
cos_theta_u = cos_from_sin(radius / dist_point_to_centroid);
|
||||
distance = dist_point_to_centroid * make_float2(1.0f / cos_theta_u, 1.0f);
|
||||
cos_theta_u = cos_from_sin(radius / min_distance);
|
||||
distance.x = min_distance / cos_theta_u;
|
||||
}
|
||||
else {
|
||||
/* Similar to background light. */
|
||||
|
@ -220,10 +221,10 @@ ccl_device_forceinline bool point_light_tree_parameters(const ccl_global KernelL
|
|||
}
|
||||
}
|
||||
else {
|
||||
const float hypotenus = sqrtf(sqr(radius) + sqr(dist_point_to_centroid));
|
||||
cos_theta_u = dist_point_to_centroid / hypotenus;
|
||||
const float hypotenus = sqrtf(sqr(radius) + sqr(min_distance));
|
||||
cos_theta_u = min_distance / hypotenus;
|
||||
|
||||
distance = make_float2(hypotenus, dist_point_to_centroid);
|
||||
distance.x = hypotenus;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -291,35 +291,32 @@ ccl_device_forceinline bool spot_light_tree_parameters(const ccl_global KernelLi
|
|||
ccl_private float2 &distance,
|
||||
ccl_private float3 &point_to_centroid)
|
||||
{
|
||||
float dist_point_to_centroid;
|
||||
const float3 point_to_centroid_ = safe_normalize_len(centroid - P, &dist_point_to_centroid);
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = min_distance * one_float2();
|
||||
|
||||
const float radius = klight->spot.radius;
|
||||
|
||||
if (klight->spot.is_sphere) {
|
||||
cos_theta_u = (dist_point_to_centroid > radius) ?
|
||||
cos_from_sin(radius / dist_point_to_centroid) :
|
||||
-1.0f;
|
||||
cos_theta_u = (min_distance > radius) ? cos_from_sin(radius / min_distance) : -1.0f;
|
||||
|
||||
if (in_volume_segment) {
|
||||
return true;
|
||||
}
|
||||
|
||||
distance = (dist_point_to_centroid > radius) ?
|
||||
dist_point_to_centroid * make_float2(1.0f / cos_theta_u, 1.0f) :
|
||||
one_float2() * radius / M_SQRT2_F;
|
||||
distance = (min_distance > radius) ? min_distance * make_float2(1.0f / cos_theta_u, 1.0f) :
|
||||
one_float2() * radius / M_SQRT2_F;
|
||||
}
|
||||
else {
|
||||
const float hypotenus = sqrtf(sqr(radius) + sqr(dist_point_to_centroid));
|
||||
cos_theta_u = dist_point_to_centroid / hypotenus;
|
||||
const float hypotenus = sqrtf(sqr(radius) + sqr(min_distance));
|
||||
cos_theta_u = min_distance / hypotenus;
|
||||
|
||||
if (in_volume_segment) {
|
||||
return true;
|
||||
}
|
||||
|
||||
distance = make_float2(hypotenus, dist_point_to_centroid);
|
||||
distance.x = hypotenus;
|
||||
}
|
||||
point_to_centroid = point_to_centroid_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -333,14 +333,14 @@ ccl_device void light_tree_node_importance(KernelGlobals kg,
|
|||
|
||||
if (in_volume_segment) {
|
||||
const float3 D = N_or_D;
|
||||
const float3 closest_point = P + dot(centroid - P, D) * D;
|
||||
const float closest_t = clamp(dot(centroid - P, D), 0.0f, t);
|
||||
const float3 closest_point = P + D * closest_t;
|
||||
/* Minimal distance of the ray to the cluster. */
|
||||
distance = len(centroid - closest_point);
|
||||
/* Vector that forms a minimal angle with the emitter centroid. */
|
||||
point_to_centroid = -compute_v(centroid, P, D, bcone.axis, t);
|
||||
/* FIXME(weizhen): it is not clear from which point the `cos_theta_u` should be computed in
|
||||
* volume segment. We could use `closest_point` as a conservative measure, but then
|
||||
* `point_to_centroid` should also use `closest_point`. */
|
||||
cos_theta_u = light_tree_cos_bounding_box_angle(bbox, closest_point, point_to_centroid);
|
||||
cos_theta_u = light_tree_cos_bounding_box_angle(
|
||||
bbox, closest_point, normalize(centroid - closest_point));
|
||||
}
|
||||
else {
|
||||
const float3 N = N_or_D;
|
||||
|
@ -405,8 +405,8 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg,
|
|||
bcone.theta_o = kemitter->theta_o;
|
||||
bcone.theta_e = kemitter->theta_e;
|
||||
float cos_theta_u;
|
||||
float2 distance; /* distance.x = max_distance, distance.y = mix_distance */
|
||||
float3 centroid, point_to_centroid, P_c;
|
||||
float2 distance; /* distance.x = max_distance, distance.y = min_distance */
|
||||
float3 centroid, point_to_centroid, P_c = P;
|
||||
|
||||
if (!compute_emitter_centroid_and_dir<in_volume_segment>(kg, kemitter, P, centroid, bcone.axis))
|
||||
{
|
||||
|
@ -415,15 +415,9 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg,
|
|||
|
||||
if (in_volume_segment) {
|
||||
const float3 D = N_or_D;
|
||||
/* Closest point. */
|
||||
P_c = P + dot(centroid - P, D) * D;
|
||||
/* Minimal distance of the ray to the cluster. */
|
||||
distance.x = len(centroid - P_c);
|
||||
distance.y = distance.x;
|
||||
point_to_centroid = -compute_v(centroid, P, D, bcone.axis, t);
|
||||
}
|
||||
else {
|
||||
P_c = P;
|
||||
/* Closest point from ray to the emitter centroid. */
|
||||
const float closest_t = clamp(dot(centroid - P, D), 0.0f, t);
|
||||
P_c += D * closest_t;
|
||||
}
|
||||
|
||||
/* Early out if the emitter is guaranteed to be invisible. */
|
||||
|
@ -457,6 +451,9 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg,
|
|||
case LIGHT_DISTANT:
|
||||
is_visible = distant_light_tree_parameters(
|
||||
centroid, bcone.theta_e, cos_theta_u, distance, point_to_centroid);
|
||||
if (in_volume_segment) {
|
||||
centroid = P - bcone.axis;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -468,6 +465,11 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
if (in_volume_segment) {
|
||||
/* Vector that forms a minimal angle with the emitter centroid. */
|
||||
point_to_centroid = -compute_v(centroid, P, N_or_D, bcone.axis, t);
|
||||
}
|
||||
|
||||
light_tree_importance<in_volume_segment>(N_or_D,
|
||||
has_transmission,
|
||||
point_to_centroid,
|
||||
|
|
|
@ -301,13 +301,11 @@ ccl_device_forceinline bool triangle_light_tree_parameters(
|
|||
ccl_private float2 &distance,
|
||||
ccl_private float3 &point_to_centroid)
|
||||
{
|
||||
if (!in_volume_segment) {
|
||||
/* TODO: a cheap substitute for minimal distance between point and primitive. Does it
|
||||
* worth the overhead to compute the accurate minimal distance? */
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = make_float2(min_distance, min_distance);
|
||||
}
|
||||
/* TODO: a cheap substitute for minimal distance between point and primitive. Does it worth the
|
||||
* overhead to compute the accurate minimal distance? */
|
||||
float min_distance;
|
||||
point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
|
||||
distance = make_float2(min_distance, min_distance);
|
||||
|
||||
cos_theta_u = FLT_MAX;
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ bool AssetCatalogDefinitionFile::write_to_disk_unsafe(const CatalogFilePath &des
|
|||
}
|
||||
|
||||
bool AssetCatalogDefinitionFile::ensure_directory_exists(
|
||||
const CatalogFilePath directory_path) const
|
||||
const CatalogFilePath &directory_path) const
|
||||
{
|
||||
/* TODO(@sybren): design a way to get such errors presented to users (or ensure that they never
|
||||
* occur). */
|
||||
|
|
|
@ -81,7 +81,7 @@ class AssetCatalogDefinitionFile {
|
|||
* Return true when the file was written correctly, false when there was a problem.
|
||||
*/
|
||||
bool write_to_disk_unsafe(const CatalogFilePath &dest_file_path) const;
|
||||
bool ensure_directory_exists(const CatalogFilePath directory_path) const;
|
||||
bool ensure_directory_exists(const CatalogFilePath &directory_path) const;
|
||||
};
|
||||
|
||||
} // namespace blender::asset_system
|
||||
|
|
|
@ -20,7 +20,8 @@ namespace blender::asset_system {
|
|||
|
||||
AssetIdentifier::AssetIdentifier(std::shared_ptr<std::string> library_root_path,
|
||||
std::string relative_asset_path)
|
||||
: library_root_path_(library_root_path), relative_asset_path_(relative_asset_path)
|
||||
: library_root_path_(std::move(library_root_path)),
|
||||
relative_asset_path_(std::move(relative_asset_path))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ AssetRepresentation::AssetRepresentation(AssetIdentifier &&identifier,
|
|||
const int id_type,
|
||||
std::unique_ptr<AssetMetaData> metadata,
|
||||
const AssetLibrary &owner_asset_library)
|
||||
: identifier_(identifier),
|
||||
: identifier_(std::move(identifier)),
|
||||
is_local_id_(false),
|
||||
owner_asset_library_(owner_asset_library),
|
||||
external_asset_()
|
||||
|
@ -35,7 +35,7 @@ AssetRepresentation::AssetRepresentation(AssetIdentifier &&identifier,
|
|||
AssetRepresentation::AssetRepresentation(AssetIdentifier &&identifier,
|
||||
ID &id,
|
||||
const AssetLibrary &owner_asset_library)
|
||||
: identifier_(identifier),
|
||||
: identifier_(std::move(identifier)),
|
||||
is_local_id_(true),
|
||||
owner_asset_library_(owner_asset_library),
|
||||
local_asset_id_(&id)
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
#include "BLI_bounds_types.hh"
|
||||
#include "BLI_generic_virtual_array.hh"
|
||||
#include "BLI_implicit_sharing.hh"
|
||||
#include "BLI_index_mask.hh"
|
||||
#include "BLI_index_mask_fwd.hh"
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
#include "BLI_shared_cache.hh"
|
||||
#include "BLI_span.hh"
|
||||
#include "BLI_vector.hh"
|
||||
#include "BLI_virtual_array.hh"
|
||||
#include "BLI_virtual_array_fwd.hh"
|
||||
|
||||
#include "BKE_attribute_math.hh"
|
||||
#include "BKE_curves.h"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
#include "BLI_virtual_array.hh"
|
||||
#include "BLI_virtual_array_fwd.hh"
|
||||
|
||||
/** \file
|
||||
* \ingroup bke
|
||||
|
|
|
@ -16,6 +16,7 @@ extern "C" {
|
|||
struct Collection;
|
||||
struct Depsgraph;
|
||||
struct ListBase;
|
||||
struct RNG;
|
||||
struct Object;
|
||||
struct ParticleData;
|
||||
struct ParticleKey;
|
||||
|
@ -78,6 +79,9 @@ typedef struct EffectorCache {
|
|||
|
||||
struct PartDeflect *pd;
|
||||
|
||||
/** Random noise generator for e.g. wind. */
|
||||
struct RNG *rng;
|
||||
|
||||
/* precalculated for guides */
|
||||
struct GuideEffectorData *guide_data;
|
||||
float guide_loc[4], guide_dir[3], guide_radius;
|
||||
|
|
|
@ -140,7 +140,7 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase *
|
|||
|
||||
bool BKE_mesh_attribute_required(const char *name);
|
||||
|
||||
float (*BKE_mesh_orco_verts_get(Object *ob))[3];
|
||||
float (*BKE_mesh_orco_verts_get(const Object *ob))[3];
|
||||
void BKE_mesh_orco_verts_transform(Mesh *mesh, float (*orco)[3], int totvert, bool invert);
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,9 +140,6 @@ struct MeshRuntime {
|
|||
/** Cache for BVH trees generated for the mesh. Defined in 'BKE_bvhutil.c' */
|
||||
BVHCache *bvh_cache = nullptr;
|
||||
|
||||
/** Cache of non-manifold boundary data for Shrink-wrap Target Project. */
|
||||
std::unique_ptr<ShrinkwrapBoundaryData> shrinkwrap_data;
|
||||
|
||||
/** Needed in case we need to lazily initialize the mesh. */
|
||||
CustomData_MeshMasks cd_mask_extra = {};
|
||||
|
||||
|
@ -204,6 +201,9 @@ struct MeshRuntime {
|
|||
/** Cache of data about vertices not used by faces. See #Mesh::verts_no_face(). */
|
||||
SharedCache<LooseVertCache> verts_no_face_cache;
|
||||
|
||||
/** Cache of non-manifold boundary data for shrinkwrap target Project. */
|
||||
SharedCache<ShrinkwrapBoundaryData> shrinkwrap_boundary_cache;
|
||||
|
||||
/**
|
||||
* A bit vector the size of the number of vertices, set to true for the center vertices of
|
||||
* subdivided faces. The values are set by the subdivision surface modifier and used by
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "BLI_bounds_types.hh"
|
||||
#include "BLI_compiler_compat.h"
|
||||
#include "BLI_function_ref.hh"
|
||||
#include "BLI_index_mask.hh"
|
||||
#include "BLI_index_mask_fwd.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_offset_indices.hh"
|
||||
#include "BLI_span.hh"
|
||||
|
|
|
@ -60,10 +60,11 @@ struct ShrinkwrapBoundaryData {
|
|||
blender::Array<ShrinkwrapBoundaryVertData> boundary_verts;
|
||||
};
|
||||
|
||||
/**
|
||||
* Free boundary data for target project.
|
||||
*/
|
||||
void BKE_shrinkwrap_compute_boundary_data(Mesh *mesh);
|
||||
namespace blender::bke::shrinkwrap {
|
||||
|
||||
const ShrinkwrapBoundaryData &boundary_cache_ensure(const Mesh &mesh);
|
||||
|
||||
} // namespace blender::bke::shrinkwrap
|
||||
|
||||
/* Information about a mesh and BVH tree. */
|
||||
struct ShrinkwrapTreeData {
|
||||
|
@ -79,7 +80,7 @@ struct ShrinkwrapTreeData {
|
|||
blender::Span<blender::float3> vert_normals;
|
||||
blender::Span<blender::float3> corner_normals;
|
||||
const bool *sharp_faces;
|
||||
ShrinkwrapBoundaryData *boundary;
|
||||
const ShrinkwrapBoundaryData *boundary;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -338,7 +338,7 @@ static float (*get_editbmesh_orco_verts(const BMEditMesh *em))[3]
|
|||
}
|
||||
|
||||
/* orco custom data layer */
|
||||
static float (*get_orco_coords(Object *ob, const BMEditMesh *em, int layer, int *free))[3]
|
||||
static float (*get_orco_coords(const Object *ob, const BMEditMesh *em, int layer, int *free))[3]
|
||||
{
|
||||
*free = 0;
|
||||
|
||||
|
@ -355,11 +355,11 @@ static float (*get_orco_coords(Object *ob, const BMEditMesh *em, int layer, int
|
|||
/* apply shape key for cloth, this should really be solved
|
||||
* by a more flexible customdata system, but not simple */
|
||||
if (!em) {
|
||||
ClothModifierData *clmd = (ClothModifierData *)BKE_modifiers_findby_type(
|
||||
const ClothModifierData *clmd = (const ClothModifierData *)BKE_modifiers_findby_type(
|
||||
ob, eModifierType_Cloth);
|
||||
if (clmd && clmd->sim_parms->shapekey_rest) {
|
||||
KeyBlock *kb = BKE_keyblock_find_by_index(BKE_key_from_object(ob),
|
||||
clmd->sim_parms->shapekey_rest);
|
||||
const KeyBlock *kb = BKE_keyblock_find_by_index(
|
||||
BKE_key_from_object(const_cast<Object *>(ob)), clmd->sim_parms->shapekey_rest);
|
||||
|
||||
if (kb && kb->data) {
|
||||
return (float(*)[3])kb->data;
|
||||
|
@ -373,7 +373,7 @@ static float (*get_orco_coords(Object *ob, const BMEditMesh *em, int layer, int
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static Mesh *create_orco_mesh(Object *ob, const Mesh *mesh, BMEditMesh *em, int layer)
|
||||
static Mesh *create_orco_mesh(const Object *ob, const Mesh *mesh, const BMEditMesh *em, int layer)
|
||||
{
|
||||
Mesh *orco_mesh;
|
||||
float(*orco)[3];
|
||||
|
@ -410,8 +410,11 @@ static MutableSpan<float3> orco_coord_layer_ensure(Mesh *mesh, const eCustomData
|
|||
return MutableSpan(reinterpret_cast<float3 *>(data), mesh->verts_num);
|
||||
}
|
||||
|
||||
static void add_orco_mesh(
|
||||
Object *ob, const BMEditMesh *em, Mesh *mesh, Mesh *mesh_orco, const eCustomDataType layer)
|
||||
static void add_orco_mesh(Object *ob,
|
||||
const BMEditMesh *em,
|
||||
Mesh *mesh,
|
||||
const Mesh *mesh_orco,
|
||||
const eCustomDataType layer)
|
||||
{
|
||||
const int totvert = mesh->verts_num;
|
||||
|
||||
|
@ -1132,12 +1135,14 @@ static GeometrySet editbmesh_calc_modifiers(Depsgraph *depsgraph,
|
|||
return geometry_set;
|
||||
}
|
||||
|
||||
static void mesh_build_extra_data(Depsgraph *depsgraph, Object *ob, Mesh *mesh_eval)
|
||||
static void mesh_build_extra_data(const Depsgraph *depsgraph,
|
||||
const Object *ob,
|
||||
const Mesh *mesh_eval)
|
||||
{
|
||||
uint32_t eval_flags = DEG_get_eval_flags_for_id(depsgraph, &ob->id);
|
||||
|
||||
if (eval_flags & DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY) {
|
||||
BKE_shrinkwrap_compute_boundary_data(mesh_eval);
|
||||
blender::bke::shrinkwrap::boundary_cache_ensure(*mesh_eval);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,9 +113,6 @@ PartDeflect *BKE_partdeflect_copy(const PartDeflect *pd_src)
|
|||
return nullptr;
|
||||
}
|
||||
PartDeflect *pd_dst = static_cast<PartDeflect *>(MEM_dupallocN(pd_src));
|
||||
if (pd_dst->rng != nullptr) {
|
||||
pd_dst->rng = BLI_rng_copy(pd_dst->rng);
|
||||
}
|
||||
return pd_dst;
|
||||
}
|
||||
|
||||
|
@ -124,9 +121,6 @@ void BKE_partdeflect_free(PartDeflect *pd)
|
|||
if (!pd) {
|
||||
return;
|
||||
}
|
||||
if (pd->rng) {
|
||||
BLI_rng_free(pd->rng);
|
||||
}
|
||||
MEM_freeN(pd);
|
||||
}
|
||||
|
||||
|
@ -136,12 +130,8 @@ static void precalculate_effector(Depsgraph *depsgraph, EffectorCache *eff)
|
|||
{
|
||||
float ctime = DEG_get_ctime(depsgraph);
|
||||
uint cfra = uint(ctime >= 0 ? ctime : -ctime);
|
||||
if (!eff->pd->rng) {
|
||||
eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra);
|
||||
}
|
||||
else {
|
||||
BLI_rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
|
||||
}
|
||||
|
||||
eff->rng = BLI_rng_new(eff->pd->seed + cfra);
|
||||
|
||||
if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type == OB_CURVES_LEGACY) {
|
||||
Curve *cu = static_cast<Curve *>(eff->ob->data);
|
||||
|
@ -375,6 +365,9 @@ void BKE_effectors_free(ListBase *lb)
|
|||
{
|
||||
if (lb) {
|
||||
LISTBASE_FOREACH (EffectorCache *, eff, lb) {
|
||||
if (eff->rng) {
|
||||
BLI_rng_free(eff->rng);
|
||||
}
|
||||
if (eff->guide_data) {
|
||||
MEM_freeN(eff->guide_data);
|
||||
}
|
||||
|
@ -960,7 +953,7 @@ static void do_physical_effector(EffectorCache *eff,
|
|||
float *total_force)
|
||||
{
|
||||
PartDeflect *pd = eff->pd;
|
||||
RNG *rng = pd->rng;
|
||||
RNG *rng = eff->rng;
|
||||
float force[3] = {0, 0, 0};
|
||||
float temp[3];
|
||||
float fac;
|
||||
|
|
|
@ -805,7 +805,7 @@ static ModifierData &legacy_object_modifier_common(Object &object,
|
|||
const ModifierType type,
|
||||
GpencilModifierData &legacy_md)
|
||||
{
|
||||
/* TODO: Copy of most of #ED_object_modifier_add, this should be a BKE_modifiers function
|
||||
/* TODO: Copy of most of #ed::object::modifier_add, this should be a BKE_modifiers function
|
||||
* actually. */
|
||||
const ModifierTypeInfo *mti = BKE_modifier_get_info(type);
|
||||
|
||||
|
|
|
@ -1005,10 +1005,10 @@ void BKE_mesh_texspace_get_reference(Mesh *mesh,
|
|||
}
|
||||
}
|
||||
|
||||
float (*BKE_mesh_orco_verts_get(Object *ob))[3]
|
||||
float (*BKE_mesh_orco_verts_get(const Object *ob))[3]
|
||||
{
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
Mesh *tme = mesh->texcomesh ? mesh->texcomesh : mesh;
|
||||
const Mesh *mesh = static_cast<const Mesh *>(ob->data);
|
||||
const Mesh *tme = mesh->texcomesh ? mesh->texcomesh : mesh;
|
||||
|
||||
/* Get appropriate vertex coordinates */
|
||||
float(*vcos)[3] = (float(*)[3])MEM_calloc_arrayN(mesh->verts_num, sizeof(*vcos), "orco mesh");
|
||||
|
|
|
@ -299,9 +299,9 @@ void BKE_mesh_runtime_clear_geometry(Mesh *mesh)
|
|||
mesh->runtime->verts_no_face_cache.tag_dirty();
|
||||
mesh->runtime->corner_tris_cache.tag_dirty();
|
||||
mesh->runtime->corner_tri_faces_cache.tag_dirty();
|
||||
mesh->runtime->shrinkwrap_boundary_cache.tag_dirty();
|
||||
mesh->runtime->subsurf_face_dot_tags.clear_and_shrink();
|
||||
mesh->runtime->subsurf_optimal_display_edges.clear_and_shrink();
|
||||
mesh->runtime->shrinkwrap_data.reset();
|
||||
mesh->flag &= ~ME_NO_OVERLAPPING_TOPOLOGY;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ void Mesh::tag_edges_split()
|
|||
}
|
||||
this->runtime->subsurf_face_dot_tags.clear_and_shrink();
|
||||
this->runtime->subsurf_optimal_display_edges.clear_and_shrink();
|
||||
this->runtime->shrinkwrap_data.reset();
|
||||
this->runtime->shrinkwrap_boundary_cache.tag_dirty();
|
||||
}
|
||||
|
||||
void Mesh::tag_sharpness_changed()
|
||||
|
@ -350,6 +350,7 @@ void Mesh::tag_face_winding_changed()
|
|||
this->runtime->face_normals_cache.tag_dirty();
|
||||
this->runtime->corner_normals_cache.tag_dirty();
|
||||
this->runtime->vert_to_corner_map_cache.tag_dirty();
|
||||
this->runtime->shrinkwrap_boundary_cache.tag_dirty();
|
||||
}
|
||||
|
||||
void Mesh::tag_positions_changed()
|
||||
|
@ -357,6 +358,7 @@ void Mesh::tag_positions_changed()
|
|||
this->runtime->vert_normals_cache.tag_dirty();
|
||||
this->runtime->face_normals_cache.tag_dirty();
|
||||
this->runtime->corner_normals_cache.tag_dirty();
|
||||
this->runtime->shrinkwrap_boundary_cache.tag_dirty();
|
||||
this->tag_positions_changed_no_normals();
|
||||
}
|
||||
|
||||
|
@ -365,6 +367,7 @@ void Mesh::tag_positions_changed_no_normals()
|
|||
free_bvh_cache(*this->runtime);
|
||||
this->runtime->corner_tris_cache.tag_dirty();
|
||||
this->runtime->bounds_cache.tag_dirty();
|
||||
this->runtime->shrinkwrap_boundary_cache.tag_dirty();
|
||||
}
|
||||
|
||||
void Mesh::tag_positions_changed_uniformly()
|
||||
|
|
|
@ -245,9 +245,6 @@ static void object_copy_data(Main *bmain,
|
|||
|
||||
if (ob_src->pd) {
|
||||
ob_dst->pd = (PartDeflect *)MEM_dupallocN(ob_src->pd);
|
||||
if (ob_dst->pd->rng) {
|
||||
ob_dst->pd->rng = (RNG *)MEM_dupallocN(ob_src->pd->rng);
|
||||
}
|
||||
}
|
||||
BKE_rigidbody_object_copy(bmain, ob_dst, ob_src, flag_subdata);
|
||||
|
||||
|
|
|
@ -313,11 +313,8 @@ static void particle_settings_blend_write(BlendWriter *writer, ID *id, const voi
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_particle_partdeflect_blend_read_data(BlendDataReader * /*reader*/, PartDeflect *pd)
|
||||
void BKE_particle_partdeflect_blend_read_data(BlendDataReader * /*reader*/, PartDeflect * /*pd*/)
|
||||
{
|
||||
if (pd) {
|
||||
pd->rng = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
|
|
|
@ -142,7 +142,7 @@ bool BKE_shrinkwrap_init_tree(
|
|||
}
|
||||
|
||||
if (shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
|
||||
data->boundary = mesh->runtime->shrinkwrap_data.get();
|
||||
data->boundary = &blender::bke::shrinkwrap::boundary_cache_ensure(*mesh);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -153,9 +153,11 @@ void BKE_shrinkwrap_free_tree(ShrinkwrapTreeData *data)
|
|||
free_bvhtree_from_mesh(&data->treeData);
|
||||
}
|
||||
|
||||
namespace blender::bke::shrinkwrap {
|
||||
|
||||
/* Accumulate edge for average boundary edge direction. */
|
||||
static void merge_vert_dir(ShrinkwrapBoundaryVertData *vdata,
|
||||
signed char *status,
|
||||
MutableSpan<int8_t> status,
|
||||
int index,
|
||||
const float edge_dir[3],
|
||||
signed char side)
|
||||
|
@ -177,34 +179,28 @@ static void merge_vert_dir(ShrinkwrapBoundaryVertData *vdata,
|
|||
status[index] = (status[index] == 0) ? side : -1;
|
||||
}
|
||||
|
||||
static std::unique_ptr<ShrinkwrapBoundaryData> shrinkwrap_build_boundary_data(Mesh *mesh)
|
||||
static ShrinkwrapBoundaryData shrinkwrap_build_boundary_data(const Mesh &mesh)
|
||||
{
|
||||
using namespace blender;
|
||||
const blender::Span<float3> positions = mesh->vert_positions();
|
||||
const blender::Span<int2> edges = mesh->edges();
|
||||
const Span<int> corner_verts = mesh->corner_verts();
|
||||
const Span<int> corner_edges = mesh->corner_edges();
|
||||
const Span<float3> positions = mesh.vert_positions();
|
||||
const Span<int2> edges = mesh.edges();
|
||||
const Span<int> corner_verts = mesh.corner_verts();
|
||||
const Span<int> corner_edges = mesh.corner_edges();
|
||||
|
||||
/* Count faces per edge (up to 2). */
|
||||
char *edge_mode = static_cast<char *>(
|
||||
MEM_calloc_arrayN(size_t(mesh->edges_num), sizeof(char), __func__));
|
||||
Array<int8_t> edge_mode(edges.size(), 0);
|
||||
|
||||
for (int i = 0; i < mesh->corners_num; i++) {
|
||||
const int eidx = corner_edges[i];
|
||||
|
||||
if (edge_mode[eidx] < 2) {
|
||||
edge_mode[eidx]++;
|
||||
for (const int edge : corner_edges) {
|
||||
if (edge_mode[edge] < 2) {
|
||||
edge_mode[edge]++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build the boundary edge bitmask. */
|
||||
blender::BitVector<> edge_is_boundary(mesh->edges_num, false);
|
||||
uint num_boundary_edges = 0;
|
||||
BitVector<> edge_is_boundary(mesh.edges_num, false);
|
||||
|
||||
for (int i = 0; i < mesh->edges_num; i++) {
|
||||
edge_mode[i] = (edge_mode[i] == 1);
|
||||
|
||||
if (edge_mode[i]) {
|
||||
int num_boundary_edges = 0;
|
||||
for (const int64_t i : edges.index_range()) {
|
||||
if (edge_mode[i] == 1) {
|
||||
edge_is_boundary[i].set();
|
||||
num_boundary_edges++;
|
||||
}
|
||||
|
@ -212,63 +208,52 @@ static std::unique_ptr<ShrinkwrapBoundaryData> shrinkwrap_build_boundary_data(Me
|
|||
|
||||
/* If no boundary, return nullptr. */
|
||||
if (num_boundary_edges == 0) {
|
||||
MEM_freeN(edge_mode);
|
||||
return {};
|
||||
}
|
||||
|
||||
/* Allocate the data object. */
|
||||
std::unique_ptr<ShrinkwrapBoundaryData> data = std::make_unique<ShrinkwrapBoundaryData>();
|
||||
|
||||
data->edge_is_boundary = std::move(edge_is_boundary);
|
||||
ShrinkwrapBoundaryData data;
|
||||
|
||||
/* Build the boundary corner_tris bit-mask. */
|
||||
const blender::Span<int3> corner_tris = mesh->corner_tris();
|
||||
const Span<int3> corner_tris = mesh.corner_tris();
|
||||
|
||||
blender::BitVector<> tri_has_boundary(corner_tris.size(), false);
|
||||
BitVector<> tri_has_boundary(corner_tris.size(), false);
|
||||
|
||||
for (const int64_t i : corner_tris.index_range()) {
|
||||
const int3 real_edges = bke::mesh::corner_tri_get_real_edges(
|
||||
edges, corner_verts, corner_edges, corner_tris[i]);
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (real_edges[j] >= 0 && edge_mode[real_edges[j]]) {
|
||||
if (real_edges[j] >= 0 && edge_is_boundary[real_edges[j]]) {
|
||||
tri_has_boundary[i].set();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data->tri_has_boundary = std::move(tri_has_boundary);
|
||||
|
||||
/* Find boundary vertices and build a mapping table for compact storage of data. */
|
||||
Array<int> vert_boundary_id(mesh->verts_num, 0);
|
||||
|
||||
for (int i = 0; i < mesh->edges_num; i++) {
|
||||
if (edge_mode[i]) {
|
||||
const blender::int2 &edge = edges[i];
|
||||
Array<int> vert_boundary_id(mesh.verts_num, 0);
|
||||
|
||||
for (const int64_t i : edges.index_range()) {
|
||||
if (edge_is_boundary[i]) {
|
||||
const int2 &edge = edges[i];
|
||||
vert_boundary_id[edge[0]] = 1;
|
||||
vert_boundary_id[edge[1]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
uint num_boundary_verts = 0;
|
||||
|
||||
for (int i = 0; i < mesh->verts_num; i++) {
|
||||
vert_boundary_id[i] = (vert_boundary_id[i] != 0) ? int(num_boundary_verts++) : -1;
|
||||
int boundary_verts_num = 0;
|
||||
for (const int64_t i : positions.index_range()) {
|
||||
vert_boundary_id[i] = (vert_boundary_id[i] != 0) ? boundary_verts_num++ : -1;
|
||||
}
|
||||
|
||||
data->vert_boundary_id = vert_boundary_id;
|
||||
|
||||
/* Compute average directions. */
|
||||
Array<ShrinkwrapBoundaryVertData> boundary_verts(num_boundary_verts);
|
||||
Array<ShrinkwrapBoundaryVertData> boundary_verts(boundary_verts_num);
|
||||
|
||||
signed char *vert_status = static_cast<signed char *>(
|
||||
MEM_calloc_arrayN(num_boundary_verts, sizeof(char), __func__));
|
||||
|
||||
for (int i = 0; i < mesh->edges_num; i++) {
|
||||
if (edge_mode[i]) {
|
||||
const blender::int2 &edge = edges[i];
|
||||
Array<int8_t> vert_status(boundary_verts_num);
|
||||
for (const int64_t i : edges.index_range()) {
|
||||
if (edge_is_boundary[i]) {
|
||||
const int2 &edge = edges[i];
|
||||
|
||||
float dir[3];
|
||||
sub_v3_v3v3(dir, positions[edge[1]], positions[edge[0]]);
|
||||
|
@ -279,11 +264,9 @@ static std::unique_ptr<ShrinkwrapBoundaryData> shrinkwrap_build_boundary_data(Me
|
|||
}
|
||||
}
|
||||
|
||||
MEM_freeN(vert_status);
|
||||
|
||||
/* Finalize average direction and compute normal. */
|
||||
const blender::Span<blender::float3> vert_normals = mesh->vert_normals();
|
||||
for (int i = 0; i < mesh->verts_num; i++) {
|
||||
const Span<float3> vert_normals = mesh.vert_normals();
|
||||
for (const int64_t i : positions.index_range()) {
|
||||
int bidx = vert_boundary_id[i];
|
||||
|
||||
if (bidx >= 0) {
|
||||
|
@ -298,17 +281,23 @@ static std::unique_ptr<ShrinkwrapBoundaryData> shrinkwrap_build_boundary_data(Me
|
|||
}
|
||||
}
|
||||
|
||||
data->boundary_verts = std::move(boundary_verts);
|
||||
data.edge_is_boundary = std::move(edge_is_boundary);
|
||||
data.tri_has_boundary = std::move(tri_has_boundary);
|
||||
data.vert_boundary_id = std::move(vert_boundary_id);
|
||||
data.boundary_verts = std::move(boundary_verts);
|
||||
|
||||
MEM_freeN(edge_mode);
|
||||
return data;
|
||||
}
|
||||
|
||||
void BKE_shrinkwrap_compute_boundary_data(Mesh *mesh)
|
||||
const ShrinkwrapBoundaryData &boundary_cache_ensure(const Mesh &mesh)
|
||||
{
|
||||
mesh->runtime->shrinkwrap_data = shrinkwrap_build_boundary_data(mesh);
|
||||
mesh.runtime->shrinkwrap_boundary_cache.ensure(
|
||||
[&](ShrinkwrapBoundaryData &r_data) { r_data = shrinkwrap_build_boundary_data(mesh); });
|
||||
return mesh.runtime->shrinkwrap_boundary_cache.data();
|
||||
}
|
||||
|
||||
} // namespace blender::bke::shrinkwrap
|
||||
|
||||
/**
|
||||
* Shrink-wrap to the nearest vertex
|
||||
*
|
||||
|
|
|
@ -383,8 +383,8 @@ VolumeGridType get_type(const VolumeGridData &volume_grid)
|
|||
return volume_grid.grid_type();
|
||||
#else
|
||||
UNUSED_VARS(volume_grid);
|
||||
#endif
|
||||
return VOLUME_GRID_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
|
||||
int get_channels_num(const VolumeGridType type)
|
||||
|
|
|
@ -191,8 +191,7 @@ void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src)
|
|||
/* Loop over `ma_src` instead of `ma_dst` since it's likely the destination is larger
|
||||
* when used for accumulating from multiple sources. */
|
||||
struct MemBuf *mb_src = ma_src->bufs;
|
||||
mb_src = ma_src->bufs;
|
||||
while (mb_src && mb_src->next) {
|
||||
while (mb_src->next) {
|
||||
mb_src = mb_src->next;
|
||||
}
|
||||
mb_src->next = ma_dst->bufs->next;
|
||||
|
|
|
@ -580,10 +580,6 @@ if(WITH_COMPOSITOR_CPU)
|
|||
PRIVATE bf::intern::atomic
|
||||
)
|
||||
|
||||
list(APPEND INC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/operations
|
||||
)
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
||||
add_definitions(-DOIDN_STATIC_LIB)
|
||||
|
|
|
@ -28,6 +28,10 @@ void Sampling::init(const Scene *scene)
|
|||
{
|
||||
sample_count_ = inst_.is_viewport() ? scene->eevee.taa_samples : scene->eevee.taa_render_samples;
|
||||
|
||||
if (inst_.is_image_render()) {
|
||||
sample_count_ = math::max(uint64_t(1), sample_count_);
|
||||
}
|
||||
|
||||
if (sample_count_ == 0) {
|
||||
BLI_assert(inst_.is_viewport());
|
||||
sample_count_ = infinite_sample_count_;
|
||||
|
|
|
@ -3365,6 +3365,7 @@ static int click_select_channel_object(bContext *C,
|
|||
bAnimListElem *ale,
|
||||
const short /* eEditKeyframes_Select or -1 */ selectmode)
|
||||
{
|
||||
using namespace blender::ed;
|
||||
Scene *scene = ac->scene;
|
||||
ViewLayer *view_layer = ac->view_layer;
|
||||
Base *base = (Base *)ale->data;
|
||||
|
@ -3377,7 +3378,7 @@ static int click_select_channel_object(bContext *C,
|
|||
|
||||
if (selectmode == SELECT_INVERT) {
|
||||
/* swap select */
|
||||
ED_object_base_select(base, BA_INVERT);
|
||||
object::base_select(base, object::BA_INVERT);
|
||||
|
||||
if (adt) {
|
||||
adt->flag ^= ADT_UI_SELECTED;
|
||||
|
@ -3393,14 +3394,14 @@ static int click_select_channel_object(bContext *C,
|
|||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
/* TODO: should this deselect all other types of channels too? */
|
||||
LISTBASE_FOREACH (Base *, b, BKE_view_layer_object_bases_get(view_layer)) {
|
||||
ED_object_base_select(b, BA_DESELECT);
|
||||
object::base_select(b, object::BA_DESELECT);
|
||||
if (b->object->adt) {
|
||||
b->object->adt->flag &= ~(ADT_UI_SELECTED | ADT_UI_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
/* select object now */
|
||||
ED_object_base_select(base, BA_SELECT);
|
||||
object::base_select(base, object::BA_SELECT);
|
||||
if (adt) {
|
||||
adt->flag |= ADT_UI_SELECTED;
|
||||
}
|
||||
|
@ -3410,7 +3411,7 @@ static int click_select_channel_object(bContext *C,
|
|||
*
|
||||
* Ensure we exit edit-mode on whatever object was active before
|
||||
* to avoid getting stuck there, see: #48747. */
|
||||
ED_object_base_activate_with_mode_exit_if_needed(C, base); /* adds notifier */
|
||||
object::base_activate_with_mode_exit_if_needed(C, base); /* adds notifier */
|
||||
|
||||
/* Similar to outliner, do not change active element when selecting elements in range. */
|
||||
if ((adt) && (adt->flag & ADT_UI_SELECTED) && (selectmode != SELECT_EXTEND_RANGE)) {
|
||||
|
|
|
@ -1304,6 +1304,7 @@ static int select_timeline_marker_frame(ListBase *markers,
|
|||
static void select_marker_camera_switch(
|
||||
bContext *C, bool camera, bool extend, ListBase *markers, int cfra)
|
||||
{
|
||||
using namespace blender::ed;
|
||||
#ifdef DURIAN_CAMERA_SWITCH
|
||||
if (camera) {
|
||||
BLI_assert(CTX_data_mode_enum(C) == CTX_MODE_OBJECT);
|
||||
|
@ -1329,9 +1330,9 @@ static void select_marker_camera_switch(
|
|||
if (marker->frame == cfra) {
|
||||
base = BKE_view_layer_base_find(view_layer, marker->camera);
|
||||
if (base) {
|
||||
ED_object_base_select(base, eObjectSelect_Mode(sel));
|
||||
object::base_select(base, object::eObjectSelect_Mode(sel));
|
||||
if (sel) {
|
||||
ED_object_base_activate(C, base);
|
||||
object::base_activate(C, base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ static int insert_key_with_keyingset(bContext *C, wmOperator *op, KeyingSet *ks)
|
|||
* updated since the last switching to the edit mode will be keyframed correctly
|
||||
*/
|
||||
if (obedit && ANIM_keyingset_find_id(ks, (ID *)obedit->data)) {
|
||||
ED_object_mode_set(C, OB_MODE_OBJECT);
|
||||
blender::ed::object::mode_set(C, OB_MODE_OBJECT);
|
||||
ob_edit_mode = true;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int insert_key_with_keyingset(bContext *C, wmOperator *op, KeyingSet *ks)
|
|||
|
||||
/* restore the edit mode if necessary */
|
||||
if (ob_edit_mode) {
|
||||
ED_object_mode_set(C, OB_MODE_EDIT);
|
||||
blender::ed::object::mode_set(C, OB_MODE_EDIT);
|
||||
}
|
||||
|
||||
/* report failure or do updates? */
|
||||
|
|
|
@ -66,7 +66,7 @@ bArmature *ED_armature_context(const bContext *C)
|
|||
CTX_data_pointer_get_type(C, "armature", &RNA_Armature).data);
|
||||
|
||||
if (armature == nullptr) {
|
||||
Object *object = ED_object_active_context(C);
|
||||
Object *object = blender::ed::object::context_active_object(C);
|
||||
if (object && object->type == OB_ARMATURE) {
|
||||
armature = static_cast<bArmature *>(object->data);
|
||||
}
|
||||
|
|
|
@ -493,7 +493,7 @@ int ED_armature_join_objects_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* Free the old object data */
|
||||
ED_object_base_free_and_unlink(bmain, scene, ob_iter);
|
||||
blender::ed::object::base_free_and_unlink(bmain, scene, ob_iter);
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
@ -735,7 +735,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
|
|||
/* Only duplicate linked armature but take into account
|
||||
* user preferences for duplicating actions. */
|
||||
short dupflag = USER_DUP_ARM | (U.dupflag & USER_DUP_ACT);
|
||||
Base *base_new = ED_object_add_duplicate(
|
||||
Base *base_new = blender::ed::object::add_duplicate(
|
||||
bmain, scene, view_layer, base_old, eDupli_ID_Flags(dupflag));
|
||||
Object *ob_new = base_new->object;
|
||||
|
||||
|
|
|
@ -1092,7 +1092,7 @@ bool ED_armature_edit_select_pick_bone(
|
|||
|
||||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
if (BKE_view_layer_active_base_get(view_layer) != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
blender::ed::object::base_activate(C, basact);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
|
||||
|
|
|
@ -243,19 +243,19 @@ static void envelope_bone_weighting(Object *ob,
|
|||
|
||||
/* add the vert to the deform group if (weight != 0.0) */
|
||||
if (distance != 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgroup, i, distance, WEIGHT_REPLACE);
|
||||
blender::ed::object::vgroup_vert_add(ob, dgroup, i, distance, WEIGHT_REPLACE);
|
||||
}
|
||||
else {
|
||||
ED_vgroup_vert_remove(ob, dgroup, i);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgroup, i);
|
||||
}
|
||||
|
||||
/* do same for mirror */
|
||||
if (dgroupflip && dgroupflip[j] && iflip != -1) {
|
||||
if (distance != 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgroupflip[j], iflip, distance, WEIGHT_REPLACE);
|
||||
blender::ed::object::vgroup_vert_add(ob, dgroupflip[j], iflip, distance, WEIGHT_REPLACE);
|
||||
}
|
||||
else {
|
||||
ED_vgroup_vert_remove(ob, dgroupflip[j], iflip);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgroupflip[j], iflip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ void ED_object_vgroup_calc_from_armature(ReportList *reports,
|
|||
if (defbase_add) {
|
||||
/* It's possible there are DWeights outside the range of the current
|
||||
* object's deform groups. In this case the new groups won't be empty #33889. */
|
||||
ED_vgroup_data_clamp_range(static_cast<ID *>(ob->data), defbase_tot);
|
||||
blender::ed::object::vgroup_data_clamp_range(static_cast<ID *>(ob->data), defbase_tot);
|
||||
}
|
||||
}
|
||||
else if (ELEM(mode, ARM_GROUPS_ENVELOPE, ARM_GROUPS_AUTO)) {
|
||||
|
|
|
@ -366,7 +366,7 @@ static bool bone_collection_assign_named_mode_specific(bContext *C,
|
|||
|
||||
static bool bone_collection_assign_poll(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ static bool bone_collection_assign_poll(bContext *C)
|
|||
/* Assign selected pchans to the bone collection that the user selects */
|
||||
static int bone_collection_assign_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ void ARMATURE_OT_collection_assign(wmOperatorType *ot)
|
|||
|
||||
static bool bone_collection_create_and_assign_poll(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ static bool bone_collection_create_and_assign_poll(bContext *C)
|
|||
/* Assign selected pchans to the bone collection that the user selects */
|
||||
static int bone_collection_create_and_assign_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ void ARMATURE_OT_collection_create_and_assign(wmOperatorType *ot)
|
|||
|
||||
static int bone_collection_unassign_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ void ARMATURE_OT_collection_unassign(wmOperatorType *ot)
|
|||
|
||||
static int bone_collection_unassign_named_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ static bool editbone_is_member(const EditBone *ebone, const BoneCollection *bcol
|
|||
|
||||
static bool armature_bone_select_poll(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr || ob->type != OB_ARMATURE) {
|
||||
return false;
|
||||
}
|
||||
|
@ -784,7 +784,7 @@ static void bone_collection_select(bContext *C,
|
|||
|
||||
static int bone_collection_select_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ void ARMATURE_OT_collection_select(wmOperatorType *ot)
|
|||
|
||||
static int bone_collection_deselect_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ static int add_or_move_to_collection_exec(bContext *C,
|
|||
const assign_bone_func assign_func_bone,
|
||||
const assign_ebone_func assign_func_ebone)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob->mode == OB_MODE_POSE) {
|
||||
ob = ED_pose_object_from_context(C);
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ static int assign_to_collection_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static bool move_to_collection_poll(bContext *C)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = blender::ed::object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1062,7 +1062,7 @@ static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void *
|
|||
bool is_move_operation;
|
||||
std::tie(parent_bcoll_index, is_move_operation) = menu_custom_data_decode(menu_custom_data);
|
||||
|
||||
const Object *ob = ED_object_context(C);
|
||||
const Object *ob = blender::ed::object::context_object(C);
|
||||
const bArmature *arm = static_cast<bArmature *>(ob->data);
|
||||
|
||||
/* The "Create a new collection" mode of this operator has its own menu, and should thus be
|
||||
|
|
|
@ -737,9 +737,9 @@ void heat_bone_weighting(Object *ob,
|
|||
continue;
|
||||
}
|
||||
|
||||
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
|
||||
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -765,16 +765,16 @@ void heat_bone_weighting(Object *ob,
|
|||
|
||||
if (bbone) {
|
||||
if (solution > 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgrouplist[j], a, solution, WEIGHT_ADD);
|
||||
blender::ed::object::vgroup_vert_add(ob, dgrouplist[j], a, solution, WEIGHT_ADD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
weight = heat_limit_weight(solution);
|
||||
if (weight > 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgrouplist[j], a, weight, WEIGHT_REPLACE);
|
||||
blender::ed::object::vgroup_vert_add(ob, dgrouplist[j], a, weight, WEIGHT_REPLACE);
|
||||
}
|
||||
else {
|
||||
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,16 +782,18 @@ void heat_bone_weighting(Object *ob,
|
|||
if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
|
||||
if (bbone) {
|
||||
if (solution > 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a], solution, WEIGHT_ADD);
|
||||
blender::ed::object::vgroup_vert_add(
|
||||
ob, dgroupflip[j], vertsflipped[a], solution, WEIGHT_ADD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
weight = heat_limit_weight(solution);
|
||||
if (weight > 0.0f) {
|
||||
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a], weight, WEIGHT_REPLACE);
|
||||
blender::ed::object::vgroup_vert_add(
|
||||
ob, dgroupflip[j], vertsflipped[a], weight, WEIGHT_REPLACE);
|
||||
}
|
||||
else {
|
||||
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -809,17 +811,17 @@ void heat_bone_weighting(Object *ob,
|
|||
continue;
|
||||
}
|
||||
|
||||
weight = ED_vgroup_vert_weight(ob, dgrouplist[j], a);
|
||||
weight = blender::ed::object::vgroup_vert_weight(ob, dgrouplist[j], a);
|
||||
weight = heat_limit_weight(weight);
|
||||
if (weight <= 0.0f) {
|
||||
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgrouplist[j], a);
|
||||
}
|
||||
|
||||
if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
|
||||
weight = ED_vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
|
||||
weight = blender::ed::object::vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
|
||||
weight = heat_limit_weight(weight);
|
||||
if (weight <= 0.0f) {
|
||||
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
blender::ed::object::vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ Object *ED_pose_object_from_context(bContext *C)
|
|||
/* Since this call may also be used from the buttons window,
|
||||
* we need to check for where to get the object. */
|
||||
if (area && area->spacetype == SPACE_PROPERTIES) {
|
||||
ob = ED_object_active_context(C);
|
||||
ob = blender::ed::object::context_active_object(C);
|
||||
}
|
||||
else {
|
||||
ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
|
||||
|
|
|
@ -234,7 +234,7 @@ bool ED_armature_pose_select_pick_bone(const Scene *scene,
|
|||
/* In weight-paint we select the associated vertex group too. */
|
||||
if (ob_act->mode & OB_MODE_ALL_WEIGHT_PAINT) {
|
||||
if (bone == arm->act_bone) {
|
||||
ED_vgroup_select_by_name(ob_act, bone->name);
|
||||
blender::ed::object::vgroup_select_by_name(ob_act, bone->name);
|
||||
DEG_id_tag_update(&ob_act->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ void ED_armature_pose_select_in_wpaint_mode(const Scene *scene,
|
|||
if ((base_arm != nullptr) && (base_arm != base_select) &&
|
||||
(base_arm->flag & BASE_SELECTED))
|
||||
{
|
||||
ED_object_base_select(base_arm, BA_DESELECT);
|
||||
blender::ed::object::base_select(base_arm, blender::ed::object::BA_DESELECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,14 +322,14 @@ void ED_armature_pose_select_in_wpaint_mode(const Scene *scene,
|
|||
if ((base_arm != nullptr) && (base_arm != base_select) &&
|
||||
(base_arm->flag & BASE_SELECTED))
|
||||
{
|
||||
ED_object_base_select(base_arm, BA_DESELECT);
|
||||
blender::ed::object::base_select(base_arm, blender::ed::object::BA_DESELECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((base_select->flag & BASE_SELECTED) == 0) {
|
||||
ED_object_base_select(base_select, BA_SELECT);
|
||||
blender::ed::object::base_select(base_select, blender::ed::object::BA_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* In weight-paint we select the associated vertex group too. */
|
||||
if (is_weight_paint) {
|
||||
ED_vgroup_select_by_name(ob_active, pchan_mirror_act->name);
|
||||
blender::ed::object::vgroup_select_by_name(ob_active, pchan_mirror_act->name);
|
||||
DEG_id_tag_update(&ob_active->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
struct AssetLibraryReference;
|
||||
struct bContext;
|
||||
|
||||
namespace blender::asset_system {
|
||||
class AssetLibrary;
|
||||
class AssetRepresentation;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
struct ID;
|
||||
struct Main;
|
||||
|
||||
namespace blender::asset_system {
|
||||
class AssetRepresentation;
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
|
||||
struct AssetHandle;
|
||||
struct AssetLibraryReference;
|
||||
struct AssetLibraryReference;
|
||||
struct bContext;
|
||||
struct ID;
|
||||
struct ImBuf;
|
||||
struct bContext;
|
||||
struct wmNotifier;
|
||||
struct wmRegionListenerParams;
|
||||
namespace blender::asset_system {
|
||||
|
@ -84,7 +83,7 @@ void storage_exit();
|
|||
|
||||
AssetHandle asset_handle_get_by_index(const AssetLibraryReference *library_reference,
|
||||
int asset_index);
|
||||
blender::asset_system::AssetRepresentation *asset_get_by_index(
|
||||
asset_system::AssetRepresentation *asset_get_by_index(
|
||||
const AssetLibraryReference &library_reference, int asset_index);
|
||||
|
||||
bool asset_image_is_loading(const AssetLibraryReference *library_reference,
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#pragma once
|
||||
|
||||
struct AssetMetaData;
|
||||
struct bContext;
|
||||
struct ID;
|
||||
struct Main;
|
||||
struct bContext;
|
||||
|
||||
namespace blender::ed::asset {
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ struct bContextDataResult;
|
|||
struct BlendDataReader;
|
||||
struct BlendWriter;
|
||||
struct Main;
|
||||
struct wmWindowManager;
|
||||
struct RegionPollParams;
|
||||
struct wmWindowManager;
|
||||
|
||||
namespace blender::ed::asset::shelf {
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
#include "ED_asset_import.hh"
|
||||
|
||||
using namespace blender;
|
||||
|
||||
namespace blender::ed::asset {
|
||||
|
||||
ID *asset_local_id_ensure_imported(Main &bmain, const asset_system::AssetRepresentation &asset)
|
||||
|
|
|
@ -1391,7 +1391,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
|||
/* Take into account user preferences for duplicating actions. */
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags(U.dupflag & USER_DUP_ACT);
|
||||
|
||||
newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, dupflag);
|
||||
newbase = blender::ed::object::add_duplicate(bmain, scene, view_layer, oldbase, dupflag);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
newob = newbase->object;
|
||||
|
@ -2714,7 +2714,7 @@ static int set_radius_exec(bContext *C, wmOperator *op)
|
|||
|
||||
for (Object *obedit : objects) {
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2831,7 +2831,7 @@ static int smooth_exec(bContext *C, wmOperator *op)
|
|||
|
||||
for (Object *obedit : objects) {
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3174,7 +3174,7 @@ static int curve_smooth_radius_exec(bContext *C, wmOperator *op)
|
|||
|
||||
for (Object *obedit : objects) {
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3223,7 +3223,7 @@ static int curve_smooth_tilt_exec(bContext *C, wmOperator *op)
|
|||
|
||||
for (Object *obedit : objects) {
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4067,7 +4067,7 @@ static int curve_normals_make_consistent_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4997,7 +4997,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
|
|||
|
||||
BKE_view_layer_synced_ensure(vc.scene, vc.view_layer);
|
||||
if (BKE_view_layer_active_base_get(vc.view_layer) != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
blender::ed::object::base_activate(C, basact);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_SELECT | ID_RECALC_SYNC_TO_EVAL);
|
||||
|
@ -6994,7 +6994,7 @@ int ED_curve_join_objects_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
}
|
||||
|
||||
ED_object_base_free_and_unlink(bmain, scene, ob_iter);
|
||||
blender::ed::object::base_free_and_unlink(bmain, scene, ob_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7043,7 +7043,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
if (!isSurf) { /* adding curve */
|
||||
|
@ -517,7 +517,8 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
const char *name = get_curve_defname(type);
|
||||
Curve *cu;
|
||||
|
||||
obedit = ED_object_add_type(C, OB_CURVES_LEGACY, name, loc, rot, true, local_view_bits);
|
||||
obedit = blender::ed::object::add_type(
|
||||
C, OB_CURVES_LEGACY, name, loc, rot, true, local_view_bits);
|
||||
newob = true;
|
||||
|
||||
cu = (Curve *)obedit->data;
|
||||
|
@ -533,7 +534,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
else { /* adding surface */
|
||||
if (obedit == nullptr || obedit->type != OB_SURF) {
|
||||
const char *name = get_surf_defname(type);
|
||||
obedit = ED_object_add_type(C, OB_SURF, name, loc, rot, true, local_view_bits);
|
||||
obedit = blender::ed::object::add_type(C, OB_SURF, name, loc, rot, true, local_view_bits);
|
||||
newob = true;
|
||||
}
|
||||
else {
|
||||
|
@ -544,7 +545,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
float radius = RNA_float_get(op->ptr, "radius");
|
||||
float scale[3];
|
||||
copy_v3_fl(scale, radius);
|
||||
ED_object_new_primitive_matrix(C, obedit, loc, rot, scale, mat);
|
||||
blender::ed::object::new_primitive_matrix(C, obedit, loc, rot, scale, mat);
|
||||
|
||||
nu = ED_curve_add_nurbs_primitive(C, obedit, mat, type, newob);
|
||||
editnurb = object_editcurve_get(obedit);
|
||||
|
@ -552,7 +553,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
|
|||
|
||||
/* userdef */
|
||||
if (newob && !enter_editmode) {
|
||||
ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA);
|
||||
blender::ed::object::editmode_exit_ex(bmain, scene, obedit, blender::ed::object::EM_FREEDATA);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
|
||||
|
@ -591,8 +592,8 @@ void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
|
||||
|
@ -614,8 +615,8 @@ void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
|
||||
|
@ -637,8 +638,8 @@ void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
|
||||
|
@ -660,8 +661,8 @@ void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_curve_path_exec(bContext *C, wmOperator *op)
|
||||
|
@ -683,8 +684,8 @@ void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
/* **************** NURBS surfaces ********************** */
|
||||
|
@ -707,8 +708,8 @@ void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
|
||||
|
@ -730,8 +731,8 @@ void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_surface_surface_exec(bContext *C, wmOperator *op)
|
||||
|
@ -753,8 +754,8 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
|
||||
|
@ -776,8 +777,8 @@ void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_surface_sphere_exec(bContext *C, wmOperator *op)
|
||||
|
@ -799,8 +800,8 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
|
||||
|
@ -822,6 +823,6 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
|
|
@ -2043,7 +2043,7 @@ static int edcu_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
|
|||
|
||||
BKE_view_layer_synced_ensure(vc.scene, vc.view_layer);
|
||||
if (BKE_view_layer_active_base_get(vc.view_layer) != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
blender::ed::object::base_activate(C, basact);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_SELECT | ID_RECALC_SYNC_TO_EVAL);
|
||||
|
|
|
@ -809,7 +809,7 @@ static void txt_add_object(bContext *C,
|
|||
object = BKE_view_layer_active_object_get(view_layer);
|
||||
|
||||
/* seems to assume view align ? TODO: look into this, could be an operator option. */
|
||||
ED_object_base_init_transform_on_add(object, nullptr, rot);
|
||||
blender::ed::object::init_transform_on_add(object, nullptr, rot);
|
||||
|
||||
BKE_object_where_is_calc(depsgraph, scene, obedit);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob)
|
|||
Main *bmain = CTX_data_main(&C);
|
||||
Scene *scene = CTX_data_scene(&C);
|
||||
|
||||
ModifierData *md = ED_object_modifier_add(
|
||||
ModifierData *md = object::modifier_add(
|
||||
nullptr, bmain, scene, &curves_ob, DATA_("Surface Deform"), eModifierType_Nodes);
|
||||
NodesModifierData &nmd = *reinterpret_cast<NodesModifierData *>(md);
|
||||
nmd.node_group = ntreeAddTree(bmain, DATA_("Surface Deform"), "GeometryNodeTree");
|
||||
|
|
|
@ -47,15 +47,9 @@ static bool active_attribute_poll(bContext *C)
|
|||
if (!editable_curves_in_edit_mode_poll(C)) {
|
||||
return false;
|
||||
}
|
||||
Object *object = CTX_data_active_object(C);
|
||||
Curves &curves_id = *static_cast<Curves *>(object->data);
|
||||
const CustomDataLayer *layer = BKE_id_attributes_active_get(&const_cast<ID &>(curves_id.id));
|
||||
if (!layer) {
|
||||
CTX_wm_operator_poll_msg_set(C, "No active attribute");
|
||||
return false;
|
||||
}
|
||||
if (layer->type == CD_PROP_STRING) {
|
||||
CTX_wm_operator_poll_msg_set(C, "Active string attribute not supported");
|
||||
const Object *object = CTX_data_active_object(C);
|
||||
const ID &object_data = *static_cast<const ID *>(object->data);
|
||||
if (!geometry::attribute_set_poll(*C, object_data)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -29,9 +29,7 @@ void transverts_from_curves_positions_create(bke::CurvesGeometry &curves, TransV
|
|||
});
|
||||
}
|
||||
|
||||
} // namespace blender::ed::curves
|
||||
|
||||
float (*ED_curves_point_normals_array_create(const Curves *curves_id))[3]
|
||||
float (*point_normals_array_create(const Curves *curves_id))[3]
|
||||
{
|
||||
using namespace blender;
|
||||
const bke::CurvesGeometry &curves = curves_id->geometry.wrap();
|
||||
|
@ -40,3 +38,5 @@ float (*ED_curves_point_normals_array_create(const Curves *curves_id))[3]
|
|||
bke::curves_normals_point_domain_calc(curves, {data, size});
|
||||
return reinterpret_cast<float(*)[3]>(data);
|
||||
}
|
||||
|
||||
} // namespace blender::ed::curves
|
||||
|
|
|
@ -524,7 +524,7 @@ static int curves_convert_from_particle_system_exec(bContext *C, wmOperator * /*
|
|||
Scene &scene = *CTX_data_scene(C);
|
||||
ViewLayer &view_layer = *CTX_data_view_layer(C);
|
||||
Depsgraph &depsgraph = *CTX_data_depsgraph_pointer(C);
|
||||
Object *ob_from_orig = ED_object_active_context(C);
|
||||
Object *ob_from_orig = object::context_active_object(C);
|
||||
ParticleSystem *psys_orig = static_cast<ParticleSystem *>(
|
||||
CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data);
|
||||
if (psys_orig == nullptr) {
|
||||
|
@ -559,7 +559,7 @@ static int curves_convert_from_particle_system_exec(bContext *C, wmOperator * /*
|
|||
|
||||
static bool curves_convert_from_particle_system_poll(bContext *C)
|
||||
{
|
||||
return ED_object_active_context(C) != nullptr;
|
||||
return blender::ed::object::context_active_object(C) != nullptr;
|
||||
}
|
||||
|
||||
} // namespace convert_from_particle_system
|
||||
|
@ -1186,11 +1186,18 @@ static int surface_set_exec(bContext *C, wmOperator *op)
|
|||
&missing_uvs);
|
||||
|
||||
/* Add deformation modifier if necessary. */
|
||||
blender::ed::curves::ensure_surface_deformation_node_exists(*C, curves_ob);
|
||||
ensure_surface_deformation_node_exists(*C, curves_ob);
|
||||
|
||||
curves_id.surface = &new_surface_ob;
|
||||
ED_object_parent_set(
|
||||
op->reports, C, scene, &curves_ob, &new_surface_ob, PAR_OBJECT, false, true, nullptr);
|
||||
object::parent_set(op->reports,
|
||||
C,
|
||||
scene,
|
||||
&curves_ob,
|
||||
&new_surface_ob,
|
||||
object::PAR_OBJECT,
|
||||
false,
|
||||
true,
|
||||
nullptr);
|
||||
|
||||
DEG_id_tag_update(&curves_ob.id, ID_RECALC_TRANSFORM);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, &curves_id);
|
||||
|
@ -1329,11 +1336,8 @@ static void CURVES_OT_tilt_clear(wmOperatorType *ot)
|
|||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::curves
|
||||
|
||||
void ED_operatortypes_curves()
|
||||
void operatortypes_curves()
|
||||
{
|
||||
using namespace blender::ed::curves;
|
||||
WM_operatortype_append(CURVES_OT_attribute_set);
|
||||
WM_operatortype_append(CURVES_OT_convert_to_particle_system);
|
||||
WM_operatortype_append(CURVES_OT_convert_from_particle_system);
|
||||
|
@ -1353,7 +1357,7 @@ void ED_operatortypes_curves()
|
|||
WM_operatortype_append(CURVES_OT_tilt_clear);
|
||||
}
|
||||
|
||||
void ED_operatormacros_curves()
|
||||
void operatormacros_curves()
|
||||
{
|
||||
wmOperatorType *ot;
|
||||
wmOperatorTypeMacro *otmacro;
|
||||
|
@ -1379,10 +1383,11 @@ void ED_operatormacros_curves()
|
|||
RNA_boolean_set(otmacro->ptr, "mirror", false);
|
||||
}
|
||||
|
||||
void ED_keymap_curves(wmKeyConfig *keyconf)
|
||||
void keymap_curves(wmKeyConfig *keyconf)
|
||||
{
|
||||
using namespace blender::ed::curves;
|
||||
/* Only set in editmode curves, by space_view3d listener. */
|
||||
wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
||||
keymap->poll = editable_curves_in_edit_mode_poll;
|
||||
}
|
||||
|
||||
} // namespace blender::ed::curves
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
static CLG_LogRef LOG = {"ed.undo.curves"};
|
||||
|
||||
namespace blender::ed::curves::undo {
|
||||
namespace blender::ed::curves {
|
||||
namespace undo {
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Implements ED Undo System
|
||||
|
@ -129,21 +130,21 @@ static void foreach_ID_ref(UndoStep *us_p,
|
|||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::ed::curves::undo
|
||||
} // namespace undo
|
||||
|
||||
void ED_curves_undosys_type(UndoType *ut)
|
||||
void undosys_type_register(UndoType *ut)
|
||||
{
|
||||
using namespace blender::ed;
|
||||
|
||||
ut->name = "Edit Curves";
|
||||
ut->poll = curves::editable_curves_in_edit_mode_poll;
|
||||
ut->step_encode = curves::undo::step_encode;
|
||||
ut->step_decode = curves::undo::step_decode;
|
||||
ut->step_free = curves::undo::step_free;
|
||||
ut->poll = editable_curves_in_edit_mode_poll;
|
||||
ut->step_encode = undo::step_encode;
|
||||
ut->step_decode = undo::step_decode;
|
||||
ut->step_free = undo::step_free;
|
||||
|
||||
ut->step_foreach_ID_ref = curves::undo::foreach_ID_ref;
|
||||
ut->step_foreach_ID_ref = undo::foreach_ID_ref;
|
||||
|
||||
ut->flags = UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE;
|
||||
|
||||
ut->step_size = sizeof(curves::undo::CurvesUndoStep);
|
||||
ut->step_size = sizeof(undo::CurvesUndoStep);
|
||||
}
|
||||
|
||||
} // namespace blender::ed::curves
|
||||
|
|
|
@ -66,6 +66,8 @@ StringRefNull rna_property_name_for_type(const eCustomDataType type)
|
|||
case CD_PROP_INT8:
|
||||
case CD_PROP_INT32:
|
||||
return "value_int";
|
||||
case CD_PROP_INT32_2D:
|
||||
return "value_int_vector_2d";
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return "";
|
||||
|
@ -103,6 +105,8 @@ void register_rna_properties_for_attribute_types(StructRNA &srna)
|
|||
-FLT_MAX,
|
||||
FLT_MAX);
|
||||
RNA_def_int(&srna, "value_int", 0, INT_MIN, INT_MAX, "Value", "", INT_MIN, INT_MAX);
|
||||
RNA_def_int_array(
|
||||
&srna, "value_int_vector_2d", 2, nullptr, INT_MIN, INT_MAX, "Value", "", INT_MIN, INT_MAX);
|
||||
RNA_def_float_color(
|
||||
&srna, "value_color", 4, color_default, -FLT_MAX, FLT_MAX, "Value", "", 0.0f, 1.0f);
|
||||
RNA_def_boolean(&srna, "value_bool", false, "Value", "");
|
||||
|
@ -140,8 +144,12 @@ GPointer rna_property_for_attribute_type_retrieve_value(PointerRNA &ptr,
|
|||
case CD_PROP_INT32:
|
||||
*static_cast<int32_t *>(buffer) = RNA_int_get(&ptr, prop_name.c_str());
|
||||
break;
|
||||
case CD_PROP_INT32_2D:
|
||||
RNA_int_get_array(&ptr, prop_name.c_str(), static_cast<int *>(buffer));
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return {};
|
||||
}
|
||||
return GPointer(bke::custom_data_type_to_cpp_type(type), buffer);
|
||||
}
|
||||
|
@ -175,16 +183,33 @@ void rna_property_for_attribute_type_set_value(PointerRNA &ptr,
|
|||
case CD_PROP_INT32:
|
||||
RNA_property_int_set(&ptr, &prop, *value.get<int32_t>());
|
||||
break;
|
||||
case CD_PROP_INT32_2D:
|
||||
RNA_property_int_set_array(&ptr, &prop, *value.get<int2>());
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
bool attribute_set_poll(bContext &C, const ID &object_data)
|
||||
{
|
||||
const CustomDataLayer *layer = BKE_id_attributes_active_get(&const_cast<ID &>(object_data));
|
||||
if (!layer) {
|
||||
CTX_wm_operator_poll_msg_set(&C, "No active attribute");
|
||||
return false;
|
||||
}
|
||||
if (ELEM(layer->type, CD_PROP_STRING, CD_PROP_FLOAT4X4, CD_PROP_QUATERNION)) {
|
||||
CTX_wm_operator_poll_msg_set(&C, "The active attribute has an unsupported type");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*********************** Attribute Operators ************************/
|
||||
|
||||
static bool geometry_attributes_poll(bContext *C)
|
||||
{
|
||||
const Object *ob = ED_object_context(C);
|
||||
const Object *ob = object::context_object(C);
|
||||
const Main *bmain = CTX_data_main(C);
|
||||
const ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
|
||||
return (ob && BKE_id_is_editable(bmain, &ob->id) && data && BKE_id_is_editable(bmain, data)) &&
|
||||
|
@ -197,7 +222,7 @@ static bool geometry_attributes_remove_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *data = (ob) ? static_cast<ID *>(ob->data) : nullptr;
|
||||
if (BKE_id_attributes_active_get(data) != nullptr) {
|
||||
return true;
|
||||
|
@ -215,7 +240,7 @@ static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C,
|
|||
return rna_enum_dummy_NULL_items;
|
||||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
if (ob == nullptr) {
|
||||
return rna_enum_dummy_NULL_items;
|
||||
}
|
||||
|
@ -225,7 +250,7 @@ static const EnumPropertyItem *geometry_attribute_domain_itemf(bContext *C,
|
|||
|
||||
static int geometry_attribute_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
|
||||
char name[MAX_NAME];
|
||||
|
@ -300,7 +325,7 @@ void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
|
|||
|
||||
static int geometry_attribute_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
CustomDataLayer *layer = BKE_id_attributes_active_get(id);
|
||||
|
||||
|
@ -336,7 +361,7 @@ void GEOMETRY_OT_attribute_remove(wmOperatorType *ot)
|
|||
|
||||
static int geometry_color_attribute_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
|
||||
char name[MAX_NAME];
|
||||
|
@ -387,7 +412,7 @@ static bool geometry_attribute_convert_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *data = static_cast<ID *>(ob->data);
|
||||
if (GS(data->name) != ID_ME) {
|
||||
return false;
|
||||
|
@ -404,7 +429,7 @@ static bool geometry_attribute_convert_poll(bContext *C)
|
|||
|
||||
static int geometry_attribute_convert_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *ob_data = static_cast<ID *>(ob->data);
|
||||
CustomDataLayer *layer = BKE_id_attributes_active_get(ob_data);
|
||||
const ConvertAttributeMode mode = static_cast<ConvertAttributeMode>(
|
||||
|
@ -522,7 +547,7 @@ void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
|
|||
|
||||
static int geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
|
||||
char name[MAX_NAME];
|
||||
|
@ -563,7 +588,7 @@ void GEOMETRY_OT_color_attribute_render_set(wmOperatorType *ot)
|
|||
|
||||
static int geometry_color_attribute_remove_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
const std::string active_name = StringRef(BKE_id_attributes_active_color_name(id));
|
||||
if (active_name.empty()) {
|
||||
|
@ -586,7 +611,7 @@ static bool geometry_color_attributes_remove_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
const Object *ob = ED_object_context(C);
|
||||
const Object *ob = object::context_object(C);
|
||||
const ID *data = static_cast<ID *>(ob->data);
|
||||
|
||||
if (BKE_id_attributes_color_find(data, BKE_id_attributes_active_color_name(data))) {
|
||||
|
@ -613,7 +638,7 @@ void GEOMETRY_OT_color_attribute_remove(wmOperatorType *ot)
|
|||
|
||||
static int geometry_color_attribute_duplicate_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
const char *active_name = BKE_id_attributes_active_color_name(id);
|
||||
if (active_name == nullptr) {
|
||||
|
@ -643,7 +668,7 @@ static bool geometry_color_attributes_duplicate_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
const Object *ob = ED_object_context(C);
|
||||
const Object *ob = object::context_object(C);
|
||||
const ID *data = static_cast<ID *>(ob->data);
|
||||
|
||||
if (BKE_id_attributes_color_find(data, BKE_id_attributes_active_color_name(data))) {
|
||||
|
@ -672,7 +697,7 @@ static int geometry_attribute_convert_invoke(bContext *C,
|
|||
wmOperator *op,
|
||||
const wmEvent * /*event*/)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
const bke::AttributeMetaData meta_data = *mesh->attributes().lookup_meta_data(
|
||||
|
@ -719,7 +744,7 @@ static bool geometry_color_attribute_convert_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
ID *id = static_cast<ID *>(ob->data);
|
||||
if (GS(id->name) != ID_ME) {
|
||||
return false;
|
||||
|
@ -742,7 +767,7 @@ static bool geometry_color_attribute_convert_poll(bContext *C)
|
|||
|
||||
static int geometry_color_attribute_convert_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
const char *name = mesh->active_color_attribute;
|
||||
ED_geometry_attribute_convert(mesh,
|
||||
|
@ -757,7 +782,7 @@ static int geometry_color_attribute_convert_invoke(bContext *C,
|
|||
wmOperator *op,
|
||||
const wmEvent * /*event*/)
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Object *ob = object::context_object(C);
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
const char *name = mesh->active_color_attribute;
|
||||
const bke::AttributeMetaData meta_data = *mesh->attributes().lookup_meta_data(name);
|
||||
|
|
|
@ -461,7 +461,7 @@ static void gpencil_object_vgroup_calc_from_armature(const bContext *C,
|
|||
if (defbase_add) {
|
||||
/* It's possible there are DWeights outside the range of the current
|
||||
* object's deform groups. In this case the new groups won't be empty */
|
||||
ED_vgroup_data_clamp_range(static_cast<ID *>(ob->data), defbase_tot);
|
||||
blender::ed::object::vgroup_data_clamp_range(static_cast<ID *>(ob->data), defbase_tot);
|
||||
}
|
||||
|
||||
if (mode == GP_ARMATURE_AUTO) {
|
||||
|
@ -487,7 +487,7 @@ bool ED_gpencil_add_armature(const bContext *C, ReportList *reports, Object *ob,
|
|||
/* if no armature modifier, add a new one */
|
||||
GpencilModifierData *md = BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Armature);
|
||||
if (md == nullptr) {
|
||||
md = ED_object_gpencil_modifier_add(
|
||||
md = blender::ed::object::gpencil_modifier_add(
|
||||
reports, bmain, scene, ob, "Armature", eGpencilModifierType_Armature);
|
||||
if (md == nullptr) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to add a new Armature modifier to object");
|
||||
|
|
|
@ -1388,7 +1388,7 @@ static void gpencil_layer_to_curve(bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
ED_object_base_select(base_new, BA_SELECT);
|
||||
blender::ed::object::base_select(base_new, blender::ed::object::BA_SELECT);
|
||||
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
|
|
|
@ -3056,7 +3056,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* Free the old object */
|
||||
ED_object_base_free_and_unlink(bmain, scene, ob_iter);
|
||||
blender::ed::object::base_free_and_unlink(bmain, scene, ob_iter);
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
@ -3764,7 +3764,7 @@ bool ED_gpencil_add_lattice_modifier(const bContext *C,
|
|||
/* if no lattice modifier, add a new one */
|
||||
GpencilModifierData *md = BKE_gpencil_modifiers_findby_type(ob, eGpencilModifierType_Lattice);
|
||||
if (md == nullptr) {
|
||||
md = ED_object_gpencil_modifier_add(
|
||||
md = blender::ed::object::gpencil_modifier_add(
|
||||
reports, bmain, scene, ob, "Lattice", eGpencilModifierType_Lattice);
|
||||
if (md == nullptr) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to add a new Lattice modifier to object");
|
||||
|
|
|
@ -611,7 +611,7 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
ob->mode = mode;
|
||||
|
||||
/* Prepare armature posemode. */
|
||||
ED_object_posemode_set_for_weight_paint(C, bmain, ob, is_mode_set);
|
||||
blender::ed::object::posemode_set_for_weight_paint(C, bmain, ob, is_mode_set);
|
||||
}
|
||||
|
||||
if (mode == OB_MODE_WEIGHT_GPENCIL_LEGACY) {
|
||||
|
@ -5074,7 +5074,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
|
|||
/* Take into account user preferences for duplicating actions. */
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags(U.dupflag & USER_DUP_ACT);
|
||||
|
||||
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
base_new = blender::ed::object::add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
ob_dst = base_new->object;
|
||||
ob_dst->mode = OB_MODE_OBJECT;
|
||||
/* Duplication will increment #bGPdata user-count, but since we create a new grease-pencil
|
||||
|
|
|
@ -337,7 +337,7 @@ static int gpencil_trace_image_exec(bContext *C, wmOperator *op)
|
|||
trace_initialize_job_data(job);
|
||||
|
||||
/* Back to active base. */
|
||||
ED_object_base_activate(job->C, job->base_active);
|
||||
blender::ed::object::base_activate(job->C, job->base_active);
|
||||
|
||||
if ((job->image->source == IMA_SRC_FILE) || (job->frame_num > 0)) {
|
||||
wmJobWorkerStatus worker_status = {};
|
||||
|
|
|
@ -136,8 +136,6 @@ bGPdata **ED_annotation_data_get_pointers_direct(ID *screen_id,
|
|||
*r_ptr = RNA_id_pointer_create(&scene->id);
|
||||
}
|
||||
return &scene->gpd;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPACE_NODE: /* Nodes Editor */
|
||||
{
|
||||
|
@ -1416,7 +1414,8 @@ Object *ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view
|
|||
{
|
||||
const float rot[3] = {0.0f};
|
||||
|
||||
Object *ob = ED_object_add_type(C, OB_GPENCIL_LEGACY, nullptr, loc, rot, false, local_view_bits);
|
||||
Object *ob = blender::ed::object::add_type(
|
||||
C, OB_GPENCIL_LEGACY, nullptr, loc, rot, false, local_view_bits);
|
||||
|
||||
/* create default brushes and colors */
|
||||
ED_gpencil_add_defaults(C, ob);
|
||||
|
|
|
@ -1864,7 +1864,7 @@ static Object *duplicate_grease_pencil_object(Main *bmain,
|
|||
GreasePencil &grease_pencil_src)
|
||||
{
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags(U.dupflag & USER_DUP_ACT);
|
||||
Base *base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
Base *base_new = object::add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
Object *object_dst = base_new->object;
|
||||
object_dst->mode = OB_MODE_OBJECT;
|
||||
object_dst->data = BKE_grease_pencil_add(bmain, grease_pencil_src.id.name + 2);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "BKE_crazyspace.hh"
|
||||
#include "BKE_curves.hh"
|
||||
|
||||
#include "BLI_index_mask.hh"
|
||||
#include "BLI_index_mask_fwd.hh"
|
||||
#include "BLI_vector.hh"
|
||||
#include "BLI_vector_set.hh"
|
||||
|
||||
|
@ -30,25 +30,19 @@ enum class AttrDomain : int8_t;
|
|||
struct GSpanAttributeWriter;
|
||||
} // namespace blender::bke
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name C Wrappers
|
||||
* \{ */
|
||||
namespace blender::ed::curves {
|
||||
|
||||
void ED_operatortypes_curves();
|
||||
void ED_operatormacros_curves();
|
||||
void ED_curves_undosys_type(UndoType *ut);
|
||||
void ED_keymap_curves(wmKeyConfig *keyconf);
|
||||
void operatortypes_curves();
|
||||
void operatormacros_curves();
|
||||
void undosys_type_register(UndoType *ut);
|
||||
void keymap_curves(wmKeyConfig *keyconf);
|
||||
|
||||
/**
|
||||
* Return an owning pointer to an array of point normals the same size as the number of control
|
||||
* points. The normals depend on the normal mode for each curve and the "tilt" attribute and may be
|
||||
* calculated for the evaluated points and sampled back to the control points.
|
||||
*/
|
||||
float (*ED_curves_point_normals_array_create(const Curves *curves_id))[3];
|
||||
|
||||
/** \} */
|
||||
|
||||
namespace blender::ed::curves {
|
||||
float (*point_normals_array_create(const Curves *curves_id))[3];
|
||||
|
||||
bool object_has_editable_curves(const Main &bmain, const Object &object);
|
||||
bke::CurvesGeometry primitive_random_sphere(int curves_size, int points_per_curve);
|
||||
|
|
|
@ -39,6 +39,7 @@ GPointer rna_property_for_attribute_type_retrieve_value(PointerRNA &ptr,
|
|||
const eCustomDataType type,
|
||||
void *buffer);
|
||||
void rna_property_for_attribute_type_set_value(PointerRNA &ptr, PropertyRNA &prop, GPointer value);
|
||||
bool attribute_set_poll(bContext &C, const ID &object_data);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "BKE_grease_pencil.hh"
|
||||
|
||||
#include "BLI_generic_span.hh"
|
||||
#include "BLI_index_mask.hh"
|
||||
#include "BLI_index_mask_fwd.hh"
|
||||
#include "BLI_math_matrix_types.hh"
|
||||
|
||||
#include "ED_keyframes_edit.hh"
|
||||
|
|
|
@ -33,7 +33,6 @@ struct Scene;
|
|||
struct ShaderFxData;
|
||||
struct View3D;
|
||||
struct ViewLayer;
|
||||
struct XFormObjectData;
|
||||
struct bConstraint;
|
||||
struct bContext;
|
||||
struct bPoseChannel;
|
||||
|
@ -42,16 +41,20 @@ struct wmKeyConfig;
|
|||
struct wmOperator;
|
||||
struct wmOperatorType;
|
||||
|
||||
namespace blender::ed::object {
|
||||
|
||||
struct XFormObjectData;
|
||||
|
||||
/* `object_edit.cc` */
|
||||
|
||||
/** `context.object` */
|
||||
Object *ED_object_context(const bContext *C);
|
||||
Object *context_object(const bContext *C);
|
||||
/**
|
||||
* Find the correct active object per context (`context.object` or `context.active_object`)
|
||||
* \note context can be NULL when called from a enum with #PROP_ENUM_NO_CONTEXT.
|
||||
*/
|
||||
Object *ED_object_active_context(const bContext *C);
|
||||
void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout);
|
||||
Object *context_active_object(const bContext *C);
|
||||
void collection_hide_menu_draw(const bContext *C, uiLayout *layout);
|
||||
|
||||
/**
|
||||
* Return an array of objects:
|
||||
|
@ -61,7 +64,7 @@ void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout);
|
|||
* the callers \a filter_fn needs to check of they are editable
|
||||
* (assuming they need to be modified).
|
||||
*/
|
||||
blender::Vector<Object *> ED_object_array_in_mode_or_selected(
|
||||
blender::Vector<Object *> objects_in_mode_or_selected(
|
||||
bContext *C, bool (*filter_fn)(const Object *ob, void *user_data), void *filter_user_data);
|
||||
|
||||
/* `object_shapekey.cc` */
|
||||
|
@ -71,42 +74,40 @@ blender::Vector<Object *> ED_object_array_in_mode_or_selected(
|
|||
* and produces an error message if so (unless \a reports is null).
|
||||
* \return true if the shape key was locked.
|
||||
*/
|
||||
bool ED_object_edit_report_if_shape_key_is_locked(const Object *obedit, ReportList *reports);
|
||||
bool shape_key_report_if_locked(const Object *obedit, ReportList *reports);
|
||||
|
||||
/**
|
||||
* Checks if the active shape key of the object is locked, and produces an error message
|
||||
* if so (unless \a reports is null).
|
||||
* \return true if the shape key was locked.
|
||||
*/
|
||||
bool ED_object_report_if_active_shape_key_is_locked(Object *ob, ReportList *reports);
|
||||
bool shape_key_report_if_active_locked(Object *ob, ReportList *reports);
|
||||
|
||||
/**
|
||||
* Checks if any of the shape keys of the object are locked, and produces an error message if so
|
||||
* (unless \a reports is null).
|
||||
* \return true if a shape key was locked.
|
||||
*/
|
||||
bool ED_object_report_if_any_shape_key_is_locked(Object *ob, ReportList *reports);
|
||||
bool shape_key_report_if_any_locked(Object *ob, ReportList *reports);
|
||||
|
||||
/* `object_utils.cc` */
|
||||
|
||||
bool ED_object_calc_active_center_for_editmode(Object *obedit,
|
||||
bool select_only,
|
||||
float r_center[3]);
|
||||
bool ED_object_calc_active_center_for_posemode(Object *ob, bool select_only, float r_center[3]);
|
||||
bool ED_object_calc_active_center(Object *ob, bool select_only, float r_center[3]);
|
||||
bool calc_active_center_for_editmode(Object *obedit, bool select_only, float r_center[3]);
|
||||
bool calc_active_center_for_posemode(Object *ob, bool select_only, float r_center[3]);
|
||||
bool calc_active_center(Object *ob, bool select_only, float r_center[3]);
|
||||
|
||||
/* Object Data Container helper API. */
|
||||
struct XFormObjectData_Container;
|
||||
XFormObjectData_Container *ED_object_data_xform_container_create();
|
||||
void ED_object_data_xform_container_destroy(XFormObjectData_Container *xds);
|
||||
XFormObjectData_Container *data_xform_container_create();
|
||||
void data_xform_container_destroy(XFormObjectData_Container *xds);
|
||||
/**
|
||||
* This may be called multiple times with the same data.
|
||||
* Each time, the original transformations are re-applied, instead of accumulating the changes.
|
||||
*/
|
||||
void ED_object_data_xform_container_update_all(XFormObjectData_Container *xds,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph);
|
||||
void ED_object_data_xform_container_item_ensure(XFormObjectData_Container *xds, Object *ob);
|
||||
void data_xform_container_update_all(XFormObjectData_Container *xds,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph);
|
||||
void data_xform_container_item_ensure(XFormObjectData_Container *xds, Object *ob);
|
||||
|
||||
/** Object Skip-Child Container helper API. */
|
||||
enum {
|
||||
|
@ -128,29 +129,28 @@ enum {
|
|||
XFORM_OB_SKIP_CHILD_PARENT_APPLY = 2,
|
||||
};
|
||||
struct XFormObjectSkipChild_Container;
|
||||
XFormObjectSkipChild_Container *ED_object_xform_skip_child_container_create();
|
||||
void ED_object_xform_skip_child_container_item_ensure_from_array(
|
||||
XFormObjectSkipChild_Container *xcs,
|
||||
const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
Object **objects,
|
||||
uint objects_len);
|
||||
void ED_object_xform_skip_child_container_destroy(XFormObjectSkipChild_Container *xcs);
|
||||
void ED_object_xform_skip_child_container_update_all(XFormObjectSkipChild_Container *xcs,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph);
|
||||
void ED_object_xform_skip_child_container_item_ensure(XFormObjectSkipChild_Container *xcs,
|
||||
Object *ob,
|
||||
Object *ob_parent_recurse,
|
||||
int mode);
|
||||
XFormObjectSkipChild_Container *xform_skip_child_container_create();
|
||||
void xform_skip_child_container_item_ensure_from_array(XFormObjectSkipChild_Container *xcs,
|
||||
const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
Object **objects,
|
||||
uint objects_len);
|
||||
void object_xform_skip_child_container_destroy(XFormObjectSkipChild_Container *xcs);
|
||||
void object_xform_skip_child_container_update_all(XFormObjectSkipChild_Container *xcs,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph);
|
||||
void object_xform_skip_child_container_item_ensure(XFormObjectSkipChild_Container *xcs,
|
||||
Object *ob,
|
||||
Object *ob_parent_recurse,
|
||||
int mode);
|
||||
|
||||
void ED_object_xform_array_m4(Object **objects, uint objects_len, const float matrix[4][4]);
|
||||
void object_xform_array_m4(Object **objects, uint objects_len, const float matrix[4][4]);
|
||||
|
||||
/* `object_ops.cc` */
|
||||
|
||||
void ED_operatortypes_object();
|
||||
void ED_operatormacros_object();
|
||||
void ED_keymap_object(wmKeyConfig *keyconf);
|
||||
void operatortypes_object();
|
||||
void operatormacros_object();
|
||||
void keymap_object(wmKeyConfig *keyconf);
|
||||
|
||||
/* `object_relations.cc` */
|
||||
|
||||
|
@ -192,16 +192,16 @@ extern EnumPropertyItem prop_make_parent_types[];
|
|||
/**
|
||||
* Set the object's parent, return true if successful.
|
||||
*/
|
||||
bool ED_object_parent_set(ReportList *reports,
|
||||
const bContext *C,
|
||||
Scene *scene,
|
||||
Object *const ob,
|
||||
Object *const par,
|
||||
int partype,
|
||||
bool xmirror,
|
||||
bool keep_transform,
|
||||
const int vert_par[3]);
|
||||
void ED_object_parent_clear(Object *ob, int type);
|
||||
bool parent_set(ReportList *reports,
|
||||
const bContext *C,
|
||||
Scene *scene,
|
||||
Object *const ob,
|
||||
Object *const par,
|
||||
int partype,
|
||||
bool xmirror,
|
||||
bool keep_transform,
|
||||
const int vert_par[3]);
|
||||
void parent_clear(Object *ob, int type);
|
||||
|
||||
/**
|
||||
* Simple API for object selection, rather than just using the flag
|
||||
|
@ -211,32 +211,29 @@ void ED_object_parent_clear(Object *ob, int type);
|
|||
* \note Caller must send a `NC_SCENE | ND_OB_SELECT` notifier
|
||||
* (or a `NC_SCENE | ND_OB_VISIBLE` in case of visibility toggling).
|
||||
*/
|
||||
void ED_object_base_select(Base *base, eObjectSelect_Mode mode);
|
||||
void base_select(Base *base, eObjectSelect_Mode mode);
|
||||
/**
|
||||
* Change active base, it includes the notifier
|
||||
*/
|
||||
void ED_object_base_activate(bContext *C, Base *base);
|
||||
void ED_object_base_activate_with_mode_exit_if_needed(bContext *C, Base *base);
|
||||
void base_activate(bContext *C, Base *base);
|
||||
void base_activate_with_mode_exit_if_needed(bContext *C, Base *base);
|
||||
/**
|
||||
* Call when the active base has changed.
|
||||
*/
|
||||
void ED_object_base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_layer);
|
||||
void base_active_refresh(Main *bmain, Scene *scene, ViewLayer *view_layer);
|
||||
/**
|
||||
* Remove base from a specific scene.
|
||||
* \note now unlinks constraints as well.
|
||||
*/
|
||||
void ED_object_base_free_and_unlink(Main *bmain, Scene *scene, Object *ob);
|
||||
void base_free_and_unlink(Main *bmain, Scene *scene, Object *ob);
|
||||
/**
|
||||
* Remove base from a specific scene.
|
||||
* `ob` must not be indirectly used.
|
||||
*/
|
||||
void ED_object_base_free_and_unlink_no_indirect_check(Main *bmain, Scene *scene, Object *ob);
|
||||
bool ED_object_base_deselect_all_ex(
|
||||
void base_free_and_unlink_no_indirect_check(Main *bmain, Scene *scene, Object *ob);
|
||||
bool base_deselect_all_ex(
|
||||
const Scene *scene, ViewLayer *view_layer, View3D *v3d, int action, bool *r_any_visible);
|
||||
bool ED_object_base_deselect_all(const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
View3D *v3d,
|
||||
int action);
|
||||
bool base_deselect_all(const Scene *scene, ViewLayer *view_layer, View3D *v3d, int action);
|
||||
|
||||
/**
|
||||
* Single object duplicate, if `dupflag == 0`, fully linked, else it uses the flags given.
|
||||
|
@ -245,16 +242,12 @@ bool ED_object_base_deselect_all(const Scene *scene,
|
|||
* \note caller must do `DAG_relations_tag_update(bmain);`
|
||||
* this is not done automatic since we may duplicate many objects in a batch.
|
||||
*/
|
||||
Base *ED_object_add_duplicate(
|
||||
Base *add_duplicate(
|
||||
Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base, eDupli_ID_Flags dupflag);
|
||||
|
||||
void ED_object_parent(Object *ob, Object *parent, int type, const char *substr);
|
||||
std::string ED_object_ot_drop_named_material_tooltip(bContext *C,
|
||||
const char *name,
|
||||
const int mval[2]);
|
||||
std::string ED_object_ot_drop_geometry_nodes_tooltip(bContext *C,
|
||||
PointerRNA *properties,
|
||||
const int mval[2]);
|
||||
void parent_set(Object *ob, Object *parent, int type, const char *substr);
|
||||
std::string drop_named_material_tooltip(bContext *C, const char *name, const int mval[2]);
|
||||
std::string drop_geometry_nodes_tooltip(bContext *C, PointerRNA *properties, const int mval[2]);
|
||||
|
||||
/* bitflags for enter/exit editmode */
|
||||
enum {
|
||||
|
@ -263,59 +256,59 @@ enum {
|
|||
};
|
||||
/**
|
||||
* \param flag:
|
||||
* - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
|
||||
* - If #EM_FREEDATA isn't in the flag, use #editmode_load directly.
|
||||
*/
|
||||
bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag);
|
||||
bool ED_object_editmode_exit(bContext *C, int flag);
|
||||
bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag);
|
||||
bool editmode_exit(bContext *C, int flag);
|
||||
|
||||
/**
|
||||
* Support freeing edit-mode data without flushing it back to the object.
|
||||
*
|
||||
* \return true if data was freed.
|
||||
*/
|
||||
bool ED_object_editmode_free_ex(Main *bmain, Object *obedit);
|
||||
bool editmode_free_ex(Main *bmain, Object *obedit);
|
||||
|
||||
bool ED_object_editmode_exit_multi_ex(Main *bmain, Scene *scene, ViewLayer *view_layer, int flag);
|
||||
bool ED_object_editmode_exit_multi(bContext *C, int flag);
|
||||
bool editmode_exit_multi_ex(Main *bmain, Scene *scene, ViewLayer *view_layer, int flag);
|
||||
bool editmode_exit_multi(bContext *C, int flag);
|
||||
|
||||
bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag);
|
||||
bool ED_object_editmode_enter(bContext *C, int flag);
|
||||
bool ED_object_editmode_load(Main *bmain, Object *obedit);
|
||||
bool editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag);
|
||||
bool editmode_enter(bContext *C, int flag);
|
||||
bool editmode_load(Main *bmain, Object *obedit);
|
||||
|
||||
void ED_object_location_from_view(bContext *C, float loc[3]);
|
||||
void ED_object_rotation_from_quat(float rot[3], const float quat[4], char align_axis);
|
||||
void ED_object_rotation_from_view(bContext *C, float rot[3], char align_axis);
|
||||
void ED_object_base_init_transform_on_add(Object *object, const float loc[3], const float rot[3]);
|
||||
void location_from_view(bContext *C, float loc[3]);
|
||||
void rotation_from_quat(float rot[3], const float quat[4], char align_axis);
|
||||
void rotation_from_view(bContext *C, float rot[3], char align_axis);
|
||||
void init_transform_on_add(Object *object, const float loc[3], const float rot[3]);
|
||||
/**
|
||||
* Uses context to figure out transform for primitive.
|
||||
* Returns standard diameter.
|
||||
*/
|
||||
float ED_object_new_primitive_matrix(bContext *C,
|
||||
Object *obedit,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
const float scale[3],
|
||||
float primmat[4][4]);
|
||||
float new_primitive_matrix(bContext *C,
|
||||
Object *obedit,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
const float scale[3],
|
||||
float primmat[4][4]);
|
||||
|
||||
/**
|
||||
* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise).
|
||||
*/
|
||||
#define OBJECT_ADD_SIZE_MAXF 1.0e12f
|
||||
|
||||
void ED_object_add_unit_props_size(wmOperatorType *ot);
|
||||
void ED_object_add_unit_props_radius_ex(wmOperatorType *ot, float default_value);
|
||||
void ED_object_add_unit_props_radius(wmOperatorType *ot);
|
||||
void ED_object_add_generic_props(wmOperatorType *ot, bool do_editmode);
|
||||
void ED_object_add_mesh_props(wmOperatorType *ot);
|
||||
void ED_object_add_generic_get_opts(bContext *C,
|
||||
wmOperator *op,
|
||||
char view_align_axis,
|
||||
float r_loc[3],
|
||||
float r_rot[3],
|
||||
float r_scale[3],
|
||||
bool *r_enter_editmode,
|
||||
unsigned short *r_local_view_bits,
|
||||
bool *r_is_view_aligned);
|
||||
void add_unit_props_size(wmOperatorType *ot);
|
||||
void add_unit_props_radius_ex(wmOperatorType *ot, float default_value);
|
||||
void add_unit_props_radius(wmOperatorType *ot);
|
||||
void add_generic_props(wmOperatorType *ot, bool do_editmode);
|
||||
void add_mesh_props(wmOperatorType *ot);
|
||||
void add_generic_get_opts(bContext *C,
|
||||
wmOperator *op,
|
||||
char view_align_axis,
|
||||
float r_loc[3],
|
||||
float r_rot[3],
|
||||
float r_scale[3],
|
||||
bool *r_enter_editmode,
|
||||
unsigned short *r_local_view_bits,
|
||||
bool *r_is_view_aligned);
|
||||
|
||||
/**
|
||||
* For object add primitive operators, or for object creation when `obdata != NULL`.
|
||||
|
@ -323,35 +316,35 @@ void ED_object_add_generic_get_opts(bContext *C,
|
|||
*
|
||||
* \note Do not call undo push in this function (users of this function have to).
|
||||
*/
|
||||
Object *ED_object_add_type_with_obdata(bContext *C,
|
||||
int type,
|
||||
const char *name,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
bool enter_editmode,
|
||||
ushort local_view_bits,
|
||||
ID *obdata);
|
||||
Object *ED_object_add_type(bContext *C,
|
||||
int type,
|
||||
const char *name,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
bool enter_editmode,
|
||||
unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL;
|
||||
Object *add_type_with_obdata(bContext *C,
|
||||
int type,
|
||||
const char *name,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
bool enter_editmode,
|
||||
ushort local_view_bits,
|
||||
ID *obdata);
|
||||
Object *add_type(bContext *C,
|
||||
int type,
|
||||
const char *name,
|
||||
const float loc[3],
|
||||
const float rot[3],
|
||||
bool enter_editmode,
|
||||
unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL;
|
||||
|
||||
/**
|
||||
* Not an especially efficient function, only added so the single user button can be functional.
|
||||
*/
|
||||
void ED_object_single_user(Main *bmain, Scene *scene, Object *ob);
|
||||
void object_single_user_make(Main *bmain, Scene *scene, Object *ob);
|
||||
|
||||
void ED_object_single_obdata_user(Main *bmain, Scene *scene, Object *ob);
|
||||
void single_obdata_user_make(Main *bmain, Scene *scene, Object *ob);
|
||||
|
||||
/* object motion paths */
|
||||
|
||||
/**
|
||||
* Clear motion paths for all objects.
|
||||
*/
|
||||
void ED_objects_clear_paths(bContext *C, bool only_selected);
|
||||
void motion_paths_clear(bContext *C, bool only_selected);
|
||||
|
||||
/* Corresponds to eAnimvizCalcRange. */
|
||||
enum eObjectPathCalcRange {
|
||||
|
@ -366,54 +359,49 @@ enum eObjectPathCalcRange {
|
|||
*
|
||||
* To be called from various tools that do incremental updates
|
||||
*/
|
||||
void ED_objects_recalculate_paths(bContext *C,
|
||||
Scene *scene,
|
||||
eObjectPathCalcRange range,
|
||||
ListBase *ld_objects);
|
||||
void motion_paths_recalc(bContext *C,
|
||||
Scene *scene,
|
||||
eObjectPathCalcRange range,
|
||||
ListBase *ld_objects);
|
||||
|
||||
void ED_objects_recalculate_paths_selected(bContext *C, Scene *scene, eObjectPathCalcRange range);
|
||||
void motion_paths_recalc_selected(bContext *C, Scene *scene, eObjectPathCalcRange range);
|
||||
|
||||
void ED_objects_recalculate_paths_visible(bContext *C, Scene *scene, eObjectPathCalcRange range);
|
||||
void motion_paths_recalc_visible(bContext *C, Scene *scene, eObjectPathCalcRange range);
|
||||
|
||||
/* constraints */
|
||||
/**
|
||||
* If object is in pose-mode, return active bone constraints, else object constraints.
|
||||
* No constraints are returned for a bone on an inactive bone-layer.
|
||||
*/
|
||||
ListBase *ED_object_constraint_active_list(Object *ob);
|
||||
ListBase *constraint_active_list(Object *ob);
|
||||
/**
|
||||
* Get the constraints for the active pose bone. Bone may be on an inactive bone-layer
|
||||
* (unlike #ED_object_constraint_active_list, such constraints are not excluded here).
|
||||
* (unlike #constraint_active_list, such constraints are not excluded here).
|
||||
*/
|
||||
ListBase *ED_object_pose_constraint_list(const bContext *C);
|
||||
ListBase *pose_constraint_list(const bContext *C);
|
||||
/**
|
||||
* Find the list that a given constraint belongs to,
|
||||
* and/or also get the posechannel this is from (if applicable).
|
||||
*/
|
||||
ListBase *ED_object_constraint_list_from_constraint(Object *ob,
|
||||
bConstraint *con,
|
||||
bPoseChannel **r_pchan);
|
||||
ListBase *constraint_list_from_constraint(Object *ob, bConstraint *con, bPoseChannel **r_pchan);
|
||||
/**
|
||||
* Single constraint.
|
||||
*/
|
||||
bConstraint *ED_object_constraint_active_get(Object *ob);
|
||||
bConstraint *constraint_active_get(Object *ob);
|
||||
|
||||
void object_test_constraints(Main *bmain, Object *ob);
|
||||
|
||||
void ED_object_constraint_active_set(Object *ob, bConstraint *con);
|
||||
void ED_object_constraint_update(Main *bmain, Object *ob);
|
||||
void ED_object_constraint_dependency_update(Main *bmain, Object *ob);
|
||||
void constraint_active_set(Object *ob, bConstraint *con);
|
||||
void constraint_update(Main *bmain, Object *ob);
|
||||
void constraint_dependency_update(Main *bmain, Object *ob);
|
||||
|
||||
void ED_object_constraint_tag_update(Main *bmain, Object *ob, bConstraint *con);
|
||||
void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con);
|
||||
void constraint_tag_update(Main *bmain, Object *ob, bConstraint *con);
|
||||
void constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con);
|
||||
|
||||
bool ED_object_constraint_move_to_index(Object *ob, bConstraint *con, int index);
|
||||
void ED_object_constraint_link(Main *bmain, Object *ob_dst, ListBase *dst, ListBase *src);
|
||||
void ED_object_constraint_copy_for_object(Main *bmain, Object *ob_dst, bConstraint *con);
|
||||
void ED_object_constraint_copy_for_pose(Main *bmain,
|
||||
Object *ob_dst,
|
||||
bPoseChannel *pchan,
|
||||
bConstraint *con);
|
||||
bool constraint_move_to_index(Object *ob, bConstraint *con, int index);
|
||||
void constraint_link(Main *bmain, Object *ob_dst, ListBase *dst, ListBase *src);
|
||||
void constraint_copy_for_object(Main *bmain, Object *ob_dst, bConstraint *con);
|
||||
void constraint_copy_for_pose(Main *bmain, Object *ob_dst, bPoseChannel *pchan, bConstraint *con);
|
||||
|
||||
/* `object_modes.cc` */
|
||||
|
||||
|
@ -421,23 +409,20 @@ void ED_object_constraint_copy_for_pose(Main *bmain,
|
|||
* Checks the mode to be set is compatible with the object
|
||||
* should be made into a generic function
|
||||
*/
|
||||
bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode);
|
||||
bool mode_compat_test(const Object *ob, eObjectMode mode);
|
||||
/**
|
||||
* Sets the mode to a compatible state (use before entering the mode).
|
||||
*
|
||||
* This is so each mode's exec function can call
|
||||
*/
|
||||
bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports);
|
||||
bool ED_object_mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportList *reports);
|
||||
bool ED_object_mode_set(bContext *C, eObjectMode mode);
|
||||
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports);
|
||||
bool mode_set_ex(bContext *C, eObjectMode mode, bool use_undo, ReportList *reports);
|
||||
bool mode_set(bContext *C, eObjectMode mode);
|
||||
|
||||
void ED_object_mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob);
|
||||
bool ED_object_mode_generic_has_data(Depsgraph *depsgraph, const Object *ob);
|
||||
void mode_generic_exit(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob);
|
||||
bool mode_generic_has_data(Depsgraph *depsgraph, const Object *ob);
|
||||
|
||||
void ED_object_posemode_set_for_weight_paint(bContext *C,
|
||||
Main *bmain,
|
||||
Object *ob,
|
||||
bool is_mode_set);
|
||||
void posemode_set_for_weight_paint(bContext *C, Main *bmain, Object *ob, bool is_mode_set);
|
||||
|
||||
/**
|
||||
* Return the index of an object in a mode (typically edit/pose mode).
|
||||
|
@ -451,18 +436,18 @@ void ED_object_posemode_set_for_weight_paint(bContext *C,
|
|||
*
|
||||
* \note The active object is always index 0.
|
||||
*/
|
||||
int ED_object_in_mode_to_index(const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
eObjectMode mode,
|
||||
const Object *ob);
|
||||
int object_in_mode_to_index(const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
eObjectMode mode,
|
||||
const Object *ob);
|
||||
|
||||
/**
|
||||
* Access the object from the index returned by #ED_object_in_mode_to_index.
|
||||
* Access the object from the index returned by #object_in_mode_to_index.
|
||||
*/
|
||||
Object *ED_object_in_mode_from_index(const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
eObjectMode mode,
|
||||
int index);
|
||||
Object *object_in_mode_from_index(const Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
eObjectMode mode,
|
||||
int index);
|
||||
|
||||
/* `object_modifier.cc` */
|
||||
|
||||
|
@ -477,48 +462,37 @@ enum {
|
|||
*
|
||||
* \param scene: is only used to set current frame in some cases, and may be NULL.
|
||||
*/
|
||||
ModifierData *ED_object_modifier_add(
|
||||
ModifierData *modifier_add(
|
||||
ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type);
|
||||
bool ED_object_modifier_remove(
|
||||
ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md);
|
||||
void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob);
|
||||
bool ED_object_modifier_move_down(ReportList *reports,
|
||||
eReportType error_type,
|
||||
Object *ob,
|
||||
ModifierData *md);
|
||||
bool ED_object_modifier_move_up(ReportList *reports,
|
||||
eReportType error_type,
|
||||
Object *ob,
|
||||
ModifierData *md);
|
||||
bool ED_object_modifier_move_to_index(ReportList *reports,
|
||||
eReportType error_type,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
int index,
|
||||
bool allow_partial);
|
||||
bool modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md);
|
||||
void modifier_clear(Main *bmain, Scene *scene, Object *ob);
|
||||
bool modifier_move_down(ReportList *reports, eReportType error_type, Object *ob, ModifierData *md);
|
||||
bool modifier_move_up(ReportList *reports, eReportType error_type, Object *ob, ModifierData *md);
|
||||
bool modifier_move_to_index(ReportList *reports,
|
||||
eReportType error_type,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
int index,
|
||||
bool allow_partial);
|
||||
|
||||
bool ED_object_modifier_convert_psys_to_mesh(ReportList *reports,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
Object *ob,
|
||||
ModifierData *md);
|
||||
bool ED_object_modifier_apply(Main *bmain,
|
||||
ReportList *reports,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
int mode,
|
||||
bool keep_modifier);
|
||||
bool ED_object_modifier_copy(
|
||||
ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md);
|
||||
void ED_object_modifier_link(bContext *C, Object *ob_dst, Object *ob_src);
|
||||
void ED_object_modifier_copy_to_object(bContext *C,
|
||||
Object *ob_dst,
|
||||
Object *ob_src,
|
||||
ModifierData *md);
|
||||
bool convert_psys_to_mesh(ReportList *reports,
|
||||
Main *bmain,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
Object *ob,
|
||||
ModifierData *md);
|
||||
bool modifier_apply(Main *bmain,
|
||||
ReportList *reports,
|
||||
Depsgraph *depsgraph,
|
||||
Scene *scene,
|
||||
Object *ob,
|
||||
ModifierData *md,
|
||||
int mode,
|
||||
bool keep_modifier);
|
||||
bool modifier_copy(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md);
|
||||
void modifier_link(bContext *C, Object *ob_dst, Object *ob_src);
|
||||
void modifier_copy_to_object(bContext *C, Object *ob_dst, Object *ob_src, ModifierData *md);
|
||||
|
||||
/**
|
||||
* If the object data of 'orig_ob' has other users, run 'callback' on
|
||||
|
@ -529,76 +503,65 @@ void ED_object_modifier_copy_to_object(bContext *C,
|
|||
* If the callback ever returns true, iteration will stop and the
|
||||
* function value will be true. Otherwise the function returns false.
|
||||
*/
|
||||
bool ED_object_iter_other(Main *bmain,
|
||||
Object *orig_ob,
|
||||
bool include_orig,
|
||||
bool (*callback)(Object *ob, void *callback_data),
|
||||
void *callback_data);
|
||||
bool iter_other(Main *bmain,
|
||||
Object *orig_ob,
|
||||
bool include_orig,
|
||||
bool (*callback)(Object *ob, void *callback_data),
|
||||
void *callback_data);
|
||||
|
||||
/**
|
||||
* Use with #ED_object_iter_other(). Sets the total number of levels
|
||||
* Use with #iter_other(). Sets the total number of levels
|
||||
* for any multi-res modifiers on the object to the int pointed to by callback_data.
|
||||
*/
|
||||
bool ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v);
|
||||
bool multires_update_totlevels(Object *ob, void *totlevel_v);
|
||||
|
||||
/* `object_greasepencil_modifier.cc` */
|
||||
|
||||
GpencilModifierData *ED_object_gpencil_modifier_add(
|
||||
GpencilModifierData *gpencil_modifier_add(
|
||||
ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type);
|
||||
bool ED_object_gpencil_modifier_remove(ReportList *reports,
|
||||
Main *bmain,
|
||||
Object *ob,
|
||||
GpencilModifierData *md);
|
||||
void ED_object_gpencil_modifier_clear(Main *bmain, Object *ob);
|
||||
bool ED_object_gpencil_modifier_move_down(ReportList *reports,
|
||||
Object *ob,
|
||||
GpencilModifierData *md);
|
||||
bool ED_object_gpencil_modifier_move_up(ReportList *reports, Object *ob, GpencilModifierData *md);
|
||||
bool ED_object_gpencil_modifier_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
GpencilModifierData *md,
|
||||
int index);
|
||||
bool ED_object_gpencil_modifier_apply(Main *bmain,
|
||||
ReportList *reports,
|
||||
Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
GpencilModifierData *md,
|
||||
int mode);
|
||||
bool ED_object_gpencil_modifier_copy(ReportList *reports, Object *ob, GpencilModifierData *md);
|
||||
void ED_object_gpencil_modifier_copy_to_object(Object *ob_dst, GpencilModifierData *md);
|
||||
bool gpencil_modifier_remove(ReportList *reports,
|
||||
Main *bmain,
|
||||
Object *ob,
|
||||
GpencilModifierData *md);
|
||||
void gpencil_modifier_clear(Main *bmain, Object *ob);
|
||||
bool gpencil_modifier_move_down(ReportList *reports, Object *ob, GpencilModifierData *md);
|
||||
bool gpencil_modifier_move_up(ReportList *reports, Object *ob, GpencilModifierData *md);
|
||||
bool gpencil_modifier_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
GpencilModifierData *md,
|
||||
int index);
|
||||
bool gpencil_modifier_apply(Main *bmain,
|
||||
ReportList *reports,
|
||||
Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
GpencilModifierData *md,
|
||||
int mode);
|
||||
bool gpencil_modifier_copy(ReportList *reports, Object *ob, GpencilModifierData *md);
|
||||
void gpencil_modifier_copy_to_object(Object *ob_dst, GpencilModifierData *md);
|
||||
|
||||
/* `object_shader_fx.cc` */
|
||||
|
||||
ShaderFxData *ED_object_shaderfx_add(
|
||||
ShaderFxData *shaderfx_add(
|
||||
ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type);
|
||||
bool ED_object_shaderfx_remove(ReportList *reports, Main *bmain, Object *ob, ShaderFxData *fx);
|
||||
void ED_object_shaderfx_clear(Main *bmain, Object *ob);
|
||||
int ED_object_shaderfx_move_down(ReportList *reports, Object *ob, ShaderFxData *fx);
|
||||
int ED_object_shaderfx_move_up(ReportList *reports, Object *ob, ShaderFxData *fx);
|
||||
bool ED_object_shaderfx_move_to_index(ReportList *reports,
|
||||
Object *ob,
|
||||
ShaderFxData *fx,
|
||||
int index);
|
||||
void ED_object_shaderfx_link(Object *dst, Object *src);
|
||||
void ED_object_shaderfx_copy(Object *dst, ShaderFxData *fx);
|
||||
bool shaderfx_remove(ReportList *reports, Main *bmain, Object *ob, ShaderFxData *fx);
|
||||
void shaderfx_clear(Main *bmain, Object *ob);
|
||||
int shaderfx_move_down(ReportList *reports, Object *ob, ShaderFxData *fx);
|
||||
int shaderfx_move_up(ReportList *reports, Object *ob, ShaderFxData *fx);
|
||||
bool shaderfx_move_to_index(ReportList *reports, Object *ob, ShaderFxData *fx, int index);
|
||||
void shaderfx_link(Object *dst, Object *src);
|
||||
void shaderfx_copy(Object *dst, ShaderFxData *fx);
|
||||
|
||||
/* `object_select.cc` */
|
||||
|
||||
void ED_object_select_linked_by_id(bContext *C, ID *id);
|
||||
void select_linked_by_id(bContext *C, ID *id);
|
||||
|
||||
const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(const bContext *C,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
bool *r_free,
|
||||
unsigned int selection_mask);
|
||||
|
||||
void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object);
|
||||
void check_force_modifiers(Main *bmain, Scene *scene, Object *object);
|
||||
|
||||
/**
|
||||
* If id is not already an Object, try to find an object that uses it as data.
|
||||
* Prefers active, then selected, then visible/selectable.
|
||||
*/
|
||||
Base *ED_object_find_first_by_data_id(const Scene *scene, ViewLayer *view_layer, ID *id);
|
||||
Base *find_first_by_data_id(const Scene *scene, ViewLayer *view_layer, ID *id);
|
||||
|
||||
/**
|
||||
* Select and make the target object active in the view layer.
|
||||
|
@ -606,7 +569,7 @@ Base *ED_object_find_first_by_data_id(const Scene *scene, ViewLayer *view_layer,
|
|||
*
|
||||
* \returns false if not found in current view layer
|
||||
*/
|
||||
bool ED_object_jump_to_object(bContext *C, Object *ob, bool reveal_hidden);
|
||||
bool jump_to_object(bContext *C, Object *ob, bool reveal_hidden);
|
||||
/**
|
||||
* Select and make the target object and bone active.
|
||||
* Switches to Pose mode if in Object mode so the selection is visible.
|
||||
|
@ -614,25 +577,23 @@ bool ED_object_jump_to_object(bContext *C, Object *ob, bool reveal_hidden);
|
|||
*
|
||||
* \returns false if object not in layer, bone not found, or other error
|
||||
*/
|
||||
bool ED_object_jump_to_bone(bContext *C, Object *ob, const char *bone_name, bool reveal_hidden);
|
||||
bool jump_to_bone(bContext *C, Object *ob, const char *bone_name, bool reveal_hidden);
|
||||
|
||||
/* `object_data_transform.cc` */
|
||||
|
||||
XFormObjectData *ED_object_data_xform_create_ex(ID *id, bool is_edit_mode);
|
||||
XFormObjectData *ED_object_data_xform_create(ID *id);
|
||||
XFormObjectData *ED_object_data_xform_create_from_edit_mode(ID *id);
|
||||
XFormObjectData *data_xform_create_ex(ID *id, bool is_edit_mode);
|
||||
XFormObjectData *data_xform_create(ID *id);
|
||||
XFormObjectData *data_xform_create_from_edit_mode(ID *id);
|
||||
|
||||
void ED_object_data_xform_destroy(XFormObjectData *xod_base);
|
||||
void data_xform_destroy(XFormObjectData *xod_base);
|
||||
|
||||
void ED_object_data_xform_by_mat4(XFormObjectData *xod, const float mat[4][4]);
|
||||
void data_xform_by_mat4(XFormObjectData *xod, const float mat[4][4]);
|
||||
|
||||
void ED_object_data_xform_restore(XFormObjectData *xod);
|
||||
void ED_object_data_xform_tag_update(XFormObjectData *xod);
|
||||
|
||||
namespace blender::ed::object {
|
||||
void data_xform_restore(XFormObjectData *xod);
|
||||
void data_xform_tag_update(XFormObjectData *xod);
|
||||
|
||||
void ui_template_modifier_asset_menu_items(uiLayout &layout,
|
||||
const bContext &C,
|
||||
StringRef catalog_path);
|
||||
|
||||
}
|
||||
} // namespace blender::ed::object
|
||||
|
|
|
@ -11,76 +11,90 @@
|
|||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
struct bDeformGroup;
|
||||
struct EnumPropertyItem;
|
||||
struct ID;
|
||||
struct MDeformVert;
|
||||
struct Object;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
|
||||
#define WEIGHT_REPLACE 1
|
||||
#define WEIGHT_ADD 2
|
||||
#define WEIGHT_SUBTRACT 3
|
||||
|
||||
bool ED_vgroup_sync_from_pose(Object *ob);
|
||||
void ED_vgroup_select_by_name(Object *ob, const char *name);
|
||||
namespace blender::ed::object {
|
||||
|
||||
bool vgroup_sync_from_pose(Object *ob);
|
||||
void vgroup_select_by_name(Object *ob, const char *name);
|
||||
/**
|
||||
* Removes out of range #MDeformWeights
|
||||
*/
|
||||
void ED_vgroup_data_clamp_range(ID *id, int total);
|
||||
void vgroup_data_clamp_range(ID *id, int total);
|
||||
/**
|
||||
* Matching index only.
|
||||
*/
|
||||
bool ED_vgroup_array_copy(Object *ob, Object *ob_from);
|
||||
bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, bool use_vert_sel);
|
||||
bool vgroup_array_copy(Object *ob, Object *ob_from);
|
||||
bool vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, bool use_vert_sel);
|
||||
/**
|
||||
* For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true.
|
||||
* This finds the unselected mirror deform verts and copies the weights to them from the selected.
|
||||
* For use with tools that use vgroup_parray_alloc with \a use_vert_sel ==
|
||||
* true. This finds the unselected mirror deform verts and copies the weights to them from the
|
||||
* selected.
|
||||
*
|
||||
* \note \a dvert_array has mirrored weights filled in,
|
||||
* in case cleanup operations are needed on both.
|
||||
*/
|
||||
void ED_vgroup_parray_mirror_sync(Object *ob,
|
||||
MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const bool *vgroup_validmap,
|
||||
int vgroup_tot);
|
||||
void vgroup_parray_mirror_sync(Object *ob,
|
||||
MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const bool *vgroup_validmap,
|
||||
int vgroup_tot);
|
||||
/**
|
||||
* Fill in the pointers for mirror verts (as if all mirror verts were selected too).
|
||||
*
|
||||
* similar to #ED_vgroup_parray_mirror_sync but only fill in mirror points.
|
||||
* similar to #vgroup_parray_mirror_sync but only fill in mirror points.
|
||||
*/
|
||||
void ED_vgroup_parray_mirror_assign(Object *ob, MDeformVert **dvert_array, int dvert_tot);
|
||||
void ED_vgroup_parray_remove_zero(MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const bool *vgroup_validmap,
|
||||
int vgroup_tot,
|
||||
float epsilon,
|
||||
bool keep_single);
|
||||
void ED_vgroup_parray_to_weight_array(const MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
float *dvert_weights,
|
||||
int def_nr);
|
||||
void ED_vgroup_parray_from_weight_array(MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const float *dvert_weights,
|
||||
int def_nr,
|
||||
bool remove_zero);
|
||||
void ED_vgroup_mirror(Object *ob,
|
||||
bool mirror_weights,
|
||||
bool flip_vgroups,
|
||||
bool all_vgroups,
|
||||
bool use_topology,
|
||||
int *r_totmirr,
|
||||
int *r_totfail);
|
||||
void vgroup_parray_mirror_assign(Object *ob, MDeformVert **dvert_array, int dvert_tot);
|
||||
void vgroup_parray_remove_zero(MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const bool *vgroup_validmap,
|
||||
int vgroup_tot,
|
||||
float epsilon,
|
||||
bool keep_single);
|
||||
void vgroup_parray_to_weight_array(const MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
float *dvert_weights,
|
||||
int def_nr);
|
||||
void vgroup_parray_from_weight_array(MDeformVert **dvert_array,
|
||||
int dvert_tot,
|
||||
const float *dvert_weights,
|
||||
int def_nr,
|
||||
bool remove_zero);
|
||||
void vgroup_mirror(Object *ob,
|
||||
bool mirror_weights,
|
||||
bool flip_vgroups,
|
||||
bool all_vgroups,
|
||||
bool use_topology,
|
||||
int *r_totmirr,
|
||||
int *r_totfail);
|
||||
|
||||
/**
|
||||
* Called while not in editmode.
|
||||
*/
|
||||
void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode);
|
||||
void vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode);
|
||||
/**
|
||||
* Mesh object mode, lattice can be in edit-mode.
|
||||
*/
|
||||
void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum);
|
||||
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum);
|
||||
void vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum);
|
||||
float vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum);
|
||||
/**
|
||||
* Use when adjusting the active vertex weight and apply to mirror vertices.
|
||||
*/
|
||||
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr);
|
||||
void vgroup_vert_active_mirror(Object *ob, int def_nr);
|
||||
|
||||
const EnumPropertyItem *vgroup_selection_itemf_helper(const bContext *C,
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *prop,
|
||||
bool *r_free,
|
||||
unsigned int selection_mask);
|
||||
|
||||
} // namespace blender::ed::object
|
||||
|
|
|
@ -53,27 +53,27 @@ set(SRC
|
|||
interface_ops.cc
|
||||
interface_panel.cc
|
||||
interface_query.cc
|
||||
interface_region_color_picker.cc
|
||||
interface_region_hud.cc
|
||||
interface_region_menu_pie.cc
|
||||
interface_region_menu_popup.cc
|
||||
interface_region_popover.cc
|
||||
interface_region_popup.cc
|
||||
interface_region_search.cc
|
||||
interface_region_tooltip.cc
|
||||
interface_regions.cc
|
||||
regions/interface_region_color_picker.cc
|
||||
regions/interface_region_hud.cc
|
||||
regions/interface_region_menu_pie.cc
|
||||
regions/interface_region_menu_popup.cc
|
||||
regions/interface_region_popover.cc
|
||||
regions/interface_region_popup.cc
|
||||
regions/interface_region_search.cc
|
||||
regions/interface_region_tooltip.cc
|
||||
regions/interface_regions.cc
|
||||
interface_string_search.cc
|
||||
interface_style.cc
|
||||
interface_template_asset_view.cc
|
||||
interface_template_attribute_search.cc
|
||||
interface_template_bone_collection_tree.cc
|
||||
interface_template_light_linking.cc
|
||||
interface_template_list.cc
|
||||
interface_template_node_inputs.cc
|
||||
interface_template_node_tree_interface.cc
|
||||
interface_template_search_menu.cc
|
||||
interface_template_search_operator.cc
|
||||
interface_templates.cc
|
||||
templates/interface_template_asset_view.cc
|
||||
templates/interface_template_attribute_search.cc
|
||||
templates/interface_template_bone_collection_tree.cc
|
||||
templates/interface_template_light_linking.cc
|
||||
templates/interface_template_list.cc
|
||||
templates/interface_template_node_inputs.cc
|
||||
templates/interface_template_node_tree_interface.cc
|
||||
templates/interface_template_search_menu.cc
|
||||
templates/interface_template_search_operator.cc
|
||||
templates/interface_templates.cc
|
||||
interface_undo.cc
|
||||
interface_utils.cc
|
||||
interface_widgets.cc
|
||||
|
@ -91,7 +91,7 @@ set(SRC
|
|||
|
||||
eyedroppers/eyedropper_intern.hh
|
||||
interface_intern.hh
|
||||
interface_regions_intern.hh
|
||||
regions/interface_regions_intern.hh
|
||||
view2d_intern.hh
|
||||
)
|
||||
|
||||
|
@ -126,11 +126,10 @@ endif()
|
|||
if(WITH_EXPERIMENTAL_FEATURES)
|
||||
add_definitions(-DWITH_GREASE_PENCIL_V3)
|
||||
list(APPEND SRC
|
||||
interface_template_grease_pencil_layer_tree.cc
|
||||
templates/interface_template_grease_pencil_layer_tree.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
||||
# RNA_prototypes.h
|
||||
|
|
|
@ -1439,11 +1439,7 @@ static std::optional<std::string> ui_but_event_property_operator_string(const bC
|
|||
}
|
||||
|
||||
/* We have a data-path! */
|
||||
bool found = false;
|
||||
|
||||
for (int data_path_index = 0; data_path_index < data_path_variations.size() && (found == false);
|
||||
data_path_index++)
|
||||
{
|
||||
for (int data_path_index = 0; data_path_index < data_path_variations.size(); data_path_index++) {
|
||||
const StringRefNull data_path = data_path_variations[data_path_index];
|
||||
if (!data_path.is_empty() || (prop_enum_value_ok && prop_enum_value_id)) {
|
||||
/* Create a property to host the "data_path" property we're sending to the operators. */
|
||||
|
@ -6421,7 +6417,7 @@ std::string UI_but_string_get_rna_label(uiBut &but)
|
|||
}
|
||||
if (but.optype) {
|
||||
PointerRNA *opptr = UI_but_operator_ptr_ensure(&but);
|
||||
return WM_operatortype_name(but.optype, opptr).c_str();
|
||||
return WM_operatortype_name(but.optype, opptr);
|
||||
}
|
||||
if (ELEM(but.type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER)) {
|
||||
if (MenuType *mt = UI_but_menutype_get(&but)) {
|
||||
|
@ -6429,7 +6425,7 @@ std::string UI_but_string_get_rna_label(uiBut &but)
|
|||
}
|
||||
|
||||
if (wmOperatorType *ot = UI_but_operatortype_get_from_enum_menu(&but, nullptr)) {
|
||||
return WM_operatortype_name(ot, nullptr).c_str();
|
||||
return WM_operatortype_name(ot, nullptr);
|
||||
}
|
||||
|
||||
if (PanelType *pt = UI_but_paneltype_get(&but)) {
|
||||
|
@ -6494,7 +6490,7 @@ std::string UI_but_string_get_rna_tooltip(bContext &C, uiBut &but)
|
|||
}
|
||||
|
||||
if (wmOperatorType *ot = UI_but_operatortype_get_from_enum_menu(&but, nullptr)) {
|
||||
return WM_operatortype_description(&C, ot, nullptr).c_str();
|
||||
return WM_operatortype_description(&C, ot, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1599,7 +1599,7 @@ static bool jump_to_target_ptr(bContext *C, PointerRNA ptr, const bool poll)
|
|||
base = BKE_view_layer_base_find(view_layer, (Object *)ptr.owner_id);
|
||||
}
|
||||
else if (OB_DATA_SUPPORT_ID(id_type)) {
|
||||
base = ED_object_find_first_by_data_id(scene, view_layer, ptr.owner_id);
|
||||
base = blender::ed::object::find_first_by_data_id(scene, view_layer, ptr.owner_id);
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
|
@ -1614,10 +1614,10 @@ static bool jump_to_target_ptr(bContext *C, PointerRNA ptr, const bool poll)
|
|||
const bool reveal_hidden = true;
|
||||
/* Select and activate the target. */
|
||||
if (target_type == &RNA_Bone) {
|
||||
ok = ED_object_jump_to_bone(C, base->object, bone_name, reveal_hidden);
|
||||
ok = blender::ed::object::jump_to_bone(C, base->object, bone_name, reveal_hidden);
|
||||
}
|
||||
else if (target_type == &RNA_Object) {
|
||||
ok = ED_object_jump_to_object(C, base->object, reveal_hidden);
|
||||
ok = blender::ed::object::jump_to_object(C, base->object, reveal_hidden);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
|
|
|
@ -1053,7 +1053,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
|
|||
if (do_scene_obj) {
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ED_object_single_user(bmain, scene, (Object *)id);
|
||||
blender::ed::object::object_single_user_make(bmain, scene, (Object *)id);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
DEG_relations_tag_update(bmain);
|
||||
}
|
||||
|
@ -2293,7 +2293,7 @@ void uiTemplateModifiers(uiLayout * /*layout*/, bContext *C)
|
|||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
Object *ob = ED_object_active_context(C);
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
ListBase *modifiers = &ob->modifiers;
|
||||
|
||||
const bool panels_match = UI_panel_list_matches_data(region, modifiers, modifier_panel_id);
|
||||
|
@ -2438,10 +2438,10 @@ void uiTemplateConstraints(uiLayout * /*layout*/, bContext *C, bool use_bone_con
|
|||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
Object *ob = ED_object_active_context(C);
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
ListBase *constraints = {nullptr};
|
||||
if (use_bone_constraints) {
|
||||
constraints = ED_object_pose_constraint_list(C);
|
||||
constraints = blender::ed::object::pose_constraint_list(C);
|
||||
}
|
||||
else if (ob != nullptr) {
|
||||
constraints = &ob->constraints;
|
||||
|
@ -2541,7 +2541,7 @@ static void gpencil_modifier_panel_id(void *md_link, char *r_name)
|
|||
void uiTemplateGpencilModifiers(uiLayout * /*layout*/, bContext *C)
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
ListBase *modifiers = &ob->greasepencil_modifiers;
|
||||
|
||||
const bool panels_match = UI_panel_list_matches_data(
|
||||
|
@ -2615,7 +2615,7 @@ static void shaderfx_panel_id(void *fx_v, char *r_idname)
|
|||
void uiTemplateShaderFx(uiLayout * /*layout*/, bContext *C)
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Object *ob = ED_object_active_context(C);
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
ListBase *shaderfx = &ob->shader_fx;
|
||||
|
||||
const bool panels_match = UI_panel_list_matches_data(region, shaderfx, shaderfx_panel_id);
|
||||
|
@ -2972,7 +2972,8 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C)
|
|||
|
||||
static void constraint_active_func(bContext * /*C*/, void *ob_v, void *con_v)
|
||||
{
|
||||
ED_object_constraint_active_set(static_cast<Object *>(ob_v), static_cast<bConstraint *>(con_v));
|
||||
blender::ed::object::constraint_active_set(static_cast<Object *>(ob_v),
|
||||
static_cast<bConstraint *>(con_v));
|
||||
}
|
||||
|
||||
static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v)
|
||||
|
@ -2981,7 +2982,7 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v
|
|||
uiLayout *row;
|
||||
bConstraint *con = (bConstraint *)con_v;
|
||||
|
||||
Object *ob = ED_object_active_context(C);
|
||||
Object *ob = blender::ed::object::context_active_object(C);
|
||||
|
||||
PointerRNA ptr = RNA_pointer_create(&ob->id, &RNA_Constraint, con);
|
||||
uiLayoutSetContextPointer(layout, "constraint", &ptr);
|
||||
|
@ -3033,7 +3034,8 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v
|
|||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
ListBase *constraint_list = ED_object_constraint_list_from_constraint(ob, con, nullptr);
|
||||
ListBase *constraint_list = blender::ed::object::constraint_list_from_constraint(
|
||||
ob, con, nullptr);
|
||||
RNA_int_set(&op_ptr, "index", BLI_listbase_count(constraint_list) - 1);
|
||||
if (!con->next) {
|
||||
uiLayoutSetEnabled(row, false);
|
|
@ -631,7 +631,7 @@ static int wm_alembic_import_exec(bContext *C, wmOperator *op)
|
|||
/* Switch out of edit mode to avoid being stuck in it (#54326). */
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit) {
|
||||
ED_object_mode_set(C, OB_MODE_OBJECT);
|
||||
blender::ed::object::mode_set(C, OB_MODE_OBJECT);
|
||||
}
|
||||
|
||||
AlembicImportParams params = {0};
|
||||
|
|
|
@ -154,7 +154,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
/* get editmode results */
|
||||
ED_object_editmode_load(bmain, CTX_data_edit_object(C));
|
||||
blender::ed::object::editmode_load(bmain, CTX_data_edit_object(C));
|
||||
|
||||
// Scene *scene = CTX_data_scene(C);
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
|
|||
/* Switch out of edit mode to avoid being stuck in it (#54326). */
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit) {
|
||||
ED_object_mode_set(C, OB_MODE_EDIT);
|
||||
blender::ed::object::mode_set(C, OB_MODE_EDIT);
|
||||
}
|
||||
|
||||
const bool validate_meshes = false;
|
||||
|
|
|
@ -665,7 +665,7 @@ bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Par
|
|||
|
||||
BKE_view_layer_synced_ensure(vc.scene, vc.view_layer);
|
||||
if (BKE_view_layer_active_base_get(vc.view_layer) != basact) {
|
||||
ED_object_base_activate(C, basact);
|
||||
blender::ed::object::base_activate(C, basact);
|
||||
}
|
||||
|
||||
DEG_id_tag_update(static_cast<ID *>(vc.obedit->data), ID_RECALC_SELECT);
|
||||
|
|
|
@ -68,7 +68,7 @@ static int make_regular_exec(bContext *C, wmOperator *op)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(ob, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(ob, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ static int lattice_flip_exec(bContext *C, wmOperator *op)
|
|||
lt = (Lattice *)obedit->data;
|
||||
lt = lt->editlatt->latt;
|
||||
|
||||
if (ED_object_edit_report_if_shape_key_is_locked(obedit, op->reports)) {
|
||||
if (blender::ed::object::shape_key_report_if_locked(obedit, op->reports)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@ static Object *make_prim_init(bContext *C,
|
|||
|
||||
r_creation_data->was_editmode = false;
|
||||
if (obedit == nullptr || obedit->type != OB_MESH) {
|
||||
obedit = ED_object_add_type(C, OB_MESH, idname, loc, rot, false, local_view_bits);
|
||||
ED_object_editmode_enter_ex(bmain, scene, obedit, 0);
|
||||
obedit = blender::ed::object::add_type(C, OB_MESH, idname, loc, rot, false, local_view_bits);
|
||||
blender::ed::object::editmode_enter_ex(bmain, scene, obedit, 0);
|
||||
|
||||
r_creation_data->was_editmode = true;
|
||||
}
|
||||
|
||||
ED_object_new_primitive_matrix(C, obedit, loc, rot, scale, r_creation_data->mat);
|
||||
blender::ed::object::new_primitive_matrix(C, obedit, loc, rot, scale, r_creation_data->mat);
|
||||
|
||||
return obedit;
|
||||
}
|
||||
|
@ -84,7 +84,8 @@ static void make_prim_finish(bContext *C,
|
|||
|
||||
/* userdef */
|
||||
if (exit_editmode) {
|
||||
ED_object_editmode_exit_ex(CTX_data_main(C), CTX_data_scene(C), obedit, EM_FREEDATA);
|
||||
blender::ed::object::editmode_exit_ex(
|
||||
CTX_data_main(C), CTX_data_scene(C), obedit, blender::ed::object::EM_FREEDATA);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
|
||||
}
|
||||
|
@ -100,7 +101,7 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Plane"),
|
||||
|
@ -150,9 +151,9 @@ void MESH_OT_primitive_plane_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_size(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_size(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_cube_exec(bContext *C, wmOperator *op)
|
||||
|
@ -166,7 +167,7 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, scale, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cube"),
|
||||
|
@ -214,9 +215,9 @@ void MESH_OT_primitive_cube_add(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_unit_props_size(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_size(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static const EnumPropertyItem fill_type_items[] = {
|
||||
|
@ -241,7 +242,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
|
|||
cap_tri = (cap_end == 2);
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Circle"),
|
||||
|
@ -294,11 +295,11 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
|
|||
|
||||
/* props */
|
||||
RNA_def_int(ot->srna, "vertices", 32, 3, MESH_ADD_VERTS_MAXI, "Vertices", "", 3, 500);
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
RNA_def_enum(ot->srna, "fill_type", fill_type_items, 0, "Fill Type", "");
|
||||
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
|
||||
|
@ -315,7 +316,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, scale, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cylinder"),
|
||||
|
@ -369,13 +370,13 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
|
|||
|
||||
/* props */
|
||||
RNA_def_int(ot->srna, "vertices", 32, 3, MESH_ADD_VERTS_MAXI, "Vertices", "", 3, 500);
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
RNA_def_float_distance(
|
||||
ot->srna, "depth", 2.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Depth", "", 0.001, 100.00);
|
||||
RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Cap Fill Type", "");
|
||||
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_cone_exec(bContext *C, wmOperator *op)
|
||||
|
@ -392,7 +393,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, scale, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cone"),
|
||||
|
@ -454,8 +455,8 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
|
|||
ot->srna, "depth", 2.0f, 0.0, OBJECT_ADD_SIZE_MAXF, "Depth", "", 0.001, 100.00);
|
||||
RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Base Fill Type", "");
|
||||
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_grid_exec(bContext *C, wmOperator *op)
|
||||
|
@ -469,7 +470,7 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Grid"),
|
||||
|
@ -526,9 +527,9 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
|
|||
RNA_def_int(
|
||||
ot->srna, "y_subdivisions", 10, 1, MESH_ADD_VERTS_MAXI, "Y Subdivisions", "", 1, 1000);
|
||||
|
||||
ED_object_add_unit_props_size(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_size(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
|
||||
|
@ -543,7 +544,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Y', loc, rot, nullptr, &enter_editmode, &local_view_bits, nullptr);
|
||||
|
||||
obedit = make_prim_init(C,
|
||||
|
@ -593,9 +594,9 @@ void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
|
|||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* props */
|
||||
ED_object_add_unit_props_size(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_size(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
|
||||
|
@ -609,7 +610,7 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, scale, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Sphere"),
|
||||
|
@ -664,9 +665,9 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
|
|||
RNA_def_int(ot->srna, "segments", 32, 3, MESH_ADD_VERTS_MAXI / 100, "Segments", "", 3, 500);
|
||||
RNA_def_int(ot->srna, "ring_count", 16, 3, MESH_ADD_VERTS_MAXI / 100, "Rings", "", 3, 500);
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
||||
static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
|
||||
|
@ -680,7 +681,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
|
|||
const bool calc_uvs = RNA_boolean_get(op->ptr, "calc_uvs");
|
||||
|
||||
WM_operator_view3d_unit_defaults(C, op);
|
||||
ED_object_add_generic_get_opts(
|
||||
blender::ed::object::add_generic_get_opts(
|
||||
C, op, 'Z', loc, rot, scale, &enter_editmode, &local_view_bits, nullptr);
|
||||
obedit = make_prim_init(C,
|
||||
CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Icosphere"),
|
||||
|
@ -731,7 +732,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
|
|||
/* props */
|
||||
RNA_def_int(ot->srna, "subdivisions", 2, 1, 10, "Subdivisions", "", 1, 8);
|
||||
|
||||
ED_object_add_unit_props_radius(ot);
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_unit_props_radius(ot);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
}
|
||||
|
|
|
@ -388,8 +388,8 @@ void MESH_OT_primitive_cube_add_gizmo(wmOperatorType *ot)
|
|||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ED_object_add_mesh_props(ot);
|
||||
ED_object_add_generic_props(ot, true);
|
||||
blender::ed::object::add_mesh_props(ot);
|
||||
blender::ed::object::add_generic_props(ot, true);
|
||||
|
||||
/* hidden props */
|
||||
PropertyRNA *prop = RNA_def_float_matrix(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue