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
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "自己动动画",
"version": "2.0.0",
"description": "骨骼链程序化次级动画工具(自己动)\n\n用于创建尾巴、头发、触手等骨骼链的自动动画效果。\n\n功能特点:\n- 一键创建控制器、层级和表达式\n- 正弦波表达式驱动动画\n- Spline权重曲线控制振幅分布\n- 4层层级系统(Wave/Master/Copy定位器)\n- 支持X/Y/Z轴动画\n\n使用方法:\n1. 创建骨骼链(建议3-10根)\n2. 选择所有骨骼\n3. 点击^O^按钮一键生成动画",
"author": "Auto Animation Tool Team",
"optimizer": "Bullet.S",
"modified_date": "",
"keywords": [
"动画",
"次级动画",
"骨骼链",
"尾巴",
"头发",
"触手",
"程序化",
"正弦波",
"自己动",
"表达式"
],
"preview": "",
"script": "BulletScripts/Quote/final_auto_animator/autoAnim_main.ms",
"url": "",
"tutorial": ""
}

27 changes: 26 additions & 1 deletion _BsKeyTools/Scripts/BsScriptHub/scripts_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,31 @@
"tutorial": "",
"category": "04_动画工具"
},
{
"name": "自己动动画",
"version": "2.0.0",
"description": "骨骼链程序化次级动画工具(自己动)\n\n用于创建尾巴、头发、触手等骨骼链的自动动画效果。\n\n功能特点:\n- 一键创建控制器、层级和表达式\n- 正弦波表达式驱动动画\n- Spline权重曲线控制振幅分布\n- 4层层级系统(Wave/Master/Copy定位器)\n- 支持X/Y/Z轴动画\n\n使用方法:\n1. 创建骨骼链(建议3-10根)\n2. 选择所有骨骼\n3. 点击^O^按钮一键生成动画",
"author": "Auto Animation Tool Team",
"optimizer": "Bullet.S",
"modified_date": "",
"keywords": [
"动画",
"次级动画",
"骨骼链",
"尾巴",
"头发",
"触手",
"程序化",
"正弦波",
"自己动",
"表达式"
],
"preview": "",
"script": "BulletScripts/Quote/final_auto_animator/autoAnim_main.ms",
"url": "",
"tutorial": "",
"category": "04_动画工具"
},
{
"name": "补间动画工具",
"version": "1.0",
Expand All @@ -329,7 +354,7 @@
"description": "可视化编辑运动轨迹,支持轨迹修改和平滑",
"author": "未知",
"optimizer": "Bullet.S",
"modified_date": "2026-01-17",
"modified_date": "2026-02-10",
"keywords": [
"动画",
"轨迹",
Expand Down
6 changes: 5 additions & 1 deletion _BsKeyTools/Scripts/BulletScripts/BsScriptHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,11 @@ def _open_help(self):
def _show_about(self):
"""显示关于对话框"""
dialog = AboutDialog(self, VERSION, self.current_branch)
dialog.exec_() if hasattr(dialog, 'exec_') else dialog.exec()
# Python 2.7: exec is a keyword, use exec_() or getattr
if hasattr(dialog, 'exec_'):
dialog.exec_()
else:
getattr(dialog, 'exec')()

def _toggle_branch(self):
"""切换分支"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
-- ============================================================================
-- Auto Animation Tool 2.0 - Main Entry Point
-- ============================================================================
-- This is the main entry point for the Auto Animation Tool.
-- It loads all required modules in the correct order and initializes the system.
--
-- Usage:
-- fileIn "D:/UGit/allTogether/aa_self_free/final_auto_animator/autoAnim_main.ms"
--
-- Version: 2.0.0
-- Author: Auto Animation Tool Team
-- ============================================================================

-- # region Version Info

global AA_VERSION = "2.0.0"
global AA_BUILD_DATE = "2026-02-13"

format "\n"
format "========================================\n"
format " Auto Animation Tool v%\n" AA_VERSION
format " Build Date: %\n" AA_BUILD_DATE
format "========================================\n"
format "\n"

-- # endregion

-- # region Get Script Directory

-- Get the directory where this script is located
-- This allows us to load modules using relative paths
scriptPath = getSourceFileName()
scriptDir = getFilenamePath scriptPath

format "[INFO] Script directory: %\n" scriptDir

-- # endregion

-- # region Load Modules

format "[INFO] Loading modules...\n"

-- Load constants first (no dependencies)
fileIn (scriptDir + "core\\constants.ms")

-- Load utility modules (depend on constants)
fileIn (scriptDir + "utils\\naming.ms")
fileIn (scriptDir + "utils\\validation.ms")
fileIn (scriptDir + "utils\\startup_installer.ms") -- Startup script auto-installer

-- Load core modules (depend on constants and utils)
fileIn (scriptDir + "core\\spline_curve_widget.ms") -- Spline weight curve creation
fileIn (scriptDir + "core\\spline_curve_sampler.ms") -- Spline X-coordinate sampling
fileIn (scriptDir + "core\\expression_builder.ms")
fileIn (scriptDir + "core\\hierarchy_manager.ms")
fileIn (scriptDir + "core\\curve_editor.ms")
fileIn (scriptDir + "core\\custom_attributes.ms")
fileIn (scriptDir + "core\\tool_functions.ms")
fileIn (scriptDir + "core\\tool_window.ms") -- Tool window UI (original code preserved)

format "[INFO] All modules loaded successfully!\n"
format "\n"

-- # endregion

-- # region Module Status

format "========================================\n"
format "Module Status:\n"
format "========================================\n"
format " [OK] core/constants.ms\n"
format " [OK] utils/naming.ms\n"
format " [OK] utils/validation.ms\n"
format " [OK] utils/startup_installer.ms\n"
format " [OK] core/spline_curve_widget.ms\n"
format " [OK] core/spline_curve_sampler.ms\n"
format " [OK] core/expression_builder.ms\n"
format " [OK] core/hierarchy_manager.ms\n"
format " [OK] core/curve_editor.ms\n"
format " [OK] core/custom_attributes.ms\n"
format " [OK] core/tool_functions.ms\n"
format " [OK] core/tool_window.ms\n"
format "========================================\n"
format "\n"

-- # endregion

-- # region Quick Test

format "[INFO] Running quick module test...\n"
format "\n"

-- Test constants
format "[TEST] Constants:\n"
format " AA_TWO_PI = %\n" AA_TWO_PI
format " AA_TIME_SCALE = %\n" AA_TIME_SCALE
format "\n"

-- Test naming utilities
format "[TEST] Naming utilities:\n"
testName = AA_GenerateUniqueName "TestObject" "_Locator"
format " Generated name: %\n" testName
format "\n"

-- Test validation
format "[TEST] Validation:\n"
testBones = selection as array
if testBones.count > 0 then (
isValid = AA_ValidateBoneChain testBones
format " Bone chain valid: %\n" isValid

if isValid then (
percentages = AA_CalculateBonePercent testBones
format " Bone percentages: %\n" percentages
)
) else (
format " No bones selected for testing\n"
)
format "\n"

format "========================================\n"
format "Auto Animation Tool v% Ready!\n" AA_VERSION
format "========================================\n"
format "\n"

-- # endregion

-- # region Startup Script Installation

-- Ensure startup script is installed for scene reload support
AA_EnsureStartupInstalled scriptDir

-- # endregion

Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
-- ============================================================================
-- Auto Animation Tool - Constants Module
-- ============================================================================
-- This module defines all global constants used throughout the auto animation system.
-- These constants replace magic numbers to improve code readability and maintainability.
--
-- Version: 2.0.0
-- Author: Auto Animation Tool Team
-- ============================================================================

-- # region Mathematical Constants

-- TWO_PI: Full sine wave cycle (2 * PI = 6.28319)
-- Used in sine wave expression calculations for frequency conversion
global AA_TWO_PI = 6.28319

-- MAGIC_CONST: Bezier tangent calculation constant (0.25 * (1.0 - 0.25) = 0.1875)
-- Used in bezier curve tangent calculations for smooth interpolation
global AA_MAGIC_CONST = 0.1875

-- # endregion

-- # region Time and Frequency Constants

-- TIME_SCALE: Frame to frequency conversion factor (114.592)
-- This constant converts frame-based loop values to frequency values
-- Formula: frequency = TWO_PI / (loop / TIME_SCALE)
global AA_TIME_SCALE = 114.592

-- CURVE_TIME_OFFSET: Timeline offset for curve evaluation (-100000.0)
-- This large negative offset ensures curve evaluation doesn't conflict with actual timeline
-- Used when sampling bezier curves for amplitude modulation
global AA_CURVE_TIME_OFFSET = -100000.0

-- # endregion

-- # region Layer Names

-- Layer names for organizing autoAnim objects
global AA_LAYER_ROOT = "autoAnim"
global AA_LAYER_CONTROLLERS = "autoAnim_Controllers"
global AA_LAYER_CURVES = "autoAnim_WeightCurves"
global AA_LAYER_HELPERS = "autoAnim_Helpers"

-- # endregion

-- # region Grid Layout Settings

-- X offset for stacking X/Y/Z grids horizontally within same group
-- Should be >= grid width (100) plus some padding
global AA_GRID_STACK_OFFSET = 110.0

-- Grid spacing between different bone chain groups
-- Should accommodate 3 panels (X/Y/Z) per group: 3 * AA_GRID_STACK_OFFSET + padding
global AA_GRID_SPACING = 350.0

-- Maximum columns before wrapping to next row
global AA_GRID_COLUMNS = 3

-- Starting position for the first grid
global AA_GRID_START_POS = [0.0, 0.0, 0.0]

-- # endregion

-- # region Layer Management Functions

-- Get or create the root autoAnim layer
-- Returns the layer object
fn AA_GetOrCreateRootLayer = (
local layerObj = layerManager.getLayerFromName AA_LAYER_ROOT
if layerObj == undefined do (
layerObj = layerManager.newLayerFromName AA_LAYER_ROOT
)
return layerObj
)

-- Get or create a child layer under autoAnim root
-- Returns the layer object
fn AA_GetOrCreateChildLayer layerName = (
-- Ensure root layer exists first
local rootLayer = AA_GetOrCreateRootLayer()

local layerObj = layerManager.getLayerFromName layerName
if layerObj == undefined do (
layerObj = layerManager.newLayerFromName layerName
)
-- Set parent to root layer
layerObj.setParent rootLayer
return layerObj
)

-- Add node to the Controllers layer (child of autoAnim)
fn AA_AddToControllersLayer nodeObj = (
local layerObj = AA_GetOrCreateChildLayer AA_LAYER_CONTROLLERS
layerObj.addnode nodeObj
)

-- Add node to the Weight Curves layer (child of autoAnim)
fn AA_AddToCurvesLayer nodeObj = (
local layerObj = AA_GetOrCreateChildLayer AA_LAYER_CURVES
layerObj.addnode nodeObj
)

-- Add node to the Helpers layer (child of autoAnim)
fn AA_AddToHelpersLayer nodeObj = (
local layerObj = AA_GetOrCreateChildLayer AA_LAYER_HELPERS
layerObj.addnode nodeObj
)

-- # endregion

-- # region Module Info

format "========================================\n"
format "Auto Animation Tool - Constants Module\n"
format "Version: 3.1.0\n"
format "========================================\n"
format "Loaded constants:\n"
format " AA_TWO_PI = %\n" AA_TWO_PI
format " AA_MAGIC_CONST = %\n" AA_MAGIC_CONST
format " AA_TIME_SCALE = %\n" AA_TIME_SCALE
format " AA_CURVE_TIME_OFFSET = %\n" AA_CURVE_TIME_OFFSET
format "Layer names:\n"
format " AA_LAYER_CONTROLLERS = %\n" AA_LAYER_CONTROLLERS
format " AA_LAYER_CURVES = %\n" AA_LAYER_CURVES
format " AA_LAYER_HELPERS = %\n" AA_LAYER_HELPERS
format "Grid layout:\n"
format " AA_GRID_SPACING = %\n" AA_GRID_SPACING
format " AA_GRID_COLUMNS = %\n" AA_GRID_COLUMNS
format " AA_GRID_STACK_OFFSET = %\n" AA_GRID_STACK_OFFSET
format "========================================\n"

-- # endregion

Loading