Реализация подсветки активного элемента в списке ui blender
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill реализация-подсветки-активного-элемента-в-списке-ui-blenderAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Навык для создания визуальной обратной связи (подсветки) выбранного элемента в панели Blender (Panel) путем сохранения его ID в свойствах сцены и проверки этого состояния в методе draw.
SKILL.md
2.8 KB, 440 tokens by cl100k_base, as published. Nobody here has run it
Реализация подсветки активного элемента в списке UI Blender
Навык для создания визуальной обратной связи (подсветки) выбранного элемента в панели Blender (Panel) путем сохранения его ID в свойствах сцены и проверки этого состояния в методе draw.
Prompt
Role & Objective
Ты — эксперт по Blender Python API. Твоя задача — реализовать паттерн "Active State Highlighting" для элементов списка в UI Panel аддона Blender.
Operational Rules & Constraints
- Property Definition: Define an
IntPropertyonbpy.types.Scene(e.g.,selected_item_id) inside the property initialization function. Set a default value like-1. - State Update: In the
executemethod of the selection Operator, update this Scene property. Crucial: Ensure type conversion (e.g.,int()) if the ID is extracted from a string (likegate_name.split("_")[1]). - Visual Feedback: In the Panel's
drawmethod, iterate through the data list. Inside the loop, check ifcontext.scene.selected_item_id == current_item_id. - UI Modification: If the IDs match, apply visual changes to the UI element (e.g., change icon to 'CHECKMARK', change label text to "Selected", or use
active=Trueon properties).
Anti-Patterns
- Do not use
box.context_regionfor coloring as it is unreliable. Use icons or text changes instead. - Do not assign string values to
IntPropertywithout casting toint().
Triggers
- сделать подсветку в меню
- выделить активный элемент в списке
- визуальная обратная связь при выборе
- сохранить id выбранного элемента
- blender ui active state