46 const bool use_adaptive_subdivision)
49 return &BKE_mesh_wrapper_ensure_subdivision(blender::id_cast<blender::Mesh *>(b_ob.
data))->
id;
92 blender::id_cast<blender::Mesh *>(b_ob_info.
object_data) :
127 BKE_id_free(
nullptr, &mesh.
id);
136 const int full_size =
size + 1;
137 ramp_color.
resize(full_size);
138 ramp_alpha.
resize(full_size);
140 for (
int i = 0; i < full_size; i++) {
143 BKE_colorband_evaluate(&ramp,
float(i) /
float(
size), color);
144 ramp_color[i] =
make_float3(color[0], color[1], color[2]);
145 ramp_alpha[i] = color[3];
154 *min_x =
min(*min_x, points.
first().x);
155 *max_x =
max(*max_x, points.
last().x);
159 const int num_curves,
166 for (
int i = 0; i < num_curves; ++i) {
178 const int full_size =
size + 1;
179 data.resize(full_size);
183 for (
int i = 0; i < full_size; i++) {
185 data[i] = BKE_curvemap_evaluateF(&cumap, &curve, t);
198 const float range =
max -
min;
204 const int full_size =
size + 1;
205 data.resize(full_size);
209 for (
int i = 0; i < full_size; i++) {
211 data[i] = BKE_curvemap_evaluateF(&cumap, &map, t);
234 const int num_curves = rgb_curve ? 4 : 3;
237 const float range_x = max_x - min_x;
248 const int full_size =
size + 1;
249 data.resize(full_size);
257 for (
int i = 0; i < full_size; i++) {
260 BKE_curvemap_evaluateF(&cumap, &mapR, BKE_curvemap_evaluateF(&cumap, &mapI, t)),
261 BKE_curvemap_evaluateF(&cumap, &mapG, BKE_curvemap_evaluateF(&cumap, &mapI, t)),
262 BKE_curvemap_evaluateF(&cumap, &mapB, BKE_curvemap_evaluateF(&cumap, &mapI, t)));
270 for (
int i = 0; i < full_size; i++) {
272 data[i] =
make_float3(BKE_curvemap_evaluateF(&cumap, &mapR, t),
273 BKE_curvemap_evaluateF(&cumap, &mapG, t),
274 BKE_curvemap_evaluateF(&cumap, &mapB, t));
295 return b_render.
xsch * b_render.
size / 100;
300 return b_render.
ysch * b_render.
size / 100;
309 BKE_image_user_frame_calc(&ima, &iuser, cfra);
310 BKE_image_user_file_path_ex(&data, &iuser, &ima, filepath,
false,
true);
312 return string(filepath);
319 BKE_image_user_frame_calc(&ima, &iuser, cfra);
343 BKE_render_result_stamp_data(&b_rr, name.c_str(), value.c_str());
352 const float *ptr = matrix.
base_ptr();
372 RNA_float_get_array(&ptr, name, &f.
x);
378 RNA_float_set_array(&ptr, name, &value.
x);
384 RNA_float_get_array(&ptr, name, &f.
x);
390 RNA_float_set_array(&ptr, name, &value.
x);
396 RNA_float_get_array(&ptr, name, &f.
x);
402 RNA_float_set_array(&ptr, name, &value.
x);
407 return RNA_boolean_get(&ptr, name) ? true :
false;
412 RNA_boolean_set(&ptr, name, (
int)value);
417 return RNA_float_get(&ptr, name);
422 RNA_float_set(&ptr, name, value);
427 return RNA_int_get(&ptr, name);
432 RNA_int_set(&ptr, name, value);
445 int default_value = -1)
447 int value = RNA_enum_get(&ptr, name);
448 if (num_values != -1 && value >= num_values) {
449 assert(default_value != -1);
450 value = default_value;
458 const char *identifier =
"";
459 const int value = RNA_property_enum_get(&ptr, prop);
461 RNA_property_enum_identifier(
nullptr, &ptr, prop, value, &identifier);
463 return string(identifier);
468 RNA_enum_set(&ptr, name, value);
473 RNA_enum_set_identifier(
nullptr, &ptr, name, identifier.c_str());
478 return RNA_string_get(&ptr, name);
483 RNA_string_set(&ptr, name, value.c_str());
492 if (path.size() >= 2 && path[0] ==
'/' && path[1] ==
'/') {
495 if (b_id && b_id->
lib) {
516 const auto &text = *blender::id_cast<const blender::Text *>(
id);
520 content += line.
line ? line.
line :
"";
531 float texspace_location[3];
532 float texspace_size[3];
533 BKE_mesh_texspace_get(
const_cast<blender::Mesh *
>(&b_mesh), texspace_location, texspace_size);
535 loc =
make_float3(texspace_location[0], texspace_location[1], texspace_location[2]);
536 size =
make_float3(texspace_size[0], texspace_size[1], texspace_size[2]);
538 if (
size.x != 0.0f) {
541 if (
size.y != 0.0f) {
544 if (
size.z != 0.0f) {
559 bool use_motion =
get_boolean(cobject,
"use_motion_blur");
564 int steps =
max(1,
get_int(cobject,
"motion_steps"));
568 if (&b_parent != &b_ob) {
571 use_motion &=
get_boolean(parent_cobject,
"use_motion_blur");
577 steps =
max(steps,
get_int(parent_cobject,
"motion_steps"));
583 return min((2 << (steps - 1)) + 1, max_steps);
591 bool use_deform_motion =
get_boolean(cobject,
"use_deform_motion");
597 if (use_deform_motion && &b_parent != &b_ob) {
600 use_deform_motion &=
get_boolean(parent_cobject,
"use_deform_motion");
602 return use_deform_motion;
614 return b_mmd->domain;
634 if ((md->
mode & enabled_mode) == 0) {
646 const bool use_adaptive_subdivision)
648 if (!use_adaptive_subdivision) {
667 const bool use_adaptive_subdivision)
669 if (!use_adaptive_subdivision) {
772 const bool use_motion =
get_boolean(cobject,
"use_motion_blur");
801 edges_.insert(std::pair<int, int>(v0, v1));
807 return edges_.contains(std::pair<int, int>(v0, v1));
General operations, lookup, etc. for blender objects.
const char * dirname(char *path)
Object is a sort of wrapper for general info.
int blender_attribute_name_split_type(ustring name, string *r_real_name)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
set< std::pair< int, int > > edges_
void insert(int v0, int v1)
bool exists(int v0, int v1)
void get_sorted_verts(int &v0, int &v1)
@ SUBDIVISION_FVAR_LINEAR_NONE
@ SUBDIVISION_FVAR_LINEAR_CORNERS_PLUS2
@ SUBDIVISION_FVAR_LINEAR_CORNERS_ONLY
@ SUBDIVISION_FVAR_LINEAR_ALL
@ SUBDIVISION_FVAR_LINEAR_BOUNDARIES
@ SUBDIVISION_FVAR_LINEAR_CORNERS_PLUS1
@ SUBDIVISION_CATMULL_CLARK
@ SUBDIVISION_BOUNDARY_EDGE_ONLY
@ SUBDIVISION_BOUNDARY_EDGE_AND_CORNER
MotionType need_motion() const
T * resize(const size_t newsize)
constexpr const T & first() const
constexpr const T & last(const int64_t n=0) const
static void curvemapping_color_to_array(const blender::CurveMapping &cumap, array< packed_float3 > &data, const int size, bool rgb_curve)
static void set_float2(blender::PointerRNA &ptr, const char *name, const float2 value)
static string get_text_datablock_content(const blender::ID *id)
static blender::SubsurfModifierData * object_subdivision_modifier(blender::Object &b_ob, const bool preview)
static Transform get_transform(const blender::float4x4 &matrix)
static uint object_motion_steps(blender::Object &b_parent, blender::Object &b_ob, const int max_steps=INT_MAX)
static blender::ID * object_get_data(const blender::Object &b_ob, const bool use_adaptive_subdivision)
static void mesh_texture_space(const blender::Mesh &b_mesh, float3 &loc, float3 &size)
static void set_string(blender::PointerRNA &ptr, const char *name, const string &value)
static bool image_is_builtin(blender::Image &ima, blender::RenderEngine &engine)
static void set_enum(blender::PointerRNA &ptr, const char *name, const int value)
static bool region_view3d_navigating_or_transforming(const blender::RegionView3D *b_rv3d)
static PathRayVisibility object_ray_visibility(blender::Object &b_ob)
static void curvemap_minmax_curve(const blender::CurveMap &curve, float *min_x, float *max_x)
static blender::FluidDomainSettings * object_fluid_gas_domain_find(blender::Object &b_ob)
static float3 get_float3(blender::PointerRNA &ptr, const char *name)
static string get_string(blender::PointerRNA &ptr, const char *name)
static int render_resolution_y(const blender::RenderData &b_render)
static bool object_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
static void object_subdivision_to_mesh(blender::Object &b_ob, Mesh &mesh, const bool preview, const bool use_adaptive_subdivision)
static float4 get_float4(blender::PointerRNA &ptr, const char *name)
static void curvemapping_float_to_array(const blender::CurveMapping &cumap, array< float > &data, const int size)
static void curvemapping_to_array(const blender::CurveMapping &cumap, array< float > &data, const int size)
static Mesh::SubdivisionType object_subdivision_type(blender::Object &b_ob, const bool preview, const bool use_adaptive_subdivision)
static string blender_absolute_path(blender::Main &b_data, blender::ID *b_id, const string &path)
static float get_float(blender::PointerRNA &ptr, const char *name)
static blender::Mesh * object_to_mesh(BObjectInfo &b_ob_info)
static string get_enum_identifier(blender::PointerRNA &ptr, const char *name)
static void set_boolean(blender::PointerRNA &ptr, const char *name, bool value)
static bool object_use_deform_motion(blender::Object &b_parent, blender::Object &b_ob)
static blender::Mesh * object_copy_mesh_data(const BObjectInfo &b_ob_info)
static bool get_boolean(blender::PointerRNA &ptr, const char *name)
static void curvemapping_minmax(const blender::CurveMapping &cumap, const int num_curves, float *min_x, float *max_x)
static void colorramp_to_array(const blender::ColorBand &ramp, array< packed_float3 > &ramp_color, array< float > &ramp_alpha, const int size)
static int image_user_frame_number(blender::ImageUser &iuser, blender::Image &ima, const int cfra)
static string image_user_file_path(blender::Main &data, blender::ImageUser &iuser, blender::Image &ima, const int cfra)
static void render_add_metadata(blender::RenderResult &b_rr, string name, string value)
static int get_int(blender::PointerRNA &ptr, const char *name)
static bool BKE_object_is_deform_modified(BObjectInfo &self, blender::Scene &scene, bool preview)
static float2 get_float2(blender::PointerRNA &ptr, const char *name)
static void set_float3(blender::PointerRNA &ptr, const char *name, const float3 value)
static int get_enum(blender::PointerRNA &ptr, const char *name, int num_values=-1, int default_value=-1)
static void free_object_to_mesh(BObjectInfo &b_ob_info, blender::Mesh &mesh)
static void set_float(blender::PointerRNA &ptr, const char *name, const float value)
static void set_float4(blender::PointerRNA &ptr, const char *name, const float4 value)
static int render_resolution_x(const blender::RenderData &b_render)
#define CCL_NAMESPACE_END
#define assert(assertion)
void set_int(int val, int &outval)
const ccl_global KernelWorkTile * tile
uint32_t PathRayVisibility
@ PATH_RAY_VISIBILITY_VOLUME_SCATTER
@ PATH_RAY_VISIBILITY_CAMERA
@ PATH_RAY_VISIBILITY_TRANSMIT
@ PATH_RAY_VISIBILITY_SHADOW
@ PATH_RAY_VISIBILITY_RAYCAST
@ PATH_RAY_VISIBILITY_DIFFUSE
@ PATH_RAY_VISIBILITY_NONE
@ PATH_RAY_VISIBILITY_GLOSSY
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS
@ SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE
MatBase< float, 4, 4 > float4x4
@ eSubsurfModifierFlag_UseAdaptiveSubdivision
int BKE_object_is_deform_modified(Scene *scene, Object *ob)
@ SUBSURF_TYPE_CATMULL_CLARK
@ SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS
@ SUBSURF_BOUNDARY_SMOOTH_ALL
string path_dirname(const string &path)
string path_join(const string &dir, const string &file)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bool use_adaptive_subdivision
blender::Object * iter_object
bool is_real_object_data() const
blender::ID * object_data
blender::Object * real_object
const T * base_ptr() const
bke::MeshRuntime * runtime
ListBaseT< ModifierData > modifiers
eObject_VisibilityFlag visibility_flag
SubsurfModifierFlag flags
eSubsurfUVSmooth uv_smooth
eSubsurfBoundarySmooth boundary_smooth
std::shared_ptr< BMEditMesh > edit_mesh