Blender_bevy_components_wor.../tools/blenvy/blueprints/operators.py
kaosat.dev ec95ab5541 feat(Blenvy): a ton of minor & bigger improvements
* fixes & experiment to auto export
 * added support for "always export" functionality for blueprints & levels
 * fixed issues with asset management
 * fixed issues with tracker
 * more ui improvements (display of the number of assets etc)
 * a lot more minor tweaks
2024-06-05 17:09:03 +02:00

39 lines
1.5 KiB
Python

import os
import bpy
from bpy_types import (Operator)
from bpy.props import (StringProperty)
from blenvy.core.helpers_collections import set_active_collection
class OT_select_blueprint(Operator):
"""Select blueprint """
bl_idname = "blueprint.select"
bl_label = "Select blueprint"
bl_options = {"UNDO"}
blueprint_collection_name: StringProperty(
name="blueprint collection name",
description="blueprints to select's collection name ",
) # type: ignore
blueprint_scene_name: StringProperty(
name="blueprint scene name",
description="blueprints to select's collection name ",
) # type: ignore
def execute(self, context):
if self.blueprint_collection_name:
collection = bpy.data.collections[self.blueprint_collection_name]
scene = bpy.data.scenes[self.blueprint_scene_name]
if scene:
bpy.ops.object.select_all(action='DESELECT')
bpy.context.window.scene = scene
bpy.context.view_layer.objects.active = None
set_active_collection(scene, self.blueprint_collection_name)
#bpy.context.view_layer.active_layer_collection = bpy.context.view_layer.layer_collection.children[self.blueprint_collection_name]
#bpy.context.view_layer.collections.active = collection
# bpy.context.view_layer.active_layer_collection = collection
"""for o in collection.objects:
o.select_set(True)"""
return {'FINISHED'}