BLI: refactor IndexMask for better performance and memory usage #104629
|
@ -824,7 +824,7 @@ static bool surfaceFormatSupported(const VkSurfaceFormatKHR &surface_format)
|
|||
/**
|
||||
* Select the surface format that we will use.
|
||||
*
|
||||
* We will select any 8bit unorm surface.
|
||||
* We will select any 8bit UNORM surface.
|
||||
*/
|
||||
static bool selectSurfaceFormat(const VkPhysicalDevice physical_device,
|
||||
const VkSurfaceKHR surface,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Name of subfolder inside BLENDER_DATAFILES that contains font files. */
|
||||
/* Name of sub-directory inside #BLENDER_DATAFILES that contains font files. */
|
||||
#define BLF_DATAFILES_FONTS_DIR "fonts"
|
||||
|
||||
/* File name of the default variable-width font. */
|
||||
|
|
|
@ -18,7 +18,7 @@ extern "C" {
|
|||
|
||||
/* Blender major and minor version. */
|
||||
#define BLENDER_VERSION 400
|
||||
/* Blender patch version for bugfix releases. */
|
||||
/* Blender patch version for bug-fix releases. */
|
||||
#define BLENDER_VERSION_PATCH 0
|
||||
/** Blender release cycle stage: alpha/beta/rc/release. */
|
||||
#define BLENDER_VERSION_CYCLE alpha
|
||||
|
|
|
@ -16,10 +16,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TODO_LAYER_OVERRIDE /* CollectionOverride */
|
||||
#define TODO_LAYER_OPERATORS /* collection mamanger and property panel operators */
|
||||
#define TODO_LAYER /* generic todo */
|
||||
|
||||
struct Base;
|
||||
struct BlendDataReader;
|
||||
struct BlendLibReader;
|
||||
|
|
|
@ -162,7 +162,7 @@ class ModifierSimulationCache {
|
|||
CacheState cache_state_ = CacheState::Valid;
|
||||
bool failed_finding_bake_ = false;
|
||||
|
||||
void try_discover_bake(StringRefNull meta_dir, StringRefNull bdata_dir);
|
||||
void try_discover_bake(StringRefNull absolute_bake_dir);
|
||||
|
||||
bool has_state_at_frame(const SubFrame &frame) const;
|
||||
bool has_states() const;
|
||||
|
|
|
@ -143,12 +143,11 @@ class DiskBDataWriter : public BDataWriter {
|
|||
};
|
||||
|
||||
/**
|
||||
* Get the directory that contains all baked simulation data for the given modifier. This is a
|
||||
* parent directory of the two directories below.
|
||||
* Get the directory that contains all baked simulation data for the given modifier.
|
||||
*/
|
||||
std::string get_bake_directory(const Main &bmain, const Object &object, const ModifierData &md);
|
||||
std::string get_bdata_directory(const Main &bmain, const Object &object, const ModifierData &md);
|
||||
std::string get_meta_directory(const Main &bmain, const Object &object, const ModifierData &md);
|
||||
std::string get_default_modifier_bake_directory(const Main &bmain,
|
||||
const Object &object,
|
||||
const ModifierData &md);
|
||||
|
||||
/**
|
||||
* Encode the simulation state in a #DictionaryValue which also contains references to external
|
||||
|
|
|
@ -3250,8 +3250,8 @@ static void animsys_create_action_track_strip(const AnimData *adt,
|
|||
* and this setting doesn't work. */
|
||||
r_action_strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
|
||||
|
||||
/* Unless extendmode is Nothing (might be useful for flattening NLA evaluation), disable range.
|
||||
* Extendmode Nothing and Hold will behave as normal. Hold Forward will behave just like Hold.
|
||||
/* Unless `extendmode` is Nothing (might be useful for flattening NLA evaluation), disable range.
|
||||
* Extend-mode Nothing and Hold will behave as normal. Hold Forward will behave just like Hold.
|
||||
*/
|
||||
if (r_action_strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
|
||||
r_action_strip->flag |= NLASTRIP_FLAG_NO_TIME_MAP;
|
||||
|
|
|
@ -104,7 +104,7 @@ static void armature_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src
|
|||
|
||||
BLI_duplicatelist(&armature_dst->bonebase, &armature_src->bonebase);
|
||||
|
||||
/* Duplicate the childrens' lists */
|
||||
/* Duplicate the children's lists. */
|
||||
bone_dst = armature_dst->bonebase.first;
|
||||
for (bone_src = armature_src->bonebase.first; bone_src; bone_src = bone_src->next) {
|
||||
bone_dst->parent = NULL;
|
||||
|
@ -2493,7 +2493,7 @@ void BKE_pose_where_is_bone(struct Depsgraph *depsgraph,
|
|||
/* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
|
||||
BKE_armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
|
||||
|
||||
/* Only rootbones get the cyclic offset (unless user doesn't want that). */
|
||||
/* Only root-bones get the cyclic offset (unless user doesn't want that). */
|
||||
/* XXX That could be a problem for snapping and other "reverse transform" features... */
|
||||
if (!pchan->parent) {
|
||||
if ((pchan->bone->flag & BONE_NO_CYCLICOFFSET) == 0) {
|
||||
|
|
|
@ -970,7 +970,7 @@ static bool collection_object_cyclic_check_internal(Object *object, Collection *
|
|||
if (object->instance_collection) {
|
||||
Collection *dup_collection = object->instance_collection;
|
||||
if ((dup_collection->id.tag & LIB_TAG_DOIT) == 0) {
|
||||
/* Cycle already exists in collections, let's prevent further crappyness */
|
||||
/* Cycle already exists in collections, let's prevent further creepiness. */
|
||||
return true;
|
||||
}
|
||||
/* flag the object to identify cyclic dependencies in further dupli collections */
|
||||
|
|
|
@ -4025,7 +4025,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
|
|||
mat4_to_size(dvec, ct->matrix);
|
||||
|
||||
if (is_negative_m4(ct->matrix)) {
|
||||
/* Bugfix #27886: (this is a limitation that riggers will have to live with for now).
|
||||
/* Bug-fix #27886: (this is a limitation that riggers will have to live with for now).
|
||||
* We can't be sure which axis/axes are negative,
|
||||
* though we know that something is negative.
|
||||
* Assume we don't care about negativity of separate axes. */
|
||||
|
|
|
@ -97,7 +97,7 @@ static int neighStraightY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
|
|||
|
||||
/* subframe_updateObject() flags */
|
||||
#define SUBFRAME_RECURSION 5
|
||||
/* surface_getBrushFlags() return vals */
|
||||
/* #surface_getBrushFlags() return values. */
|
||||
#define BRUSH_USES_VELOCITY (1 << 0)
|
||||
/* Brush mesh ray-cast status. */
|
||||
#define HIT_VOLUME 1
|
||||
|
|
|
@ -745,7 +745,7 @@ static int icon_gplayer_color_ensure_create_icon(bGPDlayer *gpl)
|
|||
BLI_assert(BLI_thread_is_main());
|
||||
|
||||
/* NOTE: The color previews for GP Layers don't really need
|
||||
* to be "rendered" to image per se (as it will just be a plain
|
||||
* to be "rendered" to image per-se (as it will just be a plain
|
||||
* colored rectangle), we need to define icon data here so that
|
||||
* we can store a pointer to the layer data in icon->obj.
|
||||
*/
|
||||
|
|
|
@ -1948,7 +1948,7 @@ void BKE_library_make_local(Main *bmain,
|
|||
/* This is probably more of a hack than something we should do here, but...
|
||||
* Issue is, the whole copying + remapping done in complex cases above may leave pose-channels
|
||||
* of armatures in complete invalid state (more precisely, the bone pointers of the
|
||||
* pose-channels - very crappy cross-data-blocks relationship), se we tag it to be fully
|
||||
* pose-channels - very crappy cross-data-blocks relationship), so we tag it to be fully
|
||||
* recomputed, but this does not seems to be enough in some cases, and evaluation code ends up
|
||||
* trying to evaluate a not-yet-updated armature object's deformations.
|
||||
* Try "make all local" in 04_01_H.lighting.blend from Agent327 without this, e.g. */
|
||||
|
|
|
@ -2192,7 +2192,7 @@ static bool lib_override_library_resync(Main *bmain,
|
|||
* old liboverrides are also remapped, it means that the old liboverride owner of the shape
|
||||
* key is also now pointing to the new liboverride shape key, not the old one. Since shape
|
||||
* keys do not own their liboverride data, the old liboverride shape key user has to be
|
||||
* restored to use the old liboverride shapekey, otherwise applying shape key override
|
||||
* restored to use the old liboverride shape-key, otherwise applying shape key override
|
||||
* operations will be useless (would apply using the new, from linked data, liboverride,
|
||||
* being effectively a no-op). */
|
||||
Key **key_override_old_p = BKE_key_from_id_p(id_override_old);
|
||||
|
|
|
@ -1285,11 +1285,9 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* take a mesh/curve/mball as starting point, remove 1 index,
|
||||
* AND with all objects that share the ob->data
|
||||
*
|
||||
* after that check indices in mesh/curve/mball!!!
|
||||
*/
|
||||
/* Take a mesh/curve/meta-ball as starting point, remove 1 index,
|
||||
* AND with all objects that share the `ob->data`.
|
||||
* After that check indices in mesh/curve/meta-ball! */
|
||||
|
||||
totcolp = BKE_object_material_len_p(ob);
|
||||
matarar = BKE_object_material_array_p(ob);
|
||||
|
|
|
@ -1454,7 +1454,7 @@ void BKE_ocean_bake(struct Ocean *o,
|
|||
|
||||
// pr = pr * och->foam_fade; /* overall fade */
|
||||
|
||||
/* Remember ocean coord sys is Y up!
|
||||
/* Remember ocean coord system is Y up!
|
||||
* break up the foam where height (Y) is low (wave valley),
|
||||
* and X and Z displacement is greatest. */
|
||||
|
||||
|
|
|
@ -4597,7 +4597,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
|
|||
}
|
||||
|
||||
for (dframe = -totframesback; dframe <= 0; dframe++) {
|
||||
/* simulate each subframe */
|
||||
/* Simulate each sub-frame. */
|
||||
dt_frac = psys->dt_frac;
|
||||
for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
|
||||
sim->courant_num = 0.0f;
|
||||
|
|
|
@ -1286,8 +1286,8 @@ static int ptcache_frame_from_filename(const char *filename, const char *ext)
|
|||
|
||||
/* could crash if trying to copy a string out of this range */
|
||||
if (len > ext_len) {
|
||||
/* using frame_len here gives compile error (vla) */
|
||||
char num[/* frame_len */ 6 + 1];
|
||||
/* Using frame_len here gives compile error (VLA). */
|
||||
char num[/*frame_len*/ 6 + 1];
|
||||
STRNCPY(num, filename + len - ext_len);
|
||||
|
||||
return atoi(num);
|
||||
|
|
|
@ -37,19 +37,24 @@ StringSimulationStateItem::StringSimulationStateItem(std::string value) : value_
|
|||
{
|
||||
}
|
||||
|
||||
void ModifierSimulationCache::try_discover_bake(const StringRefNull meta_dir,
|
||||
const StringRefNull bdata_dir)
|
||||
void ModifierSimulationCache::try_discover_bake(const StringRefNull absolute_bake_dir)
|
||||
{
|
||||
if (failed_finding_bake_) {
|
||||
return;
|
||||
}
|
||||
if (!BLI_is_dir(meta_dir.c_str()) || !BLI_is_dir(bdata_dir.c_str())) {
|
||||
|
||||
char meta_dir[FILE_MAX];
|
||||
BLI_path_join(meta_dir, sizeof(meta_dir), absolute_bake_dir.c_str(), "meta");
|
||||
char bdata_dir[FILE_MAX];
|
||||
BLI_path_join(bdata_dir, sizeof(bdata_dir), absolute_bake_dir.c_str(), "bdata");
|
||||
|
||||
if (!BLI_is_dir(meta_dir) || !BLI_is_dir(bdata_dir)) {
|
||||
failed_finding_bake_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
direntry *dir_entries = nullptr;
|
||||
const int dir_entries_num = BLI_filelist_dir_contents(meta_dir.c_str(), &dir_entries);
|
||||
const int dir_entries_num = BLI_filelist_dir_contents(meta_dir, &dir_entries);
|
||||
BLI_SCOPED_DEFER([&]() { BLI_filelist_free(dir_entries, dir_entries_num); });
|
||||
|
||||
if (dir_entries_num == 0) {
|
||||
|
|
|
@ -42,26 +42,18 @@ static std::string escape_name(const StringRef name)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
static std::string get_blendcache_directory(const Main &bmain)
|
||||
static std::string get_blend_file_name(const Main &bmain)
|
||||
{
|
||||
StringRefNull blend_file_path = BKE_main_blendfile_path(&bmain);
|
||||
char blend_directory[FILE_MAX];
|
||||
const StringRefNull blend_file_path = BKE_main_blendfile_path(&bmain);
|
||||
char blend_name[FILE_MAX];
|
||||
BLI_path_split_dir_file(blend_file_path.c_str(),
|
||||
blend_directory,
|
||||
sizeof(blend_directory),
|
||||
blend_name,
|
||||
sizeof(blend_name));
|
||||
|
||||
BLI_path_split_file_part(blend_file_path.c_str(), blend_name, sizeof(blend_name));
|
||||
const int64_t type_start_index = StringRef(blend_name).rfind(".");
|
||||
if (type_start_index == StringRef::not_found) {
|
||||
return "";
|
||||
}
|
||||
blend_name[type_start_index] = '\0';
|
||||
const std::string blendcache_name = "blendcache_" + StringRef(blend_name);
|
||||
|
||||
char blendcache_dir[FILE_MAX];
|
||||
BLI_path_join(blendcache_dir, sizeof(blendcache_dir), blend_directory, blendcache_name.c_str());
|
||||
return blendcache_dir;
|
||||
return "blendcache_" + StringRef(blend_name);
|
||||
}
|
||||
|
||||
static std::string get_modifier_sim_name(const Object &object, const ModifierData &md)
|
||||
|
@ -71,29 +63,18 @@ static std::string get_modifier_sim_name(const Object &object, const ModifierDat
|
|||
return "sim_" + object_name_escaped + "_" + modifier_name_escaped;
|
||||
}
|
||||
|
||||
std::string get_bake_directory(const Main &bmain, const Object &object, const ModifierData &md)
|
||||
std::string get_default_modifier_bake_directory(const Main &bmain,
|
||||
const Object &object,
|
||||
const ModifierData &md)
|
||||
{
|
||||
char bdata_dir[FILE_MAX];
|
||||
BLI_path_join(bdata_dir,
|
||||
sizeof(bdata_dir),
|
||||
get_blendcache_directory(bmain).c_str(),
|
||||
char dir[FILE_MAX];
|
||||
/* Make path that's relative to the .blend file. */
|
||||
BLI_path_join(dir,
|
||||
sizeof(dir),
|
||||
"//",
|
||||
get_blend_file_name(bmain).c_str(),
|
||||
get_modifier_sim_name(object, md).c_str());
|
||||
return bdata_dir;
|
||||
}
|
||||
|
||||
std::string get_bdata_directory(const Main &bmain, const Object &object, const ModifierData &md)
|
||||
{
|
||||
char bdata_dir[FILE_MAX];
|
||||
BLI_path_join(
|
||||
bdata_dir, sizeof(bdata_dir), get_bake_directory(bmain, object, md).c_str(), "bdata");
|
||||
return bdata_dir;
|
||||
}
|
||||
|
||||
std::string get_meta_directory(const Main &bmain, const Object &object, const ModifierData &md)
|
||||
{
|
||||
char meta_dir[FILE_MAX];
|
||||
BLI_path_join(meta_dir, sizeof(meta_dir), get_bake_directory(bmain, object, md).c_str(), "meta");
|
||||
return meta_dir;
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::shared_ptr<DictionaryValue> BDataSlice::serialize() const
|
||||
|
|
|
@ -38,7 +38,17 @@ extern "C" {
|
|||
* (most likely doesn't exist or no access).
|
||||
*/
|
||||
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
||||
int BLI_copy(const char *file, const char *to) ATTR_NONNULL();
|
||||
|
||||
/**
|
||||
* \return 0 on success.
|
||||
*/
|
||||
int BLI_copy(const char *path_src, const char *path_dst) ATTR_NONNULL();
|
||||
/**
|
||||
* When `path_src` points to a directory, moves all its contents into `path_dst`,
|
||||
* else rename `path_src` itself to `path_dst`.
|
||||
* \return 0 on success.
|
||||
*/
|
||||
int BLI_path_move(const char *path_src, const char *path_dst) ATTR_NONNULL();
|
||||
|
||||
/**
|
||||
* Rename a file or directory.
|
||||
|
@ -76,13 +86,8 @@ int BLI_delete(const char *path, bool dir, bool recursive) ATTR_NONNULL();
|
|||
* \return zero on success (matching 'remove' behavior).
|
||||
*/
|
||||
int BLI_delete_soft(const char *filepath, const char **error_message) ATTR_NONNULL();
|
||||
/**
|
||||
* When `path` points to a directory, moves all its contents into `to`,
|
||||
* else rename `path` itself to `to`.
|
||||
*/
|
||||
int BLI_path_move(const char *path, const char *to) ATTR_NONNULL();
|
||||
#if 0 /* Unused */
|
||||
int BLI_create_symlink(const char *path, const char *to) ATTR_NONNULL();
|
||||
int BLI_create_symlink(const char *path, const char *path_dst) ATTR_NONNULL();
|
||||
#endif
|
||||
|
||||
/* Keep in sync with the definition of struct `direntry` in `BLI_fileops_types.h`. */
|
||||
|
|
|
@ -86,6 +86,11 @@ const char *dirname(char *path);
|
|||
/* Windows utility functions. */
|
||||
|
||||
bool BLI_windows_register_blend_extension(bool background);
|
||||
/**
|
||||
* Set the `root_dir` to the default root directory on MS-Windows,
|
||||
* The string is guaranteed to be set with a length of 3 & null terminated,
|
||||
* using a fall-back in case the root directory can't be found.
|
||||
*/
|
||||
void BLI_windows_get_default_root_dir(char root_dir[4]);
|
||||
int BLI_windows_get_executable_dir(char *str);
|
||||
|
||||
|
|
|
@ -43,9 +43,13 @@
|
|||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utils.h"
|
||||
#include "BLI_sys_types.h" /* for intptr_t support */
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
/** Sizes above this must be allocated. */
|
||||
#define FILE_MAX_STATIC_BUF 256
|
||||
|
||||
#ifdef WIN32
|
||||
/* Text string used as the "verb" for Windows shell operations. */
|
||||
static char *windows_operation_string(FileExternalOperation operation)
|
||||
|
@ -655,75 +659,93 @@ int BLI_delete_soft(const char *file, const char **error_message)
|
|||
return err;
|
||||
}
|
||||
|
||||
int BLI_path_move(const char *file, const char *to)
|
||||
/**
|
||||
* MS-Windows doesn't support moving to a directory, it has to be
|
||||
* `mv filepath filepath` and not `mv filepath destination_directory` (same for copying).
|
||||
*
|
||||
* So when `path_dst` ends with as slash:
|
||||
* ensure the filename component of `path_src` is added to a copy of `path_dst`.
|
||||
*/
|
||||
static const char *path_destination_ensure_filename(const char *path_src,
|
||||
const char *path_dst,
|
||||
char *buf,
|
||||
size_t buf_size)
|
||||
{
|
||||
char str[MAXPATHLEN + 12];
|
||||
int err;
|
||||
|
||||
/* windows doesn't support moving to a directory
|
||||
* it has to be 'mv filepath filepath' and not
|
||||
* 'mv filepath destination_directory' */
|
||||
|
||||
STRNCPY(str, to);
|
||||
/* points 'to' to a directory ? */
|
||||
if (BLI_path_slash_rfind(str) == (str + strlen(str) - 1)) {
|
||||
if (BLI_path_slash_rfind(file) != NULL) {
|
||||
strcat(str, BLI_path_slash_rfind(file) + 1);
|
||||
const char *filename_src = BLI_path_basename(path_src);
|
||||
/* Unlikely but possible this has no slashes. */
|
||||
if (filename_src != path_src) {
|
||||
const size_t path_dst_len = strlen(path_dst);
|
||||
/* Check if `path_dst` points to a directory. */
|
||||
if (path_dst_len && BLI_path_slash_is_native_compat(path_dst[path_dst_len - 1])) {
|
||||
size_t buf_size_needed = path_dst_len + strlen(filename_src) + 1;
|
||||
char *path_dst_with_filename = (buf_size_needed <= buf_size) ?
|
||||
buf :
|
||||
MEM_mallocN(buf_size_needed, __func__);
|
||||
BLI_string_join(path_dst_with_filename, buf_size_needed, path_dst, filename_src);
|
||||
return path_dst_with_filename;
|
||||
}
|
||||
}
|
||||
return path_dst;
|
||||
}
|
||||
|
||||
UTF16_ENCODE(file);
|
||||
UTF16_ENCODE(str);
|
||||
err = !MoveFileW(file_16, str_16);
|
||||
UTF16_UN_ENCODE(str);
|
||||
UTF16_UN_ENCODE(file);
|
||||
int BLI_path_move(const char *path_src, const char *path_dst)
|
||||
{
|
||||
char path_dst_buf[FILE_MAX_STATIC_BUF];
|
||||
const char *path_dst_with_filename = path_destination_ensure_filename(
|
||||
path_src, path_dst, path_dst_buf, sizeof(path_dst_buf));
|
||||
|
||||
int err;
|
||||
|
||||
UTF16_ENCODE(path_src);
|
||||
UTF16_ENCODE(path_dst_with_filename);
|
||||
err = !MoveFileW(path_src_16, path_dst_with_filename_16);
|
||||
UTF16_UN_ENCODE(path_dst_with_filename);
|
||||
UTF16_UN_ENCODE(path_src);
|
||||
|
||||
if (err) {
|
||||
callLocalErrorCallBack("Unable to move file");
|
||||
printf(" Move from '%s' to '%s' failed\n", file, str);
|
||||
printf(" Move from '%s' to '%s' failed\n", path_src, path_dst_with_filename);
|
||||
}
|
||||
|
||||
if (!ELEM(path_dst_with_filename, path_dst_buf, path_dst)) {
|
||||
MEM_freeN((void *)path_dst_with_filename);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int BLI_copy(const char *file, const char *to)
|
||||
int BLI_copy(const char *path_src, const char *path_dst)
|
||||
{
|
||||
char str[MAXPATHLEN + 12];
|
||||
char path_dst_buf[FILE_MAX_STATIC_BUF];
|
||||
const char *path_dst_with_filename = path_destination_ensure_filename(
|
||||
path_src, path_dst, path_dst_buf, sizeof(path_dst_buf));
|
||||
int err;
|
||||
|
||||
/* windows doesn't support copying to a directory
|
||||
* it has to be 'cp filepath filepath' and not
|
||||
* 'cp filepath destdir' */
|
||||
|
||||
STRNCPY(str, to);
|
||||
/* points 'to' to a directory ? */
|
||||
if (BLI_path_slash_rfind(str) == (str + strlen(str) - 1)) {
|
||||
if (BLI_path_slash_rfind(file) != NULL) {
|
||||
strcat(str, BLI_path_slash_rfind(file) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
UTF16_ENCODE(file);
|
||||
UTF16_ENCODE(str);
|
||||
err = !CopyFileW(file_16, str_16, false);
|
||||
UTF16_UN_ENCODE(str);
|
||||
UTF16_UN_ENCODE(file);
|
||||
UTF16_ENCODE(path_src);
|
||||
UTF16_ENCODE(path_dst_with_filename);
|
||||
err = !CopyFileW(path_src_16, path_dst_with_filename_16, false);
|
||||
UTF16_UN_ENCODE(path_dst_with_filename);
|
||||
UTF16_UN_ENCODE(path_src);
|
||||
|
||||
if (err) {
|
||||
callLocalErrorCallBack("Unable to copy file!");
|
||||
printf(" Copy from '%s' to '%s' failed\n", file, str);
|
||||
printf(" Copy from '%s' to '%s' failed\n", path_src, path_dst_with_filename);
|
||||
}
|
||||
|
||||
if (!ELEM(path_dst_with_filename, path_dst_buf, path_dst)) {
|
||||
MEM_freeN((void *)path_dst_with_filename);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
# if 0
|
||||
int BLI_create_symlink(const char *file, const char *to)
|
||||
int BLI_create_symlink(const char *path_src, const char *path_dst)
|
||||
{
|
||||
/* See patch from #30870, should this ever become needed. */
|
||||
callLocalErrorCallBack("Linking files is unsupported on Windows");
|
||||
(void)file;
|
||||
(void)to;
|
||||
(void)path_src;
|
||||
(void)path_dst;
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
|
@ -1277,69 +1299,59 @@ static int move_single_file(const char *from, const char *to)
|
|||
return RecursiveOp_Callback_OK;
|
||||
}
|
||||
|
||||
int BLI_path_move(const char *path, const char *to)
|
||||
int BLI_path_move(const char *path_src, const char *path_dst)
|
||||
{
|
||||
int ret = recursive_operation(path, to, move_callback_pre, move_single_file, NULL);
|
||||
int ret = recursive_operation(path_src, path_dst, move_callback_pre, move_single_file, NULL);
|
||||
|
||||
if (ret && ret != -1) {
|
||||
return recursive_operation(path, NULL, NULL, delete_single_file, delete_callback_post);
|
||||
return recursive_operation(path_src, NULL, NULL, delete_single_file, delete_callback_post);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *check_destination(const char *file, const char *to)
|
||||
static const char *path_destination_ensure_filename(const char *path_src,
|
||||
const char *path_dst,
|
||||
char *buf,
|
||||
size_t buf_size)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (!stat(to, &st)) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
char *str, *path;
|
||||
const char *filename;
|
||||
size_t len = 0;
|
||||
|
||||
str = strip_last_slash(file);
|
||||
filename = BLI_path_slash_rfind(str);
|
||||
|
||||
if (!filename) {
|
||||
MEM_freeN(str);
|
||||
return (char *)to;
|
||||
}
|
||||
|
||||
/* skip slash */
|
||||
filename += 1;
|
||||
|
||||
len = strlen(to) + strlen(filename) + 1;
|
||||
path = MEM_callocN(len + 1, "check_destination path");
|
||||
BLI_path_join(path, len + 1, to, filename);
|
||||
|
||||
MEM_freeN(str);
|
||||
|
||||
return path;
|
||||
if (BLI_is_dir(path_dst)) {
|
||||
char *path_src_no_slash = strip_last_slash(path_src);
|
||||
const char *filename_src = BLI_path_basename(path_src_no_slash);
|
||||
if (filename_src != path_src_no_slash) {
|
||||
const size_t buf_size_needed = strlen(path_dst) + 1 + strlen(filename_src) + 1;
|
||||
char *path_dst_with_filename = (buf_size_needed <= buf_size) ?
|
||||
buf :
|
||||
MEM_mallocN(buf_size_needed, __func__);
|
||||
BLI_path_join(path_dst_with_filename, buf_size_needed, path_dst, filename_src);
|
||||
path_dst = path_dst_with_filename;
|
||||
}
|
||||
MEM_freeN(path_src_no_slash);
|
||||
}
|
||||
|
||||
return to;
|
||||
return path_dst;
|
||||
}
|
||||
|
||||
int BLI_copy(const char *file, const char *to)
|
||||
int BLI_copy(const char *path_src, const char *path_dst)
|
||||
{
|
||||
const char *actual_to = check_destination(file, to);
|
||||
char path_dst_buf[FILE_MAX_STATIC_BUF];
|
||||
const char *path_dst_with_filename = path_destination_ensure_filename(
|
||||
path_src, path_dst, path_dst_buf, sizeof(path_dst_buf));
|
||||
int ret;
|
||||
|
||||
ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);
|
||||
ret = recursive_operation(
|
||||
path_src, path_dst_with_filename, copy_callback_pre, copy_single_file, NULL);
|
||||
|
||||
if (actual_to != to) {
|
||||
MEM_freeN((void *)actual_to);
|
||||
if (!ELEM(path_dst_with_filename, path_dst_buf, path_dst)) {
|
||||
MEM_freeN((void *)path_dst_with_filename);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
# if 0
|
||||
int BLI_create_symlink(const char *file, const char *to)
|
||||
int BLI_create_symlink(const char *path_src, const char *path_dst)
|
||||
{
|
||||
return symlink(to, file);
|
||||
return symlink(path_dst, path_src);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
|
@ -1111,16 +1111,19 @@ bool BLI_path_abs(char path[FILE_MAX], const char *basepath)
|
|||
/* We are checking here if we have an absolute path that is not in the current `.blend` file
|
||||
* as a lib main - we are basically checking for the case that a UNIX root `/` is passed. */
|
||||
if (!wasrelative && !BLI_path_is_abs_win32(path)) {
|
||||
const size_t root_dir_len = 3;
|
||||
char *p = path;
|
||||
BLI_windows_get_default_root_dir(tmp);
|
||||
/* Get rid of the slashes at the beginning of the path. */
|
||||
while (ELEM(*p, '\\', '/')) {
|
||||
BLI_assert(strlen(tmp) == root_dir_len);
|
||||
|
||||
/* Step over the slashes at the beginning of the path. */
|
||||
while (BLI_path_slash_is_native_compat(*p)) {
|
||||
p++;
|
||||
}
|
||||
strcat(tmp, p);
|
||||
BLI_strncpy(tmp + root_dir_len, p, sizeof(tmp) - root_dir_len);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(tmp, path, FILE_MAX);
|
||||
STRNCPY(tmp, path);
|
||||
}
|
||||
#else
|
||||
STRNCPY(tmp, path);
|
||||
|
|
|
@ -428,14 +428,14 @@ TEST(polyfill2d, SquareCW)
|
|||
TEST_POLYFILL_TEMPLATE_STATIC(poly, POLYFILL2D_TEST_NOP);
|
||||
}
|
||||
|
||||
/* Starfleet insigna */
|
||||
/* Star-fleet insignia. */
|
||||
TEST(polyfill2d, Starfleet)
|
||||
{
|
||||
const float poly[][2] = {{0, 0}, {0.6f, 0.4f}, {1, 0}, {0.5f, 1}};
|
||||
TEST_POLYFILL_TEMPLATE_STATIC(poly, POLYFILL2D_TEST_NOP);
|
||||
}
|
||||
|
||||
/* Starfleet insigna with repeated point */
|
||||
/* Star-fleet insignia with repeated point. */
|
||||
TEST(polyfill2d, StarfleetDegenerate)
|
||||
{
|
||||
const float poly[][2] = {{0, 0}, {0.6f, 0.4f}, {0.6f, 0.4f}, {1, 0}, {0.5f, 1}};
|
||||
|
|
|
@ -162,8 +162,8 @@ void blo_write_id_struct(BlendWriter *writer,
|
|||
*
|
||||
* Required for writing properly embedded IDs currently.
|
||||
*
|
||||
* \note: Once there is a better generic handling of embedded IDs, this may go back to private code
|
||||
* in writefile.c
|
||||
* \note Once there is a better generic handling of embedded IDs,
|
||||
* this may go back to private code in `writefile.c`.
|
||||
*/
|
||||
typedef struct BLO_Write_IDBuffer BLO_Write_IDBuffer;
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ void BLO_main_expander(BLOExpandDoitCallback expand_doit_func);
|
|||
* Loop over all ID data in Main to mark relations.
|
||||
* Set (id->tag & LIB_TAG_NEED_EXPAND) to mark expanding. Flags get cleared after expanding.
|
||||
*
|
||||
* \param fdhandle: usually filedata, or own handle.
|
||||
* \param fdhandle: usually file-data, or own handle.
|
||||
* \param mainvar: the Main database to expand.
|
||||
*/
|
||||
void BLO_expand_main(void *fdhandle, struct Main *mainvar);
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "BKE_modifier.h"
|
||||
#include "BKE_node.hh"
|
||||
#include "BKE_screen.h"
|
||||
#include "BKE_simulation_state_serialize.hh"
|
||||
#include "BKE_workspace.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
@ -4478,5 +4479,21 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
FOREACH_NODETREE_END;
|
||||
|
||||
BKE_animdata_main_cb(bmain, version_liboverride_nla_frame_start_end, NULL);
|
||||
|
||||
/* Store simulation bake directory in geometry nodes modifier. */
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type != eModifierType_Nodes) {
|
||||
continue;
|
||||
}
|
||||
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
|
||||
if (nmd->simulation_bake_directory) {
|
||||
continue;
|
||||
}
|
||||
const std::string bake_dir = blender::bke::sim::get_default_modifier_bake_directory(
|
||||
*bmain, *ob, *md);
|
||||
nmd->simulation_bake_directory = BLI_strdup(bake_dir.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1076,7 +1076,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
|||
if (bmain->versionfile <= 230) {
|
||||
bScreen *screen;
|
||||
|
||||
/* new variable blockscale, for panels in any area */
|
||||
/* New variable block-scale, for panels in any area. */
|
||||
for (screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
ScrArea *area;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* Copyright 2017 Blender Foundation */
|
||||
|
||||
/*
|
||||
* Based on C++ version by Sergey Sharybin <sergey.vfx@gmail.com>.
|
||||
* Based on Python script msgfmt.py from Python source code tree, which was written by
|
||||
* Martin v. Löwis <loewis@informatik.hu-berlin.de>
|
||||
* Based on C++ version by `Sergey Sharybin <sergey.vfx@gmail.com>`.
|
||||
* Based on Python script `msgfmt.py` from Python source code tree, which was written by
|
||||
* `Martin v. Löwis <loewis@informatik.hu-berlin.de>`.
|
||||
*
|
||||
* Generate binary message catalog from textual translation description.
|
||||
*
|
||||
|
|
|
@ -426,7 +426,7 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
|
|||
};
|
||||
|
||||
/*
|
||||
* Average Vertices Facevert Data.
|
||||
* Average Vertices Face-vert Data.
|
||||
*
|
||||
* Merge uv/vcols associated with the input vertices at
|
||||
* the bounding box center. (I know, it's not averaging but
|
||||
|
|
|
@ -163,7 +163,7 @@ enum {
|
|||
BMW_ISLAND,
|
||||
BMW_ISLAND_MANIFOLD,
|
||||
BMW_CONNECTED_VERTEX,
|
||||
/* end of array index enum vals */
|
||||
/* End of array index enum values. */
|
||||
|
||||
/* Do not initialize function pointers and struct size in #BMW_init. */
|
||||
BMW_CUSTOM,
|
||||
|
|
|
@ -354,7 +354,7 @@ enum eVelocityStep : uint32_t {
|
|||
};
|
||||
|
||||
struct VelocityObjectIndex {
|
||||
/** Offset inside #VelocityObjectBuf for each timestep. Indexed using eVelocityStep. */
|
||||
/** Offset inside #VelocityObjectBuf for each time-step. Indexed using eVelocityStep. */
|
||||
packed_int3 ofs;
|
||||
/** Temporary index to copy this to the #VelocityIndexBuf. */
|
||||
uint resource_id;
|
||||
|
|
|
@ -155,7 +155,7 @@ void Instance::draw(Manager &manager)
|
|||
const DRWView *view_legacy = DRW_view_default_get();
|
||||
View view("OverlayView", view_legacy);
|
||||
|
||||
/* TODO: Better semantical switch? */
|
||||
/* TODO: Better semantics using a switch? */
|
||||
if (!resources.color_overlay_tx.is_valid()) {
|
||||
/* Likely to be the selection case. Allocate dummy texture and bind only depth buffer. */
|
||||
resources.line_tx.acquire(int2(1, 1), GPU_RGBA8);
|
||||
|
|
|
@ -262,7 +262,7 @@ struct MeshBatchCache {
|
|||
|
||||
MeshBatchList batch;
|
||||
|
||||
/* Index buffer per material. These are subranges of `ibo.tris` */
|
||||
/* Index buffer per material. These are sub-ranges of `ibo.tris`. */
|
||||
GPUIndexBuf **tris_per_mat;
|
||||
|
||||
GPUBatch **surface_per_mat;
|
||||
|
|
|
@ -2573,7 +2573,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
|||
draw_select_framebuffer_depth_only_setup(viewport_size);
|
||||
GPU_framebuffer_bind(g_select_buffer.framebuffer_depth_only);
|
||||
GPU_framebuffer_clear_depth(g_select_buffer.framebuffer_depth_only, 1.0f);
|
||||
/* WORKAROUND: Needed for Select-Next for keeping the same codeflow as Overlay-Next. */
|
||||
/* WORKAROUND: Needed for Select-Next for keeping the same code-flow as Overlay-Next. */
|
||||
BLI_assert(DRW_viewport_texture_list_get()->depth == NULL);
|
||||
DRW_viewport_texture_list_get()->depth = g_select_buffer.texture_depth;
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ class Manager {
|
|||
ResourceHandle resource_handle(const float4x4 &model_matrix);
|
||||
/**
|
||||
* Get resource id for a loose matrix with bounds. The draw-calls for this resource handle will
|
||||
* be culled bute there won't be any associated object info / bounds. Assumes correct handedness
|
||||
* / winding.
|
||||
* be culled but there won't be any associated object info / bounds.
|
||||
* Assumes correct handedness / winding.
|
||||
*/
|
||||
ResourceHandle resource_handle(const float4x4 &model_matrix,
|
||||
const float3 &bounds_center,
|
||||
|
|
|
@ -1670,7 +1670,7 @@ static bool gpencil_check_cursor_region(bContext *C, const int mval_i[2])
|
|||
return false;
|
||||
}
|
||||
|
||||
/* TODO: add more spacetypes */
|
||||
/* TODO: add more space-types. */
|
||||
if (!ELEM(area->spacetype, SPACE_VIEW3D)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -791,7 +791,7 @@ static void ui_item_enum_expand_elem_exec(uiLayout *layout,
|
|||
}
|
||||
|
||||
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
/* If this is set, assert since we're clobbering someone elses callback. */
|
||||
/* If this is set, assert since we're clobbering someone else's callback. */
|
||||
/* Buttons get their block's func by default, so we cannot assert in that case either. */
|
||||
BLI_assert(ELEM(but->func, nullptr, block->func));
|
||||
UI_but_func_set(but, ui_item_enum_expand_handle, but, POINTER_FROM_INT(value));
|
||||
|
|
|
@ -742,7 +742,7 @@ uiBlock *ui_popup_block_refresh(bContext *C,
|
|||
/* checks which buttons are visible, sets flags to prevent draw (do after region init) */
|
||||
ui_popup_block_scrolltest(block);
|
||||
|
||||
/* adds subwindow */
|
||||
/* Adds sub-window. */
|
||||
ED_region_floating_init(region);
|
||||
|
||||
/* get winmat now that we actually have the subwindow */
|
||||
|
|
|
@ -44,7 +44,7 @@ static void fontstyle_set_ex(const uiFontStyle *fs, const float dpi_fac);
|
|||
* This is a complete set of layout rules, the 'state' of the Layout
|
||||
* Engine. Multiple styles are possible, defined via C or Python. Styles
|
||||
* get a name, and will typically get activated per region type, like
|
||||
* "Header", or "Listview" or "Toolbar". Properties of Style definitions
|
||||
* `Header`, or `Listview` or `Toolbar`. Properties of Style definitions
|
||||
* are:
|
||||
*
|
||||
* - default column properties, internal spacing, aligning, min/max width
|
||||
|
|
|
@ -549,9 +549,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
|
|||
cur->xmin -= temp;
|
||||
cur->xmax -= temp;
|
||||
|
||||
/* width does not get modified, as keepaspect here is just set to make
|
||||
* sure visible area adjusts to changing view shape!
|
||||
*/
|
||||
/* Width does not get modified, as keep-aspect here is just set to make
|
||||
* sure visible area adjusts to changing view shape! */
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -229,7 +229,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
|
|||
* in editmesh_select.cc (around line 1000)... */
|
||||
/* sets as active, useful for other tools */
|
||||
if (em->selectmode & SCE_SELECT_VERTEX) {
|
||||
/* low priority TODO: get vertrex close to mouse. */
|
||||
/* low priority TODO: get vertex close to mouse. */
|
||||
BM_select_history_store(em->bm, lcd->eed->v1);
|
||||
}
|
||||
if (em->selectmode & SCE_SELECT_EDGE) {
|
||||
|
|
|
@ -209,8 +209,7 @@ static bool bake_simulation_poll(bContext *C)
|
|||
|
||||
struct ModifierBakeData {
|
||||
NodesModifierData *nmd;
|
||||
std::string meta_dir;
|
||||
std::string bdata_dir;
|
||||
std::string absolute_bake_dir;
|
||||
std::unique_ptr<bke::sim::BDataSharing> bdata_sharing;
|
||||
};
|
||||
|
||||
|
@ -244,6 +243,9 @@ static void bake_simulation_job_startjob(void *customdata,
|
|||
if (!BKE_id_is_editable(job.bmain, &object->id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *base_path = ID_BLEND_PATH(job.bmain, &object->id);
|
||||
|
||||
ObjectBakeData bake_data;
|
||||
bake_data.object = object;
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
|
@ -252,10 +254,14 @@ static void bake_simulation_job_startjob(void *customdata,
|
|||
if (nmd->simulation_cache != nullptr) {
|
||||
nmd->simulation_cache->reset();
|
||||
}
|
||||
bake_data.modifiers.append({nmd,
|
||||
bke::sim::get_meta_directory(*job.bmain, *object, *md),
|
||||
bke::sim::get_bdata_directory(*job.bmain, *object, *md),
|
||||
std::make_unique<BDataSharing>()});
|
||||
if (StringRef(nmd->simulation_bake_directory).is_empty()) {
|
||||
nmd->simulation_bake_directory = BLI_strdup(
|
||||
bke::sim::get_default_modifier_bake_directory(*job.bmain, *object, *md).c_str());
|
||||
}
|
||||
char absolute_bake_dir[FILE_MAX];
|
||||
STRNCPY(absolute_bake_dir, nmd->simulation_bake_directory);
|
||||
BLI_path_abs(absolute_bake_dir, base_path);
|
||||
bake_data.modifiers.append({nmd, absolute_bake_dir, std::make_unique<BDataSharing>()});
|
||||
}
|
||||
}
|
||||
objects_to_bake.append(std::move(bake_data));
|
||||
|
@ -305,12 +311,14 @@ static void bake_simulation_job_startjob(void *customdata,
|
|||
char bdata_path[FILE_MAX];
|
||||
BLI_path_join(bdata_path,
|
||||
sizeof(bdata_path),
|
||||
modifier_bake_data.bdata_dir.c_str(),
|
||||
modifier_bake_data.absolute_bake_dir.c_str(),
|
||||
"bdata",
|
||||
bdata_file_name.c_str());
|
||||
char meta_path[FILE_MAX];
|
||||
BLI_path_join(meta_path,
|
||||
sizeof(meta_path),
|
||||
modifier_bake_data.meta_dir.c_str(),
|
||||
modifier_bake_data.absolute_bake_dir.c_str(),
|
||||
"meta",
|
||||
meta_file_name.c_str());
|
||||
|
||||
BLI_file_ensure_parent_dir_exists(bdata_path);
|
||||
|
@ -429,21 +437,25 @@ static int delete_baked_simulation_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
for (Object *object : objects) {
|
||||
const char *base_path = ID_BLEND_PATH(bmain, &object->id);
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Nodes) {
|
||||
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
|
||||
const std::string bake_directory = bke::sim::get_bake_directory(*bmain, *object, *md);
|
||||
if (BLI_exists(bake_directory.c_str())) {
|
||||
if (BLI_delete(bake_directory.c_str(), true, true)) {
|
||||
BKE_reportf(op->reports,
|
||||
RPT_ERROR,
|
||||
"Failed to remove bake directory %s",
|
||||
bake_directory.c_str());
|
||||
}
|
||||
}
|
||||
if (nmd->simulation_cache != nullptr) {
|
||||
nmd->simulation_cache->reset();
|
||||
}
|
||||
if (StringRef(nmd->simulation_bake_directory).is_empty()) {
|
||||
continue;
|
||||
}
|
||||
char absolute_bake_dir[FILE_MAX];
|
||||
STRNCPY(absolute_bake_dir, nmd->simulation_bake_directory);
|
||||
BLI_path_abs(absolute_bake_dir, base_path);
|
||||
if (BLI_exists(absolute_bake_dir)) {
|
||||
if (BLI_delete(absolute_bake_dir, true, true)) {
|
||||
BKE_reportf(
|
||||
op->reports, RPT_ERROR, "Failed to remove bake directory %s", absolute_bake_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2635,7 +2635,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
|
|||
* \note Only for pose-channels.
|
||||
* \{ */
|
||||
|
||||
/* TODO: should these be here, or back in editors/armature/poseobject.c again? */
|
||||
/* TODO: should these be here, or back in `editors/armature/poseobject.c` again? */
|
||||
|
||||
/* present menu with options + validation for targets to use */
|
||||
static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
|
|
|
@ -266,12 +266,16 @@ static void transform_active_color_data(
|
|||
IndexMaskMemory memory;
|
||||
const IndexMask selection = get_selected_indices(mesh, color_attribute.domain, memory);
|
||||
|
||||
threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) {
|
||||
selection.foreach_segment(GrainSize(1024), [&](const IndexMaskSegment segment) {
|
||||
color_attribute.varray.type().to_static_type_tag<ColorGeometry4f, ColorGeometry4b>(
|
||||
[&](auto type_tag) {
|
||||
using namespace blender;
|
||||
using T = typename decltype(type_tag)::type;
|
||||
selection.foreach_index(GrainSize(1024), [&](const int i) {
|
||||
if constexpr (std::is_same_v<T, ColorGeometry4f>) {
|
||||
for ([[maybe_unused]] const int i : segment) {
|
||||
if constexpr (std::is_void_v<T>) {
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, ColorGeometry4f>) {
|
||||
ColorGeometry4f color = color_attribute.varray.get<ColorGeometry4f>(i);
|
||||
transform_fn(color);
|
||||
color_attribute.varray.set_by_copy(i, &color);
|
||||
|
@ -282,7 +286,7 @@ static void transform_active_color_data(
|
|||
ColorGeometry4b color_encoded = color.encode();
|
||||
color_attribute.varray.set_by_copy(i, &color_encoded);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1116,7 +1116,7 @@ void ED_spacetype_image(void)
|
|||
art->listener = image_main_region_listener;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: listview/buttons/scopes */
|
||||
/* regions: list-view/buttons/scopes */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
||||
|
|
|
@ -1169,7 +1169,7 @@ void ED_spacetype_node()
|
|||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: listview/buttons */
|
||||
/* regions: list-view/buttons */
|
||||
art = MEM_cnew<ARegionType>("spacetype node region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
||||
|
|
|
@ -1048,7 +1048,7 @@ void ED_spacetype_sequencer(void)
|
|||
ED_KEYMAP_GPENCIL;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* Listview/buttons. */
|
||||
/* List-view/buttons. */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH * 1.3f;
|
||||
|
|
|
@ -2150,7 +2150,7 @@ void ED_spacetype_view3d()
|
|||
art->lock = 1; /* can become flag, see BKE_spacedata_draw_locks */
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: listview/buttons */
|
||||
/* regions: list-view/buttons */
|
||||
art = MEM_cnew<ARegionType>("spacetype view3d buttons region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
||||
|
|
|
@ -375,12 +375,12 @@ static void constraintRotLim(const TransInfo *UNUSED(t), TransData *td)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* skip incompatible spacetypes */
|
||||
/* Skip incompatible space-types. */
|
||||
if (!ELEM(con->ownspace, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only do conversion if necessary, to preserve quats and eulers */
|
||||
/* Only do conversion if necessary, to preserve quaternion and euler rotations. */
|
||||
if (do_limit == false) {
|
||||
constraintob_from_transdata(&cob, td);
|
||||
do_limit = true;
|
||||
|
|
|
@ -61,7 +61,7 @@ static PyNumberMethods nature_as_number = {
|
|||
/*nb_inplace_matrix_multiply*/ nullptr,
|
||||
};
|
||||
|
||||
/*-----------------------BPy_Nature docstring ------------------------------------*/
|
||||
/*-----------------------BPy_Nature doc-string -----------------------------------*/
|
||||
|
||||
PyDoc_STRVAR(Nature_doc,
|
||||
"Class hierarchy: int > :class:`Nature`\n"
|
||||
|
|
|
@ -318,7 +318,7 @@ void IndexBuf::init_build_on_device(uint index_len)
|
|||
|
||||
void IndexBuf::init_subrange(IndexBuf *elem_src, uint start, uint length)
|
||||
{
|
||||
/* We don't support nested subranges. */
|
||||
/* We don't support nested sub-ranges. */
|
||||
BLI_assert(elem_src && elem_src->is_subrange_ == false);
|
||||
BLI_assert((length == 0) || (start + length <= elem_src->index_len_));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ extern "C" {
|
|||
* Types needed for using the image buffer.
|
||||
*
|
||||
* Imbuf is external code, slightly adapted to live in the Blender
|
||||
* context. It requires an external jpeg module, and the avi-module
|
||||
* context. It requires an external JPEG module, and the AVI-module
|
||||
* (also external code) in order to function correctly.
|
||||
*
|
||||
* This file contains types and some constants that go with them. Most
|
||||
|
|
|
@ -766,7 +766,7 @@ static int startffmpeg(struct anim *anim)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Try do detect if input has 0-255 YCbCR range (JFIF Jpeg MotionJpeg) */
|
||||
/* Try do detect if input has 0-255 YCbCR range (JFIF, JPEG, Motion-JPEG). */
|
||||
if (!sws_getColorspaceDetails(anim->img_convert_ctx,
|
||||
(int **)&inv_table,
|
||||
&srcRange,
|
||||
|
|
|
@ -1206,7 +1206,7 @@ bool imb_save_jp2_stream(struct ImBuf *ibuf, opj_stream_t *stream, int /*flags*/
|
|||
|
||||
/* compression ratio */
|
||||
/* invert range, from 10-100, 100-1
|
||||
* Where jpeg see's 1 and highest quality (lossless) and 100 is very low quality. */
|
||||
* Where JPEG see's 1 and highest quality (lossless) and 100 is very low quality. */
|
||||
parameters.tcp_rates[0] = ((100 - quality) / 90.0f * 99.0f) + 1;
|
||||
|
||||
parameters.tcp_numlayers = 1; /* only one resolution */
|
||||
|
|
|
@ -764,7 +764,7 @@ void *IMB_exr_get_handle_name(const char *name)
|
|||
|
||||
if (data == nullptr) {
|
||||
data = (ExrHandle *)IMB_exr_get_handle();
|
||||
BLI_strncpy(data->name, name, strlen(name) + 1);
|
||||
STRNCPY(data->name, name);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
@ -821,12 +821,16 @@ static void imb_exr_get_views(MultiPartInputFile &file, StringVector &views)
|
|||
}
|
||||
|
||||
/* Multi-layer Blender files have the view name in all the passes (even the default view one). */
|
||||
static void imb_exr_insert_view_name(char *name_full, const char *passname, const char *viewname)
|
||||
static void imb_exr_insert_view_name(char name_full[EXR_TOT_MAXNAME + 1],
|
||||
const char *passname,
|
||||
const char *viewname)
|
||||
{
|
||||
/* Match: `sizeof(ExrChannel::name)`. */
|
||||
const size_t name_full_maxncpy = EXR_TOT_MAXNAME + 1;
|
||||
BLI_assert(!ELEM(name_full, passname, viewname));
|
||||
|
||||
if (viewname == nullptr || viewname[0] == '\0') {
|
||||
BLI_strncpy(name_full, passname, sizeof(ExrChannel::name));
|
||||
BLI_strncpy(name_full, passname, name_full_maxncpy);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -838,10 +842,10 @@ static void imb_exr_insert_view_name(char *name_full, const char *passname, cons
|
|||
len = BLI_str_rpartition(passname, delims, &sep, &token);
|
||||
|
||||
if (sep) {
|
||||
BLI_snprintf(name_full, EXR_PASS_MAXNAME, "%.*s.%s.%s", int(len), passname, viewname, token);
|
||||
BLI_snprintf(name_full, name_full_maxncpy, "%.*s.%s.%s", int(len), passname, viewname, token);
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(name_full, EXR_PASS_MAXNAME, "%s.%s", passname, viewname);
|
||||
BLI_snprintf(name_full, name_full_maxncpy, "%s.%s", passname, viewname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1142,7 +1146,7 @@ float *IMB_exr_channel_rect(void *handle,
|
|||
|
||||
/* name has to be unique, thus it's a combination of layer, pass, view, and channel */
|
||||
if (layname && layname[0] != '\0') {
|
||||
char temp_buf[EXR_PASS_MAXNAME];
|
||||
char temp_buf[EXR_TOT_MAXNAME + 1];
|
||||
imb_exr_insert_view_name(temp_buf, name, viewname);
|
||||
STRNCPY(name, temp_buf);
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
|
|||
Material *ma = ob->totcol ? BKE_object_material_get(ob, material_index + 1) : nullptr;
|
||||
COLLADASW::PrimitivesBase *primitive_list = create_primitive_list(is_triangulated, mSW);
|
||||
|
||||
/* sets count attribute in <polylist> */
|
||||
/* sets count attribute in `<polylist>`. */
|
||||
primitive_list->setCount(polygon_count);
|
||||
|
||||
/* sets material name */
|
||||
|
|
|
@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)
|
|||
|
||||
const char *type_str = bc_primTypeToStr(type);
|
||||
|
||||
/* OpenCollada passes POLYGONS type for <polylist> */
|
||||
/* OpenCollada passes POLYGONS type for `<polylist>`. */
|
||||
if (ELEM(type, COLLADAFW::MeshPrimitive::POLYLIST, COLLADAFW::MeshPrimitive::POLYGONS)) {
|
||||
|
||||
COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp;
|
||||
|
@ -636,7 +636,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh,
|
|||
|
||||
int collada_meshtype = mp->getPrimitiveType();
|
||||
|
||||
/* since we cannot set poly->mat_nr here, we store a portion of me->mpoly in Primitive */
|
||||
/* Since we cannot set `poly->mat_nr` here, we store a portion of `me->mpoly` in Primitive. */
|
||||
Primitive prim = {poly_index, &material_indices[poly_index], 0};
|
||||
|
||||
/* If MeshPrimitive is TRIANGLE_FANS we split it into triangles
|
||||
|
|
|
@ -79,7 +79,7 @@ class MeshImporter : public MeshImporterBase {
|
|||
|
||||
/* this structure is used to assign material indices to polygons
|
||||
* it holds a portion of Mesh faces and corresponds to a DAE primitive list
|
||||
* (<triangles>, <polylist>, etc.) */
|
||||
* (`<triangles>`, `<polylist>`, etc.) */
|
||||
struct Primitive {
|
||||
int poly_index;
|
||||
int *material_indices;
|
||||
|
@ -110,7 +110,10 @@ class MeshImporter : public MeshImporterBase {
|
|||
void print_index_list(COLLADAFW::IndexList &index_list);
|
||||
#endif
|
||||
|
||||
/** Checks if mesh has supported primitive types: lines, polylist, triangles, triangle_fans. */
|
||||
/**
|
||||
* Checks if mesh has supported primitive types:
|
||||
* `lines`, `polylist`, `triangles`, `triangle_fans`.
|
||||
*/
|
||||
bool is_nice_mesh(COLLADAFW::Mesh *mesh);
|
||||
|
||||
void read_vertices(COLLADAFW::Mesh *mesh, Mesh *me);
|
||||
|
|
|
@ -71,7 +71,7 @@ void path_reference_copy(const Set<std::pair<std::string, std::string>> ©_se
|
|||
fprintf(stderr, "Can't make directory for '%s', not copying\n", dst);
|
||||
continue;
|
||||
}
|
||||
if (!BLI_copy(src, dst)) {
|
||||
if (BLI_copy(src, dst) != 0) {
|
||||
fprintf(stderr, "Can't copy '%s' to '%s'\n", src, dst);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -371,8 +371,8 @@ static void create_temp_path_for_usdz_export(const char *filepath,
|
|||
char usdc_temp_filepath[FILE_MAX];
|
||||
BLI_path_join(usdc_temp_filepath, FILE_MAX, BKE_tempdir_session(), "USDZ", usdc_file);
|
||||
|
||||
BLI_strncpy(job->unarchived_filepath, usdc_temp_filepath, strlen(usdc_temp_filepath) + 1);
|
||||
BLI_strncpy(job->usdz_filepath, filepath, strlen(filepath) + 1);
|
||||
STRNCPY(job->unarchived_filepath, usdc_temp_filepath);
|
||||
STRNCPY(job->usdz_filepath, filepath);
|
||||
|
||||
MEM_freeN(usdc_file);
|
||||
}
|
||||
|
|
|
@ -159,9 +159,9 @@ static void import_startjob(void *customdata, bool *stop, bool *do_update, float
|
|||
G.is_break = false;
|
||||
|
||||
if (data->params.create_collection) {
|
||||
char display_name[1024];
|
||||
char display_name[MAX_ID_NAME - 2];
|
||||
BLI_path_to_display_name(
|
||||
display_name, strlen(data->filepath), BLI_path_basename(data->filepath));
|
||||
display_name, sizeof(display_name), BLI_path_basename(data->filepath));
|
||||
Collection *import_collection = BKE_collection_add(
|
||||
data->bmain, data->scene->master_collection, display_name);
|
||||
id_fake_user_set(&import_collection->id);
|
||||
|
|
|
@ -137,15 +137,17 @@ typedef enum eCustomDataType {
|
|||
/* CD_ID_MCOL = 21, */
|
||||
/* CD_TEXTURE_MLOOPCOL = 22, */ /* UNUSED */
|
||||
CD_CLOTH_ORCO = 23,
|
||||
/* CD_RECAST = 24, */ /* UNUSED */
|
||||
/* CD_RECAST = 24, */ /* UNUSED */
|
||||
|
||||
CD_MPOLY = 25,
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
CD_MPOLY = 25,
|
||||
CD_MLOOP = 26,
|
||||
#endif
|
||||
CD_SHAPE_KEYINDEX = 27,
|
||||
CD_SHAPEKEY = 28,
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
CD_BWEIGHT = 29,
|
||||
#endif
|
||||
/** Subdivision sharpness data per edge or per vertex. */
|
||||
CD_CREASE = 30,
|
||||
CD_ORIGSPACE_MLOOP = 31,
|
||||
|
|
|
@ -143,7 +143,7 @@ typedef enum {
|
|||
eModifierFlag_Active = (1 << 2),
|
||||
/**
|
||||
* Only set on modifiers in evaluated objects. The flag indicates that the user modified inputs
|
||||
* to the modifer which might invalidate simulation caches.
|
||||
* to the modifier which might invalidate simulation caches.
|
||||
*/
|
||||
eModifierFlag_UserModified = (1 << 3),
|
||||
} ModifierFlag;
|
||||
|
@ -2324,6 +2324,11 @@ typedef struct NodesModifierData {
|
|||
ModifierData modifier;
|
||||
struct bNodeTree *node_group;
|
||||
struct NodesModifierSettings settings;
|
||||
/**
|
||||
* Directory where baked simulation states are stored. This may be relative to the .blend file.
|
||||
*/
|
||||
char *simulation_bake_directory;
|
||||
void *_pad;
|
||||
|
||||
/**
|
||||
* Contains logged information from the last evaluation.
|
||||
|
|
|
@ -56,7 +56,7 @@ typedef struct bActionStrip {
|
|||
float actstart, actend;
|
||||
/** Offset within action, for cycles and striding. */
|
||||
float actoffs;
|
||||
/** The stridelength (considered when flag & ACT_USESTRIDE). */
|
||||
/** The stride-length (considered when flag & ACT_USESTRIDE). */
|
||||
float stridelen;
|
||||
/** The number of times to repeat the action range. */
|
||||
float repeat;
|
||||
|
|
|
@ -260,9 +260,9 @@ typedef struct Object {
|
|||
|
||||
short type; /* #ObjectType */
|
||||
short partype;
|
||||
/** Can be vertexnrs. */
|
||||
/** Can be vertex indices. */
|
||||
int par1, par2, par3;
|
||||
/** String describing subobject info, MAX_ID_NAME-2. */
|
||||
/** String describing sub-object info, `MAX_ID_NAME - 2`. */
|
||||
char parsubstr[64];
|
||||
struct Object *parent, *track;
|
||||
/* Proxy pointer are deprecated, only kept for conversion to liboverrides. */
|
||||
|
|
|
@ -437,7 +437,7 @@ enum {
|
|||
/* REACTOR type currently unused */
|
||||
/* PART_REACTOR = 1, */
|
||||
PART_HAIR = 2,
|
||||
PART_FLUID = 3, /* deprecated (belonged to elbeem) */
|
||||
PART_FLUID = 3, /* Deprecated (belonged to ELBEEM). */
|
||||
PART_FLUID_FLIP = 4,
|
||||
PART_FLUID_SPRAY = 5,
|
||||
PART_FLUID_BUBBLE = 6,
|
||||
|
|
|
@ -187,9 +187,9 @@ typedef struct Sequence {
|
|||
float _pad1;
|
||||
|
||||
short anim_preseek; /* UNUSED. */
|
||||
/** Streamindex for movie or sound files with several streams. */
|
||||
/** Stream-index for movie or sound files with several streams. */
|
||||
short streamindex;
|
||||
/** For multicam source selection. */
|
||||
/** For multi-camera source selection. */
|
||||
int multicam_source;
|
||||
/** MOVIECLIP render flags. */
|
||||
int clip_flag;
|
||||
|
|
|
@ -187,14 +187,17 @@ typedef struct Tex {
|
|||
|
||||
float cropxmin, cropymin, cropxmax, cropymax;
|
||||
int texfilter;
|
||||
int afmax; /* anisotropic filter maximum value, ewa -> max eccentricity, feline -> max probes */
|
||||
/** Anisotropic filter maximum value, EWA -> max eccentricity, feline -> max probes. */
|
||||
int afmax;
|
||||
short xrepeat, yrepeat;
|
||||
short extend;
|
||||
|
||||
/* variables disabled, moved to struct iuser */
|
||||
/* Variables only used for versioning, moved to struct member `iuser`. */
|
||||
short _pad0;
|
||||
int len;
|
||||
int frames, offset, sfra;
|
||||
int len DNA_DEPRECATED;
|
||||
int frames DNA_DEPRECATED;
|
||||
int offset DNA_DEPRECATED;
|
||||
int sfra DNA_DEPRECATED;
|
||||
|
||||
float checkerdist, nabla;
|
||||
char _pad1[4];
|
||||
|
|
|
@ -253,7 +253,7 @@ typedef struct ThemeSpace {
|
|||
unsigned char button_text[4];
|
||||
unsigned char button_text_hi[4];
|
||||
|
||||
/* listview regions */
|
||||
/* List-view regions. */
|
||||
/** Region background. */
|
||||
unsigned char list[4];
|
||||
/** Panel title. */
|
||||
|
@ -489,7 +489,7 @@ typedef struct bTheme {
|
|||
ThemeUI tui;
|
||||
|
||||
/**
|
||||
* Individual Spacetypes:
|
||||
* Individual Space-types:
|
||||
* \note Ensure #UI_THEMESPACE_END is updated when adding.
|
||||
*/
|
||||
ThemeSpace space_properties;
|
||||
|
|
|
@ -48,8 +48,10 @@ typedef struct View2D {
|
|||
|
||||
/** Storage of current winx/winy values, set in UI_view2d_size_update. */
|
||||
short winx, winy;
|
||||
/** Storage of previous winx/winy values encountered by UI_view2d_curRect_validate(),
|
||||
* for keepaspect. */
|
||||
/**
|
||||
* Storage of previous winx/winy values encountered by #UI_view2d_curRect_validate(),
|
||||
* for keep-aspect.
|
||||
*/
|
||||
short oldwinx, oldwiny;
|
||||
|
||||
/** Pivot point for transforms (rotate and scale). */
|
||||
|
|
|
@ -286,11 +286,11 @@ typedef enum PropertyFlag {
|
|||
|
||||
/** This is an IDProperty, not a DNA one. */
|
||||
PROP_IDPROPERTY = (1 << 10),
|
||||
/** For dynamic arrays, and retvals of type string. */
|
||||
/** For dynamic arrays & return values of type string. */
|
||||
PROP_DYNAMIC = (1 << 17),
|
||||
/** For enum that shouldn't be contextual */
|
||||
PROP_ENUM_NO_CONTEXT = (1 << 24),
|
||||
/** For enums not to be translated (e.g. viewlayers' names in nodes). */
|
||||
/** For enums not to be translated (e.g. view-layers' names in nodes). */
|
||||
PROP_ENUM_NO_TRANSLATE = (1 << 29),
|
||||
|
||||
/**
|
||||
|
|
|
@ -1567,7 +1567,7 @@ static void rna_def_ID_materials(BlenderRNA *brna)
|
|||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
/* for mesh/mball/curve materials */
|
||||
/* For mesh/meta-ball/curve materials. */
|
||||
srna = RNA_def_struct(brna, "IDMaterials", NULL);
|
||||
RNA_def_struct_sdna(srna, "ID");
|
||||
RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/* NOTE: the original vertex color stuff is now just used for
|
||||
* getting info on the layers themselves, accessing the data is
|
||||
* done through the (not yet written) mpoly interfaces. */
|
||||
|
||||
/** \file
|
||||
* \ingroup RNA
|
||||
*/
|
||||
|
|
|
@ -1147,7 +1147,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr,
|
|||
BKE_object_material_assign(G_MAIN, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
|
||||
|
||||
if (ob->type == OB_GPENCIL_LEGACY) {
|
||||
/* notifying material property in topbar */
|
||||
/* Notifying material property in top-bar. */
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6292,6 +6292,22 @@ static void rna_def_userdef_script_directory(BlenderRNA *brna)
|
|||
RNA_def_struct_name_property(srna, prop);
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
/* NOTE(@ideasman42): Ideally, changing scripts directory would behave as if
|
||||
* Blender were launched with different script directories (instead of requiring a restart).
|
||||
* Editing could re-initialize Python's `sys.path`, however this isn't enough.
|
||||
*
|
||||
* - For adding new directories this would work for the most-part, duplicate modules between
|
||||
* directories might cause Python's state on restart to differ however that could
|
||||
* be considered a corner case as duplicate modules might cause bad/unexpected behavior anyway.
|
||||
* - Support for removing/changing directories is more involved as there might be modules
|
||||
* loaded into memory which are no longer accessible.
|
||||
*
|
||||
* Properly supporting this would likely require unloading all Blender/Python modules,
|
||||
* then re-initializing Python's state. This is already supported with `SCRIPT_OT_reload`,
|
||||
* even then, there are cases that don't work well (especially if any Python operators are
|
||||
* running at the time this runs). So accept the limitation having to restart
|
||||
* before changes to script directories are taken into account. */
|
||||
|
||||
prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
|
||||
RNA_def_property_string_sdna(prop, NULL, "dir_path");
|
||||
RNA_def_property_ui_text(
|
||||
|
@ -6299,7 +6315,6 @@ static void rna_def_userdef_script_directory(BlenderRNA *brna)
|
|||
"Python Scripts Directory",
|
||||
"Alternate script path, matching the default layout with sub-directories: startup, add-ons, "
|
||||
"modules, and presets (requires restart)");
|
||||
/* TODO: editing should reset sys.path! */
|
||||
}
|
||||
|
||||
static void rna_def_userdef_script_directory_collection(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
|
|
|
@ -103,7 +103,7 @@ def check_if_changed(a, b):
|
|||
|
||||
def get_props_from_txt(input_filename):
|
||||
"""
|
||||
If the file is *.txt, the script assumes it is formatted as outlined in this script docstring
|
||||
If the file is *.txt, the script assumes it is formatted as outlined in this script doc-string.
|
||||
"""
|
||||
|
||||
file = open(input_filename, 'r')
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "BLI_listbase.h"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_multi_value_map.hh"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_set.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_search.h"
|
||||
|
@ -1152,9 +1153,14 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
|
|||
if (nmd_orig.simulation_cache->cache_state() != bke::sim::CacheState::Baked &&
|
||||
!bmain_path.is_empty())
|
||||
{
|
||||
nmd_orig.simulation_cache->try_discover_bake(
|
||||
bke::sim::get_meta_directory(*bmain, *ctx.object, nmd.modifier),
|
||||
bke::sim::get_bdata_directory(*bmain, *ctx.object, nmd.modifier));
|
||||
if (!StringRef(nmd.simulation_bake_directory).is_empty()) {
|
||||
if (const char *base_path = ID_BLEND_PATH(bmain, &ctx.object->id)) {
|
||||
char absolute_bake_dir[FILE_MAX];
|
||||
STRNCPY(absolute_bake_dir, nmd.simulation_bake_directory);
|
||||
BLI_path_abs(absolute_bake_dir, base_path);
|
||||
nmd_orig.simulation_cache->try_discover_bake(absolute_bake_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2004,6 +2010,8 @@ static void blendWrite(BlendWriter *writer, const ID * /*id_owner*/, const Modif
|
|||
|
||||
BLO_write_struct(writer, NodesModifierData, nmd);
|
||||
|
||||
BLO_write_string(writer, nmd->simulation_bake_directory);
|
||||
|
||||
if (nmd->settings.properties != nullptr) {
|
||||
Map<IDProperty *, IDPropertyUIDataBool *> boolean_props;
|
||||
if (!BLO_write_is_undo(writer)) {
|
||||
|
@ -2042,6 +2050,7 @@ static void blendWrite(BlendWriter *writer, const ID * /*id_owner*/, const Modif
|
|||
static void blendRead(BlendDataReader *reader, ModifierData *md)
|
||||
{
|
||||
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
|
||||
BLO_read_data_address(reader, &nmd->simulation_bake_directory);
|
||||
if (nmd->node_group == nullptr) {
|
||||
nmd->settings.properties = nullptr;
|
||||
}
|
||||
|
@ -2062,6 +2071,9 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
|
|||
|
||||
tnmd->runtime_eval_log = nullptr;
|
||||
tnmd->simulation_cache = nullptr;
|
||||
tnmd->simulation_bake_directory = nmd->simulation_bake_directory ?
|
||||
BLI_strdup(nmd->simulation_bake_directory) :
|
||||
nullptr;
|
||||
|
||||
if (nmd->settings.properties != nullptr) {
|
||||
tnmd->settings.properties = IDP_CopyProperty_ex(nmd->settings.properties, flag);
|
||||
|
@ -2077,6 +2089,7 @@ static void freeData(ModifierData *md)
|
|||
}
|
||||
|
||||
MEM_delete(nmd->simulation_cache);
|
||||
MEM_SAFE_FREE(nmd->simulation_bake_directory);
|
||||
|
||||
clear_runtime_data(nmd);
|
||||
}
|
||||
|
|
|
@ -1446,7 +1446,7 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md,
|
|||
if (smd->nonmanifold_offset_mode == MOD_SOLIDIFY_NONMANIFOLD_OFFSET_MODE_CONSTRAINTS) {
|
||||
NewEdgeRef *first_edge = nullptr;
|
||||
NewEdgeRef **edge_ptr = g->edges;
|
||||
/* Contains normal and offset [nx, ny, nz, ofs]. */
|
||||
/* Contains normal and offset `[nx, ny, nz, ofs]`. */
|
||||
float(*planes_queue)[4] = static_cast<float(*)[4]>(
|
||||
MEM_malloc_arrayN(g->edges_len + 1, sizeof(*planes_queue), __func__));
|
||||
uint queue_index = 0;
|
||||
|
|
|
@ -507,8 +507,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
/* Right now:
|
||||
* If weight = 50 then all faces are given equal weight.
|
||||
* If weight > 50 then more weight given to faces with larger vals (face area / corner angle).
|
||||
* If weight < 50 then more weight given to faces with lesser vals. However current calculation
|
||||
* If weight > 50 then more weight given to faces with larger values (face area / corner angle).
|
||||
* If weight < 50 then more weight given to faces with lesser values. However current calculation
|
||||
* does not converge to min/max.
|
||||
*/
|
||||
float weight = float(wnmd->weight) / 50.0f;
|
||||
|
|
|
@ -820,7 +820,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
|
|||
/* Recreate links between copied nodes. */
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node->runtime->tmp_flag >= 0) {
|
||||
/* Naming can be confusing here. We use original nodelink name for from/to prefix.
|
||||
/* Naming can be confusing here. We use original node-link name for from/to prefix.
|
||||
* The final link is in reversed order. */
|
||||
int socket_index;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, socket_index) {
|
||||
|
|
|
@ -940,7 +940,7 @@ PyObject *PyC_ExceptionBuffer(void)
|
|||
PySys_SetObject("stdout", stdout_backup);
|
||||
PySys_SetObject("stderr", stderr_backup);
|
||||
|
||||
Py_DECREF(stdout_backup); /* now sys owns the ref again */
|
||||
Py_DECREF(stdout_backup); /* Now `sys` owns the reference again. */
|
||||
Py_DECREF(stderr_backup);
|
||||
|
||||
Py_DECREF(string_io_mod);
|
||||
|
@ -1096,7 +1096,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
|
|||
PyObject *builtins = PyEval_GetBuiltins();
|
||||
PyObject *mod_main = PyModule_New("__main__");
|
||||
PyDict_SetItemString(modules, "__main__", mod_main);
|
||||
Py_DECREF(mod_main); /* sys.modules owns now */
|
||||
Py_DECREF(mod_main); /* `sys.modules` owns now. */
|
||||
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
|
||||
if (filename) {
|
||||
/* __file__ mainly for nice UI'ness
|
||||
|
|
|
@ -555,8 +555,8 @@ PyObject *BPY_app_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppType.tp_init = NULL;
|
||||
BlenderAppType.tp_new = NULL;
|
||||
BlenderAppType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
/* Kind of a hack on top of #PyStructSequence. */
|
||||
py_struct_seq_getset_init();
|
||||
|
|
|
@ -83,8 +83,8 @@ PyObject *BPY_app_alembic_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppABCType.tp_init = NULL;
|
||||
BlenderAppABCType.tp_new = NULL;
|
||||
BlenderAppABCType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppABCType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -346,8 +346,8 @@ PyObject *BPY_app_build_options_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppBuildOptionsType.tp_init = NULL;
|
||||
BlenderAppBuildOptionsType.tp_new = NULL;
|
||||
BlenderAppBuildOptionsType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppBuildOptionsType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -125,8 +125,8 @@ PyObject *BPY_app_ffmpeg_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppFFmpegType.tp_init = NULL;
|
||||
BlenderAppFFmpegType.tp_new = NULL;
|
||||
BlenderAppFFmpegType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppFFmpegType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -255,8 +255,8 @@ PyObject *BPY_app_handlers_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppCbType.tp_init = NULL;
|
||||
BlenderAppCbType.tp_new = NULL;
|
||||
BlenderAppCbType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
/* assign the C callbacks */
|
||||
if (ret) {
|
||||
|
|
|
@ -89,8 +89,8 @@ PyObject *BPY_app_ocio_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppOCIOType.tp_init = NULL;
|
||||
BlenderAppOCIOType.tp_new = NULL;
|
||||
BlenderAppOCIOType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppOCIOType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ PyObject *BPY_app_oiio_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppOIIOType.tp_init = NULL;
|
||||
BlenderAppOIIOType.tp_new = NULL;
|
||||
BlenderAppOIIOType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppOIIOType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ PyObject *BPY_app_opensubdiv_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppOpenSubdivType.tp_init = NULL;
|
||||
BlenderAppOpenSubdivType.tp_new = NULL;
|
||||
/* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppOpenSubdivType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -87,8 +87,8 @@ PyObject *BPY_app_openvdb_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppOVDBType.tp_init = NULL;
|
||||
BlenderAppOVDBType.tp_new = NULL;
|
||||
BlenderAppOVDBType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppOVDBType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -122,8 +122,8 @@ PyObject *BPY_app_sdl_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppSDLType.tp_init = NULL;
|
||||
BlenderAppSDLType.tp_new = NULL;
|
||||
BlenderAppSDLType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppSDLType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -859,7 +859,7 @@ PyObject *BPY_app_translations_struct(void)
|
|||
|
||||
/* prevent user from creating new instances */
|
||||
BlenderAppTranslationsType.tp_new = NULL;
|
||||
/* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppTranslationsType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -84,8 +84,8 @@ PyObject *BPY_app_usd_struct(void)
|
|||
/* prevent user from creating new instances */
|
||||
BlenderAppUSDType.tp_init = NULL;
|
||||
BlenderAppUSDType.tp_new = NULL;
|
||||
BlenderAppUSDType.tp_hash = (hashfunc)
|
||||
_Py_HashPointer; /* without this we can't do set(sys.modules) #29635. */
|
||||
/* Without this we can't do `set(sys.modules)` #29635. */
|
||||
BlenderAppUSDType.tp_hash = (hashfunc)_Py_HashPointer;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *gzgt, void *userdata)
|
|||
|
||||
/* don't do translations here yet */
|
||||
#if 0
|
||||
/* Use i18n context from rna_ext.srna if possible (py gizmogroups). */
|
||||
/* Use i18n context from rna_ext.srna if possible (py gizmo-groups). */
|
||||
if (gzgt->rna_ext.srna) {
|
||||
RNA_def_struct_translation_context(gzgt->srna, RNA_struct_translation_context(gzgt->rna_ext.srna));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* \ingroup pythonintern
|
||||
*
|
||||
* This file inserts an exit callback into Python's 'atexit' module.
|
||||
* Without this sys.exit() can crash because blender is not properly closing
|
||||
* Without this `sys.exit()` can crash because blender is not properly closing
|
||||
* resources.
|
||||
*/
|
||||
|
||||
|
|
|
@ -567,7 +567,7 @@ static int py_to_array(PyObject *seq,
|
|||
* python data, the check here is mainly for completeness. */
|
||||
if (copy_values(seq, ptr, prop, 0, data, item_size, NULL, convert_item, NULL) != NULL) {
|
||||
if (param_data == NULL) {
|
||||
/* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
|
||||
/* NULL can only pass through in case RNA property array-length is 0 (impossible?) */
|
||||
rna_set_array(ptr, prop, data);
|
||||
PyMem_FREE(data);
|
||||
}
|
||||
|
|
|
@ -123,8 +123,4 @@ for d in dir(bpy.types):
|
|||
seek(r, 'bpy.types.' + d + '.bl_rna', 0)
|
||||
'''
|
||||
|
||||
# print dir(bpy)
|
||||
# import sys
|
||||
# sys.exit()
|
||||
|
||||
print("iter over ", seek_count, "rna items")
|
||||
|
|
|
@ -108,7 +108,7 @@ typedef struct RenderLayer {
|
|||
|
||||
int rectx, recty;
|
||||
|
||||
/** Optional saved endresult on disk. */
|
||||
/** Optional saved end-result on disk. */
|
||||
void *exrhandle;
|
||||
|
||||
ListBase passes;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue