mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-24 00:24:11 +00:00
b8a7eba71d
* improvements to assets ui * assets ui now specific to per level data, not based on selection anymore * blueprints ui now presents assets per blueprint * a lot of tweaks & improvements in the areas above
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
import os
|
|
import bpy
|
|
from bpy_types import (Operator)
|
|
from bpy.props import (StringProperty)
|
|
|
|
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
|
|
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'}
|
|
|