Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ui.py « limbs « pitchipoy « rigs « rigify - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b086e666f72cee302b88f91556b14f0f78b091ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
script = """
controls = [%s]
tweaks   = [%s]
ik_ctrl  = '%s'
fk_ctrl  = '%s'
parent   = '%s'

# IK/FK Switch on all Control Bones
if is_selected( controls ):
    layout.prop( pose_bones[ parent ], '["%s"]', slider = True )

# BBone rubber hose on each Respective Tweak
for t in tweaks:
    if is_selected( t ):
        layout.prop( pose_bones[ t ], '["%s"]', slider = True )
        
# IK Stretch on IK Control bone
if is_selected( ik_ctrl ):
    layout.prop( pose_bones[ parent ], '["%s"]', slider = True )
    
# FK limb follow
if is_selected( fk_ctrl ):
    layout.prop( pose_bones[ parent ], '["%s"]', slider = True )
""" 

def create_script( bones, limb_type=None):      # limb_type arg is added for future fk/ik
                                                # switch to add in UI scripts
                                                # scripts are different between arms and
                                                # legs and paws

    # All ctrls have IK/FK switch
    controls =  [ bones['ik']['ctrl']['limb'] ] + bones['fk']['ctrl']
    controls += bones['ik']['ctrl']['terminal']

    controls_string = ", ".join(["'" + x + "'" for x in controls])

    # All tweaks have their own bbone prop
    tweaks        = bones['tweak']['ctrl'][1:-1]
    tweaks_string = ", ".join(["'" + x + "'" for x in tweaks])
    
    # IK ctrl has IK stretch 
    ik_ctrl = bones['ik']['ctrl']['terminal'][-1]

    return script % ( 
        controls_string, 
        tweaks_string, 
        ik_ctrl,
        bones['fk']['ctrl'][0],
        bones['parent'],
        'IK/FK',
        'rubber_tweak',
        'IK_Strertch',
        'FK_limb_follow'
    )