[feat] add 2 new features

- add tunnel section creation and re-organise rail creation menu.
- allow duplicated elements (Nong xxx) creation for some special, such as Fan and Extra Point.
This commit is contained in:
2023-01-09 11:10:13 +08:00
parent 2a87e98904
commit e7376a3e9c
5 changed files with 136 additions and 40 deletions

View File

@ -15,14 +15,27 @@ class BALLANCE_OT_add_components(bpy.types.Operator):
items=tuple(map(lambda x: (x, x, ""), UTILS_constants.bmfile_componentList)),
)
attentionElements = ["PC_TwoFlames", "PR_Resetpoint"]
uniqueElements = ["PS_FourFlames", "PE_Balloon"]
attentionElements = ("PC_TwoFlames", "PR_Resetpoint")
uniqueElements = ("PS_FourFlames", "PE_Balloon")
canDuplicatedElements = ('P_Extra_Point', 'P_Modul_18', 'P_Modul_26')
elements_sector: bpy.props.IntProperty(
name="Sector",
description="Define which sector the object will be grouped in",
min=1,
max=8,
min=1, max=8,
default=1,
)
elements_duplicated: bpy.props.BoolProperty(
name="Duplicated",
description="Whether duplicate elements (Nong xxx / 脓xxx)",
default=False,
)
elements_dup_times: bpy.props.IntProperty(
name="Duplication Times",
description="How many this element should be duplicated.",
min=1, max=64,
soft_min=1, soft_max=32,
default=1,
)
@ -41,6 +54,13 @@ class BALLANCE_OT_add_components(bpy.types.Operator):
obj = bpy.data.objects.new(finalObjectName, loadedMesh)
UTILS_functions.add_into_scene_and_move_to_cursor(obj)
# extra duplication
if self.elements_type in self.canDuplicatedElements:
for i in range(self.elements_dup_times - 1):
obj = bpy.data.objects.new(finalObjectName, loadedMesh)
UTILS_functions.add_into_scene_and_move_to_cursor(obj)
return {'FINISHED'}
def invoke(self, context, event):
@ -49,8 +69,18 @@ class BALLANCE_OT_add_components(bpy.types.Operator):
def draw(self, context):
layout = self.layout
# attension notice
if self.elements_type in self.attentionElements:
layout.label(text="Please note that sector is suffix.")
if self.elements_type in self.canDuplicatedElements:
layout.label(text="This element can use duplication feature.")
# cfg
layout.prop(self, "elements_type")
if self.elements_type not in self.uniqueElements:
layout.prop(self, "elements_sector")
if self.elements_type in self.attentionElements:
layout.label(text="Please note that sector is suffix.")
if self.elements_type in self.canDuplicatedElements:
layout.separator()
layout.prop(self, "elements_duplicated")
layout.prop(self, "elements_dup_times")