30. Creating new structural materials

Questions and discussion for this lecture live here. Fire away by hitting Reply below :fire:

Hi SeƔn,
just a few questions.

First, I was wondering if is there a way to take notes inside of Serpens. It would be nice to add some comments here and there throughout our serpens code while developing it, and would be extremely useful when we come back to it in the future

Second, in this lecture at the beginning (min 5-6) when you build the string Material + Number, why don’t you simply connect ā€œMaterialā€ and ā€œCurrent Material Lengthā€ to the Combine Strings node? Instead you create a list with the two strings then Join them together. I thing the former method would be more straightforward, unless I am missing something

Thank you in advance
Oliviero

Hey Oliviero,

For your first question…I agree, code comments are something I miss with the node-based workflow. But you prompted me to find a work-around. It’s not ideas…but…if you add a Frame node, in the node properties, (where we usually change the name and colour), you can point to a text file, the contents of which will render in the frame. So, you can create a text file in Blender’s text editor, write your note and then display it in a frame…see the image attached.

As for your second question, you may well be right that there is a simpler way! I can’t quite work out the method you’re suggesting through. Could you wire it up and take a screenshot and post it here?

You’re flying through lectures…I better get more published soon!

Cheers,
S

Thank you for the work-around! That will be very useful!

For what concerns the second question, here’s a screenshot of what I’ve tried to describe previously

Yeap - this looks like a much more direct approach! Sometimes you just can’t see the wood for the trees!
Thanks for posting this.

SeƔn

Hey SeƔn,
Sorry to bother you, but I’m having another question… I’m not sure if you can help me because this issue seems more related to Blender than to the plugin development on Serpens.

The issue seems to be related to the material icon. When I use Serpens to connect the elements that should make the material icon appear, a space is generated where the icon should be, but the icon does not appear (sometimes it’s just an image made of a few pixels). Additionally, Blender slows down too much, becomes unmanageable, and I have to terminate it.

I’ve noticed that when I access the material library directly in Blender, there are some materials I generated during the plugin development that haven’t disappeared (because of the fake-user activation). These materials don’t have an icon (or in some cases, have an icon made up of a few pixels) and as soon as I view them, again Blender slows down too much and I have to terminate it. I tried to delete them by writing a code with Python and Blender’s API, but without success.

Back to the main problem, I believe the issue is related to Blender’s installation on my computer. This is because, after downloading your reference file at the end of the section and running it, I noticed that:

  • I can view the material icons you defined (steel and concrete).
  • If I try to add a material, the material is added but without an icon, and Blender slows down my computer so much that I have to terminate it.

I tried to reinstall a near-LTS version of Blender, close to the one I had when I started, but it didn’t solve anything.

Any idea of what’s happening?

Thank you

Oliviero


Just an update. I have noticed the following warning whenever I run Blender from the terminal

WARN (bgl): source/blender/python/generic/bgl.cc:2676 BPyInit_bgl: 'bgl' imported without an OpenGL backend. Please update your add-ons to use the 'gpu' module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I have tried to find a solution on the internet but didn’t manage to find one. (I don’t know if this is relate to the problem I have, but it may be).

Hey @Oliviero - this behaviour sounds quite odd. The fact that you’re also encountering the behaviour when you fire up my downloadable version of the file does suggest that the issue could be hardware related.

Have you tried exporting your addon? I’d be interested to know if this performance issue only occurs on ā€˜dev mode’ or if the issue persists even after the addon is packaged up and exported.

I suspect the issue might be related to the ā€˜Data to Icon’ node. This node comes with a health warning and is known to be quite intensive to run (I’m not sure of the underlying reasons for this BTW).

Keep in mind that we’re only using this node to achieve a superficial UI improvement. If running it on your computer is causing an issue, I would just not implement the material icons - they look node in the UI but that’s about all they do.

SeƔn

Hey @Sean, sorry for the delay.

Have you tried exporting your addon?

I’ve tried to export my addon but the issue is still there

I suspect the issue might be related to the ā€˜Data to Icon’ node.

I might be wrong, but I think the issue is somewhere else. The reason why I do believe this is that even before introducing that node, as explained above, I have generated some materials which have not disappeared (and I don’t know how to erase them) because of the fake user activation. Some of these materials have a strange icon made out of some white pixels, as if Blender was trying to load something but it can’t.

In any case, I will follow your suggestion and go on with the course without implemmenting the material icon for the moment.

Oliviero

Email me your Blend file and I will take a look when I get a minute. But yes…proceed with the course and don’t let this derail progress…the material icon is only a superficial addition as I mentioned before.
S