From e14729500c9d7eabf410f329dc1970e19711ad5f Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 25 Aug 2025 13:24:15 +0800 Subject: [PATCH] fix: fix rail adders poll issue - add Ballance Texture requirement for all rail adders because they need it. --- bbp_ng/OP_ADDS_rail.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/bbp_ng/OP_ADDS_rail.py b/bbp_ng/OP_ADDS_rail.py index c8a7db0..f097353 100644 --- a/bbp_ng/OP_ADDS_rail.py +++ b/bbp_ng/OP_ADDS_rail.py @@ -1,6 +1,6 @@ import bpy, mathutils, math import typing -from . import UTIL_rail_creator +from . import UTIL_rail_creator, PROP_preferences ## Const Value Hint: # Default Rail Radius: 0.35 (in measure) @@ -233,6 +233,10 @@ class BBP_OT_add_rail_section(SharedRailSectionInputProperty, bpy.types.Operator bl_options = {'REGISTER', 'UNDO'} bl_translation_context = 'BBP_OT_add_rail_section' + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_rail_section( @@ -254,6 +258,10 @@ class BBP_OT_add_transition_section(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} bl_translation_context = 'BBP_OT_add_transition_section' + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_transition_section(bm, c_DefaultRailRadius, c_DefaultRailSpan), @@ -272,6 +280,10 @@ class BBP_OT_add_straight_rail(SharedExtraTransform, SharedRailSectionInputPrope bl_options = {'REGISTER', 'UNDO'} bl_translation_context = 'BBP_OT_add_straight_rail' + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_straight_rail( @@ -301,6 +313,10 @@ class BBP_OT_add_transition_rail(SharedExtraTransform, SharedRailCapInputPropert bl_options = {'REGISTER', 'UNDO'} bl_translation_context = 'BBP_OT_add_transition_rail' + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_transition_rail( @@ -340,6 +356,10 @@ class BBP_OT_add_side_rail(SharedExtraTransform, SharedRailCapInputProperty, Sha translation_context = 'BBP_OT_add_side_rail/property' ) # type: ignore + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_straight_rail( @@ -379,6 +399,10 @@ class BBP_OT_add_arc_rail(SharedExtraTransform, SharedRailSectionInputProperty, translation_context = 'BBP_OT_add_arc_rail/property' ) # type: ignore + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_screw_rail( @@ -430,6 +454,10 @@ class BBP_OT_add_spiral_rail(SharedExtraTransform, SharedRailCapInputProperty, S translation_context = 'BBP_OT_add_spiral_rail/property' ) # type: ignore + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_screw_rail( @@ -474,6 +502,10 @@ class BBP_OT_add_side_spiral_rail(SharedExtraTransform, SharedRailSectionInputPr translation_context = 'BBP_OT_add_side_spiral_rail/property' ) # type: ignore + @classmethod + def poll(cls, context): + return PROP_preferences.get_raw_preferences().has_valid_blc_tex_folder() + def execute(self, context): UTIL_rail_creator.rail_creator_wrapper( lambda bm: UTIL_rail_creator.create_screw_rail(