Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_convert_node.c
| Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | static bool is_node_parent_select(bNode *node) | ||||
| while ((node = node->parent)) { | while ((node = node->parent)) { | ||||
| if (node->flag & NODE_TRANSFORM) { | if (node->flag & NODE_TRANSFORM) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| void createTransNodeData(TransInfo *t) | static void createTransNodeData(bContext *UNUSED(C), TransInfo *t) | ||||
| { | { | ||||
| const float dpi_fac = UI_DPI_FAC; | const float dpi_fac = UI_DPI_FAC; | ||||
| SpaceNode *snode = t->area->spacedata.first; | SpaceNode *snode = t->area->spacedata.first; | ||||
| /* Custom data to enable edge panning during the node transform */ | /* Custom data to enable edge panning during the node transform */ | ||||
| View2DEdgePanData *customdata = MEM_callocN(sizeof(*customdata), __func__); | View2DEdgePanData *customdata = MEM_callocN(sizeof(*customdata), __func__); | ||||
| UI_view2d_edge_pan_init(t->context, | UI_view2d_edge_pan_init(t->context, | ||||
| customdata, | customdata, | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Node Transform Creation | /** \name Node Transform Creation | ||||
| * \{ */ | * \{ */ | ||||
| void flushTransNodes(TransInfo *t) | static void flushTransNodes(TransInfo *t) | ||||
| { | { | ||||
| const float dpi_fac = UI_DPI_FAC; | const float dpi_fac = UI_DPI_FAC; | ||||
| View2DEdgePanData *customdata = (View2DEdgePanData *)t->custom.type.data; | View2DEdgePanData *customdata = (View2DEdgePanData *)t->custom.type.data; | ||||
| if (t->options & CTX_VIEW2D_EDGE_PAN) { | if (t->options & CTX_VIEW2D_EDGE_PAN) { | ||||
| if (t->state == TRANS_CANCEL) { | if (t->state == TRANS_CANCEL) { | ||||
| UI_view2d_edge_pan_cancel(t->context, customdata); | UI_view2d_edge_pan_cancel(t->context, customdata); | ||||
| ▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Special After Transform Node | /** \name Special After Transform Node | ||||
| * \{ */ | * \{ */ | ||||
| void special_aftertrans_update__node(bContext *C, TransInfo *t) | static void special_aftertrans_update__node(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| struct Main *bmain = CTX_data_main(C); | struct Main *bmain = CTX_data_main(C); | ||||
| const bool canceled = (t->state == TRANS_CANCEL); | const bool canceled = (t->state == TRANS_CANCEL); | ||||
| SpaceNode *snode = (SpaceNode *)t->area->spacedata.first; | SpaceNode *snode = (SpaceNode *)t->area->spacedata.first; | ||||
| if (canceled && t->remove_on_cancel) { | if (canceled && t->remove_on_cancel) { | ||||
| /* remove selected nodes on cancel */ | /* remove selected nodes on cancel */ | ||||
| bNodeTree *ntree = snode->edittree; | bNodeTree *ntree = snode->edittree; | ||||
| Show All 12 Lines | if (!canceled) { | ||||
| ED_node_link_insert(bmain, t->area); | ED_node_link_insert(bmain, t->area); | ||||
| } | } | ||||
| /* clear link line */ | /* clear link line */ | ||||
| ED_node_link_intersect_test(t->area, 0); | ED_node_link_intersect_test(t->area, 0); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| TransConvertTypeInfo TransConvertType_Node = { | |||||
| /* flags */ (T_POINTS | T_2D_EDIT), | |||||
| /* createTransData */ createTransNodeData, | |||||
| /* recalcData */ flushTransNodes, | |||||
| /* special_aftertrans_update */ special_aftertrans_update__node, | |||||
| }; | |||||