diff --git a/ballance_blender_plugin/__init__.py b/ballance_blender_plugin/__init__.py index f5de843..4f8ace2 100644 --- a/ballance_blender_plugin/__init__.py +++ b/ballance_blender_plugin/__init__.py @@ -103,7 +103,7 @@ def menu_func_ballance_add(self, context): layout.separator() layout.label(text="Ballance") layout.operator_menu_enum("ballance.add_elements", "elements_type", icon='MESH_ICOSPHERE', text="Elements") - layout.operator("ballance.add_rail", icon='MESH_CUBE', text="Rail section") + layout.operator("ballance.add_rail", icon='MESH_CIRCLE', text="Rail section") layout.menu(BALLANCE_MT_AddFloorMenu.bl_idname, icon='MESH_CUBE') def register(): diff --git a/ballance_blender_plugin/add_floor.py b/ballance_blender_plugin/add_floor.py index 3240b7f..fc3aa15 100644 --- a/ballance_blender_plugin/add_floor.py +++ b/ballance_blender_plugin/add_floor.py @@ -1,4 +1,5 @@ import bpy,mathutils +import os from . import utils, config class BALLANCE_OT_add_floor(bpy.types.Operator): @@ -16,18 +17,21 @@ class BALLANCE_OT_add_floor(bpy.types.Operator): expand_length_1 : bpy.props.IntProperty( name="D1 length", description="The length of expand direction 1", + min=0, default=0, ) expand_length_2 : bpy.props.IntProperty( name="D2 length", description="The length of expand direction 2", + min=0, default=0, ) height_multiplier : bpy.props.FloatProperty( name="Height", description="The multiplier for height. Default height is 5", + min=0.0, default=1.0, ) @@ -62,6 +66,10 @@ class BALLANCE_OT_add_floor(bpy.types.Operator): name="Bottom face" ) + @classmethod + def poll(self, context): + prefs = bpy.context.preferences.addons[__package__].preferences + return os.path.isdir(prefs.external_folder) def execute(self, context): return {'FINISHED'} @@ -75,10 +83,23 @@ class BALLANCE_OT_add_floor(bpy.types.Operator): col = layout.column() col.label(text="Basic param") col.prop(self, "floor_type") + col.prop(self, "rotation_inside_mesh") + col.prop(self, "height_multiplier") + + col.separator() + col.label(text="Expand") col.prop(self, "expand_length_1") col.prop(self, "expand_length_2") - col.prop(self, "height_multiplier") - col.prop(self, "rotation_inside_mesh") + grids = col.grid_flow(columns=3) + grids.separator() + grids.label(text="X") + grids.separator() + grids.label(text="X") + grids.template_icon(icon_value = config.blenderIcon_floor_dict[self.floor_type]) + grids.label(text="X") + grids.separator() + grids.label(text="X") + grids.separator() col.separator() col.label(text="Faces") @@ -88,17 +109,15 @@ class BALLANCE_OT_add_floor(bpy.types.Operator): col.separator() col.label(text="Sides") - row = col.row(align=True) - row.label(text="") - row.prop(self, "use_2d_top") - row.label(text="") - row = col.row(align=True) - row.prop(self, "use_2d_left") - row.template_icon(icon_value = config.blenderIcon_floor_dict[self.floor_type]) - row.prop(self, "use_2d_right") - row = col.row(align=True) - row.label(text="") - row.prop(self, "use_2d_bottom") - row.label(text="") + grids = col.grid_flow(columns=3) + grids.separator() + grids.prop(self, "use_2d_top") + grids.separator() + grids.prop(self, "use_2d_left") + grids.template_icon(icon_value = config.blenderIcon_floor_dict[self.floor_type]) + grids.prop(self, "use_2d_right") + grids.separator() + grids.prop(self, "use_2d_bottom") + grids.separator() diff --git a/ballance_blender_plugin/config.py b/ballance_blender_plugin/config.py index b5944d6..0ae54c8 100644 --- a/ballance_blender_plugin/config.py +++ b/ballance_blender_plugin/config.py @@ -118,7 +118,7 @@ component_list = [ floor_block_dict = {} floor_basic_block_list = [] floor_derived_block_list = [] -with open(os.path.join(os.path.dirname(__file__), "json", "VanillaBlock.json")) as fp: +with open(os.path.join(os.path.dirname(__file__), "json", "BasicBlock.json")) as fp: for item in json.load(fp): floor_basic_block_list.append(item["Type"]) floor_block_dict[item["Type"]] = item diff --git a/ballance_blender_plugin/json/VanillaBlock.json b/ballance_blender_plugin/json/BasicBlock.json similarity index 96% rename from ballance_blender_plugin/json/VanillaBlock.json rename to ballance_blender_plugin/json/BasicBlock.json index 90afcd1..4f42b57 100644 --- a/ballance_blender_plugin/json/VanillaBlock.json +++ b/ballance_blender_plugin/json/BasicBlock.json @@ -5,6 +5,14 @@ "UnitSize": "Small", "ExpandType": "Column", "InitColumnDirection": "PositiveX", + "DefaultSideConfig": { + "UseTwoDTop": false, + "UseTwoDRight": false, + "UseTwoDBottom": false, + "UseTwoDLeft": true, + "UseThreeDTop": true, + "UseThreeDBottom": false + }, "ThreeDTopFace": { "Vertices": [ "2.5,0,0;+d1;;", diff --git a/ballance_blender_plugin/preferences.py b/ballance_blender_plugin/preferences.py index 870557c..044ae2c 100644 --- a/ballance_blender_plugin/preferences.py +++ b/ballance_blender_plugin/preferences.py @@ -5,7 +5,7 @@ class BallanceBlenderPluginPreferences(bpy.types.AddonPreferences): external_folder: bpy.props.StringProperty( name="External texture folder", - description="The Ballance texture folder which will be used buy this plugin to get external texture.", + description="The Ballance texture folder which will be used by this plugin to get external texture.", ) no_component_collection: bpy.props.StringProperty(