2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-13 18:09:49 +00:00
|
|
|
* 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
|
2018-06-01 18:19:39 +02:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-12-13 18:09:49 +00:00
|
|
|
*
|
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-13 18:09:49 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*/
|
2011-02-27 20:29:51 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spnode
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2008-12-13 18:09:49 +00:00
|
|
|
|
BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.
In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.
####Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
This means we will use many of the existing vector types and others
we currently don't have (uintX, intX). All these variations were
asking for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector
functions should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
incompleteness.
- The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
bit of a let down. Most clases are incomplete, out of sync with each
others with different codestyles, and some functions that should be
static are not (i.e: `float3::reflect()`).
####Upsides:
- Still support `.x, .y, .z, .w` for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types
and can be restricted to certain types. Also template specialization
let us define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance
is the same.
####Downsides:
- Might impact debugability. Though I would arge that the bugs are
rarelly caused by the vector class itself (since the operations are
quite trivial) but by the type conversions.
- Might impact compile time. I did not saw a significant impact since
the usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length.
For instance, one can't call `len_squared_v3v3` in
`math::length_squared()` and call it a day.
- Type cast does not work with the template version of the `math::`
vector functions. Meaning you need to manually cast `float *` and
`(float *)[3]` to `float3` for the function calls.
i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
- Some parts might loose in readability:
`float3::dot(v1.normalized(), v2.normalized())`
becoming
`math::dot(math::normalize(v1), math::normalize(v2))`
But I propose, when appropriate, to use
`using namespace blender::math;` on function local or file scope to
increase readability.
`dot(normalize(v1), normalize(v2))`
####Consideration:
- Include back `.length()` method. It is quite handy and is more C++
oriented.
- I considered the GLM library as a candidate for replacement. It felt
like too much for what we need and would be difficult to extend / modify
to our needs.
- I used Macros to reduce code in operators declaration and potential
copy paste bugs. This could reduce debugability and could be reverted.
- This touches `delaunay_2d.cc` and the intersection code. I would like
to know @howardt opinion on the matter.
- The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
But according to @JacquesLucke it is not a real problem for now.
I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.
Reviewed By: brecht, sergey, JacquesLucke
Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:57:07 +01:00
|
|
|
#include "BLI_math_vec_types.hh"
|
2021-11-12 12:12:27 -06:00
|
|
|
#include "BLI_vector.hh"
|
|
|
|
|
|
2021-12-03 11:31:25 -05:00
|
|
|
#include "BKE_node.h"
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2021-12-03 11:31:25 -05:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
#include "UI_interface.hh"
|
|
|
|
|
#include "UI_view2d.h"
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
struct ARegion;
|
2009-08-19 00:55:30 +00:00
|
|
|
struct ARegionType;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Main;
|
2021-02-18 14:14:17 +11:00
|
|
|
struct NodeInsertOfsData;
|
2008-12-24 10:33:10 +00:00
|
|
|
struct View2D;
|
|
|
|
|
struct bContext;
|
2011-03-13 22:07:55 +00:00
|
|
|
struct bNode;
|
|
|
|
|
struct bNodeLink;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bNodeSocket;
|
2020-04-16 15:09:49 +02:00
|
|
|
struct wmGizmoGroupType;
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
struct wmKeyConfig;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct wmWindow;
|
2011-03-13 22:07:55 +00:00
|
|
|
|
2022-01-20 15:10:28 -06:00
|
|
|
/* Outside of blender namespace to avoid Python documentation build error with `ctypes`. */
|
|
|
|
|
extern const char *node_context_dir[];
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
|
|
|
|
|
2021-12-03 11:31:25 -05:00
|
|
|
/** Temporary data used in node link drag modal operator. */
|
2021-11-18 11:46:44 -05:00
|
|
|
struct bNodeLinkDrag {
|
2021-11-19 15:36:32 -05:00
|
|
|
/** Links dragged by the operator. */
|
2022-01-20 10:36:56 -06:00
|
|
|
Vector<bNodeLink *> links;
|
2021-02-03 11:02:01 -06:00
|
|
|
bool from_multi_input_socket;
|
2021-12-15 09:51:57 -06:00
|
|
|
eNodeSocketInOut in_out;
|
|
|
|
|
|
|
|
|
|
/** Draw handler for the "+" icon when dragging a link in empty space. */
|
|
|
|
|
void *draw_handle;
|
2021-03-02 23:09:38 +01:00
|
|
|
|
2021-04-15 10:00:25 +02:00
|
|
|
/** Temporarily stores the last picked link from multi-input socket operator. */
|
2021-12-15 09:51:57 -06:00
|
|
|
bNodeLink *last_picked_multi_input_socket_link;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Temporarily stores the last hovered socket for multi-input socket operator.
|
|
|
|
|
* Store it to recalculate sorting after it is no longer hovered.
|
|
|
|
|
*/
|
|
|
|
|
bNode *last_node_hovered_while_dragging_a_link;
|
2021-03-15 15:41:41 +01:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
/* The cursor position, used for drawing a + icon when dragging a node link. */
|
|
|
|
|
std::array<int, 2> cursor;
|
|
|
|
|
|
|
|
|
|
/** The node the drag started at. */
|
|
|
|
|
bNode *start_node;
|
|
|
|
|
/** The socket the drag started at. */
|
|
|
|
|
bNodeSocket *start_socket;
|
|
|
|
|
/** The number of links connected to the #start_socket when the drag started. */
|
|
|
|
|
int start_link_count;
|
2021-06-16 18:17:07 +01:00
|
|
|
|
|
|
|
|
/* Data for edge panning */
|
|
|
|
|
View2DEdgePanData pan_data;
|
2021-11-18 11:46:44 -05:00
|
|
|
};
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
struct SpaceNode_Runtime {
|
2021-01-19 16:43:08 -06:00
|
|
|
float aspect;
|
|
|
|
|
|
|
|
|
|
/** Mouse position for drawing socket-less links and adding nodes. */
|
2022-01-20 10:36:56 -06:00
|
|
|
float2 cursor;
|
2021-01-19 16:43:08 -06:00
|
|
|
|
|
|
|
|
/** For auto compositing. */
|
|
|
|
|
bool recalc;
|
|
|
|
|
|
|
|
|
|
/** Temporary data for modal linking operator. */
|
2021-11-19 15:36:32 -05:00
|
|
|
std::unique_ptr<bNodeLinkDrag> linkdrag;
|
2021-01-19 16:43:08 -06:00
|
|
|
|
|
|
|
|
/* XXX hack for translate_attach op-macros to pass data from transform op to insert_offset op */
|
|
|
|
|
/** Temporary data for node insert offset (in UI called Auto-offset). */
|
|
|
|
|
struct NodeInsertOfsData *iofsd;
|
2021-11-18 11:46:44 -05:00
|
|
|
};
|
2021-01-19 16:43:08 -06:00
|
|
|
|
2021-12-05 16:45:41 -05:00
|
|
|
enum NodeResizeDirection {
|
|
|
|
|
NODE_RESIZE_NONE = 0,
|
|
|
|
|
NODE_RESIZE_TOP = (1 << 0),
|
|
|
|
|
NODE_RESIZE_BOTTOM = (1 << 1),
|
|
|
|
|
NODE_RESIZE_RIGHT = (1 << 2),
|
|
|
|
|
NODE_RESIZE_LEFT = (1 << 3),
|
|
|
|
|
};
|
|
|
|
|
ENUM_OPERATORS(NodeResizeDirection, NODE_RESIZE_LEFT);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Transform between View2Ds in the tree path.
|
|
|
|
|
*/
|
2022-01-20 10:36:56 -06:00
|
|
|
float2 space_node_group_offset(const SpaceNode &snode);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
float node_socket_calculate_height(const bNodeSocket &socket);
|
2022-01-20 10:36:56 -06:00
|
|
|
float2 node_link_calculate_multi_input_position(const float2 &socket_position,
|
|
|
|
|
int index,
|
|
|
|
|
int total_inputs);
|
2021-02-11 01:16:17 -06:00
|
|
|
|
2021-12-03 11:05:59 -05:00
|
|
|
int node_get_resize_cursor(NodeResizeDirection directions);
|
2022-01-07 11:38:08 +11:00
|
|
|
NodeResizeDirection node_get_resize_direction(const bNode *node, int x, int y);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Usual convention here would be #node_socket_get_color(),
|
|
|
|
|
* but that's already used (for setting a color property socket).
|
|
|
|
|
*/
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_socket_color_get(const bContext &C,
|
|
|
|
|
const bNodeTree &ntree,
|
|
|
|
|
PointerRNA &node_ptr,
|
|
|
|
|
const bNodeSocket &sock,
|
2020-04-16 15:09:49 +02:00
|
|
|
float r_color[4]);
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_draw_space(const bContext &C, ARegion ®ion);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2022-01-18 13:07:18 -06:00
|
|
|
/**
|
|
|
|
|
* Sort nodes by selection: unselected nodes first, then selected,
|
|
|
|
|
* then the active node at the very end. Relative order is kept intact.
|
|
|
|
|
*/
|
2022-01-18 13:32:36 -06:00
|
|
|
void node_sort(bNodeTree &ntree);
|
2022-01-18 13:07:18 -06:00
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
void node_set_cursor(wmWindow &win, SpaceNode &snode, const float2 &cursor);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* DPI scaled coords */
|
2022-01-20 10:36:56 -06:00
|
|
|
float2 node_to_view(const bNode &node, const float2 &co);
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_to_updated_rect(const bNode &node, rctf &r_rect);
|
2022-01-20 10:36:56 -06:00
|
|
|
float2 node_from_view(const bNode &node, const float2 &co);
|
2012-05-22 14:13:33 +00:00
|
|
|
|
2022-01-05 21:44:03 -05:00
|
|
|
void node_operatortypes();
|
2021-11-18 11:46:44 -05:00
|
|
|
void node_keymap(wmKeyConfig *keyconf);
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_deselect_all(SpaceNode &snode);
|
|
|
|
|
void node_socket_select(bNode *node, bNodeSocket &sock);
|
2022-01-07 11:38:08 +11:00
|
|
|
void node_socket_deselect(bNode *node, bNodeSocket &sock, bool deselect_node);
|
|
|
|
|
void node_deselect_all_input_sockets(SpaceNode &snode, bool deselect_nodes);
|
|
|
|
|
void node_deselect_all_output_sockets(SpaceNode &snode, bool deselect_nodes);
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_select_single(bContext &C, bNode &node);
|
2021-11-18 11:46:44 -05:00
|
|
|
|
|
|
|
|
void NODE_OT_select(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_all(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_linked_to(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_linked_from(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_box(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_circle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_lasso(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_grouped(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_select_same_type_step(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_find_node(wmOperatorType *ot);
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
bool space_node_view_flag(
|
|
|
|
|
bContext &C, SpaceNode &snode, ARegion ®ion, int node_flag, int smooth_viewtx);
|
2013-03-27 17:22:12 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_view_all(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_view_selected(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_geometry_node_view_legacy(wmOperatorType *ot);
|
2011-12-18 12:51:50 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_backimage_move(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_backimage_zoom(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_backimage_fit(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_backimage_sample(wmOperatorType *ot);
|
2012-08-02 21:52:09 +00:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void nodelink_batch_start(SpaceNode &snode);
|
|
|
|
|
void nodelink_batch_end(SpaceNode &snode);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* \note this is used for fake links in groups too.
|
|
|
|
|
*/
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_draw_link(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
|
|
|
|
const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Don't do shadows if th_col3 is -1.
|
|
|
|
|
*/
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_draw_link_bezier(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
|
|
|
|
const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link,
|
2018-04-05 15:41:17 +02:00
|
|
|
int th_col1,
|
|
|
|
|
int th_col2,
|
|
|
|
|
int th_col3);
|
2021-12-09 00:55:11 +11:00
|
|
|
/** If v2d not nullptr, it clips and returns 0 if not visible. */
|
2021-11-18 11:46:44 -05:00
|
|
|
bool node_link_bezier_points(const View2D *v2d,
|
|
|
|
|
const SpaceNode *snode,
|
2021-12-03 16:25:17 -05:00
|
|
|
const bNodeLink &link,
|
2015-11-13 00:03:12 +11:00
|
|
|
float coord_array[][2],
|
2022-01-07 11:38:08 +11:00
|
|
|
int resol);
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* Return quadratic beziers points for a given nodelink and clip if v2d is not nullptr.
|
|
|
|
|
*/
|
2021-11-18 11:46:44 -05:00
|
|
|
bool node_link_bezier_handles(const View2D *v2d,
|
|
|
|
|
const SpaceNode *snode,
|
2021-12-03 16:25:17 -05:00
|
|
|
const bNodeLink &ink,
|
2021-02-11 01:16:17 -06:00
|
|
|
float vec[4][2]);
|
2021-12-03 16:25:17 -05:00
|
|
|
void draw_nodespace_back_pix(const bContext &C,
|
|
|
|
|
ARegion ®ion,
|
|
|
|
|
SpaceNode &snode,
|
2013-04-24 16:36:50 +00:00
|
|
|
bNodeInstanceKey parent_key);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2022-01-18 13:07:18 -06:00
|
|
|
void node_select_all(ListBase *lb, int action);
|
|
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* XXX Does some additional initialization on top of #nodeAddNode
|
|
|
|
|
* Can be used with both custom and static nodes,
|
|
|
|
|
* if `idname == nullptr` the static int type will be used instead.
|
|
|
|
|
*/
|
2021-12-03 16:25:17 -05:00
|
|
|
bNode *node_add_node(const bContext &C, const char *idname, int type, float locx, float locy);
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_add_reroute(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_group(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_object(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_collection(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_texture(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_file(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_add_mask(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_new_node_tree(wmOperatorType *ot);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
const char *node_group_idname(bContext *C);
|
|
|
|
|
void NODE_OT_group_make(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_group_insert(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_group_ungroup(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_group_separate(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_group_edit(wmOperatorType *ot);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void sort_multi_input_socket_links(SpaceNode &snode,
|
|
|
|
|
bNode &node,
|
2021-11-18 11:46:44 -05:00
|
|
|
bNodeLink *drag_link,
|
2022-01-20 10:36:56 -06:00
|
|
|
const float2 *cursor);
|
2016-02-05 01:39:42 +05:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_link(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_link_make(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_links_cut(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_links_detach(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_links_mute(wmOperatorType *ot);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_parent_set(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_join(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_attach(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_detach(wmOperatorType *ot);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_link_viewer(wmOperatorType *ot);
|
2012-08-01 19:11:17 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_insert_offset(wmOperatorType *ot);
|
2015-08-01 17:39:48 +02:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void snode_set_context(const bContext &C);
|
2021-11-18 11:46:44 -05:00
|
|
|
|
|
|
|
|
bool composite_node_active(bContext *C);
|
2021-12-09 00:55:11 +11:00
|
|
|
/** Operator poll callback. */
|
2021-11-18 11:46:44 -05:00
|
|
|
bool composite_node_editable(bContext *C);
|
|
|
|
|
|
|
|
|
|
bool node_has_hidden_sockets(bNode *node);
|
|
|
|
|
void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
|
|
|
|
|
int node_render_changed_exec(bContext *, wmOperator *);
|
2021-12-09 00:55:11 +11:00
|
|
|
/** Type is #SOCK_IN and/or #SOCK_OUT. */
|
2021-12-03 16:25:17 -05:00
|
|
|
bool node_find_indicated_socket(SpaceNode &snode,
|
|
|
|
|
bNode **nodep,
|
|
|
|
|
bNodeSocket **sockp,
|
2022-01-20 10:36:56 -06:00
|
|
|
const float2 &cursor,
|
2021-12-03 16:25:17 -05:00
|
|
|
eNodeSocketInOut in_out);
|
|
|
|
|
float node_link_dim_factor(const View2D &v2d, const bNodeLink &link);
|
|
|
|
|
bool node_link_is_hidden_or_dimmed(const View2D &v2d, const bNodeLink &link);
|
2021-11-18 11:46:44 -05:00
|
|
|
|
|
|
|
|
void NODE_OT_duplicate(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_delete(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_delete_reconnect(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_resize(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void NODE_OT_mute_toggle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_hide_toggle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_hide_socket_toggle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_preview_toggle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_options_toggle(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_node_copy_color(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void NODE_OT_read_viewlayers(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_render_changed(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void NODE_OT_output_file_add_socket(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_output_file_move_active_socket(wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
void NODE_OT_switch_view_update(wmOperatorType *ot);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
2021-12-09 00:55:11 +11:00
|
|
|
/**
|
|
|
|
|
* \note clipboard_cut is a simple macro of copy + delete.
|
|
|
|
|
*/
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_clipboard_copy(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_clipboard_paste(wmOperatorType *ot);
|
2012-08-02 09:52:37 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_tree_socket_add(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_tree_socket_remove(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_tree_socket_change_type(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_tree_socket_move(wmOperatorType *ot);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_shader_script_update(wmOperatorType *ot);
|
2012-11-03 14:32:26 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_viewer_border(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_clear_viewer_border(wmOperatorType *ot);
|
2013-03-07 17:47:30 +00:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt);
|
|
|
|
|
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt);
|
|
|
|
|
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt);
|
|
|
|
|
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt);
|
2017-05-29 22:06:59 +10:00
|
|
|
|
2021-11-18 11:46:44 -05:00
|
|
|
void NODE_OT_cryptomatte_layer_add(wmOperatorType *ot);
|
|
|
|
|
void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot);
|
2017-05-29 22:06:59 +10:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void node_geometry_add_attribute_search_button(const bContext &C,
|
|
|
|
|
const bNodeTree &node_tree,
|
|
|
|
|
const bNode &node,
|
|
|
|
|
PointerRNA &socket_ptr,
|
|
|
|
|
uiLayout &layout);
|
2021-03-02 13:01:33 -06:00
|
|
|
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
/* Nodes draw without dpi - the view zoom is flexible. */
|
|
|
|
|
#define HIDDEN_RAD (0.75f * U.widget_unit)
|
2018-07-25 12:53:15 +02:00
|
|
|
#define BASIS_RAD (0.2f * U.widget_unit)
|
2012-08-04 12:54:27 +00:00
|
|
|
#define NODE_DYS (U.widget_unit / 2)
|
|
|
|
|
#define NODE_DY U.widget_unit
|
2021-08-27 11:25:30 -07:00
|
|
|
#define NODE_SOCKDY (0.1f * U.widget_unit)
|
2021-12-03 16:25:17 -05:00
|
|
|
#define NODE_WIDTH(node) (node.width * UI_DPI_FAC)
|
|
|
|
|
#define NODE_HEIGHT(node) (node.height * UI_DPI_FAC)
|
Node Editor: Style update to nodes
This patch changes how nodes look visually, in an attempt to fix a number of issues:
* The header background is currently drawn using a theme color fully opaque, this limits the colors we can use because the node name/label is drawn on top.
* Hard-coded transparency makes nodes hard to read. The node backdrop already has alpha so if the user wants it they can set it. This patch uses alpha from the theme.
* Better muted status indicator, instead of simply making everything transparent and the wires inside red, draw a red outline around the node, darken the header and backdrop.
* On muted nodes, display wires behind the backdrop to not interfere with text/widgets inside the node.
Nodes:
* Darken header to improve readability of node label.
* Draw a line under the header
* Thicker outline.
* Do not hard-code transparency on nodes, use the theme's node backdrop alpha component.
* Use angle icon instead of triangle (to be consistent with the [[ https://developer.blender.org/D12814 | changes ]] to panels)
Style adjustment to sockets drawing:
* Do not hard-code the socket outline color to black, use `TH_WIRE` instead
* Do not use `TH_TEXT_HI` for selected sockets, use `TH_ACTIVE` (active node outline)
* Do not draw sockets background transparent on muted nodes.
* Thicker outline to help contrast and readability
{F11496707, size=full}
Reviewed By: #user_interface, HooglyBoogly
Differential Revision: https://developer.blender.org/D12884
2021-10-26 20:07:26 +02:00
|
|
|
#define NODE_MARGIN_X (1.2f * U.widget_unit)
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
|
2021-02-11 01:16:17 -06:00
|
|
|
#define NODE_MULTI_INPUT_LINK_GAP (0.25f * U.widget_unit)
|
2019-01-04 15:08:24 +01:00
|
|
|
#define NODE_RESIZE_MARGIN (0.20f * U.widget_unit)
|
2012-08-01 19:11:17 +00:00
|
|
|
#define NODE_LINK_RESOL 12
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2021-10-26 11:05:01 -05:00
|
|
|
Vector<ui::ContextPathItem> context_path_for_space_node(const bContext &C);
|
2021-12-03 11:31:25 -05:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
void invoke_node_link_drag_add_menu(bContext &C,
|
|
|
|
|
bNode &node,
|
|
|
|
|
bNodeSocket &socket,
|
|
|
|
|
const float2 &cursor);
|
|
|
|
|
|
|
|
|
|
} // namespace blender::ed::space_node
|