Fix #108049: De-duplicate copied active node #108082

Closed
Iliya Katushenock wants to merge 6 commits from mod_moder:tmp_fix_deduplicate_active_node_of_copys into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Initially, activiti flag isn't processed separately.
This cause that we can get multiple active nodes.
To avoid this incorrect state, just mapping old
active nodes before copy/duplicate its.

Initially, activiti flag isn't processed separately. This cause that we can get multiple active nodes. To avoid this incorrect state, just mapping old active nodes before copy/duplicate its.
Iliya Katushenock added 1 commit 2023-05-19 16:12:57 +02:00
Iliya Katushenock requested review from Lukas Tönne 2023-05-19 16:13:15 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-05-19 16:13:20 +02:00
Iliya Katushenock added 1 commit 2023-05-19 16:17:31 +02:00
Member

I tried this for a bit and it works well for the most part.

But I found that this triggers an assert, when the active node you're trying to copy can't be pasted into the node tree.
E.g. when trying to copy nodes from a geometry node tree into a shader node tree and the active node that's copied is exclusive to geometry nodes. See attached video.

I tried this for a bit and it works well for the most part. But I found that this triggers an assert, when the active node you're trying to copy can't be pasted into the node tree. E.g. when trying to copy nodes from a geometry node tree into a shader node tree and the active node that's copied is exclusive to geometry nodes. See attached video.
Author
Member

I'm surprised the copy-to-other editor feature still exists. Yes, I need to take this into account...

I'm surprised the copy-to-other editor feature still exists. Yes, I need to take this into account...
Iliya Katushenock added 2 commits 2023-05-20 18:32:47 +02:00
Lukas Tönne approved these changes 2023-05-22 15:17:49 +02:00
Lukas Tönne left a comment
Member

Looks good, just one typo.

This handles the clipboard and the duplication operator. Do we know if the same problem exists in other copy-style operator? Full Node tree copy should be fine, and the shader branch copy won't care about active nodes, but the node group Insert/Separate/Ungroup operators might be affected.

See #106852 for a list of places if found where node copies take place.

Looks good, just one typo. This handles the clipboard and the duplication operator. Do we know if the same problem exists in other copy-style operator? Full Node tree copy should be fine, and the shader branch copy won't care about active nodes, but the node group Insert/Separate/Ungroup operators might be affected. See #106852 for a list of places if found where node copies take place.
@ -1296,2 +1296,4 @@
Map<const ID *, ID *> duplicated_node_groups;
bNode *actibe_node = nodeGetActive(ntree);
Member

typo: actibe

typo: acti**b**e
mod_moder marked this conversation as resolved
Author
Member

@LukasTonne A lot of other operators do not work with selected nodes only, but also required active one. This mean, active node processes implicitly and without some formal declaration is not so easy to prove correction in code without some dead weys, like:

group_insert_imp:
  // copy ...;
  bke::set_active(node_group, bke::get_active(node_group));
  return;

But so far, as far as I can understand, everything works correctly. Unless the behavior is changed ... But then only such code as in the example will make it clear that this needs to be processed somehow. For now, it works on its own.

@LukasTonne A lot of other operators do not work with selected nodes only, but also required active one. This mean, active node processes implicitly and without some formal declaration is not so easy to prove correction in code without some dead weys, like: ```Cpp group_insert_imp: // copy ...; bke::set_active(node_group, bke::get_active(node_group)); return; ``` But so far, as far as I can understand, everything works correctly. Unless the behavior is changed ... But then only such code as in the example will make it clear that this needs to be processed somehow. For now, it works on its own.
Iliya Katushenock added 2 commits 2023-05-22 20:38:16 +02:00
Author
Member
https://projects.blender.org/blender/blender/pulls/108535
Iliya Katushenock deleted branch tmp_fix_deduplicate_active_node_of_copys 2023-06-18 12:05:36 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108082
No description provided.