Forum

delete node materials from new blendfile

17 June 2017 19:52
When I create a new project, a blend file is created with the
Blend4web-Cube. Also available in the material slot are tree
Materials:

- logo
- Material
- shadow_plane

With a script all objects and materials should be deleted, but this
script is not working as expected.

Attached is a minimal script.

You can reproduce the strange behavior as follows:

1. create a new project
2. switch to the scripting-layout and/or text editor
3. load and run the script

It looks like the result is an empty scene, but you will get errors if
you start the preview. I have found two workarounds, but I am not
satisfied with both solutions:

1. The only way to circumvent all errors and crashes is to select all
Objects manually and delete all selected objects. Afterward the script
is working as expected.

2. Create a new blend file and overwrite the generated one in the
project folder.


It looks like it is not possible to remove the node materials in the blend file with a script.

Does anyone know a better solution to get rid of all materials (shadow_plan, logo) and
objects from the standard blend file and start with an empty scene with the help of an script?

Peter
18 June 2017 04:57
File > New > Save As and save over the original?
Although it sounds like you are trying to make an automated process so maybe that is not a solution.
18 June 2017 07:29
Yes, now thats clear to me. I am trying to build an automated and repeatable first step with the help of a script. I was faced with this behavior in a workshop, not knowing this side effect. Now it is obvious, but why should it not be possible to delete parts of a complex scene automatically?

Peter
18 June 2017 12:12
Maybe you could find the template blend file and replace it with an empty one. During project creation, an existing blend file is probably just copied to the new project directory.
 
Please register or log in to leave a reply.