import bpy, math, random
from mathutils import Vector
from math import radians, sin, cos
exec(bpy.data.texts['HelperCode'].as_string())
# ---------- CHARACTER: one fully modeled, posed space cowboy ----------
SU=M('Vac_suit_navy'); SH=M('Vac_suit_seams'); CO=M('Duster_brown_canvas'); COD=M('Duster_fold_shadow'); LE=M('Belt_and_holster_leather'); LED=M('Leather_edges'); POL=M('Hard_polymer'); PH=M('Polymer_highlights'); MT=M('Brushed_steel'); MD=M('Oxidized_steel'); BR=M('Aged_brass'); CY=M('Energy_cyan'); COP=M('Copper_conduit'); SK=M('Warm_skin'); SKL=M('Face_highlight'); HA=M('Hair_and_beard'); EW=M('Eye_white'); IR=M('Iris'); GL=M('Sealed_glove'); RED=M('Warning_red'); GLASS=M('Helmet_dome_glass')
# body anchors: right side pressed toward corner, weight on planted boot, other boot braced
pelvis=(.40,1.83,2.10)
uv('Cowboy_pelvis',pelvis,(.48,.31,.38),SU,rot=(0,radians(-7),radians(-2)),coll='CHARACTER')
uv('Cowboy_torso',(.56,1.83,2.73),(.52,.32,.89),SU,rot=(0,radians(-9),radians(-2)),coll='CHARACTER')
# segmented abdominal suit rings read as fitted vac-suit
for i,z in enumerate([2.52,2.68,2.84,3.00]): tor('Suit_abdomen_rib_%d'%i,(.57,1.82,z),.36,.025,SH,scale=(1.0,.68,1),coll='CHARACTER')
# chest-side shoulder caps
uv('Shoulder_L',(.20,1.82,3.37),(.24,.28,.26),SU,coll='CHARACTER');uv('Shoulder_R',(1.03,1.86,3.35),(.25,.28,.26),SU,coll='CHARACTER')
# neck pressure collar ring
cyl('Neck_skin',(.70,1.82,3.68),(.70,1.82,3.99),.16,SK,'CHARACTER',24,.012)
tor('Pressure_collar_ring',(.70,1.82,3.82),.245,.075,MD,scale=(1,.88,1),coll='CHARACTER');tor('Collar_blue_seal',(.70,1.82,3.86),.205,.025,CY,scale=(1,.88,1),coll='CHARACTER')
# legs, one firm and one lifted/braced into corner - visible stance
hipL=(.24,1.78,2.10); kneeL=(.06,1.51,1.18); ankleL=(-.02,1.34,.45)
hipR=(.66,1.86,2.08); kneeR=(.92,1.98,1.34); ankleR=(.74,1.78,.92)
cone('Left_trouser',hipL,kneeL,.23,.18,SU,'CHARACTER',28,.018);cone('Left_lower_suit',kneeL,ankleL,.17,.13,SU,'CHARACTER',28,.018);uv('Left_knee_pad',kneeL,(.20,.17,.14),PH,rot=(0,radians(15),0),coll='CHARACTER')
cone('Right_trouser',hipR,kneeR,.23,.18,SU,'CHARACTER',28,.018);cone('Right_lower_suit',kneeR,ankleR,.17,.13,SU,'CHARACTER',28,.018);uv('Right_knee_pad',kneeR,(.20,.17,.14),PH,rot=(0,radians(-20),0),coll='CHARACTER')
# magnetic boots and soles, physically meeting ground/wall
cube('Mag_boot_ground',(-.08,1.17,.28),(.62,.58,.46),POL,rot=(0,radians(-2),radians(-4)),bev=.12,coll='CHARACTER');cube('Ground_boot_toe_cap',(-.10,.91,.33),(.48,.22,.28),MD,rot=(0,radians(-2),radians(-4)),bev=.09,coll='CHARACTER');cube('Ground_boot_sole',(-.08,1.15,.075),(.68,.62,.12),MD,rot=(0,radians(-2),radians(-4)),bev=.035,coll='CHARACTER');cube('Ground_boot_mag_strip',(-.08,1.16,.02),(.42,.34,.035),CY,rot=(0,radians(-2),radians(-4)),bev=.01,coll='CHARACTER')
cube('Mag_boot_wall_braced',(.69,1.77,.87),(.62,.52,.46),POL,rot=(0,radians(3),radians(2)),bev=.12,coll='CHARACTER');cube('Braced_boot_toe_plate',(.97,1.77,.90),(.12,.44,.32),MD,rot=(0,radians(3),radians(2)),bev=.05,coll='CHARACTER');cube('Braced_boot_sole',(.69,1.77,.63),(.65,.55,.10),MD,rot=(0,radians(3),radians(2)),bev=.035,coll='CHARACTER')
for j,y in enumerate([1.62,1.80,1.98]):cyl('Wall_boot_magnet_%d'%j,(.995,y,.88),(.965,y,.88),.055,CY,'CHARACTER',20,.008)
# long canvas duster tails / yoke / lapels, layered from back to front
poly('Duster_left_tail',[(-.03,3.53),(.34,3.62),(.34,2.42),(.24,1.18),(-.12,1.08),(-.35,1.30),(-.27,2.52)],1.91,.18,CO,'CHARACTER',.035)
poly('Duster_right_tail',[(.38,3.61),(.87,3.49),(1.03,2.62),(.93,1.15),(.57,1.08),(.42,2.35)],1.88,.18,CO,'CHARACTER',.035)
poly('Duster_left_yoke',[(-.10,3.65),(.42,3.72),(.40,3.32),(.10,3.17),(-.22,3.30)],1.70,.16,CO,'CHARACTER',.035)
poly('Duster_right_yoke',[(.42,3.72),(.98,3.60),(1.16,3.32),(.78,3.18),(.40,3.32)],1.70,.16,CO,'CHARACTER',.035)
poly('Duster_left_lapel',[(.12,3.56),(.40,3.42),(.47,2.65),(.22,2.42),(.06,3.06)],1.52,.08,COD,'CHARACTER',.018)
poly('Duster_right_lapel',[(.42,3.43),(.76,3.53),(.88,3.06),(.69,2.55),(.47,2.65)],1.51,.08,COD,'CHARACTER',.018)
# sculpted seam lines and real fold strips
for i,pts in enumerate([[ (.02,1.49,3.25),(.06,1.47,2.65),(.02,1.48,1.35)],[(.27,1.43,3.10),(.22,1.42,2.52),(.18,1.44,1.25)],[(.73,1.43,3.13),(.78,1.42,2.45),(.73,1.43,1.25)],[(.93,1.57,3.22),(.95,1.57,2.48),(.86,1.58,1.34)]]):tube('Duster_fold_%d'%i,pts,.022,COD,'CHARACTER')
tube('Duster_left_hem',[(-.11,1.45,1.10),(.05,1.45,1.03),(.25,1.45,1.15)],.032,LED,'CHARACTER');tube('Duster_right_hem',[(.57,1.48,1.08),(.75,1.48,1.02),(.94,1.52,1.16)],.032,LED,'CHARACTER')
for i,z in enumerate([3.30,3.08,2.86,2.64]):uv('Duster_button_%d'%i,(.44,1.46,z),(.045,.025,.045),BR,coll='CHARACTER',seg=20,rings=12)
# arms posed: relaxed left, weapon-side right hovering above grip
shoulderL=(.20,1.80,3.38);elbowL=(-.04,1.48,2.83);wristL=(.12,1.31,2.52)
shoulderR=(1.04,1.84,3.37);elbowR=(1.24,1.56,2.88);wristR=(1.10,1.43,2.64)
cone('Left_duster_sleeve',shoulderL,elbowL,.22,.17,CO,'CHARACTER',28,.02);cone('Left_suit_forearm',elbowL,wristL,.16,.12,SU,'CHARACTER',28,.016)
cone('Right_duster_sleeve',shoulderR,elbowR,.22,.17,CO,'CHARACTER',28,.02);cone('Right_suit_forearm',elbowR,wristR,.16,.12,SU,'CHARACTER',28,.016)
tor('Left_sealed_cuff',wristL,.145,.04,MD,scale=(1,.75,1),coll='CHARACTER');tor('Right_sealed_cuff',wristR,.145,.04,MD,scale=(1,.75,1),coll='CHARACTER')
# individually articulated fingers / thumbs for both hands
def gloved_hand(prefix,center,wrist,mirror=1):
    center=Vector(center);wrist=Vector(wrist);uv(prefix+'_palm',center,(.16,.115,.17),GL,coll='CHARACTER');cyl(prefix+'_wrist_seal',wrist,center,.11,GL,'CHARACTER',24,.014)
    for i,off in enumerate([-.12,-.06,0,.06,.12]):
        rootp=center+Vector((off,-.055,.08));splay=mirror*(.025+abs(off)*.12);p2=rootp+Vector((splay,-.045,-.115-abs(off)*.03));p3=p2+Vector((splay*.55,-.035,-.105))
        cone(prefix+'_finger_%d_phalanxA'%i,rootp,p2,.041,.034,GL,'CHARACTER',16,.008);cone(prefix+'_finger_%d_phalanxB'%i,p2,p3,.036,.026,GL,'CHARACTER',16,.008);uv(prefix+'_finger_%d_knuckle'%i,p2,(.043,.038,.043),GL,coll='CHARACTER',seg=16,rings=10)
        if i in [1,2,3]:uv(prefix+'_finger_%d_plate'%i,p2+Vector((0,-.025,.01)),(.025,.012,.016),PH,coll='CHARACTER',seg=12,rings=8)
    tr=center+Vector((mirror*.13,-.02,.02));tm=tr+Vector((mirror*.13,-.08,-.08));te=tm+Vector((mirror*.055,-.04,-.10));cone(prefix+'_thumb_A',tr,tm,.045,.034,GL,'CHARACTER',16,.008);cone(prefix+'_thumb_B',tm,te,.036,.025,GL,'CHARACTER',16,.008);uv(prefix+'_thumb_joint',tm,(.045,.038,.045),GL,coll='CHARACTER',seg=16,rings=10)
gloved_hand('Relaxed_left_hand',(.12,1.30,2.46),wristL,-1);gloved_hand('Open_gun_hand',(1.10,1.40,2.48),wristR,1)
for name,p in [('Left',wristL),('Right',wristR)]:cube(name+'_cuff_indicator',(p[0],p[1]-.10,p[2]),(.09,.025,.045),CY,bev=.01,coll='CHARACTER')
# chest life support: plate, regulator, gauges, warning stripes
cube('Chest_life_support_plate',(.61,1.47,3.12),(.72,.13,.72),POL,rot=(0,radians(-8),0),bev=.08,coll='CHARACTER');cube('Chest_plate_inset',(.61,1.385,3.12),(.47,.035,.46),MD,rot=(0,radians(-8),0),bev=.035,coll='CHARACTER');cyl('Chest_regulator',(.61,1.31,3.13),(.61,1.22,3.13),.13,MT,'CHARACTER',32,.012);tor('Regulator_outer_ring',(.61,1.205,3.13),.13,.022,BR,rot=(radians(90),0,0),coll='CHARACTER');cyl('Regulator_glow',(.61,1.18,3.13),(.61,1.15,3.13),.068,CY,'CHARACTER',24,.006)
for i,(x,z) in enumerate([(.42,3.31),(.80,3.31),(.42,2.93),(.80,2.93)]):cyl('Life_support_gauge_%d'%i,(x,1.34,z),(x,1.27,z),.055,BR,'CHARACTER',20,.006);cyl('Gauge_face_%d'%i,(x,1.255,z),(x,1.23,z),.034,CY if i%2==0 else RED,'CHARACTER',16,.004)
for i in range(3):cube('Chest_warning_stripe_%d'%i,(.47+i*.09,1.23,2.78),(.055,.015,.12),RED,rot=(0,0,radians(-15)),bev=.008,coll='CHARACTER')
# backpack, tanks, fins, vents, hoses
cube('Backpack_main_unit',(.68,2.10,3.05),(.78,.34,1.12),POL,rot=(0,radians(-6),0),bev=.09,coll='CHARACTER');cube('Backpack_backplate',(.68,2.29,3.07),(.56,.08,.88),MD,rot=(0,radians(-6),0),bev=.04,coll='CHARACTER')
for i,x in enumerate([.42,.91]):cyl('Backpack_tank_%d'%i,(x,2.26,2.66),(x,2.26,3.53),.14,MD,'CHARACTER',24,.025);tor('Backpack_tank_ring_%d'%i,(x,2.26,3.13),.14,.018,BR,coll='CHARACTER')
cube('Backpack_left_fin',(.23,2.10,3.18),(.12,.22,.62),MT,rot=(0,radians(-8),0),bev=.03,coll='CHARACTER');cube('Backpack_right_fin',(1.13,2.10,3.18),(.12,.22,.62),MT,rot=(0,radians(-8),0),bev=.03,coll='CHARACTER')
for i,z in enumerate([2.78,3.03,3.28]):cube('Backpack_vent_%d'%i,(.68,1.91,z),(.30,.025,.045),CY if i==1 else MT,bev=.008,coll='CHARACTER')
tube('Life_support_hose_A',[(.72,1.37,3.24),(.92,1.50,3.52),(1.07,1.82,3.50),(.98,2.02,3.42)],.045,COP,'CHARACTER');tube('Life_support_hose_B',[(.48,1.38,3.02),(.36,1.58,3.38),(.35,1.98,3.32),(.42,2.12,3.18)],.038,MT,'CHARACTER');tube('Collar_hose',[(.82,1.75,3.83),(.98,1.88,3.92),(1.05,2.05,3.70)],.032,CY,'CHARACTER')
# belt front and loops / energy cells
tor('Wide_gun_belt',(.49,1.79,2.25),.48,.085,LE,scale=(1,.70,1),coll='CHARACTER');cube('Gun_belt_front',(.49,1.43,2.25),(.95,.13,.16),LE,rot=(0,radians(-7),0),bev=.04,coll='CHARACTER');cube('Gun_belt_buckle',(.49,1.34,2.26),(.27,.06,.27),BR,rot=(radians(90),0,0),bev=.025,coll='CHARACTER');cube('Buckle_inner',(.49,1.305,2.26),(.12,.025,.12),LE,rot=(radians(90),0,0),bev=.01,coll='CHARACTER')
for i,x in enumerate([.02,.18,.80,1.00]):tor('Belt_loop_%d'%i,(x,1.42,2.27),.065,.018,LED,scale=(1,.55,1),rot=(radians(90),0,0),coll='CHARACTER');cube('Power_cell_%d'%i,(x,1.33,2.42),(.10,.10,.28),POL,bev=.025,coll='CHARACTER');cube('Power_cell_glow_%d'%i,(x,1.27,2.46),(.045,.018,.15),CY,bev=.012,coll='CHARACTER')
# open holster / gun
poly('Open_leather_holster',[(.73,2.17),(1.24,2.13),(1.19,1.60),(.96,1.47),(.76,1.62)],1.28,.16,LE,'CHARACTER',.045);cube('Holster_inner_lining',(1.00,1.245,1.88),(.25,.025,.40),POL,rot=(0,radians(-10),0),bev=.025,coll='CHARACTER');cube('Holster_top_rim',(.99,1.20,2.13),(.52,.12,.10),LED,rot=(0,radians(-8),0),bev=.025,coll='CHARACTER');cube('Holster_leg_strap',(.96,1.25,1.57),(.45,.10,.10),LE,rot=(0,radians(-5),0),bev=.025,coll='CHARACTER')
cone('Energy_revolver_grip',(1.05,1.20,2.16),(1.13,1.20,1.78),.10,.075,POL,'CHARACTER',24,.018)
for i in range(3):tor('Revolver_grip_wrap_%d'%i,(1.07+i*.018,1.20,1.86+i*.10),.08,.012,LED,scale=(1,.8,1),rot=(0,radians(12),0),coll='CHARACTER')
cube('Energy_revolver_frame',(.91,1.20,2.17),(.38,.17,.20),MT,rot=(0,radians(-5),0),bev=.05,coll='CHARACTER');cyl('Revolver_energy_cylinder',(.80,1.10,2.17),(.80,1.28,2.17),.12,CY,'CHARACTER',32,.012);tor('Revolver_cylinder_rim',(.80,1.10,2.17),.12,.018,BR,rot=(radians(90),0,0),coll='CHARACTER');cyl('Revolver_emitter_barrel',(.72,1.20,2.19),(.30,1.20,2.24),.055,MD,'CHARACTER',24,.012);cyl('Revolver_emitter_glow',(.31,1.20,2.24),(.18,1.20,2.25),.038,CY,'CHARACTER',24,.008);tor('Revolver_muzzle_ring',(.18,1.20,2.25),.06,.018,BR,rot=(0,radians(90),0),coll='CHARACTER');cube('Revolver_hammer',(1.02,1.20,2.31),(.10,.13,.08),MD,rot=(0,0,radians(-12)),bev=.025,coll='CHARACTER');tor('Revolver_trigger_guard',(.99,1.10,2.06),.10,.018,MD,scale=(1,.75,1),rot=(radians(90),0,0),coll='CHARACTER')
# head and readable turned face
head=(.70,1.67,4.25);yaw=radians(-30);f=Vector((sin(yaw),-cos(yaw),0));r=Vector((cos(yaw),sin(yaw),0))
uv('Cowboy_head',head,(.34,.29,.43),SK,rot=(0,radians(-3),yaw),coll='CHARACTER');uv('Ear_left',Vector(head)+r*.31,(.085,.055,.13),SK,coll='CHARACTER');uv('Ear_right',Vector(head)-r*.31,(.085,.055,.13),SK,coll='CHARACTER')
for side,sgn in [('L',1),('R',-1):
 ec=Vector(head)+f*.285+r*(.105*sgn)+Vector((0,0,.065));uv('Eye_white_'+side,ec,(.070,.043,.052),EW,coll='CHARACTER',seg=24,rings=14);uv('Iris_'+side,ec+f*.050,(.034,.018,.035),IR,coll='CHARACTER',seg=20,rings=12);uv('Pupil_'+side,ec+f*.068,(.014,.010,.018),HA,coll='CHARACTER',seg=16,rings=10);p1=Vector(head)+f*.295+r*(.17*sgn)+Vector((0,0,.17));p2=Vector(head)+f*.30+r*(.04*sgn)+Vector((0,0,.18));tube('Brow_'+side,[p1,p2],.026,HA,'CHARACTER')
uv('Nose',Vector(head)+f*.34+Vector((0,0,-.015)),(.075,.095,.105),SKL,rot=(0,0,yaw),coll='CHARACTER');uv('Nose_tip',Vector(head)+f*.405+Vector((0,0,-.065)),(.060,.055,.055),SKL,rot=(0,0,yaw),coll='CHARACTER');uv('Moustache_L',Vector(head)+f*.315+r*.075+Vector((0,0,-.10)),(.11,.045,.045),HA,rot=(0,0,yaw),coll='CHARACTER');uv('Moustache_R',Vector(head)+f*.315-r*.075+Vector((0,0,-.10)),(.11,.045,.045),HA,rot=(0,0,yaw),coll='CHARACTER');uv('Beard_chin',Vector(head)+f*.29+Vector((0,0,-.22)),(.22,.10,.17),HA,rot=(0,0,yaw),coll='CHARACTER');tube('Mouth_line',[Vector(head)+f*.375+r*.075+Vector((0,0,-.14)),Vector(head)+f*.38-r*.075+Vector((0,0,-.14))],.012,M('Warning_red'),'CHARACTER')
# transparent dome and wide brim integrated around it
uv('Transparent_helmet_dome',(.70,1.68,4.36),(.49,.43,.58),GLASS,coll='CHARACTER',seg=40,rings=24);tor('Helmet_dome_lower_rim',(.70,1.68,4.02),.37,.032,MT,scale=(1,.88,1),coll='CHARACTER');tor('Helmet_dome_upper_rim',(.70,1.68,4.72),.43,.028,MD,scale=(1,.88,1),coll='CHARACTER');tube('Helmet_visor_seam',[(.34,1.49,4.48),(.70,1.36,4.58),(1.07,1.49,4.48)],.016,CY,'CHARACTER')
bpy.ops.mesh.primitive_cylinder_add(vertices=64,radius=1,depth=.12,location=(.70,1.68,4.78));hatbrim=bpy.context.object;hatbrim.name='Wide_frontier_hat_brim';hatbrim.scale=(.72,.60,1);bpy.ops.object.transform_apply(location=False,rotation=False,scale=True);assign_mat(hatbrim,LE);bevel(hatbrim,.035,3);move_to(hatbrim,'CHARACTER')
ring('Hat_open_crown',(.70,1.68),(.45,.37),(.31,.27),4.72,5.02,LE,'CHARACTER',36);tor('Hatband',(.70,1.68,4.78),.36,.045,LED,scale=(1,.83,1),coll='CHARACTER');cube('Hatband_badge',(.70,1.34,4.80),(.16,.035,.20),BR,rot=(radians(90),0,0),bev=.018,coll='CHARACTER')
for a in [.3,1.9,3.5,5.1]:tube('Hat_crown_crease_%s'%str(a),[(.70+.35*cos(a),1.68+.29*sin(a),4.80),(.70+.40*cos(a),1.68+.33*sin(a),4.98)],.012,COD,'CHARACTER')
result={'stage':'character','objects':len(bpy.data.objects),'character_named':'Cowboy_head'}


Traceback (most recent call last):
  File "<repo>\.runner\blender-mcp-v1.0.0\addon\mcp_to_blender_server.py", line 230, in _execute_code
    exec(code, namespace)
    ~~~~^^^^^^^^^^^^^^^^^
  File "<string>", line 75
    for side,sgn in [('L',1),('R',-1):
                                     ^
SyntaxError: invalid syntax