Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@
],
"github-actions.workflows.pinned.workflows": [
".github/workflows/unit_test_addon.yml"
]
],
//Use this lines to remove annorying blender new api errors on vscode
// "python.analysis.diagnosticSeverityOverrides": {
// "reportInvalidTypeForm": "none",
// "reportIndexIssue": "none"
// }
}

// ActRec_pref (bpy.types.Preferences): preferences of this addon
Expand Down
62 changes: 21 additions & 41 deletions ActRec/Storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
"id": "c7a7a7d9164611ecb20d70c94ef23b30"
},
{
"id": "c7a7cecf164611ecbea570c94ef23b30"
"id": "c7a7f5bd164611ec8b7d70c94ef23b30"
},
{
"id": "c7a7ced2164611ec9dcf70c94ef23b30"
"id": "c7a7cecf164611ecbea570c94ef23b30"
},
{
"id": "c7a7f5bd164611ec8b7d70c94ef23b30"
"id": "c7a7ced2164611ec9dcf70c94ef23b30"
}
],
"areas": [
Expand Down Expand Up @@ -128,7 +128,7 @@
],
"actions": [
{
"icon": 3,
"icon": 47,
"icon_name": "CANCEL",
"id": "c7a1f271164611eca91770c94ef23b30",
"label": "Delete",
Expand Down Expand Up @@ -264,7 +264,7 @@
]
},
{
"icon": 289,
"icon": 334,
"icon_name": "MESH_UVSPHERE",
"id": "c7a73281164611eca36c70c94ef23b30",
"label": "AddCubeSphere",
Expand Down Expand Up @@ -333,7 +333,7 @@
]
},
{
"icon": 608,
"icon": 6,
"icon_name": "AUTOMERGE_ON",
"id": "c7a759ee164611ecb84c70c94ef23b30",
"label": "Merge",
Expand Down Expand Up @@ -362,10 +362,10 @@
]
},
{
"icon": 391,
"icon": 393,
"icon_name": "ALIGN_CENTER",
"id": "c7a780f7164611ecb42870c94ef23b30",
"label": "CheckerEdoge",
"label": "Checker Edge Loop",
"description": "Play this Action Button",
"macros": [
{
Expand All @@ -391,7 +391,7 @@
]
},
{
"icon": 462,
"icon": 445,
"icon_name": "MOD_CAST",
"id": "c7a7a7d9164611ecb20d70c94ef23b30",
"label": "Crease&Shap",
Expand Down Expand Up @@ -420,7 +420,7 @@
]
},
{
"icon": 288,
"icon": 325,
"icon_name": "MESH_CIRCLE",
"id": "c7a7cecf164611ecbea570c94ef23b30",
"label": "CreaseClear",
Expand Down Expand Up @@ -449,7 +449,7 @@
]
},
{
"icon": 201,
"icon": 212,
"icon_name": "GROUP_VERTEX",
"id": "c7a7ced2164611ec9dcf70c94ef23b30",
"label": "ResetShape",
Expand All @@ -468,7 +468,7 @@
]
},
{
"icon": 555,
"icon": 566,
"icon_name": "PIVOT_ACTIVE",
"id": "c7a7f5bd164611ec8b7d70c94ef23b30",
"label": "Origin To Select",
Expand Down Expand Up @@ -527,7 +527,7 @@
]
},
{
"icon": 307,
"icon": 337,
"icon_name": "META_CUBE",
"id": "c7a81cb8164611ecb9ca70c94ef23b30",
"label": "Seam&UV",
Expand Down Expand Up @@ -625,7 +625,7 @@
]
},
{
"icon": 132,
"icon": 161,
"icon_name": "UV_DATA",
"id": "c7a843b2164611ec929870c94ef23b30",
"label": "ClearSeam",
Expand Down Expand Up @@ -702,7 +702,7 @@
]
},
{
"icon": 166,
"icon": 198,
"icon_name": "TEXTURE_DATA",
"id": "c7a8918b164611ecb21d70c94ef23b30",
"label": "AlignLayout",
Expand Down Expand Up @@ -761,7 +761,7 @@
]
},
{
"icon": 287,
"icon": 327,
"icon_name": "MESH_CUBE",
"id": "c7a8b816164611ecab0970c94ef23b30",
"label": "AddCube",
Expand Down Expand Up @@ -859,7 +859,7 @@
]
},
{
"icon": 127,
"icon": 142,
"icon_name": "NODE_MATERIAL",
"id": "146b8a47986011ed86faa8a1598ce02d",
"label": "Subd Smooth",
Expand All @@ -869,36 +869,16 @@
"icon": 0,
"icon_name": "NONE",
"id": "c7a40355164611ecb9cd70c94ef23b30",
"label": "Shade Smooth",
"label": "Shade Smooth by Angle",
"command": "bpy.ops.object.shade_smooth()",
"active": true,
"ui_type": "",
"operator_execution_context": "EXEC_DEFAULT"
},
{
"icon": 0,
"icon_name": "NONE",
"id": "c7a42aa4164611ecba6570c94ef23b30",
"label": "Auto Smooth = True",
"command": "bpy.context.object.data.use_auto_smooth = True",
"active": true,
"ui_type": "",
"operator_execution_context": "EXEC_DEFAULT"
},
{
"icon": 0,
"icon_name": "NONE",
"id": "c7a6be1e164611ec8ede70c94ef23b30",
"label": "Auto Smooth Angle = 3.14159",
"command": "bpy.context.object.data.auto_smooth_angle = 3.14159",
"active": true,
"ui_type": "",
"operator_execution_context": "EXEC_DEFAULT"
}
]
},
{
"icon": 127,
"icon": 142,
"icon_name": "NODE_MATERIAL",
"id": "c7a40353164611ecbaad70c94ef23b30",
"label": "Subd Smooth",
Expand All @@ -919,7 +899,7 @@
"icon_name": "NONE",
"id": "35bf6e3e986011edb5cfa8a1598ce02d",
"label": "Shade Smooth",
"command": "bpy.ops.object.shade_smooth(use_auto_smooth=True)",
"command": "bpy.ops.object.shade_smooth()",
"active": true,
"ui_type": "VIEW_3D",
"operator_execution_context": "EXEC_DEFAULT"
Expand Down Expand Up @@ -947,7 +927,7 @@
]
},
{
"icon": 256,
"icon": 30,
"icon_name": "RESTRICT_SELECT_OFF",
"id": "4275b287986211edb4bca8a1598ce02d",
"label": "SelectCube",
Expand Down
22 changes: 6 additions & 16 deletions ActRec/actrec/functions/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,12 @@ def get_global_action_id(ActRec_pref: AR_preferences, id: str, index: int) -> Un
return None


def get_global_action_ids(ActRec_pref: AR_preferences, id: str, index: int) -> list:
"""
get global action is inside a list or selected global actions if not found

Args:
ActRec_pref (AR_preferences): preferences of this addon
id (str): id to check
index (int): index of action

Returns:
list: list with ids of actions
"""
id = get_global_action_id(ActRec_pref, id, index)
if id is None:
return ActRec_pref.get("global_actions.selected_ids", [])
return [id]
def get_global_action_ids(ActRec_pref, id, index):
# BLENDER 5.0 FIX: Convert the internal string back to a list for the operators
raw_ids = ActRec_pref.global_selected_ids_internal
if raw_ids:
return raw_ids.split(",")
return []


def add_empty_action_keymap(id: str, km: KeyMap) -> KeyMapItem:
Expand Down
6 changes: 6 additions & 0 deletions ActRec/actrec/functions/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ def property_to_python(property: Property, exclude: list = [], depth: int = 5) -
Union[list, dict, str]: converts Collection, Arrays to lists and PointerProperty to dict
"""
# CollectionProperty are a list of PointerProperties
if hasattr(property, "bl_rna") and property.bl_rna.identifier == "AR_preferences":
return "Preferences Object (Skipped to prevent loop)"

if depth <= 0:
return "max depth"

if depth <= 0:
return "max depth"
if isinstance(property, set): # Catch EnumProperty with EnumFlag
Expand Down
35 changes: 22 additions & 13 deletions ActRec/actrec/operators/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AR_OT_global_recategorize_action(shared.Id_based, Operator):
@classmethod
def poll(cls, context: Context) -> bool:
ActRec_pref = get_preferences(context)
return len(ActRec_pref.global_actions) and len(ActRec_pref.get("global_actions.selected_ids", []))
return len(ActRec_pref.global_actions) and bool(ActRec_pref.global_selected_ids_internal)

def invoke(self, context: Context, event: Event) -> set[str]:
return context.window_manager.invoke_props_dialog(self)
Expand Down Expand Up @@ -570,7 +570,7 @@ class AR_OT_global_to_local(shared.Id_based, Operator):
@ classmethod
def poll(cls, context: Context) -> bool:
ActRec_pref = get_preferences(context)
return len(ActRec_pref.global_actions) and len(ActRec_pref.get("global_actions.selected_ids", []))
return len(ActRec_pref.global_actions) and bool(ActRec_pref.global_selected_ids_internal)

def global_to_local(self, ActRec_pref: AR_preferences, action: AR_global_actions) -> None:
"""
Expand Down Expand Up @@ -615,14 +615,18 @@ class AR_OT_global_remove(shared.Id_based, Operator):
@classmethod
def description(cls, context: Context, properties: OperatorProperties) -> str:
ActRec_pref = get_preferences(context)
ids = ActRec_pref.get("global_actions.selected_ids", [])
selected_actions_str = ", ".join(ActRec_pref.global_actions[id].label for id in ids)
return "Remove the selected actions\nActions: %s" % (selected_actions_str)
# BLENDER 5.0 FIX: Convert string back to list for the tooltip
raw_ids = ActRec_pref.global_selected_ids_internal
ids = raw_ids.split(",") if raw_ids else []

selected_labels = [ActRec_pref.global_actions[id].label for id in ids if id in ActRec_pref.global_actions]
selected_actions_str = ", ".join(selected_labels)
return "Remove the selected actions\nActions: %s" % (selected_actions_str if selected_actions_str else "None")

@classmethod
def poll(cls, context: Context) -> bool:
ActRec_pref = get_preferences(context)
return len(ActRec_pref.global_actions) and len(ActRec_pref.get("global_actions.selected_ids", []))
return len(ActRec_pref.global_actions) and bool(ActRec_pref.global_selected_ids_internal)

def invoke(self, context: Context, event: Event) -> set[str]:
return context.window_manager.invoke_confirm(self, event)
Expand Down Expand Up @@ -651,7 +655,7 @@ class AR_OT_global_move_up(shared.Id_based, Operator):
@classmethod
def poll(cls, context: Context) -> bool:
ActRec_pref = get_preferences(context)
return len(ActRec_pref.global_actions) and len(ActRec_pref.get("global_actions.selected_ids", []))
return len(ActRec_pref.global_actions) and bool(ActRec_pref.global_selected_ids_internal)

def execute(self, context: Context) -> set[str]:
ActRec_pref = get_preferences(context)
Expand All @@ -677,7 +681,7 @@ class AR_OT_global_move_down(shared.Id_based, Operator):
@classmethod
def poll(cls, context: Context) -> bool:
ActRec_pref = get_preferences(context)
return len(ActRec_pref.global_actions) and len(ActRec_pref.get("global_actions.selected_ids", []))
return len(ActRec_pref.global_actions) and bool(ActRec_pref.global_selected_ids_internal)

def execute(self, context: Context) -> set[str]:
ActRec_pref = get_preferences(context)
Expand All @@ -702,11 +706,16 @@ class AR_OT_global_execute_action(shared.Id_based, Operator):
bl_options = {'UNDO', 'INTERNAL'}

@classmethod
def description(cls, context: Context, properties: OperatorProperties):
ActRec_pref = functions.get_preferences(context)
id = functions.get_global_action_id(ActRec_pref, properties.id, properties.index)
action = ActRec_pref.global_actions[id]
return action.description
def description(cls, context, properties):
ActRec_pref = get_preferences(context)
# BLENDER 5.0 FIX: Get list from the internal string property
raw_ids = ActRec_pref.global_selected_ids_internal
ids = raw_ids.split(",") if raw_ids else []

if len(ids) > 1:
return f"Selected Actions: {len(ids)}"
# ... rest of the existing description logic (e.g. return self.bl_description)
return cls.bl_description

def execute(self, context: Context) -> set[str]:
ActRec_pref = get_preferences(context)
Expand Down
Loading
Loading