Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-03-12 01:46:40 +01:00
commit 497e532e23
13 changed files with 105 additions and 8 deletions

View File

@ -493,6 +493,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeAttributeSampleTexture"),
NodeItem("GeometryNodeAttributeCombineXYZ"),
NodeItem("GeometryNodeAttributeSeparateXYZ"),
NodeItem("GeometryNodeAttributeRemove"),
]),
GeometryNodeCategory("GEO_COLOR", "Color", items=[
NodeItem("ShaderNodeValToRGB"),

View File

@ -266,7 +266,7 @@ void BKE_animsys_evaluate_all_animation(struct Main *main,
void animsys_evaluate_action(struct PointerRNA *ptr,
struct bAction *act,
const struct AnimationEvalContext *anim_eval_context,
const bool flush_to_original);
bool flush_to_original);
/* Evaluate Action Group */
void animsys_evaluate_action_group(struct PointerRNA *ptr,

View File

@ -1372,6 +1372,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_ATTRIBUTE_COMBINE_XYZ 1027
#define GEO_NODE_ATTRIBUTE_SEPARATE_XYZ 1028
#define GEO_NODE_SUBDIVIDE 1029
#define GEO_NODE_ATTRIBUTE_REMOVE 1030
/** \} */

View File

@ -4795,6 +4795,7 @@ static void registerGeometryNodes()
register_node_type_geo_attribute_randomize();
register_node_type_geo_attribute_separate_xyz();
register_node_type_geo_attribute_vector_math();
register_node_type_geo_attribute_remove();
register_node_type_geo_boolean();
register_node_type_geo_collection_info();
register_node_type_geo_edge_split();

View File

@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_map.hh"
#include "BLI_math.h"
#include "BLI_set.hh"
#include "BLI_span.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
@ -81,6 +82,7 @@
# include "COM_compositor.h"
#endif
using blender::Set;
using blender::Span;
using blender::Vector;
@ -1746,10 +1748,11 @@ static void count_mutli_input_socket_links(bNodeTree *ntree, SpaceNode *snode)
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
LISTBASE_FOREACH (struct bNodeSocket *, socket, &node->inputs) {
if (socket->flag & SOCK_MULTI_INPUT) {
Set<bNodeSocket *> visited_from_sockets;
socket->total_inputs = 0;
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
if (link->tosock == socket) {
socket->total_inputs++;
visited_from_sockets.add(link->fromsock);
}
}
/* Count temporary links going into this socket. */
@ -1757,10 +1760,11 @@ static void count_mutli_input_socket_links(bNodeTree *ntree, SpaceNode *snode)
LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
bNodeLink *link = (bNodeLink *)linkdata->data;
if (link->tosock == socket) {
socket->total_inputs++;
visited_from_sockets.add(link->fromsock);
}
}
}
socket->total_inputs = visited_from_sockets.size();
}
}
}

View File

@ -890,10 +890,24 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2])
continue;
}
/* Skip if tsock is already linked with this output. */
bNodeLink *existing_link_connected_to_fromsock = NULL;
LISTBASE_FOREACH (bNodeLink *, existing_link, &snode->edittree->links) {
if (existing_link->fromsock == link->fromsock && existing_link->tosock == tsock) {
existing_link_connected_to_fromsock = existing_link;
break;
}
}
/* attach links to the socket */
link->tonode = tnode;
link->tosock = tsock;
snode->runtime->last_node_hovered_while_dragging_a_link = tnode;
if (existing_link_connected_to_fromsock) {
link->multi_input_socket_index =
existing_link_connected_to_fromsock->multi_input_socket_index;
continue;
}
sort_multi_input_socket_links(snode, tnode, link, cursor);
}
}

View File

@ -910,7 +910,6 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r
static int snap_curs_to_active_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
if (snap_calc_active_center(C, false, scene->cursor.location)) {
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);

View File

@ -265,7 +265,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lattice = {
/* structName */ "LatticeGpencilModifierData",
/* structSize */ sizeof(LatticeGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
/* flags */ eGpencilModifierTypeFlag_Single | eGpencilModifierTypeFlag_SupportsEditmode,
/* flags */ eGpencilModifierTypeFlag_SupportsEditmode,
/* copyData */ copyData,

View File

@ -154,6 +154,7 @@ set(SRC
geometry/nodes/node_geo_attribute_sample_texture.cc
geometry/nodes/node_geo_attribute_separate_xyz.cc
geometry/nodes/node_geo_attribute_vector_math.cc
geometry/nodes/node_geo_attribute_remove.cc
geometry/nodes/node_geo_boolean.cc
geometry/nodes/node_geo_collection_info.cc
geometry/nodes/node_geo_common.cc

View File

@ -37,6 +37,7 @@ void register_node_type_geo_attribute_proximity(void);
void register_node_type_geo_attribute_randomize(void);
void register_node_type_geo_attribute_separate_xyz(void);
void register_node_type_geo_attribute_vector_math(void);
void register_node_type_geo_attribute_remove(void);
void register_node_type_geo_boolean(void);
void register_node_type_geo_collection_info(void);
void register_node_type_geo_edge_split(void);

View File

@ -299,6 +299,7 @@ DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, "VOLUME_T
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_COMBINE_XYZ, def_geo_attribute_combine_xyz, "ATTRIBUTE_COMBINE_XYZ", AttributeCombineXYZ, "Attribute Combine XYZ", "")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_SEPARATE_XYZ, def_geo_attribute_separate_xyz, "ATTRIBUTE_SEPARATE_XYZ", AttributeSeparateXYZ, "Attribute Separate XYZ", "")
DefNode(GeometryNode, GEO_NODE_SUBDIVIDE, 0, "SUBDIVIDE", Subdivide, "Subdivide", "")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_REMOVE, 0, "ATTRIBUTE_REMOVE", AttributeRemove, "Attribute Remove", "")
/* undefine macros */
#undef DefNode

View File

@ -0,0 +1,71 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_attribute_remove_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_STRING, N_("Attribute")},
{-1, ""},
};
static bNodeSocketTemplate geo_node_attribute_remove_out[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{-1, ""},
};
namespace blender::nodes {
static void remove_attribute(GeometryComponent &component, const GeoNodeExecParams &params)
{
const std::string attribute_name = params.get_input<std::string>("Attribute");
if (attribute_name.empty()) {
return;
}
if (!component.attribute_try_delete(attribute_name)) {
params.error_message_add(NodeWarningType::Error,
TIP_("Cannot delete attribute with name \"") + attribute_name + "\"");
}
}
static void geo_node_attribute_remove_exec(GeoNodeExecParams params)
{
GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
geometry_set = geometry_set_realize_instances(geometry_set);
if (geometry_set.has<MeshComponent>()) {
remove_attribute(geometry_set.get_component_for_write<MeshComponent>(), params);
}
if (geometry_set.has<PointCloudComponent>()) {
remove_attribute(geometry_set.get_component_for_write<PointCloudComponent>(), params);
}
params.set_output("Geometry", geometry_set);
}
} // namespace blender::nodes
void register_node_type_geo_attribute_remove()
{
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_ATTRIBUTE_REMOVE, "Attribute Remove", NODE_CLASS_ATTRIBUTE, 0);
node_type_socket_templates(&ntype, geo_node_attribute_remove_in, geo_node_attribute_remove_out);
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_remove_exec;
nodeRegisterType(&ntype);
}

View File

@ -577,9 +577,12 @@ void wm_event_do_notifiers(bContext *C)
}
ED_screen_areas_iter (win, screen, area) {
if ((note->category == NC_SPACE) && note->reference &&
(note->reference != area->spacedata.first)) {
continue;
if ((note->category == NC_SPACE) && note->reference) {
/* Filter out notifiers sent to other spaces. RNA sets the reference to the owning ID
* though, the screen, so let notifiers through that reference the entire screen. */
if ((note->reference != area->spacedata.first) && (note->reference != screen)) {
continue;
}
}
wmSpaceTypeListenerParams area_params = {
.window = win,