Compare commits

..

7 Commits

Author SHA1 Message Date
kaosat.dev 1f86e6a9dd docs(): url fixes 2024-08-14 16:38:32 +02:00
kaosat.dev 4fb339522a docs(quickstart): minor tweaks for 0.1.0-alpha.1 release 2024-08-14 16:20:26 +02:00
kaosat.dev 9ffe83c0bd chore(Bevy): fix attempt 2024-08-14 16:14:11 +02:00
kaosat.dev 79a1d21705 chore(Bevy): added missing dep 2024-08-14 15:43:11 +02:00
kaosat.dev 46b846ead7 feat(Blender): added mention of QOL menu in docs, plus some minor tweaks to context menu 2024-08-14 15:28:07 +02:00
kaosat.dev db7647b0a8 feat(Blender): added dynamic tooltips 2024-08-14 14:52:08 +02:00
kaosat.dev 48ce690860 feat(Blender):
* added ability to clear/reset settings to default
 * a lot of improvements to QOL ui features
   * fixed issue with editing scenes being tagged as Level scenes
   * fixed mode switching issues
   * added save & reset of camera settings
   * improved selection logic
   * various minor tweaks
   * better naming & cleanups
2024-08-14 14:37:42 +02:00
15 changed files with 201 additions and 123 deletions

View File

@ -4,7 +4,7 @@
# BLENVY: a friendly Blender <=> Bevy workflow
![demo](./docs/blender_bevy.png)
![demo](https://github.com/kaosat-dev/Blenvy/blob/main/docs/blender_bevy.png)
Crates & tools for adding components from gltf files in the [Bevy](https://bevyengine.org/) game engine.
@ -24,7 +24,7 @@ It also allows you to setup 'blueprints' in Blender by using collections (the re
## Quickstart
Want to jump right in? See the [quickstart guide](./docs/quickstart/readme.md) for how to setup a basic project as fast as possible.
Want to jump right in? See the [quickstart guide](https://github.com/kaosat-dev/Blenvy/blob/main/docs/quickstart/README.md) for how to setup a basic project as fast as possible.
## Features
@ -82,7 +82,7 @@ The workflow goes as follows (once you got your Bevy code setup)
* create & register all your components you want to be able to set from the Blender side (this is basic Bevy, no specific work needed)
![component registration](./docs/component_registration.png)
![component registration](https://github.com/kaosat-dev/Blenvy/blob/main/docs/component_registration.png)
* setup & then use the Blenvy [Bevy crate](./crates/blenvy/README.md)
* setup & then use the Blenvy [Blender add-on](./tools/blenvy/README.md)
@ -91,11 +91,11 @@ The workflow goes as follows (once you got your Bevy code setup)
* then add your components to objects in Blender **with a nice UI** see [here](./README-workflow-ui.md) for more details
See the [quickstart](./docs/quickstart/readme.md) for a full step-by-step guide.
See the [quickstart](https://github.com/kaosat-dev/Blenvy/blob/main/docs/quickstart/README.md) for a full step-by-step guide.
## Third Party Integration
Read about the [Avian Physics Integration](docs/avian/readme.md) to learn how to setup colliders in Blender that will be used by the Avian physics engine in Bevy.
Read about the [Avian Physics Integration](https://github.com/kaosat-dev/Blenvy/blob/main/docs/avian/README.md) to learn how to setup colliders in Blender that will be used by the Avian physics engine in Bevy.
## Limitations / issues

View File

@ -370,6 +370,7 @@ PRE ALPHA1 RELEASE:
- [x] blender add-on
- [x] barebones bevy test
- [x] hot reload => some of it works, the rest not anymore ? (see bug https://github.com/bevyengine/bevy/issues/14698)
- [x] add "right click to edit blueprint"
- [ ] merge blenvy branch into main
- [ ] push to crates.io
- [ ] tag
@ -386,7 +387,6 @@ BEVY:
- [ ] make a fleshed out demo
BLENDER:
- [ ] add "right click to edit blueprint"
- [ ] overall cleanup
- [ ] review wonky logic for cross file components injections
- [ ] update & fix tests

View File

@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0"
workspace = true
[dependencies]
bevy = { version = "0.14", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } #, "file_watcher"
bevy = { version = "0.14", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "animation"] }
serde = "1.0.188"
ron = "0.8.1"
serde_json = "1.0.108"

View File

@ -17,7 +17,7 @@ This guide assumes you use Blender 4.2 or newer and have set it to English.
## Install the Blender Addon
- Download `blenvy.zip` from the [release page](https://github.com/kaosat-dev/Blenvy/releases/tag/blenvy_v0.1.0_pre_alpha)
- Download `blenvy.zip` from the [release page](https://github.com/kaosat-dev/Blenvy/releases/tag/blenvy_0.1.0-alpha.1)
- Open Blender
- Drag and drop `blenvy.zip` into Blender
- <details>
@ -39,7 +39,7 @@ Run the following commands:
cargo new my_game
cd my_game
cargo add bevy
cargo add blenvy --git https://github.com/kaosat-dev/Blenvy/ --branch blenvy
cargo add blenvy
```
This guide will tell you to `cargo run` at multiple points. We expect that you are still in the `my_game` directory when you do so.

View File

@ -158,6 +158,11 @@ Take a look at the [relevant](../../examples/demo/) example for more [details](.
- for a detailed overview of blueprints please see [here](./README-blueprints.md)
> [!TIP]
> you can right click on a Blueprint instance in your level scenes or press SHIFT + F to edit a Blueprint in a seperate temprary scene !
> you can right click or press SHIFT + F to create a new empty Blueprint and an instance of it from your main scenes
> right click again & select the option to stop editing it, or
## Development
- I highly recomend (if you are using vscode like me) to use

View File

@ -49,7 +49,7 @@ from .blueprints.operators import BLENVY_OT_blueprint_select
# blenvy core
from .core.blenvy_manager import BlenvyManager
from .core.operators import BLENVY_OT_configuration_switch, BLENVY_OT_tooling_switch
from .core.operators import BLENVY_OT_tooling_switch, BLENVY_OT_configuration_switch, BLENVY_OT_configuration_reset
from .core.ui.ui import (BLENVY_PT_SidePanel)
from .core.ui.scenes_list import BLENVY_OT_scenes_list_actions
from .core.ui.menus_and_shortcuts import BLENVY_OT_ui_blueprint_create, BLENVY_OT_ui_blueprint_edit_start, BLENVY_OT_ui_blueprint_edit_end, BLENVY_OT_ui_blueprint_create_or_edit, edit_or_create_blueprint_menu
@ -112,6 +112,7 @@ classes = [
BlenvyManager,
BLENVY_OT_tooling_switch,
BLENVY_OT_configuration_switch,
BLENVY_OT_configuration_reset,
Asset,
AssetsRegistry,

View File

@ -1,7 +1,7 @@
import bpy
from bpy_types import (PropertyGroup)
from bpy.props import (EnumProperty, PointerProperty, StringProperty, BoolProperty, CollectionProperty, IntProperty)
from ...settings import load_settings, upsert_settings, generate_complete_settings_dict
from bpy.props import (EnumProperty, BoolProperty)
from ...settings import load_settings, upsert_settings, generate_complete_settings_dict, clear_settings
# list of settings we do NOT want to save
settings_black_list = ['settings_save_enabled', 'dry_run']
@ -128,3 +128,13 @@ class AutoExportSettings(PropertyGroup):
self.settings_save_enabled = True
def reset_settings(self):
for property_name in self.bl_rna.properties.keys():
if property_name not in ["name", "rna_type"]:
self.property_unset(property_name)
# clear the stored settings
clear_settings(".blenvy_export_settings")
clear_settings(".blenvy_export_settings_previous")
clear_settings(".blenvy_gltf_settings_previous")
clear_settings(".blenvy.project_serialized_previous")

View File

@ -1,8 +1,8 @@
import os
import bpy
from bpy_types import (PropertyGroup)
from bpy.props import (EnumProperty, PointerProperty, StringProperty, BoolProperty, CollectionProperty, FloatProperty)
from ...settings import load_settings, upsert_settings, generate_complete_settings_dict
from bpy.props import (StringProperty, BoolProperty, FloatProperty)
from ...settings import load_settings, upsert_settings, generate_complete_settings_dict, clear_settings
from .propGroups.prop_groups import generate_propertyGroups_for_components
from .components.metadata import ensure_metadata_for_all_items
@ -154,3 +154,10 @@ class ComponentsSettings(PropertyGroup):
except:pass
self.settings_save_enabled = True
def reset_settings(self):
for property_name in self.bl_rna.properties.keys():
if property_name not in ["name", "rna_type"]:
self.property_unset(property_name)
# clear the stored settings
clear_settings(".blenvy_components_settings")

View File

@ -101,7 +101,6 @@ class BLENVY_OT_item_select(Operator):
select_area(context=context, area_name="OBJECT")
elif self.item_type == 'COLLECTION':
print("selecting collection")
collection = bpy.data.collections[self.target_name]
scene_of_collection = get_collection_scene(collection) if self.override_scene_name == "" else bpy.data.scenes.get(self.override_scene_name, None)
if scene_of_collection is not None:

View File

@ -1,8 +1,8 @@
import os
import bpy
from bpy_types import (PropertyGroup)
from bpy.props import (BoolProperty, EnumProperty, PointerProperty, StringProperty, CollectionProperty, IntProperty)
from ..settings import upsert_settings, load_settings, generate_complete_settings_dict
from bpy.props import (BoolProperty, EnumProperty, PointerProperty, StringProperty, CollectionProperty, IntProperty, FloatProperty, FloatVectorProperty)
from ..settings import upsert_settings, load_settings, generate_complete_settings_dict, clear_settings
from ..add_ons.auto_export.settings import AutoExportSettings
from ..add_ons.bevy_components.settings import ComponentsSettings
@ -154,11 +154,22 @@ class BlenvyManager(PropertyGroup):
edit_blueprint_previous_mode: StringProperty(
name="edit_blueprint_previous_mode",
description="previous blenvy mode before starting editing the current blueprint",
description="previous blenvy mode before starting editing the current Blueprint",
default="",
update=save_settings
)# type: ignore
edit_blueprint_previous_view_distance: FloatProperty(
name="edit_blueprint_previous_view_distance",
description="previous view distance before focusing in on the specific Blueprint to edit",
default=0.0,
)# type: ignore
edit_blueprint_previous_view_position: FloatVectorProperty(
name="edit_blueprint_previous_view_position",
description="previous view position before focusing in on the specific Blueprint to edit",
)# type: ignore
# sub ones
auto_export: PointerProperty(type=AutoExportSettings) # type: ignore
components: PointerProperty(type=ComponentsSettings) # type: ignore
@ -195,7 +206,7 @@ class BlenvyManager(PropertyGroup):
('Level', 'Level','Level scene'),
('Library', 'Library', 'Library scene'),
),
default='None'
default='None'
)
@classmethod
@ -228,3 +239,18 @@ class BlenvyManager(PropertyGroup):
for scene in bpy.data.scenes:
self.scenes_to_scene_names[scene] = scene.name
def reset_settings(self):
for property_name in self.bl_rna.properties.keys():
if property_name not in ["name", "rna_type"]:
self.property_unset(property_name)
# now reset auto_export settings
self.auto_export.reset_settings()
# now reset component settings
self.components.reset_settings()
# clear the stored settings
clear_settings(".blenvy_common_settings")
clear_settings(".blenvy_common_settings_previous")

View File

@ -17,10 +17,7 @@ def recurLayerCollection(layerColl, collName):
return found
def set_active_collection(scene, collection_name):
print("set active collection", scene, collection_name)
layer_collection = scene.view_layers['ViewLayer'].layer_collection
layerColl = recurLayerCollection(layer_collection, collection_name)
print("layerColl", layerColl)
# set active collection to the collection
bpy.context.view_layer.active_layer_collection = layerColl

View File

@ -1,6 +1,8 @@
from bpy_types import (Operator)
from bpy.props import (EnumProperty)
from ..settings import clear_settings
class BLENVY_OT_tooling_switch(Operator):
"""Switch blenvy tooling"""
bl_idname = "bevy.tooling_switch"
@ -26,8 +28,6 @@ class BLENVY_OT_tooling_switch(Operator):
context.window_manager.blenvy.mode = self.tool
return {'FINISHED'}
class BLENVY_OT_configuration_switch(Operator):
"""Switch tooling configuration"""
bl_idname = "bevy.config_switch"
@ -50,3 +50,20 @@ class BLENVY_OT_configuration_switch(Operator):
context.window_manager.blenvy.config_mode = self.tool
return {'FINISHED'}
class BLENVY_OT_configuration_reset(Operator):
"""Reset all blenvy settings to default"""
bl_idname = "bevy.config_reset"
bl_label = "Clear stored setting & reset configuration to default"
#bl_options = {}
def execute(self, context):
print("reset configuration")
blenvy = context.window_manager.blenvy
try:
blenvy.reset_settings()
except Exception as error:
self.report({"ERROR"}, f"Failed to reset settings: {error}")
return {"CANCELLED"}
return {'FINISHED'}

View File

@ -1,8 +1,6 @@
import bpy
import json
from mathutils import Vector
from ..helpers_collections import set_active_collection
from bpy.props import (EnumProperty)
from ..blenvy_manager import BlenvyManager
""" This file contains quality of life operators/menus/shortcuts to make working with blueprints more pleasant
@ -16,79 +14,127 @@ from ..blenvy_manager import BlenvyManager
- or alternative: sub menu to choose instance creation or not
- [x] save & restore blenvy mode
- [x] add a contextual shortcut to easilly jump in/out of editing mode
- [ ] if editing is already in progress close it first
- [ ] do this for the wrapper
- [x] if editing is already in progress close it first
- [x] do this for the wrapper
- [x] do this for the shortcut
- [ ] move the "close first" logic to inside create & edit operators
- [x] move the "close first" logic to inside create & edit operators
- [ ] also allow triggering editing from library scene with collection selected
=> requires checking if collection is a blueprint's collection
- [x] do not go in create mode if there is an object (not a collection !) selected
- [ ] save & reset camera
- [x] save & reset camera
"""
def edit_or_create_blueprint_menu(self, context):
if bpy.context.active_object and bpy.context.active_object.instance_collection:
self.layout.operator(BLENVY_OT_ui_blueprint_edit_start.bl_idname)
blenvy = context.window_manager.blenvy # type: BlenvyManager
selected_objects = context.selected_objects
selected_object = selected_objects[0] if len(selected_objects) > 0 else None
text = "Start editing Blueprint"
if selected_object is not None and selected_object.instance_collection:
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
text = "Exit editing previous Blueprint and start editing Blueprint"
else:
text = "Start editing Blueprint"
self.layout.operator(BLENVY_OT_ui_blueprint_create_or_edit.bl_idname, text=text)
else:
blenvy = context.window_manager.blenvy # type: BlenvyManager
prev_scene = bpy.data.scenes.get(blenvy.edit_blueprint_previous_scene)
if prev_scene is not None:
self.layout.operator(BLENVY_OT_ui_blueprint_edit_end.bl_idname)
text = "Exit editing Blueprint"
self.layout.operator(BLENVY_OT_ui_blueprint_create_or_edit.bl_idname, text=text)
else:
self.layout.operator(BLENVY_OT_ui_blueprint_create.bl_idname)
if len(selected_objects) == 0: # do not go into creation mode if any object was selected
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
text = "Exit editing previous Blueprint and start editing new Blueprint"
else:
text = "Create & start editing Blueprint"
self.layout.operator(BLENVY_OT_ui_blueprint_create_or_edit.bl_idname, text=text)
# for camera save & reset
def find_area():
try:
for a in bpy.data.window_managers[0].windows[0].screen.areas:
if a.type == "VIEW_3D":
return a
return None
except:
return None
def find_viewport_camera():
def find_area():
try:
for a in bpy.data.window_managers[0].windows[0].screen.areas:
if a.type == "VIEW_3D":
return a
return None
except:
return None
area = find_area()
if area is None:
print("area not find")
return None
else:
# print(dir(area))
r3d = area.spaces[0].region_3d
view_mat = r3d.view_matrix
print("view matrix: ", view_mat)
region_3D = area.spaces[0].region_3d
view_mat = region_3D.view_matrix
loc, rot, sca = view_mat.decompose()
print("location xyz: ", loc)
"""print("location xyz: ", loc)
print("rotation wxyz: ", rot)
print("scale xyz: ", sca)
print("")
print("view_distance: ", r3d.view_distance)
print("view_location: ", r3d.view_location)
print("view_rotation: ", r3d.view_rotation)
print("view_camera_zoom: ", r3d.view_camera_zoom)
print("view_distance: ", r3d.view_distance)
print("view_camera_offset: ", r3d.view_camera_offset)
print("view_distance: ", region_3D.view_distance)
print("view_location: ", region_3D.view_location)
print("view_rotation: ", region_3D.view_rotation)
print("view_camera_zoom: ", region_3D.view_camera_zoom)
print("view_camera_offset: ", region_3D.view_camera_offset)"""
return (region_3D.view_distance, region_3D.view_location)
def set_viewport_camera(view_distance, view_location):
area = find_area()
if area is None or view_distance == 0.0:
return None
else:
region_3D = area.spaces[0].region_3d
region_3D.view_distance = view_distance
region_3D.view_location = view_location
class BLENVY_OT_ui_blueprint_create_or_edit(bpy.types.Operator):
"""Create Blueprint in a new Scene"""
"""Create/Edit start/stop Blueprint in a new Scene"""
bl_idname = "window_manager.blenvy_blueprint_shortcut"
bl_label = "Edit Blueprint"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def description(cls, context, properties):
blenvy = context.window_manager.blenvy # type: BlenvyManager
selected_objects = context.selected_objects
selected_object = selected_objects[0] if len(selected_objects) > 0 else None
if selected_object is not None and selected_object.instance_collection:
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
return "End editing Blueprint"
else:
return "Start editing Blueprint in a new temporary scene"
else:
prev_scene = bpy.data.scenes.get(blenvy.edit_blueprint_previous_scene)
if prev_scene is not None:
return "End editing Blueprint"
else:
if len(selected_objects) == 0: # do not go into creation mode if any object was selected
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
return "End editing Blueprint"
else:
return "Create and start editing Blueprint in a new Scene"
return "Create/Edit start/stop Blueprint in a new Scene"
def execute(self, context):
blenvy = context.window_manager.blenvy # type: BlenvyManager
if bpy.context.active_object and bpy.context.active_object.instance_collection:
selected_objects = context.selected_objects
selected_object = selected_objects[0] if len(selected_objects) > 0 else None
if selected_object is not None and selected_object.instance_collection:
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
bpy.ops.window_manager.blenvy_exit_edit_blueprint()
bpy.ops.window_manager.blenvy_blueprint_edit_start()
else:
blenvy = context.window_manager.blenvy # type: BlenvyManager
prev_scene = bpy.data.scenes.get(blenvy.edit_blueprint_previous_scene)
if prev_scene is not None:
bpy.ops.window_manager.blenvy_exit_edit_blueprint()
else:
if len(context.selected_objects) == 0: # do not go into creation mode if any object was selected
if len(selected_objects) == 0: # do not go into creation mode if any object was selected
if blenvy.edit_blueprint_current_scene != "": # if there is already editing in progress, close it first
bpy.ops.window_manager.blenvy_exit_edit_blueprint()
bpy.ops.window_manager.blenvy_create_blueprint()
@ -118,13 +164,12 @@ class BLENVY_OT_ui_blueprint_create(bpy.types.Operator):
if len(blenvy.library_scenes_names) > 0:
library_scene_name = blenvy.library_scenes_names[0]
else:
bpy.data.scenes.new(library_scene_name)
scene = bpy.data.scenes.new(library_scene_name)
scene.blenvy_scene_type = "Library"
# automatically add it to the library : find library scene, if any, if not, create it
bpy.data.scenes[library_scene_name].collection.children.link(collection)
# create an instance of the blueprint ONLY the current scene we are in is a level scene
if context.scene.blenvy_scene_type == 'Level':
source_collection = collection
@ -143,6 +188,7 @@ class BLENVY_OT_ui_blueprint_create(bpy.types.Operator):
new_scene = bpy.context.scene
new_scene.name = scene_name
bpy.context.window.scene = new_scene
new_scene.blenvy_scene_type = 'None'
new_scene.collection.children.link(collection)
@ -187,58 +233,20 @@ class BLENVY_OT_ui_blueprint_edit_start(bpy.types.Operator):
new_scene.name = scene_name
bpy.context.window.scene = new_scene
new_scene.collection.children.link(collection)
new_scene.blenvy_scene_type = 'None'
# flag the current temporary scene as an active edit
blenvy.edit_blueprint_current_scene = scene_name
# Assuming you want to focus on the objects from the linked collection
# Switch to the new scene context
"""blenvy.edit_collection_world_texture = "checker"
if blenvy.edit_collection_world_texture != "none":
world = bpy.data.worlds.new(bpy.context.scene.name)
new_scene.world = world
world.use_nodes = True
tree = world.node_tree
if blenvy.edit_collection_world_texture in ["checker", "checker_view"]:
checker_texture = tree.nodes.new("ShaderNodeTexChecker")
checker_texture.inputs["Scale"].default_value = 20
checker_texture.location = Vector((-250, 0))
if blenvy.edit_collection_world_texture == "checker_view":
coord = tree.nodes.new("ShaderNodeTexCoord")
coord.location = Vector((-500, 0))
for op in coord.outputs:
op.hide = True
tree.links.new(coord.outputs["Window"], checker_texture.inputs["Vector"])
tree.links.new(checker_texture.outputs["Color"], tree.nodes["Background"].inputs["Color"])
elif blenvy.edit_collection_world_texture == "gray":
tree.nodes["Background"].inputs["Color"].default_value = (.3, .3, .3, 1)"""
# deselect all objects then select the first object in new scene
bpy.ops.object.select_all(action='DESELECT')
# find the root object
if len(collection.objects) > 0 :
root_obj = collection.objects[0]
while root_obj.parent:
root_obj = root_obj.parent
# select object and children
new_scene.objects[root_obj.name].select_set(True)
# def select_children(parent):
# for child in parent.children:
# child.select_set(True)
# select_children(child) # Recursively select further descendants
# select_children(root_obj);
# Select the view layer and view the selected objects
bpy.context.view_layer.objects.active = new_scene.objects[root_obj.name]
bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[collection.name]
# zoom to selected
bpy.ops.view3d.view_selected()
# backup view distance
view_distance, view_location = find_viewport_camera()
if view_distance is not None:
blenvy.edit_blueprint_previous_view_distance = view_distance
blenvy.edit_blueprint_previous_view_position = view_location
# focus on objects in the temp scene
bpy.ops.view3d.view_all()
# now that the 3d view has been adapted, we select what we actually need: the collection/blueprint
bpy.ops.blenvy.select_item(target_name=collection.name, item_type="COLLECTION", override_scene_name=scene_name)
@ -260,10 +268,10 @@ class BLENVY_OT_ui_blueprint_edit_end(bpy.types.Operator):
# we are done editing the blueprint, reset settings to the way they were before
blenvy.edit_blueprint_previous_scene = ""
blenvy.mode = blenvy.edit_blueprint_previous_mode
set_viewport_camera(blenvy.edit_blueprint_previous_view_distance, blenvy.edit_blueprint_previous_view_position)
if prev_scene is None:
print("No scene to return to")
self.report({"WARNING"}, "No scene to return to")
return {'CANCELLED'}
if blenvy.edit_blueprint_current_scene != "":
active_edit_scene = bpy.data.scenes.get(blenvy.edit_blueprint_current_scene, None)
@ -278,17 +286,12 @@ class BLENVY_OT_ui_blueprint_edit_end(bpy.types.Operator):
bpy.context.window.scene = prev_scene
except:
bpy.context.window.scene = prev_scene
"""if current_scene.name.startswith("EDITING:"):
bpy.data.scenes.remove(bpy.context.scene)
bpy.context.window.scene = prev_scene"""
blenvy.edit_blueprint_current_scene = ""
blenvy.edit_blueprint_current_scene = ""
else:
blenvy.edit_blueprint_current_scene = ""
print("Not in temp scene")
self.report({"WARNING"}, "Not currently in Blueprint editing scene")
return {'CANCELLED'}
return {'FINISHED'}

View File

@ -183,3 +183,8 @@ def draw_common_settings_ui(layout, settings):
remove_operator.scene_type = 'LEVEL'
remove_operator.scene_name = scene.name
col.separator()
# reset settings
row = section.row()
row.label(text="Reset settings")
row.operator("bevy.config_reset")

View File

@ -25,6 +25,14 @@ def load_settings(name):
return None
return None
def clear_settings(name):
texts = bpy.data.texts
stored_settings = texts.get(name, None)
if stored_settings is not None:
stored_settings.clear()
texts.remove(texts[name], do_unlink=True)
# given the input (actual) settings, filters out any invalid/useless params & params that are equal to defaults
def generate_complete_settings_dict(settings, presets, ignore_list=[], preset_defaults=True):