forked from bartvdbraak/blender
Fix T46220: Add torus has no 'layers' option
Add layers property for all operators using AddObjectHelper
This commit is contained in:
parent
982a06ac22
commit
c34993160d
@ -33,6 +33,7 @@ import bpy
|
|||||||
|
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
BoolProperty,
|
BoolProperty,
|
||||||
|
BoolVectorProperty,
|
||||||
FloatVectorProperty,
|
FloatVectorProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -136,16 +137,22 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name=
|
|||||||
if context.space_data and context.space_data.type == 'VIEW_3D':
|
if context.space_data and context.space_data.type == 'VIEW_3D':
|
||||||
v3d = context.space_data
|
v3d = context.space_data
|
||||||
|
|
||||||
if use_active_layer:
|
if operator is not None and any(operator.layers):
|
||||||
if v3d and v3d.local_view:
|
base.layers = operator.layers
|
||||||
base.layers_from_view(context.space_data)
|
|
||||||
base.layers[scene.active_layer] = True
|
|
||||||
else:
|
|
||||||
base.layers = [True if i == scene.active_layer
|
|
||||||
else False for i in range(len(scene.layers))]
|
|
||||||
else:
|
else:
|
||||||
if v3d:
|
if use_active_layer:
|
||||||
base.layers_from_view(context.space_data)
|
if v3d and v3d.local_view:
|
||||||
|
base.layers_from_view(context.space_data)
|
||||||
|
base.layers[scene.active_layer] = True
|
||||||
|
else:
|
||||||
|
base.layers = [True if i == scene.active_layer
|
||||||
|
else False for i in range(len(scene.layers))]
|
||||||
|
else:
|
||||||
|
if v3d:
|
||||||
|
base.layers_from_view(context.space_data)
|
||||||
|
|
||||||
|
if operator is not None:
|
||||||
|
operator.layers = base.layers
|
||||||
|
|
||||||
obj_new.matrix_world = add_object_align_init(context, operator)
|
obj_new.matrix_world = add_object_align_init(context, operator)
|
||||||
|
|
||||||
@ -209,6 +216,12 @@ class AddObjectHelper:
|
|||||||
name="Rotation",
|
name="Rotation",
|
||||||
subtype='EULER',
|
subtype='EULER',
|
||||||
)
|
)
|
||||||
|
layers = BoolVectorProperty(
|
||||||
|
name="Layers",
|
||||||
|
size=20,
|
||||||
|
subtype='LAYER',
|
||||||
|
options={'HIDDEN', 'SKIP_SAVE'},
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(self, context):
|
def poll(self, context):
|
||||||
|
Loading…
Reference in New Issue
Block a user