Page MenuHome

Crash after initialization custom node group tree
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 416.34

Blender Version
Broken: version: 2.83 (sub 13), branch: master, commit date: 2020-04-21 17:59, hash: rB13e3a1c53222

Short description of error
I'm experimenting with creating custom node tree groups in custom node tree and I faced with this crash.

Exact steps for others to reproduce the error

  • run first script (left in file)
  • run second script (right)
  • open custom node tree editor
  • select Tree
  • crash

Event Timeline

Ankit Meel (ankitm) changed the task status from Needs Triage to Needs Information from User.May 10 2020, 7:48 AM

BLI_assert failed: source/blender/blenloader/intern/writefile.c:1008, write_node_socket_default_value(), at '0'
get this while running script 2, so it seems you're doing somehtng wrong, which later gives a problem ?
file on diffusion

I'm definitely doing something wrong. There is no any guide about how to create custom node group in custom tree. So I'm experimenting and I'm trying find the way.

What information do you need?

Ankit Meel (ankitm) changed the task status from Needs Information from User to Needs Triage.May 10 2020, 8:57 AM

Although there is likely to be an error in the script, it should not crash but rather display an error message.
I think it is a bug, but I will wait for a second opinion.

@Sergey (randum) Yes it crashes, I can't fully point out why, imo you are not in the right context, but here is a short description of what you might be doing "wrong".

  • created 2 custom editors, apart from Custom node tree, there is Test Group Tree just below the custom one.
  • trying to link nodes from 2 different editors, one is Tree from Custom node tree and the other one is TreeGroup from the other panel Test Group tree does it work with normal nodes ?, I am not that proficient.

And it won't crash if you are in Test Group tree and have selected Tree Group and the input socket is created in the right under Nodes section

@Himanshi Kalra (calra) What I'm actually doing is reproduce group nodes in coustome tree editor. For this I have use two different node trees. One normal for tree editor and another for group node. Also I'm using special node which is dedicated for creating node groups. It has node_tree attribute for nested tree unlike of other normal nodes. Also I'm adding special sockets for nested node tree. Nested node tree can have sockets. So:

  • I can change pool method for group tree so it will always return False and it will crash anyway.
  • I'm not linking any nodes at all.

It looks like that the problem is in NodeSocketInterface. Everything work until i'm adding the socket ot nested node tree what is cause the crash.

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.May 15 2020, 1:56 PM
Germano Cavalcante (mano-wii) triaged this task as Low priority.
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

This might solve one of the issues:

diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 3237f33835e..f3cc40215f3 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2306,6 +2306,7 @@ static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
 
   /* setup dummy socket & socket type to store static properties in */
   memset(&dummyst, 0, sizeof(bNodeSocketType));
+  dummyst.type = -1;
 
   memset(&dummysock, 0, sizeof(bNodeSocket));
   dummysock.typeinfo = &dummyst;
@@ -2629,6 +2630,7 @@ static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
 
   /* setup dummy socket & socket type to store static properties in */
   memset(&dummyst, 0, sizeof(bNodeSocketType));
+  dummyst.type = -1;
 
   memset(&dummysock, 0, sizeof(bNodeSocket));
   dummysock.typeinfo = &dummyst;

But I'm not even sure if we support what you want to do at all.
@Campbell Barton (campbellbarton), in the current implementation, should custom node tree types be able to use node groups the same way internal tree types use them? If no, then this report is probably not a bug, but more a feature request.

@Sergey (randum), do you know of any addon that adds new a new node tree type that uses normal node groups?

Yes, node groups are used in Sorcar since june. There is interesting discussion here:

https://github.com/nortikin/sverchok/issues/3319

It looks like that all what should be done is to create MyGroupNode(NodeCustomGroup). Group input and group output nodes can be created from standard Blender classes in nested tree. Creating new sockets in MyGroupNode and in socket interface panel after connecting to input and output group nodes is happening automatically.

So probably I should not been trying to create custom input group node and custom node socket interface as I did in the example.

Yes, node groups are used in Sorcar since june. There is interesting discussion here:

https://github.com/nortikin/sverchok/issues/3319

It looks like that all what should be done is to create MyGroupNode(NodeCustomGroup). Group input and group output nodes can be created from standard Blender classes in nested tree. Creating new sockets in MyGroupNode and in socket interface panel after connecting to input and output group nodes is happening automatically.

So probably I should not been trying to create custom input group node and custom node socket interface as I did in the example.

When you follow their example, can you get it working? If yes, it would be nice if you could simplify the example as much as possible. It might be a good idea to add this as an example to the api docs.

Yes it looks working. I will try to make an example.

Sergey (randum) added a comment.EditedTue, Sep 15, 7:47 PM

I have made an example. It creates new tree editor with available group node. The node has UI for creating node groups (sub trees). There is some solution in the script which is not best I guess. I left comments there.

Jacques Lucke (JacquesLucke) claimed this task.

Thanks, since this is working now, I'll close this report. I created T80827, so that I don't forget about this topic.