Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-04-16 19:52:23 +02:00
commit 8bc9286c4c
32 changed files with 271 additions and 176 deletions

View File

@ -85,8 +85,8 @@ class VersionInfo:
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.short_version = "%d.%d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]

View File

@ -923,10 +923,6 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# Zero pad the minor version so `_out_version_minor` is always two characters.
# This is needed if the minor version is a single digit.
string(REGEX REPLACE "^([0-9])$" "0\\1" _out_version_minor "${_out_version_minor}")
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)

View File

@ -561,6 +561,7 @@ static OCIO_GPUDisplayShader &getGPUDisplayShader(
GpuShaderDescRcPtr shaderdesc_to_scene_linear = GpuShaderDesc::CreateShaderDesc();
shaderdesc_to_scene_linear->setLanguage(GPU_LANGUAGE_GLSL_1_3);
shaderdesc_to_scene_linear->setFunctionName("OCIO_to_scene_linear");
shaderdesc_to_scene_linear->setResourcePrefix("to_scene");
(*(ConstProcessorRcPtr *)processor_to_scene_linear)
->getDefaultGPUProcessor()
->extractGpuShaderInfo(shaderdesc_to_scene_linear);
@ -569,6 +570,7 @@ static OCIO_GPUDisplayShader &getGPUDisplayShader(
GpuShaderDescRcPtr shaderdesc_to_display = GpuShaderDesc::CreateShaderDesc();
shaderdesc_to_display->setLanguage(GPU_LANGUAGE_GLSL_1_3);
shaderdesc_to_display->setFunctionName("OCIO_to_display");
shaderdesc_to_scene_linear->setResourcePrefix("to_display");
(*(ConstProcessorRcPtr *)processor_to_display)
->getDefaultGPUProcessor()
->extractGpuShaderInfo(shaderdesc_to_display);

Binary file not shown.

View File

@ -99,6 +99,15 @@ class PREFERENCES_OT_copy_prev(Operator):
version = bpy.app.version
version_new = ((version[0] * 100) + version[1])
version_old = ((version[0] * 100) + version[1]) - 1
# Special case, remove when the version is > 3.0.
if version_new == 300:
version_new = 294
version_old = 293
else:
print("TODO: remove exception!")
# End special case.
# Ensure we only try to copy files from a point release.
# The check below ensures the second numbers match.
while (version_new % 100) // 10 == (version_old % 100) // 10:

View File

@ -246,11 +246,12 @@ class IMAGE_MT_image(Menu):
layout.separator()
layout.operator("image.pack", text="Pack")
if ima:
if ima and context.area.ui_type == 'IMAGE_EDITOR':
layout.separator()
layout.operator("palette.extract_from_image", text="Extract Palette")
layout.operator("gpencil.image_to_grease_pencil", text="Generate Grease Pencil")
class IMAGE_MT_image_flip(Menu):
bl_label = "Flip"

View File

@ -137,7 +137,7 @@ static char *blender_version_decimal(const int version)
{
static char version_str[5];
BLI_assert(version < 1000);
BLI_snprintf(version_str, sizeof(version_str), "%d.%02d", version / 100, version % 100);
BLI_snprintf(version_str, sizeof(version_str), "%d.%d", version / 100, version % 100);
return version_str;
}

View File

@ -36,30 +36,42 @@ static void geometry_set_collect_recursive_collection(const Collection &collecti
const float4x4 &transform,
Vector<GeometryInstanceGroup> &r_sets);
static void add_final_mesh_as_geometry_component(const Object &object, GeometrySet &geometry_set)
{
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(&const_cast<Object &>(object),
false);
if (mesh != nullptr) {
BKE_mesh_wrapper_ensure_mdata(mesh);
MeshComponent &mesh_component = geometry_set.get_component_for_write<MeshComponent>();
mesh_component.replace(mesh, GeometryOwnershipType::ReadOnly);
mesh_component.copy_vertex_group_names_from_object(object);
}
}
/**
* \note This doesn't extract instances from the "dupli" system for non-geometry-nodes instances.
*/
static GeometrySet object_get_geometry_set_for_read(const Object &object)
{
/* Objects evaluated with a nodes modifier will have a geometry set already. */
if (object.type == OB_MESH && object.mode == OB_MODE_EDIT) {
GeometrySet geometry_set;
if (object.runtime.geometry_set_eval != nullptr) {
/* `geometry_set_eval` only contains non-mesh components, see `editbmesh_build_data`. */
geometry_set = *object.runtime.geometry_set_eval;
}
add_final_mesh_as_geometry_component(object, geometry_set);
return geometry_set;
}
if (object.runtime.geometry_set_eval != nullptr) {
return *object.runtime.geometry_set_eval;
}
/* Otherwise, construct a new geometry set with the component based on the object type. */
GeometrySet new_geometry_set;
GeometrySet geometry_set;
if (object.type == OB_MESH) {
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(
&const_cast<Object &>(object), false);
if (mesh != nullptr) {
BKE_mesh_wrapper_ensure_mdata(mesh);
MeshComponent &mesh_component = new_geometry_set.get_component_for_write<MeshComponent>();
mesh_component.replace(mesh, GeometryOwnershipType::ReadOnly);
mesh_component.copy_vertex_group_names_from_object(object);
}
add_final_mesh_as_geometry_component(object, geometry_set);
}
/* TODO: Cover the case of point-clouds without modifiers-- they may not be covered by the
@ -68,7 +80,7 @@ static GeometrySet object_get_geometry_set_for_read(const Object &object)
/* TODO: Add volume support. */
/* Return by value since there is not always an existing geometry set owned elsewhere to use. */
return new_geometry_set;
return geometry_set;
}
static void geometry_set_collect_recursive_collection_instance(

View File

@ -4135,7 +4135,7 @@ bool BKE_object_minmax_dupli(Depsgraph *depsgraph,
const bool use_hidden)
{
bool ok = false;
if ((ob->transflag & OB_DUPLI) == 0) {
if ((ob->transflag & OB_DUPLI) == 0 && ob->runtime.geometry_set_eval == NULL) {
return ok;
}

View File

@ -176,6 +176,13 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
CustomData_MeshMasks cddata_masks = scene->customdata_mask;
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
/* Custom attributes should not be removed automatically. They might be used by the render
* engine or scripts. They can still be removed explicitly using geometry nodes. */
cddata_masks.vmask |= CD_MASK_PROP_ALL;
cddata_masks.emask |= CD_MASK_PROP_ALL;
cddata_masks.fmask |= CD_MASK_PROP_ALL;
cddata_masks.pmask |= CD_MASK_PROP_ALL;
cddata_masks.lmask |= CD_MASK_PROP_ALL;
/* Make sure Freestyle edge/face marks appear in DM for render (see T40315).
* Due to Line Art implementation, edge marks should also be shown in viewport. */
#ifdef WITH_FREESTYLE

View File

@ -226,7 +226,10 @@ int BLO_library_link_copypaste(struct Main *mainl, BlendHandle *bh, const uint64
* Struct for temporarily loading datablocks from a blend file.
*/
typedef struct TempLibraryContext {
struct Main *temp_main;
/** Temporary main used for library data. */
struct Main *bmain_lib;
/** Temporary main used to load data into (currently initialized from `real_main`). */
struct Main *bmain_base;
struct BlendHandle *blendhandle;
struct LibraryLink_Params liblink_params;
struct Library *lib;

View File

@ -21,6 +21,9 @@
#include "MEM_guardedalloc.h"
#include "BLI_string.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "DNA_ID.h"
@ -32,15 +35,20 @@ TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main,
struct ReportList *reports)
{
TempLibraryContext *temp_lib_ctx = MEM_callocN(sizeof(*temp_lib_ctx), __func__);
temp_lib_ctx->bmain_base = BKE_main_new();
/* Copy the file path so any path remapping is performed properly. */
STRNCPY(temp_lib_ctx->bmain_base->name, real_main->name);
temp_lib_ctx->blendhandle = BLO_blendhandle_from_file(blend_file_path, reports);
BLO_library_link_params_init(&temp_lib_ctx->liblink_params, real_main, 0, LIB_TAG_TEMP_MAIN);
BLO_library_link_params_init(
&temp_lib_ctx->liblink_params, temp_lib_ctx->bmain_base, 0, LIB_TAG_TEMP_MAIN);
temp_lib_ctx->temp_main = BLO_library_link_begin(
temp_lib_ctx->bmain_lib = BLO_library_link_begin(
&temp_lib_ctx->blendhandle, blend_file_path, &temp_lib_ctx->liblink_params);
temp_lib_ctx->temp_id = BLO_library_link_named_part(temp_lib_ctx->temp_main,
temp_lib_ctx->temp_id = BLO_library_link_named_part(temp_lib_ctx->bmain_lib,
&temp_lib_ctx->blendhandle,
idcode,
idname,
@ -51,8 +59,13 @@ TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main,
void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx)
{
/* This moves the temporary ID and any indirectly loaded data into `bmain_base`
* only to free `bmain_base`, while redundant this is the typical code-path for library linking,
* it's more convenient to follow this convention rather than create a new code-path for this
* one-off use case. */
BLO_library_link_end(
temp_lib_ctx->temp_main, &temp_lib_ctx->blendhandle, &temp_lib_ctx->liblink_params);
temp_lib_ctx->bmain_lib, &temp_lib_ctx->blendhandle, &temp_lib_ctx->liblink_params);
BLO_blendhandle_close(temp_lib_ctx->blendhandle);
BKE_main_free(temp_lib_ctx->bmain_base);
MEM_freeN(temp_lib_ctx);
}

View File

@ -1575,7 +1575,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (scene->ed != NULL) {
if (scene->toolsettings->sequencer_tool_settings == NULL) {
scene->toolsettings->sequencer_tool_settings = SEQ_tool_settings_init();
}
}

View File

@ -68,7 +68,9 @@ typedef struct SnapGizmo3D {
struct {
int x;
int y;
#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
short shift, ctrl, alt, oskey;
#endif
} last_eventstate;
#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
@ -93,39 +95,36 @@ typedef struct SnapGizmo3D {
bool is_enabled;
} SnapGizmo3D;
static bool eventstate_cmp(SnapGizmo3D *snap_gizmo, const wmEvent *event)
{
if ((event->x == snap_gizmo->last_eventstate.x) && (event->y == snap_gizmo->last_eventstate.y) &&
(event->ctrl == snap_gizmo->last_eventstate.ctrl) &&
(event->shift == snap_gizmo->last_eventstate.shift) &&
(event->alt == snap_gizmo->last_eventstate.alt) &&
(event->oskey == snap_gizmo->last_eventstate.oskey)) {
return true;
}
return false;
}
/* Checks if the current event is different from the one captured in the last update. */
static bool eventstate_has_changed(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
{
if (wm && wm->winactive) {
const wmEvent *event = wm->winactive->eventstate;
return eventstate_cmp(snap_gizmo, event) == false;
if ((event->x != snap_gizmo->last_eventstate.x) ||
(event->y != snap_gizmo->last_eventstate.y)) {
return true;
}
#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
if (!(snap_gizmo->flag & ED_SNAPGIZMO_TOGGLE_ALWAYS_TRUE)) {
if ((event->ctrl != snap_gizmo->last_eventstate.ctrl) ||
(event->shift != snap_gizmo->last_eventstate.shift) ||
(event->alt != snap_gizmo->last_eventstate.alt) ||
(event->oskey != snap_gizmo->last_eventstate.oskey)) {
return true;
}
}
#endif
}
return false;
}
/* Copies the current eventstate. */
static void eventstate_save(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
static void eventstate_save_xy(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
{
if (wm && wm->winactive) {
const wmEvent *event = wm->winactive->eventstate;
snap_gizmo->last_eventstate.x = event->x;
snap_gizmo->last_eventstate.y = event->y;
snap_gizmo->last_eventstate.ctrl = event->ctrl;
snap_gizmo->last_eventstate.shift = event->shift;
snap_gizmo->last_eventstate.alt = event->alt;
snap_gizmo->last_eventstate.oskey = event->oskey;
}
}
@ -137,16 +136,20 @@ static bool invert_snap(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
}
const wmEvent *event = wm->winactive->eventstate;
if (eventstate_cmp(snap_gizmo, event)) {
if ((event->ctrl == snap_gizmo->last_eventstate.ctrl) &&
(event->shift == snap_gizmo->last_eventstate.shift) &&
(event->alt == snap_gizmo->last_eventstate.alt) &&
(event->oskey == snap_gizmo->last_eventstate.oskey)) {
/* Nothing has changed. */
return snap_gizmo->invert_snap;
}
if (snap_gizmo->keymap == NULL) {
/* Lazy initialization. */
snap_gizmo->keymap = WM_modalkeymap_find(wm->defaultconf, "Generic Gizmo Tweak Modal Map");
RNA_enum_value_from_id(snap_gizmo->keymap->modal_items, "SNAP_ON", &snap_gizmo->snap_on);
}
/* Save new eventstate. */
snap_gizmo->last_eventstate.ctrl = event->ctrl;
snap_gizmo->last_eventstate.shift = event->shift;
snap_gizmo->last_eventstate.alt = event->alt;
snap_gizmo->last_eventstate.oskey = event->oskey;
const int snap_on = snap_gizmo->snap_on;
wmKeyMap *keymap = WM_keymap_active(wm, snap_gizmo->keymap);
@ -335,8 +338,9 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz,
Scene *scene = DEG_get_input_scene(depsgraph);
#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
if ((snap_gizmo->flag & ED_SNAPGIZMO_TOGGLE_ALWAYS_TRUE) == 0) {
if (!(snap_gizmo->flag & ED_SNAPGIZMO_TOGGLE_ALWAYS_TRUE)) {
snap_gizmo->invert_snap = invert_snap(snap_gizmo, wm);
const ToolSettings *ts = scene->toolsettings;
if (snap_gizmo->invert_snap != !(ts->snap_flag & SCE_SNAP)) {
snap_gizmo->snap_elem = 0;
@ -344,8 +348,7 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz,
}
}
#endif
eventstate_save(snap_gizmo, wm);
eventstate_save_xy(snap_gizmo, wm);
snap_gizmo->is_enabled = true;
@ -555,8 +558,14 @@ static void gizmo_snap_rna_snap_elem_index_get_fn(struct PointerRNA *ptr,
static void snap_gizmo_setup(wmGizmo *gz)
{
/* Flags. */
gz->flag |= WM_GIZMO_NO_TOOLTIP;
#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz;
snap_gizmo->keymap = WM_modalkeymap_find(gz->parent_gzgroup->type->keyconf,
"Generic Gizmo Tweak Modal Map");
RNA_enum_value_from_id(snap_gizmo->keymap->modal_items, "SNAP_ON", &snap_gizmo->snap_on);
#endif
}
static void snap_gizmo_draw(const bContext *C, wmGizmo *gz)

View File

@ -228,7 +228,7 @@ static void pick_link(const bContext *C,
BLI_assert(nldrag->last_node_hovered_while_dragging_a_link != NULL);
sort_multi_input_socket_links(
snode, nldrag->last_node_hovered_while_dragging_a_link, NULL,NULL);
snode, nldrag->last_node_hovered_while_dragging_a_link, NULL, NULL);
/* Send changed event to original link->tonode. */
if (node) {
@ -901,7 +901,7 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
existing_link_connected_to_fromsock->multi_input_socket_index;
continue;
}
if(link->tosock && link->tosock->flag & SOCK_MULTI_INPUT){
if (link->tosock && link->tosock->flag & SOCK_MULTI_INPUT) {
sort_multi_input_socket_links(snode, tnode, link, cursor);
}
}

View File

@ -665,6 +665,10 @@ static const EnumPropertyItem *outliner_id_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return DummyRNA_NULL_items;
}
EnumPropertyItem item_tmp = {0}, *item = NULL;
int totitem = 0;
int i = 0;

View File

@ -278,8 +278,14 @@ typedef struct wmWindow {
char event_queue_check_click;
/** Enable when #KM_PRESS events are not handled (keyboard/mouse-buttons only). */
char event_queue_check_drag;
/**
* Enable when the drag was handled,
* to avoid mouse-motion continually triggering drag events which are not handled
* but add overhead to gizmo handling (for example), see T87511.
*/
char event_queue_check_drag_handled;
char _pad0[2];
char _pad0[1];
/** Internal, lock pie creation from this event until released. */
short pie_event_type_lock;
@ -374,7 +380,12 @@ typedef struct wmKeyMapItem {
/** Unique identifier. Positive for kmi that override builtins, negative otherwise. */
short id;
char _pad[2];
/** Rna pointer to access properties. */
/**
* RNA pointer to access properties.
*
* \note The `ptr.owner_id` value must be NULL, as a signal not to use the context
* when running property callbacks such as ENUM item functions.
*/
struct PointerRNA *ptr;
} wmKeyMapItem;

View File

@ -636,6 +636,12 @@ typedef enum StructFlag {
STRUCT_PUBLIC_NAMESPACE = (1 << 9),
/** All subtypes are added too. */
STRUCT_PUBLIC_NAMESPACE_INHERIT = (1 << 10),
/**
* When the #PointerRNA.owner_id is NULL, this signifies the property should be accessed
* without any context (the key-map UI and import/export for example).
* So accessing the property should not read from the current context to derive values/limits.
*/
STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID = (1 << 11),
} StructFlag;
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);

View File

@ -1623,35 +1623,35 @@ void RNA_property_enum_items_ex(bContext *C,
*r_free = false;
if (!use_static && eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
const EnumPropertyItem *item;
if (!use_static && (eprop->item_fn != NULL)) {
const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) ||
((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) &&
(ptr->owner_id == NULL));
if (C != NULL || no_context) {
const EnumPropertyItem *item;
if (prop->flag & PROP_ENUM_NO_CONTEXT) {
item = eprop->item_fn(NULL, ptr, prop, r_free);
}
else {
item = eprop->item_fn(C, ptr, prop, r_free);
}
item = eprop->item_fn(no_context ? NULL : C, ptr, prop, r_free);
/* any callbacks returning NULL should be fixed */
BLI_assert(item != NULL);
/* any callbacks returning NULL should be fixed */
BLI_assert(item != NULL);
if (r_totitem) {
int tot;
for (tot = 0; item[tot].identifier; tot++) {
/* pass */
if (r_totitem) {
int tot;
for (tot = 0; item[tot].identifier; tot++) {
/* pass */
}
*r_totitem = tot;
}
*r_totitem = tot;
}
*r_item = item;
}
else {
*r_item = eprop->item;
if (r_totitem) {
*r_totitem = eprop->totitem;
*r_item = item;
return;
}
}
*r_item = eprop->item;
if (r_totitem) {
*r_totitem = eprop->totitem;
}
}
void RNA_property_enum_items(bContext *C,
@ -1753,43 +1753,43 @@ void RNA_property_enum_items_gettexted_all(bContext *C,
*r_totitem = eprop->totitem;
}
if (eprop->item_fn && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
const EnumPropertyItem *item;
int i;
bool free = false;
if (eprop->item_fn != NULL) {
const bool no_context = (prop->flag & PROP_ENUM_NO_CONTEXT) ||
((ptr->type->flag & STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID) &&
(ptr->owner_id == NULL));
if (C != NULL || no_context) {
const EnumPropertyItem *item;
int i;
bool free = false;
if (prop->flag & PROP_ENUM_NO_CONTEXT) {
item = eprop->item_fn(NULL, ptr, prop, &free);
}
else {
item = eprop->item_fn(C, ptr, prop, &free);
}
item = eprop->item_fn(no_context ? NULL : NULL, ptr, prop, &free);
/* any callbacks returning NULL should be fixed */
BLI_assert(item != NULL);
/* any callbacks returning NULL should be fixed */
BLI_assert(item != NULL);
for (i = 0; i < eprop->totitem; i++) {
bool exists = false;
int i_fixed;
for (i = 0; i < eprop->totitem; i++) {
bool exists = false;
int i_fixed;
/* Items that do not exist on list are returned,
* but have their names/identifiers NULL'ed out. */
for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) {
if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) {
exists = true;
break;
/* Items that do not exist on list are returned,
* but have their names/identifiers NULL'ed out. */
for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) {
if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) {
exists = true;
break;
}
}
if (!exists) {
item_array[i].name = NULL;
item_array[i].identifier = "";
}
}
if (!exists) {
item_array[i].name = NULL;
item_array[i].identifier = "";
if (free) {
MEM_freeN((void *)item);
}
}
if (free) {
MEM_freeN((void *)item);
}
}
#ifdef WITH_INTERNATIONAL

View File

@ -2483,6 +2483,10 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return rna_enum_transform_orientation_items;
}
Scene *scene;
if (ptr->owner_id && (GS(ptr->owner_id->name) == ID_SCE)) {
scene = (Scene *)ptr->owner_id;
@ -2493,11 +2497,15 @@ const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
return rna_TransformOrientation_impl_itemf(scene, false, r_free);
}
const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C),
const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *C,
PointerRNA *ptr,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
return rna_enum_transform_orientation_items;
}
Scene *scene = (Scene *)ptr->owner_id;
TransformOrientationSlot *orient_slot = ptr->data;
bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);

View File

@ -880,6 +880,7 @@ static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
wmKeyMapItem *kmi = ptr->data;
if (kmi->ptr) {
BLI_assert(kmi->ptr->owner_id == NULL);
return *(kmi->ptr);
}
@ -1974,7 +1975,7 @@ static void rna_def_operator(BlenderRNA *brna)
RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags);
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID);
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
}

View File

@ -179,6 +179,14 @@ static void add_object_relation(const ModifierUpdateDepsgraphContext *ctx, Objec
}
else if (ELEM(object.type, OB_MESH, OB_POINTCLOUD, OB_VOLUME)) {
DEG_add_object_relation(ctx->node, &object, DEG_OB_COMP_GEOMETRY, "Nodes Modifier");
/* We don't know exactly what attributes from the other object we will need. */
CustomData_MeshMasks mask;
mask.vmask = CD_MASK_PROP_ALL | CD_MASK_MDEFORMVERT;
mask.pmask = CD_MASK_PROP_ALL;
mask.lmask = CD_MASK_PROP_ALL;
mask.fmask = CD_MASK_PROP_ALL;
mask.emask = CD_MASK_PROP_ALL;
DEG_add_customdata_mask(ctx->node, &object, &mask);
}
}
}
@ -454,10 +462,6 @@ class GeometryNodesEvaluator {
{
const bNode &bnode = params.node();
if (DEG_is_active(depsgraph_)) {
this->store_ui_hints(node, params);
}
/* Use the geometry-node-execute callback if it exists. */
if (bnode.typeinfo->geometry_node_execute != nullptr) {
bnode.typeinfo->geometry_node_execute(params);
@ -475,41 +479,6 @@ class GeometryNodesEvaluator {
this->execute_unknown_node(node, params);
}
void store_ui_hints(const DNode node, GeoNodeExecParams params) const
{
for (const InputSocketRef *socket_ref : node->inputs()) {
if (!socket_ref->is_available()) {
continue;
}
if (socket_ref->bsocket()->type != SOCK_GEOMETRY) {
continue;
}
if (socket_ref->is_multi_input_socket()) {
/* Not needed currently. */
continue;
}
bNodeTree *btree_cow = node->btree();
bNodeTree *btree_original = (bNodeTree *)DEG_get_original_id((ID *)btree_cow);
const NodeTreeEvaluationContext context(*self_object_, *modifier_);
const GeometrySet &geometry_set = params.get_input<GeometrySet>(socket_ref->identifier());
blender::bke::geometry_set_instances_attribute_foreach(
geometry_set,
[&](StringRefNull attribute_name, const AttributeMetaData &meta_data) {
BKE_nodetree_attribute_hint_add(*btree_original,
context,
*node->bnode(),
attribute_name,
meta_data.domain,
meta_data.data_type);
return true;
},
8);
}
}
void execute_multi_function_node(const DNode node,
GeoNodeExecParams params,
const MultiFunction &fn)
@ -1231,6 +1200,37 @@ static void log_preview_socket_value(const Span<GPointer> values,
}
}
static void log_ui_hints(const DSocket socket,
const Span<GPointer> values,
Object *self_object,
NodesModifierData *nmd)
{
const DNode node = socket.node();
if (node->is_reroute_node() || socket->typeinfo()->type != SOCK_GEOMETRY) {
return;
}
bNodeTree *btree_cow = node->btree();
bNodeTree *btree_original = (bNodeTree *)DEG_get_original_id((ID *)btree_cow);
const NodeTreeEvaluationContext context{*self_object, nmd->modifier};
for (const GPointer data : values) {
if (data.type() == &CPPType::get<GeometrySet>()) {
const GeometrySet &geometry_set = *(const GeometrySet *)data.get();
blender::bke::geometry_set_instances_attribute_foreach(
geometry_set,
[&](StringRefNull attribute_name, const AttributeMetaData &meta_data) {
BKE_nodetree_attribute_hint_add(*btree_original,
context,
*node->bnode(),
attribute_name,
meta_data.domain,
meta_data.data_type);
return true;
},
8);
}
}
}
/**
* Evaluate a node group to compute the output geometry.
* Currently, this uses a fairly basic and inefficient algorithm that might compute things more
@ -1297,6 +1297,7 @@ static GeometrySet compute_geometry(const DerivedNodeTree &tree,
if (!keys.is_empty()) {
log_preview_socket_value(values, ctx->object, keys);
}
log_ui_hints(socket, values, ctx->object, nmd);
};
GeometryNodesEvaluator evaluator{group_inputs,

View File

@ -67,6 +67,8 @@ static void geometry_node_tree_get_from_context(const bContext *C,
static void geometry_node_tree_update(bNodeTree *ntree)
{
ntreeSetOutput(ntree);
/* Needed to give correct types to reroutes. */
ntree_update_reroute_nodes(ntree);
}

View File

@ -622,7 +622,7 @@ static void geo_node_point_distribute_exec(GeoNodeExecParams params)
const GeometryNodePointDistributeMode distribute_method =
static_cast<GeometryNodePointDistributeMode>(params.node().custom1);
const int seed = params.get_input<int>("Seed");
const int seed = params.get_input<int>("Seed") * 5383843;
const float density = params.extract_input<float>("Density Max");
const std::string density_attribute_name = params.extract_input<std::string>(
"Density Attribute");

View File

@ -731,15 +731,6 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap,
BLI_buffer_declare_static(wmGizmo *, visible_3d_gizmos, BLI_BUFFER_NOP, 128);
bool do_step[WM_GIZMOMAP_DRAWSTEP_MAX];
int mval[2] = {UNPACK2(event->mval)};
/* Ensure for drag events we use the location where the user clicked.
* Without this click-dragging on a gizmo can accidentally act on the wrong gizmo. */
if (WM_event_is_mouse_drag(event)) {
mval[0] += event->x - event->prevclickx;
mval[1] += event->y - event->prevclicky;
}
for (int i = 0; i < ARRAY_SIZE(do_step); i++) {
do_step[i] = WM_gizmo_context_check_drawstep(C, i);
}
@ -775,7 +766,7 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap,
}
else if (step == WM_GIZMOMAP_DRAWSTEP_2D) {
if ((gz = wm_gizmogroup_find_intersected_gizmo(
wm, gzgroup, C, event_modifier, mval, r_part))) {
wm, gzgroup, C, event_modifier, event->mval, r_part))) {
break;
}
}
@ -787,7 +778,7 @@ wmGizmo *wm_gizmomap_highlight_find(wmGizmoMap *gzmap,
/* 2D gizmos get priority. */
if (gz == NULL) {
gz = gizmo_find_intersected_3d(
C, mval, visible_3d_gizmos.data, visible_3d_gizmos.count, r_part);
C, event->mval, visible_3d_gizmos.data, visible_3d_gizmos.count, r_part);
}
}
BLI_buffer_free(&visible_3d_gizmos);

View File

@ -186,6 +186,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
win->addmousemove = true;
win->event_queue_check_click = 0;
win->event_queue_check_drag = 0;
win->event_queue_check_drag_handled = 0;
BLO_read_data_address(reader, &win->stereo3d_format);
/* Multi-view always fallback to anaglyph at file opening

View File

@ -1621,7 +1621,7 @@ int WM_operator_name_call_with_properties(struct bContext *C,
{
PointerRNA props_ptr;
wmOperatorType *ot = WM_operatortype_find(opstring, false);
RNA_pointer_create(NULL, ot->srna, properties, &props_ptr);
RNA_pointer_create(G_MAIN->wm.first, ot->srna, properties, &props_ptr);
return WM_operator_name_call_ptr(C, ot, context, &props_ptr);
}
@ -2941,6 +2941,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if (wm_action_not_handled(action)) {
if (win->event_queue_check_drag) {
if (WM_event_drag_test(event, &event->prevclickx)) {
win->event_queue_check_drag_handled = true;
int x = event->x;
int y = event->y;
short val = event->val;
@ -2984,6 +2986,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if (event->is_repeat == false) {
win->event_queue_check_click = true;
win->event_queue_check_drag = true;
win->event_queue_check_drag_handled = false;
}
}
else if (event->val == KM_RELEASE) {
@ -3470,6 +3473,13 @@ void wm_event_do_handlers(bContext *C)
win->event_queue_check_click = false;
}
/* If the drag even was handled, don't attempt to keep re-handing the same
* drag event on every cursor motion, see: T87511. */
if (win->event_queue_check_drag_handled) {
win->event_queue_check_drag = false;
win->event_queue_check_drag_handled = false;
}
/* Update previous mouse position for following events to use. */
win->eventstate->prevx = event->x;
win->eventstate->prevy = event->y;

View File

@ -80,6 +80,9 @@ static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
kmin->ptr = MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
WM_operator_properties_create(kmin->ptr, kmin->idname);
/* Signal for no context, see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
kmin->ptr->owner_id = NULL;
kmin->properties = IDP_CopyProperty(kmin->properties);
kmin->ptr->data = kmin->properties;
}
@ -106,6 +109,9 @@ static void wm_keymap_item_properties_set(wmKeyMapItem *kmi)
{
WM_operator_properties_alloc(&(kmi->ptr), &(kmi->properties), kmi->idname);
WM_operator_properties_sanitize(kmi->ptr, 1);
/* Signal for no context, see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
kmi->ptr->owner_id = NULL;
}
/**
@ -136,6 +142,9 @@ static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi)
kmi->ptr->data = kmi->properties;
}
WM_operator_properties_sanitize(kmi->ptr, 1);
/* Signal for no context, see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
kmi->ptr->owner_id = NULL;
}
}
else {

View File

@ -252,7 +252,7 @@ void WM_operatortype_props_advanced_end(wmOperatorType *ot)
return;
}
RNA_pointer_create(NULL, ot->srna, NULL, &struct_ptr);
WM_operator_properties_create_ptr(&struct_ptr, ot);
RNA_STRUCT_BEGIN (&struct_ptr, prop) {
counter++;

View File

@ -583,7 +583,8 @@ char *WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, i
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
{
RNA_pointer_create(NULL, ot->srna, NULL, ptr);
/* Set the ID so the context can be accessed: see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
RNA_pointer_create(G_MAIN->wm.first, ot->srna, NULL, ptr);
}
void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
@ -594,7 +595,8 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
WM_operator_properties_create_ptr(ptr, ot);
}
else {
RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
/* Set the ID so the context can be accessed: see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
RNA_pointer_create(G_MAIN->wm.first, &RNA_OperatorProperties, NULL, ptr);
}
}
@ -1205,7 +1207,7 @@ IDProperty *WM_operator_last_properties_ensure_idprops(wmOperatorType *ot)
void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr)
{
IDProperty *props = WM_operator_last_properties_ensure_idprops(ot);
RNA_pointer_create(NULL, ot->srna, props, ptr);
RNA_pointer_create(G_MAIN->wm.first, ot->srna, props, ptr);
}
/**

View File

@ -130,14 +130,11 @@ set(SRC
# MSVC 2010 gives linking errors with the manifest
if(WIN32 AND NOT UNIX)
string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
string(SUBSTRING ${BLENDER_VERSION} 3 1 bver3)
add_definitions(
-DBLEN_VER_RC_STR="${BLENDER_VERSION}"
-DBLEN_VER_RC_1=${bver1}
-DBLEN_VER_RC_2=${bver2}
-DBLEN_VER_RC_3=${bver3}
-DBLEN_VER_RC_1=${BLENDER_VERSION_MAJOR}
-DBLEN_VER_RC_2=${BLENDER_VERSION_MINOR}
-DBLEN_VER_RC_3=${BLENDER_VERSION_PATCH}
-DBLEN_VER_RC_4=0
)

View File

@ -72,7 +72,7 @@ enum {
/* for the callbacks: */
#ifndef WITH_PYTHON_MODULE
# define BLEND_VERSION_FMT "Blender %d.%02d.%d"
# define BLEND_VERSION_FMT "Blender %d.%d.%d"
# define BLEND_VERSION_ARG (BLENDER_VERSION / 100), (BLENDER_VERSION % 100), BLENDER_VERSION_PATCH
#endif