Mesh: Replace MLoop struct with generic attributes #104424
|
@ -157,9 +157,6 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur
|
|||
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some efficiency, only enable for development)." OFF)
|
||||
mark_as_advanced(WITH_PYTHON_SAFETY)
|
||||
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." OFF)
|
||||
if(APPLE)
|
||||
option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
|
||||
endif()
|
||||
|
||||
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)
|
||||
set(BUILDINFO_OVERRIDE_DATE "" CACHE STRING "Use instead of the current date for reproducible builds (empty string disables this option)")
|
||||
|
@ -1628,8 +1625,8 @@ if(WITH_PYTHON)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
# Windows and macOS have this bundled with Python libraries.
|
||||
if(WIN32)
|
||||
# Always use numpy bundled in precompiled libs.
|
||||
elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR WITH_PYTHON_NUMPY)
|
||||
if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
|
||||
find_python_package(numpy "core/include")
|
||||
|
@ -1637,13 +1634,13 @@ if(WITH_PYTHON)
|
|||
endif()
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
# pass, we have this in lib/python/site-packages
|
||||
# Always copy from precompiled libs.
|
||||
elseif(WITH_PYTHON_INSTALL_REQUESTS)
|
||||
find_python_package(requests "")
|
||||
endif()
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
# pass, we have this in lib/python/site-packages
|
||||
# Always copy from precompiled libs.
|
||||
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
|
||||
find_python_package(zstandard "")
|
||||
endif()
|
||||
|
@ -1908,9 +1905,6 @@ if(FIRST_RUN)
|
|||
info_cfg_option(WITH_LZO)
|
||||
|
||||
info_cfg_text("Python:")
|
||||
if(APPLE)
|
||||
info_cfg_option(WITH_PYTHON_FRAMEWORK)
|
||||
endif()
|
||||
info_cfg_option(WITH_PYTHON_INSTALL)
|
||||
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
|
||||
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
|
||||
|
|
|
@ -34,11 +34,17 @@ SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
|
|||
MARK_AS_ADVANCED(PYTHON_VERSION)
|
||||
|
||||
|
||||
# See: http://docs.python.org/extending/embedding.html#linking-requirements
|
||||
# for why this is needed
|
||||
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
|
||||
MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
|
||||
|
||||
if(APPLE)
|
||||
if(WITH_PYTHON_MODULE)
|
||||
set(PYTHON_LINKFLAGS "-undefined dynamic_lookup")
|
||||
else()
|
||||
set(PYTHON_LINKFLAGS)
|
||||
endif()
|
||||
else()
|
||||
# See: http://docs.python.org/extending/embedding.html#linking-requirements
|
||||
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
|
||||
MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
|
||||
endif()
|
||||
|
||||
# if the user passes these defines as args, we don't want to overwrite
|
||||
SET(_IS_INC_DEF OFF)
|
||||
|
|
|
@ -1208,16 +1208,8 @@ endmacro()
|
|||
|
||||
macro(without_system_libs_begin)
|
||||
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
|
||||
if(APPLE)
|
||||
# Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(without_system_libs_end)
|
||||
unset(CMAKE_IGNORE_PATH)
|
||||
if(APPLE)
|
||||
# FIRST is the default.
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
|
@ -36,6 +36,9 @@ endmacro()
|
|||
# ------------------------------------------------------------------------
|
||||
# Find system provided libraries.
|
||||
|
||||
# Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
|
||||
# Find system ZLIB, not the pre-compiled one supplied with OpenCollada.
|
||||
set(ZLIB_ROOT /usr)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
@ -75,6 +78,11 @@ if(NOT EXISTS "${LIBDIR}/")
|
|||
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
|
||||
# Optionally use system Python if PYTHON_ROOT_DIR is specified.
|
||||
if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
endif()
|
||||
|
||||
# Prefer lib directory paths
|
||||
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
|
||||
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
|
||||
|
@ -123,34 +131,8 @@ if(WITH_CODEC_SNDFILE)
|
|||
unset(_sndfile_VORBISENC_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
# Use precompiled libraries by default.
|
||||
set(PYTHON_VERSION 3.10)
|
||||
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
||||
# Normally cached but not since we include them with blender.
|
||||
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
|
||||
set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}")
|
||||
set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.a)
|
||||
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
|
||||
else()
|
||||
# Module must be compiled against Python framework.
|
||||
set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
|
||||
set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}")
|
||||
set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}")
|
||||
set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}")
|
||||
unset(_py_framework)
|
||||
endif()
|
||||
|
||||
# uncached vars
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
|
||||
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
|
||||
|
||||
# needed for Audaspace, numpy is installed into python site-packages
|
||||
set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
|
||||
|
||||
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
|
||||
message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_FFTW3)
|
||||
|
@ -213,11 +195,6 @@ if(WITH_JACK)
|
|||
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
|
||||
# force cmake to link right framework
|
||||
string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLLADA)
|
||||
find_package(OpenCOLLADA)
|
||||
find_library(PCRE_LIBRARIES NAMES pcre HINTS ${LIBDIR}/opencollada/lib)
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "kernel/device/cpu/compat.h"
|
||||
#include "kernel/device/cpu/globals.h"
|
||||
|
||||
#include "kernel/osl/types.h"
|
||||
#include "kernel/osl/closures_setup.h"
|
||||
#include "kernel/osl/types.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
|
|
|
@ -450,6 +450,7 @@ static bool set_attribute_float2(float2 f[3], TypeDesc type, bool derivatives, v
|
|||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool set_attribute_float2(float2 f, TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
float2 fv[3];
|
||||
|
@ -460,6 +461,7 @@ static bool set_attribute_float2(float2 f, TypeDesc type, bool derivatives, void
|
|||
|
||||
return set_attribute_float2(fv, type, derivatives, val);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
|
@ -588,6 +590,7 @@ static bool set_attribute_float4(float4 f[3], TypeDesc type, bool derivatives, v
|
|||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool set_attribute_float4(float4 f, TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
float4 fv[3];
|
||||
|
@ -598,6 +601,7 @@ static bool set_attribute_float4(float4 f, TypeDesc type, bool derivatives, void
|
|||
|
||||
return set_attribute_float4(fv, type, derivatives, val);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool set_attribute_float(float f[3], TypeDesc type, bool derivatives, void *val)
|
||||
{
|
||||
|
|
|
@ -150,7 +150,8 @@ static void flatten_surface_closure_tree(const KernelGlobalsCPU *kg,
|
|||
switch (closure->id) {
|
||||
case OSL::ClosureColor::MUL: {
|
||||
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
|
||||
flatten_surface_closure_tree(kg, sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
|
||||
flatten_surface_closure_tree(
|
||||
kg, sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
|
||||
break;
|
||||
}
|
||||
case OSL::ClosureColor::ADD: {
|
||||
|
@ -161,14 +162,10 @@ static void flatten_surface_closure_tree(const KernelGlobalsCPU *kg,
|
|||
}
|
||||
#define OSL_CLOSURE_STRUCT_BEGIN(Upper, lower) \
|
||||
case OSL_CLOSURE_##Upper##_ID: { \
|
||||
const OSL::ClosureComponent *comp = \
|
||||
reinterpret_cast<const OSL::ClosureComponent *>(closure); \
|
||||
const OSL::ClosureComponent *comp = reinterpret_cast<const OSL::ClosureComponent *>(closure); \
|
||||
weight *= TO_FLOAT3(comp->w); \
|
||||
osl_closure_##lower##_setup(kg, \
|
||||
sd, \
|
||||
path_flag, \
|
||||
weight, \
|
||||
reinterpret_cast<const Upper##Closure *>(comp + 1)); \
|
||||
osl_closure_##lower##_setup( \
|
||||
kg, sd, path_flag, weight, reinterpret_cast<const Upper##Closure *>(comp + 1)); \
|
||||
break; \
|
||||
}
|
||||
#include "closures_template.h"
|
||||
|
|
|
@ -17,5 +17,4 @@ enum ClosureTypeOSL {
|
|||
#include "closures_template.h"
|
||||
};
|
||||
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
|
|
@ -331,6 +331,7 @@ def has_selected_ids_in_context(context):
|
|||
|
||||
return False
|
||||
|
||||
|
||||
class OUTLINER_MT_asset(Menu):
|
||||
bl_label = "Assets"
|
||||
|
||||
|
|
|
@ -5175,6 +5175,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
|
|||
layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
|
||||
layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type")
|
||||
layout.operator("gpencil.stroke_flip", text="Switch Direction")
|
||||
layout.operator("gpencil.stroke_start_set", text="Set Start Point")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("gpencil.stroke_normalize", text="Normalize Thickness").mode = 'THICKNESS'
|
||||
|
@ -7329,6 +7330,7 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu):
|
|||
col.operator("transform.shear", text="Shear")
|
||||
col.operator("transform.tosphere", text="To Sphere")
|
||||
col.operator("transform.transform", text="Shrink/Fatten").mode = 'GPENCIL_SHRINKFATTEN'
|
||||
col.operator("gpencil.stroke_start_set", text="Set Start Point")
|
||||
|
||||
col.separator()
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ const char *BKE_appdir_folder_home(void);
|
|||
*
|
||||
* \returns True if the path is valid and points to an existing directory.
|
||||
*/
|
||||
bool BKE_appdir_folder_documents(char *dir);
|
||||
bool BKE_appdir_folder_documents(char *dir) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
/**
|
||||
* Get the user's cache directory, i.e.
|
||||
* - Linux: `$HOME/.cache/blender/`
|
||||
|
@ -66,7 +66,7 @@ bool BKE_appdir_folder_documents(char *dir);
|
|||
* \returns True if the path is valid. It doesn't create or checks format
|
||||
* if the `blender` folder exists. It does check if the parent of the path exists.
|
||||
*/
|
||||
bool BKE_appdir_folder_caches(char *r_path, size_t path_len);
|
||||
bool BKE_appdir_folder_caches(char *r_path, size_t path_len) ATTR_NONNULL(1);
|
||||
/**
|
||||
* Get a folder out of the \a folder_id presets for paths.
|
||||
*
|
||||
|
@ -75,15 +75,17 @@ bool BKE_appdir_folder_caches(char *r_path, size_t path_len);
|
|||
* \return The path if found, NULL string if not.
|
||||
*/
|
||||
bool BKE_appdir_folder_id_ex(int folder_id, const char *subfolder, char *path, size_t path_len);
|
||||
const char *BKE_appdir_folder_id(int folder_id, const char *subfolder);
|
||||
const char *BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT;
|
||||
/**
|
||||
* Returns the path to a folder in the user area, creating it if it doesn't exist.
|
||||
*/
|
||||
const char *BKE_appdir_folder_id_create(int folder_id, const char *subfolder);
|
||||
const char *BKE_appdir_folder_id_create(int folder_id,
|
||||
const char *subfolder) ATTR_WARN_UNUSED_RESULT;
|
||||
/**
|
||||
* Returns the path to a folder in the user area without checking that it actually exists first.
|
||||
*/
|
||||
const char *BKE_appdir_folder_id_user_notest(int folder_id, const char *subfolder);
|
||||
const char *BKE_appdir_folder_id_user_notest(int folder_id,
|
||||
const char *subfolder) ATTR_WARN_UNUSED_RESULT;
|
||||
/**
|
||||
* Returns the path of the top-level version-specific local, user or system directory.
|
||||
* If check_is_dir, then the result will be NULL if the directory doesn't exist.
|
||||
|
@ -99,23 +101,24 @@ bool BKE_appdir_app_is_portable_install(void);
|
|||
* Return true if templates exist
|
||||
*/
|
||||
bool BKE_appdir_app_template_any(void);
|
||||
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
|
||||
bool BKE_appdir_app_template_has_userpref(const char *app_template);
|
||||
void BKE_appdir_app_templates(struct ListBase *templates);
|
||||
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
|
||||
ATTR_NONNULL(1);
|
||||
bool BKE_appdir_app_template_has_userpref(const char *app_template) ATTR_NONNULL(1);
|
||||
void BKE_appdir_app_templates(struct ListBase *templates) ATTR_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Initialize path to program executable.
|
||||
*/
|
||||
void BKE_appdir_program_path_init(const char *argv0);
|
||||
void BKE_appdir_program_path_init(const char *argv0) ATTR_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Path to executable
|
||||
*/
|
||||
const char *BKE_appdir_program_path(void);
|
||||
const char *BKE_appdir_program_path(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
/**
|
||||
* Path to directory of executable
|
||||
*/
|
||||
const char *BKE_appdir_program_dir(void);
|
||||
const char *BKE_appdir_program_dir(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
|
||||
/**
|
||||
* Gets a good default directory for fonts.
|
||||
|
@ -128,7 +131,7 @@ bool BKE_appdir_font_folder_default(char *dir);
|
|||
bool BKE_appdir_program_python_search(char *fullpath,
|
||||
size_t fullpath_len,
|
||||
int version_major,
|
||||
int version_minor);
|
||||
int version_minor) ATTR_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Initialize path to temporary directory.
|
||||
|
@ -138,11 +141,11 @@ void BKE_tempdir_init(const char *userdir);
|
|||
/**
|
||||
* Path to persistent temporary directory (with trailing slash)
|
||||
*/
|
||||
const char *BKE_tempdir_base(void);
|
||||
const char *BKE_tempdir_base(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
/**
|
||||
* Path to temporary directory (with trailing slash)
|
||||
*/
|
||||
const char *BKE_tempdir_session(void);
|
||||
const char *BKE_tempdir_session(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
|
||||
/**
|
||||
* Delete content of this instance's temp dir.
|
||||
*/
|
||||
|
|
|
@ -734,6 +734,7 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold
|
|||
BLENDER_USER_CONFIG,
|
||||
BLENDER_USER_SCRIPTS,
|
||||
BLENDER_USER_AUTOSAVE)) {
|
||||
BLI_assert_unreachable();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1166,19 +1166,21 @@ static void studiolight_add_files_from_datafolder(const int folder_id,
|
|||
const char *subfolder,
|
||||
int flag)
|
||||
{
|
||||
struct direntry *dirs;
|
||||
const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
|
||||
if (folder) {
|
||||
const uint dirs_num = BLI_filelist_dir_contents(folder, &dirs);
|
||||
int i;
|
||||
for (i = 0; i < dirs_num; i++) {
|
||||
if (dirs[i].type & S_IFREG) {
|
||||
studiolight_add_file(dirs[i].path, flag);
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
dirs = NULL;
|
||||
if (!folder) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct direntry *dirs;
|
||||
const uint dirs_num = BLI_filelist_dir_contents(folder, &dirs);
|
||||
int i;
|
||||
for (i = 0; i < dirs_num; i++) {
|
||||
if (dirs[i].type & S_IFREG) {
|
||||
studiolight_add_file(dirs[i].path, flag);
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
dirs = NULL;
|
||||
}
|
||||
|
||||
static int studiolight_flag_cmp_order(const StudioLight *sl)
|
||||
|
|
|
@ -154,12 +154,12 @@ void BLI_hostname_get(char *buffer, size_t bufsize)
|
|||
if (gethostname(buffer, bufsize - 1) < 0) {
|
||||
BLI_strncpy(buffer, "-unknown-", bufsize);
|
||||
}
|
||||
/* When gethostname() truncates, it doesn't guarantee the trailing \0. */
|
||||
/* When `gethostname()` truncates, it doesn't guarantee the trailing `\0`. */
|
||||
buffer[bufsize - 1] = '\0';
|
||||
#else
|
||||
DWORD bufsize_inout = bufsize;
|
||||
if (!GetComputerName(buffer, &bufsize_inout)) {
|
||||
strncpy(buffer, "-unknown-", bufsize);
|
||||
BLI_strncpy(buffer, "-unknown-", bufsize);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -470,7 +470,7 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
|
|||
BMLoop *lf; /* current face loops */
|
||||
MLoopUV *f_luv; /* first face loop uv */
|
||||
float p_uv[2]; /* previous uvs */
|
||||
float t_uv[2]; /* tmp uvs */
|
||||
float t_uv[2]; /* temp uvs */
|
||||
|
||||
int n = 0;
|
||||
BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
|
||||
|
@ -603,7 +603,7 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
|
||||
void *p_col; /* previous color */
|
||||
void *t_col = alloca(size); /* tmp color */
|
||||
void *t_col = alloca(size); /* Temp color. */
|
||||
|
||||
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
|
||||
if (use_ccw == false) { /* same loops direction */
|
||||
|
|
|
@ -781,6 +781,7 @@ static const EnumPropertyItem *rna_asset_library_reference_itemf(bContext *UNUSE
|
|||
const EnumPropertyItem *items = ED_asset_library_reference_to_rna_enum_itemf(false);
|
||||
if (!items) {
|
||||
*r_free = false;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
*r_free = true;
|
||||
|
|
|
@ -3790,6 +3790,101 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot)
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Stroke Start Set Operator
|
||||
* \{ */
|
||||
|
||||
static int gpencil_stroke_start_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = ob->data;
|
||||
|
||||
/* sanity checks */
|
||||
if (ELEM(NULL, ob, gpd)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
|
||||
const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
|
||||
if (is_curve_edit) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Curve Edit mode not supported");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
/* Read all selected strokes. */
|
||||
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
|
||||
bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
|
||||
|
||||
for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
|
||||
if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
|
||||
if (gpf == NULL) {
|
||||
continue;
|
||||
}
|
||||
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
|
||||
if (gps->flag & GP_STROKE_SELECT) {
|
||||
/* skip strokes that are invalid for current view */
|
||||
if (ED_gpencil_stroke_can_use(C, gps) == false) {
|
||||
continue;
|
||||
}
|
||||
/* check if the color is editable */
|
||||
if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only cyclic strokes. */
|
||||
if ((gps->flag & GP_STROKE_CYCLIC) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find first selected point and set start. */
|
||||
bGPDspoint *pt;
|
||||
for (int i = 0; i < gps->totpoints; i++) {
|
||||
pt = &gps->points[i];
|
||||
if (pt->flag & GP_SPOINT_SELECT) {
|
||||
BKE_gpencil_stroke_start_set(gps, i);
|
||||
BKE_gpencil_stroke_geometry_update(gpd, gps);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If not multi-edit, exit loop. */
|
||||
if (!is_multiedit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
if (changed) {
|
||||
/* notifiers */
|
||||
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void GPENCIL_OT_stroke_start_set(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Set Start Point";
|
||||
ot->idname = "GPENCIL_OT_stroke_start_set";
|
||||
ot->description = "Set start point for cyclic strokes";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gpencil_stroke_start_set_exec;
|
||||
ot->poll = gpencil_active_layer_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Stroke Re-project Operator
|
||||
* \{ */
|
||||
|
|
|
@ -593,6 +593,7 @@ void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
|
|||
*/
|
||||
void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_stroke_join(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_stroke_start_set(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_stroke_simplify(struct wmOperatorType *ot);
|
||||
|
|
|
@ -621,6 +621,7 @@ void ED_operatortypes_gpencil(void)
|
|||
WM_operatortype_append(GPENCIL_OT_stroke_caps_set);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_join);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_flip);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_start_set);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_subdivide);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_simplify);
|
||||
WM_operatortype_append(GPENCIL_OT_stroke_simplify_fixed);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "BLI_linklist_stack.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_string_utils.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
@ -2687,12 +2688,13 @@ static void ed_panel_draw(const bContext *C,
|
|||
const uiStyle *style = UI_style_get_dpi();
|
||||
|
||||
/* Draw panel. */
|
||||
|
||||
char block_name[BKE_ST_MAXNAME + INSTANCED_PANEL_UNIQUE_STR_LEN];
|
||||
strncpy(block_name, pt->idname, BKE_ST_MAXNAME);
|
||||
if (unique_panel_str != NULL) {
|
||||
if (unique_panel_str) {
|
||||
/* Instanced panels should have already been added at this point. */
|
||||
strncat(block_name, unique_panel_str, INSTANCED_PANEL_UNIQUE_STR_LEN);
|
||||
BLI_string_join(block_name, sizeof(block_name), pt->idname, unique_panel_str);
|
||||
}
|
||||
else {
|
||||
STRNCPY(block_name, pt->idname);
|
||||
}
|
||||
uiBlock *block = UI_block_begin(C, region, block_name, UI_EMBOSS);
|
||||
|
||||
|
|
|
@ -840,7 +840,7 @@ void ED_spacetype_action(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_ACTION;
|
||||
strncpy(st->name, "Action", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Action");
|
||||
|
||||
st->create = action_create;
|
||||
st->free = action_free;
|
||||
|
|
|
@ -917,7 +917,7 @@ void ED_spacetype_buttons(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_PROPERTIES;
|
||||
strncpy(st->name, "Buttons", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Buttons");
|
||||
|
||||
st->create = buttons_create;
|
||||
st->free = buttons_free;
|
||||
|
|
|
@ -1251,7 +1251,7 @@ void ED_spacetype_clip(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_CLIP;
|
||||
strncpy(st->name, "Clip", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Clip");
|
||||
|
||||
st->create = clip_create;
|
||||
st->free = clip_free;
|
||||
|
|
|
@ -289,7 +289,7 @@ void ED_spacetype_console(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_CONSOLE;
|
||||
strncpy(st->name, "Console", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Console");
|
||||
|
||||
st->create = console_create;
|
||||
st->free = console_free;
|
||||
|
|
|
@ -366,6 +366,39 @@ static FileSelect file_select(
|
|||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Bookmark Utilities
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Local utility to write #BLENDER_BOOKMARK_FILE, reporting an error on failure.
|
||||
*/
|
||||
static bool fsmenu_write_file_and_refresh_or_report_error(struct FSMenu *fsmenu,
|
||||
ScrArea *area,
|
||||
ReportList *reports)
|
||||
{
|
||||
/* NOTE: use warning instead of error here, because the bookmark operation may be part of
|
||||
* other actions which should not cause the operator to fail entirely. */
|
||||
const char *cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL);
|
||||
if (UNLIKELY(!cfgdir)) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to create configuration directory to write bookmarks");
|
||||
return false;
|
||||
}
|
||||
|
||||
char filepath[FILE_MAX];
|
||||
BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_BOOKMARK_FILE);
|
||||
if (UNLIKELY(!fsmenu_write_file(fsmenu, filepath))) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to open or write bookmark file \"%s\"", filepath);
|
||||
return false;
|
||||
}
|
||||
|
||||
ED_area_tag_refresh(area);
|
||||
ED_area_tag_redraw(area);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Box Select Operator
|
||||
* \{ */
|
||||
|
@ -1053,19 +1086,17 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
PropertyRNA *prop;
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "dir"))) {
|
||||
FileSelectParams *params = ED_fileselect_get_active_params(sfile);
|
||||
char entry[256];
|
||||
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "dir");
|
||||
FileSelectParams *params = ED_fileselect_get_active_params(sfile);
|
||||
char entry[256];
|
||||
|
||||
RNA_property_string_get(op->ptr, prop, entry);
|
||||
BLI_strncpy(params->dir, entry, sizeof(params->dir));
|
||||
BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
|
||||
ED_file_change_dir(C);
|
||||
RNA_property_string_get(op->ptr, prop, entry);
|
||||
BLI_strncpy(params->dir, entry, sizeof(params->dir));
|
||||
BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
|
||||
ED_file_change_dir(C);
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1095,7 +1126,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot)
|
|||
/** \name Add Bookmark Operator
|
||||
* \{ */
|
||||
|
||||
static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int bookmark_add_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
@ -1103,19 +1134,11 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
struct FileSelectParams *params = ED_fileselect_get_active_params(sfile);
|
||||
|
||||
if (params->dir[0] != '\0') {
|
||||
char name[FILE_MAX];
|
||||
|
||||
fsmenu_insert_entry(
|
||||
fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, NULL, ICON_FILE_FOLDER, FS_INSERT_SAVE);
|
||||
BLI_join_dirfile(name,
|
||||
sizeof(name),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, name);
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
}
|
||||
|
||||
ED_area_tag_refresh(area);
|
||||
ED_area_tag_redraw(area);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -1146,27 +1169,11 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
|
|||
int nentries = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
|
||||
|
||||
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "index");
|
||||
|
||||
if (prop) {
|
||||
int index;
|
||||
if (RNA_property_is_set(op->ptr, prop)) {
|
||||
index = RNA_property_int_get(op->ptr, prop);
|
||||
}
|
||||
else { /* if index unset, use active bookmark... */
|
||||
index = sfile->bookmarknr;
|
||||
}
|
||||
if ((index > -1) && (index < nentries)) {
|
||||
char name[FILE_MAX];
|
||||
|
||||
fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
|
||||
BLI_join_dirfile(name,
|
||||
sizeof(name),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, name);
|
||||
ED_area_tag_refresh(area);
|
||||
ED_area_tag_redraw(area);
|
||||
}
|
||||
const int index = RNA_property_is_set(op->ptr, prop) ? RNA_property_int_get(op->ptr, prop) :
|
||||
sfile->bookmarknr;
|
||||
if ((index > -1) && (index < nentries)) {
|
||||
fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1197,7 +1204,7 @@ void FILE_OT_bookmark_delete(wmOperatorType *ot)
|
|||
/** \name Cleanup Bookmark Operator
|
||||
* \{ */
|
||||
|
||||
static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int bookmark_cleanup_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
struct FSMenu *fsmenu = ED_fsmenu_get();
|
||||
|
@ -1218,16 +1225,8 @@ static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
|
||||
if (changed) {
|
||||
char name[FILE_MAX];
|
||||
|
||||
BLI_join_dirfile(name,
|
||||
sizeof(name),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, name);
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
fsmenu_refresh_bookmarks_status(CTX_wm_manager(C), fsmenu);
|
||||
ED_area_tag_refresh(area);
|
||||
ED_area_tag_redraw(area);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1269,8 +1268,6 @@ static int bookmark_move_exec(bContext *C, wmOperator *op)
|
|||
struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS);
|
||||
const struct FSMenuEntry *fsmentry_org = fsmentry;
|
||||
|
||||
char fname[FILE_MAX];
|
||||
|
||||
const int direction = RNA_enum_get(op->ptr, "direction");
|
||||
const int totitems = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
|
||||
const int act_index = sfile->bookmarknr;
|
||||
|
@ -1306,13 +1303,8 @@ static int bookmark_move_exec(bContext *C, wmOperator *op)
|
|||
/* Need to update active bookmark number. */
|
||||
sfile->bookmarknr = new_index;
|
||||
|
||||
BLI_join_dirfile(fname,
|
||||
sizeof(fname),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, fname);
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
|
||||
ED_area_tag_redraw(area);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -1352,21 +1344,16 @@ void FILE_OT_bookmark_move(wmOperatorType *ot)
|
|||
/** \name Reset Recent Blend Files Operator
|
||||
* \{ */
|
||||
|
||||
static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int reset_recent_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
char name[FILE_MAX];
|
||||
struct FSMenu *fsmenu = ED_fsmenu_get();
|
||||
|
||||
while (ED_fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) {
|
||||
fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0);
|
||||
}
|
||||
BLI_join_dirfile(name,
|
||||
sizeof(name),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(fsmenu, name);
|
||||
ED_area_tag_redraw(area);
|
||||
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1795,6 +1782,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
|
|||
}
|
||||
/* Opening file, sends events now, so things get handled on window-queue level. */
|
||||
else if (sfile->op) {
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
struct FSMenu *fsmenu = ED_fsmenu_get();
|
||||
wmOperator *op = sfile->op;
|
||||
char filepath[FILE_MAX];
|
||||
|
||||
|
@ -1803,7 +1792,7 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
|
|||
file_sfile_to_operator_ex(bmain, op, sfile, filepath);
|
||||
|
||||
if (BLI_exists(params->dir)) {
|
||||
fsmenu_insert_entry(ED_fsmenu_get(),
|
||||
fsmenu_insert_entry(fsmenu,
|
||||
FS_CATEGORY_RECENT,
|
||||
params->dir,
|
||||
NULL,
|
||||
|
@ -1811,11 +1800,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
|
|||
FS_INSERT_SAVE | FS_INSERT_FIRST);
|
||||
}
|
||||
|
||||
BLI_join_dirfile(filepath,
|
||||
sizeof(filepath),
|
||||
BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
|
||||
BLENDER_BOOKMARK_FILE);
|
||||
fsmenu_write_file(ED_fsmenu_get(), filepath);
|
||||
fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
|
||||
|
||||
WM_event_fileselect_event(CTX_wm_manager(C), op, EVT_FILESELECT_EXEC);
|
||||
}
|
||||
|
||||
|
@ -2327,7 +2313,6 @@ static int file_directory_new_exec(bContext *C, wmOperator *op)
|
|||
char name[FILE_MAXFILE];
|
||||
char path[FILE_MAX];
|
||||
bool generate_name = true;
|
||||
PropertyRNA *prop;
|
||||
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
|
@ -2341,7 +2326,8 @@ static int file_directory_new_exec(bContext *C, wmOperator *op)
|
|||
|
||||
path[0] = '\0';
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
|
||||
{
|
||||
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "directory");
|
||||
RNA_property_string_get(op->ptr, prop, path);
|
||||
if (path[0] != '\0') {
|
||||
generate_name = false;
|
||||
|
|
|
@ -519,7 +519,7 @@ void fsmenu_remove_entry(struct FSMenu *fsmenu, FSMenuCategory category, int idx
|
|||
}
|
||||
}
|
||||
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
|
||||
bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
|
||||
{
|
||||
FSMenuEntry *fsm_iter = NULL;
|
||||
char fsm_name[FILE_MAX];
|
||||
|
@ -527,33 +527,36 @@ void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
|
|||
|
||||
FILE *fp = BLI_fopen(filepath, "w");
|
||||
if (!fp) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
fprintf(fp, "[Bookmarks]\n");
|
||||
bool has_error = false;
|
||||
has_error |= (fprintf(fp, "[Bookmarks]\n") < 0);
|
||||
for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS); fsm_iter;
|
||||
fsm_iter = fsm_iter->next) {
|
||||
if (fsm_iter->path && fsm_iter->save) {
|
||||
fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name));
|
||||
if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) {
|
||||
fprintf(fp, "!%s\n", fsm_iter->name);
|
||||
has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0);
|
||||
}
|
||||
fprintf(fp, "%s\n", fsm_iter->path);
|
||||
has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0);
|
||||
}
|
||||
}
|
||||
fprintf(fp, "[Recent]\n");
|
||||
has_error = (fprintf(fp, "[Recent]\n") < 0);
|
||||
for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_RECENT);
|
||||
fsm_iter && (nwritten < FSMENU_RECENT_MAX);
|
||||
fsm_iter = fsm_iter->next, nwritten++) {
|
||||
if (fsm_iter->path && fsm_iter->save) {
|
||||
fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name));
|
||||
if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) {
|
||||
fprintf(fp, "!%s\n", fsm_iter->name);
|
||||
has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0);
|
||||
}
|
||||
fprintf(fp, "%s\n", fsm_iter->path);
|
||||
has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
return !has_error;
|
||||
}
|
||||
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath)
|
||||
|
|
|
@ -37,8 +37,11 @@ short fsmenu_can_save(struct FSMenu *fsmenu, enum FSMenuCategory category, int i
|
|||
/** Removes the fsmenu entry at the given \a index. */
|
||||
void fsmenu_remove_entry(struct FSMenu *fsmenu, enum FSMenuCategory category, int idx);
|
||||
|
||||
/** saves the 'bookmarks' to the specified file */
|
||||
void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath);
|
||||
/**
|
||||
* Saves the 'bookmarks' to the specified file.
|
||||
* \return true on success.
|
||||
*/
|
||||
bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath);
|
||||
|
||||
/** reads the 'bookmarks' from the specified file */
|
||||
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath);
|
||||
|
|
|
@ -992,7 +992,7 @@ void ED_spacetype_file(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_FILE;
|
||||
strncpy(st->name, "File", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "File");
|
||||
|
||||
st->create = file_create;
|
||||
st->free = file_free;
|
||||
|
|
|
@ -810,7 +810,7 @@ void ED_spacetype_ipo(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_GRAPH;
|
||||
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Graph");
|
||||
|
||||
st->create = graph_create;
|
||||
st->free = graph_free;
|
||||
|
|
|
@ -1029,7 +1029,7 @@ void ED_spacetype_image(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_IMAGE;
|
||||
strncpy(st->name, "Image", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Image");
|
||||
|
||||
st->create = image_create;
|
||||
st->free = image_free;
|
||||
|
|
|
@ -254,7 +254,7 @@ void ED_spacetype_info(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_INFO;
|
||||
strncpy(st->name, "Info", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Info");
|
||||
|
||||
st->create = info_create;
|
||||
st->free = info_free;
|
||||
|
|
|
@ -568,7 +568,7 @@ void ED_spacetype_nla(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_NLA;
|
||||
strncpy(st->name, "NLA", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "NLA");
|
||||
|
||||
st->create = nla_create;
|
||||
st->free = nla_free;
|
||||
|
|
|
@ -1021,7 +1021,7 @@ void ED_spacetype_node()
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_NODE;
|
||||
strncpy(st->name, "Node", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Node");
|
||||
|
||||
st->create = node_create;
|
||||
st->free = node_free;
|
||||
|
|
|
@ -445,7 +445,7 @@ void ED_spacetype_outliner(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_OUTLINER;
|
||||
strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Outliner");
|
||||
|
||||
st->create = outliner_create;
|
||||
st->free = outliner_free;
|
||||
|
|
|
@ -152,7 +152,7 @@ void ED_spacetype_script(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_SCRIPT;
|
||||
strncpy(st->name, "Script", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Script");
|
||||
|
||||
st->create = script_create;
|
||||
st->free = script_free;
|
||||
|
|
|
@ -997,7 +997,7 @@ void ED_spacetype_sequencer(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_SEQ;
|
||||
strncpy(st->name, "Sequencer", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Sequencer");
|
||||
|
||||
st->create = sequencer_create;
|
||||
st->free = sequencer_free;
|
||||
|
|
|
@ -619,7 +619,7 @@ void ED_spacetype_spreadsheet()
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_SPREADSHEET;
|
||||
strncpy(st->name, "Spreadsheet", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Spreadsheet");
|
||||
|
||||
st->create = spreadsheet_create;
|
||||
st->free = spreadsheet_free;
|
||||
|
|
|
@ -136,7 +136,7 @@ void ED_spacetype_statusbar(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_STATUSBAR;
|
||||
strncpy(st->name, "Status Bar", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Status Bar");
|
||||
|
||||
st->create = statusbar_create;
|
||||
st->free = statusbar_free;
|
||||
|
|
|
@ -403,7 +403,7 @@ void ED_spacetype_text(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_TEXT;
|
||||
strncpy(st->name, "Text", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Text");
|
||||
|
||||
st->create = text_create;
|
||||
st->free = text_free;
|
||||
|
|
|
@ -706,7 +706,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region)
|
|||
drawcache->showlinenrs = st->showlinenrs;
|
||||
drawcache->tabnumber = st->tabnumber;
|
||||
|
||||
strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME);
|
||||
STRNCPY(drawcache->text_id, txt->id.name);
|
||||
|
||||
/* clear update flag */
|
||||
drawcache->update_flag = 0;
|
||||
|
|
|
@ -288,7 +288,7 @@ void ED_spacetype_topbar(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_TOPBAR;
|
||||
strncpy(st->name, "Top Bar", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Top Bar");
|
||||
|
||||
st->create = topbar_create;
|
||||
st->free = topbar_free;
|
||||
|
|
|
@ -189,7 +189,7 @@ void ED_spacetype_userpref(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_USERPREF;
|
||||
strncpy(st->name, "Userpref", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "Userpref");
|
||||
|
||||
st->create = userpref_create;
|
||||
st->free = userpref_free;
|
||||
|
|
|
@ -1972,7 +1972,7 @@ void ED_spacetype_view3d(void)
|
|||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_VIEW3D;
|
||||
strncpy(st->name, "View3D", BKE_ST_MAXNAME);
|
||||
STRNCPY(st->name, "View3D");
|
||||
|
||||
st->create = view3d_create;
|
||||
st->free = view3d_free;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <time.h>
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
@ -56,9 +57,8 @@ static void fillCineonMainHeader(LogImageFile *cineon,
|
|||
cineon->height *
|
||||
getRowLength(cineon->width, cineon->element[0]),
|
||||
cineon->isMSB);
|
||||
strcpy(header->fileHeader.version, "v4.5");
|
||||
strncpy(header->fileHeader.file_name, filepath, 99);
|
||||
header->fileHeader.file_name[99] = 0;
|
||||
STRNCPY(header->fileHeader.version, "v4.5");
|
||||
STRNCPY(header->fileHeader.file_name, filepath);
|
||||
fileClock = time(NULL);
|
||||
fileTime = localtime(&fileClock);
|
||||
strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime);
|
||||
|
@ -93,8 +93,7 @@ static void fillCineonMainHeader(LogImageFile *cineon,
|
|||
header->imageHeader.green_primary_y = swap_float(0.0f, cineon->isMSB);
|
||||
header->imageHeader.blue_primary_x = swap_float(0.0f, cineon->isMSB);
|
||||
header->imageHeader.blue_primary_y = swap_float(0.0f, cineon->isMSB);
|
||||
strncpy(header->imageHeader.label, creator, 199);
|
||||
header->imageHeader.label[199] = 0;
|
||||
STRNCPY(header->imageHeader.label, creator);
|
||||
header->imageHeader.interleave = 0;
|
||||
header->imageHeader.data_sign = 0;
|
||||
header->imageHeader.sense = 0;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <time.h>
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
@ -60,14 +61,12 @@ static void fillDpxMainHeader(LogImageFile *dpx,
|
|||
header->fileHeader.ind_hdr_size = swap_uint(sizeof(DpxFilmHeader) + sizeof(DpxTelevisionHeader),
|
||||
dpx->isMSB);
|
||||
header->fileHeader.user_data_size = DPX_UNDEFINED_U32;
|
||||
strncpy(header->fileHeader.file_name, filename, 99);
|
||||
header->fileHeader.file_name[99] = 0;
|
||||
STRNCPY(header->fileHeader.file_name, filename);
|
||||
fileClock = time(NULL);
|
||||
fileTime = localtime(&fileClock);
|
||||
strftime(header->fileHeader.creation_date, 24, "%Y:%m:%d:%H:%M:%S%Z", fileTime);
|
||||
header->fileHeader.creation_date[23] = 0;
|
||||
strncpy(header->fileHeader.creator, creator, 99);
|
||||
header->fileHeader.creator[99] = 0;
|
||||
STRNCPY(header->fileHeader.creator, creator);
|
||||
header->fileHeader.project[0] = 0;
|
||||
header->fileHeader.copyright[0] = 0;
|
||||
header->fileHeader.key = 0xFFFFFFFF;
|
||||
|
|
|
@ -136,7 +136,7 @@ typedef struct SequenceRuntime {
|
|||
*/
|
||||
typedef struct Sequence {
|
||||
struct Sequence *next, *prev;
|
||||
/** Tmp var for copying, and tagging for linked selection. */
|
||||
/** Temp var for copying, and tagging for linked selection. */
|
||||
void *tmp;
|
||||
/** Needed (to be like ipo), else it will raise libdata warnings, this should never be used. */
|
||||
void *lib;
|
||||
|
|
|
@ -51,7 +51,7 @@ static void initData(ModifierData *md)
|
|||
VolumeToMeshModifierData *vmmd = reinterpret_cast<VolumeToMeshModifierData *>(md);
|
||||
vmmd->object = nullptr;
|
||||
vmmd->threshold = 0.1f;
|
||||
strncpy(vmmd->grid_name, "density", MAX_NAME);
|
||||
STRNCPY(vmmd->grid_name, "density");
|
||||
vmmd->adaptivity = 0.0f;
|
||||
vmmd->resolution_mode = VOLUME_TO_MESH_RESOLUTION_MODE_GRID;
|
||||
vmmd->voxel_amount = 32;
|
||||
|
|
|
@ -113,7 +113,7 @@ class BokehBlurOperation : public NodeOperation {
|
|||
* computations of the bokeh blur. */
|
||||
const float size = math::clamp(get_input("Size").get_float_value_default(1.0f), 0.0f, 10.0f);
|
||||
|
||||
/* The 100 divisor is arbitrary and was chosen using visual judgement. */
|
||||
/* The 100 divisor is arbitrary and was chosen using visual judgment. */
|
||||
return size * (max_size / 100.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -952,7 +952,7 @@ static void render_result_exr_file_cache_path(Scene *sce,
|
|||
}
|
||||
BLI_hash_md5_to_hexdigest(path_digest, path_hexdigest);
|
||||
|
||||
/* Default to *non-volatile* tmp dir. */
|
||||
/* Default to *non-volatile* temp dir. */
|
||||
if (*root == '\0') {
|
||||
root = BKE_tempdir_base();
|
||||
}
|
||||
|
|
|
@ -177,14 +177,12 @@ static bool seq_proxy_get_fname(Scene *scene,
|
|||
|
||||
BLI_snprintf(name,
|
||||
PROXY_MAXFILE,
|
||||
"%s/images/%d/%s_proxy%s",
|
||||
"%s/images/%d/%s_proxy%s.jpg",
|
||||
dir,
|
||||
proxy_size_number,
|
||||
SEQ_render_give_stripelem(scene, seq, timeline_frame)->name,
|
||||
suffix);
|
||||
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
|
||||
strcat(name, ".jpg");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1397,29 +1397,27 @@ void wm_homefile_read_post(struct bContext *C,
|
|||
|
||||
void wm_history_file_read(void)
|
||||
{
|
||||
char name[FILE_MAX];
|
||||
LinkNode *l, *lines;
|
||||
struct RecentFile *recent;
|
||||
const char *line;
|
||||
int num;
|
||||
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
|
||||
|
||||
if (!cfgdir) {
|
||||
return;
|
||||
}
|
||||
|
||||
char name[FILE_MAX];
|
||||
LinkNode *l;
|
||||
int num;
|
||||
|
||||
BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_HISTORY_FILE);
|
||||
|
||||
lines = BLI_file_read_as_lines(name);
|
||||
LinkNode *lines = BLI_file_read_as_lines(name);
|
||||
|
||||
wm_history_files_free();
|
||||
|
||||
/* read list of recent opened files from recent-files.txt to memory */
|
||||
for (l = lines, num = 0; l && (num < U.recent_files); l = l->next) {
|
||||
line = l->link;
|
||||
const char *line = l->link;
|
||||
/* don't check if files exist, causes slow startup for remote/external drives */
|
||||
if (line[0]) {
|
||||
recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
|
||||
struct RecentFile *recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
|
||||
BLI_addtail(&(G.recent_files), recent);
|
||||
recent->filepath = BLI_strdup(line);
|
||||
num++;
|
||||
|
@ -1919,12 +1917,11 @@ static void wm_autosave_location(char filepath[FILE_MAX])
|
|||
}
|
||||
|
||||
const char *tempdir_base = BKE_tempdir_base();
|
||||
/* NOTE(@campbellbarton): It's strange that this is only used on WIN32.
|
||||
* From reading commits it seems accessing the temporary directory used to be less reliable.
|
||||
* If this is still the case on WIN32 - other features such as copy-paste will also fail.
|
||||
* We could support #BLENDER_USER_AUTOSAVE on all platforms or remove it entirely. */
|
||||
#ifdef WIN32
|
||||
/* XXX Need to investigate how to handle default location of `/tmp/`
|
||||
* This is a relative directory on Windows, and it may be found. Example:
|
||||
* Blender installed on `D:\` drive, `D:\` drive has `D:\tmp\` Now, `BLI_exists()`
|
||||
* will find `/tmp/` exists, but #BLI_windows_get_default_root_dir will expand this to `C:\`.
|
||||
* If there is no `C:\tmp` autosave fails. */
|
||||
if (!BLI_exists(tempdir_base)) {
|
||||
const char *savedir = BKE_appdir_folder_id_create(BLENDER_USER_AUTOSAVE, NULL);
|
||||
if (savedir) {
|
||||
|
|
|
@ -32,35 +32,35 @@
|
|||
*/
|
||||
static bool wm_platform_support_check_approval(const char *platform_support_key, bool update)
|
||||
{
|
||||
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
|
||||
bool result = false;
|
||||
|
||||
if (G.factory_startup) {
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
|
||||
if (!cfgdir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cfgdir) {
|
||||
char filepath[FILE_MAX];
|
||||
BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE);
|
||||
LinkNode *lines = BLI_file_read_as_lines(filepath);
|
||||
for (LinkNode *line_node = lines; line_node; line_node = line_node->next) {
|
||||
char *line = line_node->link;
|
||||
if (STREQ(line, platform_support_key)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
bool result = false;
|
||||
char filepath[FILE_MAX];
|
||||
BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE);
|
||||
LinkNode *lines = BLI_file_read_as_lines(filepath);
|
||||
for (LinkNode *line_node = lines; line_node; line_node = line_node->next) {
|
||||
char *line = line_node->link;
|
||||
if (STREQ(line, platform_support_key)) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!result && update) {
|
||||
FILE *fp = BLI_fopen(filepath, "a");
|
||||
if (fp) {
|
||||
fprintf(fp, "%s\n", platform_support_key);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_file_free_lines(lines);
|
||||
}
|
||||
|
||||
if (!result && update) {
|
||||
FILE *fp = BLI_fopen(filepath, "a");
|
||||
if (fp) {
|
||||
fprintf(fp, "%s\n", platform_support_key);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_file_free_lines(lines);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -362,9 +362,9 @@ elseif(APPLE)
|
|||
else()
|
||||
# Paths defined in terms of site-packages since the site-packages
|
||||
# directory can be a symlink (brew for example).
|
||||
set(TARGETDIR_BPY ${PYTHON_LIBPATH}/site-packages/bpy)
|
||||
set(TARGETDIR_VER ${PYTHON_LIBPATH}/site-packages/bpy/${BLENDER_VERSION})
|
||||
set(TARGETDIR_LIB ${PYTHON_LIBPATH}/site-packages/bpy/lib)
|
||||
set(TARGETDIR_BPY ${PYTHON_SITE_PACKAGES}/bpy)
|
||||
set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/bpy/${BLENDER_VERSION})
|
||||
set(TARGETDIR_LIB ${PYTHON_SITE_PACKAGES}/bpy/lib)
|
||||
endif()
|
||||
else()
|
||||
set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})
|
||||
|
|
Loading…
Reference in New Issue