fn creaPuntos = ( CreaPunto1= point box:true cross:true size:20 name:"Punto1" pos: [0,0,0] CreaPunto2= point box:true cross:true size:20 name:"Punto2" pos:[100,0,0] creaPunto1.wirecolor= green creaPunto2.wirecolor= green $punto2.parent= $punto1 ) fn creaCadena UI_numeroHuesos Punto1 Punto2 ancho alto cantidadControles TamanoControl tipoLink colorsito= ( --CREA LOS HUESOS ENTRE LOS PUNTOS DEL INICIO Y EL FINAL DEL TENTACULO NumberBones= UI_numeroHuesos CreaPunto1= Punto1 CreaPunto2= Punto2 InitialPose= CreaPunto1.pos.x Long= length(CreaPunto1.pos-CreaPunto2.pos) vecDir= normalize (CreaPunto2.pos-CreaPunto1.pos) BoneLength= Long/NumberBones huesos =#() puntos = #() helpersitos= #() --CREA LOS HUESOS ENRE LOS DOS PUNTOS SELECCIONADOS for i = 1 to NumberBones do ( creaHueso= bonesys.createbone [((i-1)*BoneLength)+InitialPose,Punto1.pos.y,Punto1.pos.z] [(i*BoneLength)+InitialPose,Punto1.pos.y,Punto1.pos.z] [0,0,1] creaHueso.Width=ancho creaHueso.Height=alto creaHueso.parent= Punto1 creaHueso.wirecolor= colorsito creaHueso.name= "huesoMain_"+i as string helpersHueso= point box:true cross:false size: 5 cross: false axistripod= true helpersHueso.name= "HelperChain_"+i as string helpersHueso.wirecolor= blue helpersHueso.pos= creaHueso.pos creaHueso.position.controller =position_constraint() creaHueso.position.controller.appendtarget helpersHueso 100 append huesos creaHueso append puntos helpersHueso Punto2.parent= puntos[puntos.count] ) --CREACION ULTIMO HUESO creaUltimoHueso = bonesys.createbone (CreaPunto2.pos) (CreaPunto2.pos) [0,0,1] creaUltimoHueso.name = ("huesoMain_"+(huesos.count +1) as string ) creaUltimoHueso.Width=ancho creaUltimoHueso.Height=alto creaUltimoHueso.wirecolor= colorsito creaUltimoPunto = point box:true cross:false size: 5 cross: false axistripod= true creaUltimoPunto.name = ("HelperChain_"+(puntos.count +1) as string) creaUltimoPunto.pos = CreaPunto2.pos creaUltimoHueso.position.controller = position_constraint() creaUltimoHueso.position.controller.appendtarget creaUltimoPunto 100 append huesos creaUltimoHueso append puntos creaUltimoPunto --EMPARENTA CADA HUESO A SU HUESO ANTERIOR Y CREA EL LOOK AT CONSTRAINT for o in 1 to huesos.count do ( if huesos[o].name != "huesoMain_1"then huesos[o].parent = huesos[o-1] else huesos [o].parent = CreaPunto1 if puntos[o] != puntos[1] then puntos[o].parent = puntos[o-1] else puntos[o].parent = Punto1 if huesos[o] != huesos[huesos.count] then huesos[o].rotation.controller =lookAt_constraint target_axis:0 upnode_axis:2 StoUP_axis:2 lookat_vector_length:0 if huesos[o] != huesos[huesos.count] then huesos[o].rotation.controller.appendtarget puntos[o+1] 100 else 0 if huesos[o] != huesos[huesos.count] then huesos[o].rotation.controller.pickupnode=puntos[o] else 0 if huesos[o] != huesos[huesos.count] then huesos[o].rotation.controller.upnode_world=false else 0 ) if $splineColumna == undefined then (--CREA LA SPLINE PARA EL SKIN ss = SplineShape pos:Punto1.pos name:"splineColumna" render_useViewportSettings:false render_displayRenderMesh:true render_thickness:0.01 addNewSpline ss ss.wirecolor= blue cantidad =cantidadControles --Cantidad de puntos en la linea dependiendo de la longitud de la misma longitud=length (Punto2.pos-Punto1.pos) --longitud del vector entre las dos selecciones vectorsito= (Punto2.pos-Punto1.pos)-- vector generado entre ambas selecciones direccion= vectorsito/longitud --direccion del vector normalizando vectorsito posiciones= longitud/cantidad --division para obtener la longitud de cada segmento dentro de la linea addKnot ss 1 #corner #line Punto1.pos --Aņade el primer punto en la seleccion numero 1 for o = 1 to cantidadControles do ( -- aņade los nuevos puntos dentro de la linea dependiendo de la cantidad proporcionada en la interfaz addKnot ss 1 #smooth #curve ((direccion* (posiciones*o))+Punto1.pos) print posiciones ) updateShape ss ss ) else 0 --CREA EL PATH CONSTRAINT EN LOS PUNTOS porcentajePath= 100.0/(puntos.count-1) -- for o in 1 to huesos.count do ( ControladorPath= Path_Constraint follow:on puntos[o].pos.controller = controladorPath puntos[o].pos.controller.path = $splineColumna porcentajes= porcentajePath*(o-1) puntos[o].pos.controller.percent = porcentajes deleteKeys puntos ) --AŅADE EL PATH CONSTRAINT A LOS PUNTO1 Y PUNTO2 ControladorPath1= Path_Constraint follow:on $Punto1.pos.controller = controladorPath1 $Punto1.pos.controller.path = $splineColumna $Punto1.pos.controller.percent=0 ControladorPath2= Path_Constraint follow:on $Punto2.pos.controller = controladorPath2 $Punto2.pos.controller.path = $splineColumna $Punto2.pos.controller.percent=100 deleteKeys $Punto1 deleteKeys $Punto2 --CREACION DEL PUNTO CONTROL GENERAL if $controlGral == undefined then ( PUNTO_CTRL= point name:"controlGral" size: 25 pos: punto1.pos box: true PUNTO_CTRL.wirecolor= red ) else ( 0 )-- select $splineColumna -- splineSkin= Spline_IK_Control() addmodifier $splineColumna (Spline_IK_Control ()) $splineColumna.modifiers[#Spline_IK_Control].linkTypes = tipoLink $splineColumna.modifiers[#Spline_IK_Control].createHelper ((cantidadControles)+1) -- RENOMBRA LOS HELPERS for i = 1 to $splineColumna.modifiers[#Spline_IK_Control].getKnotCount() do ( $splineColumna.modifiers[#Spline_IK_Control].helper_list[i].name = ("helpersito"+i as string) $splineColumna.modifiers[#Spline_IK_Control].helper_list[i].wirecolor= green $splineColumna.modifiers[#Spline_IK_Control].helper_list[i].size= TamanoControl -- if $splineColumna.modifiers[#Spline_IK_Control].helper_list[i]!=$splineColumna.modifiers[#Spline_IK_Control].helper_list[1] then ( --$splineColumna.modifiers[#Spline_IK_Control].helper_list[i].parent = $splineColumna.modifiers[#Spline_IK_Control].helper_list[i-1] 0 ) else ( $splineColumna.modifiers[#Spline_IK_Control].helper_list[i].parent = $controlGral ) ) $Punto1.parent=PUNTO_CTRL $splineColumna.parent= PUNTO_CTRL Helpersitos = $helpersito* as array --AŅADE EL ORIENTATION CONSTRAINT A LOS HELPER CHAIN for i in 1 to puntos.count do ( puntos[i].rotation.controller= rotation_list() puntos[i].rotation.controller.Available.controller= Orientation_Constraint() puntos[i].rotation.controller.Orientation_Constraint.controller.appendtarget Helpersitos[1] (100*(UI_numeroHuesos-i)/(UI_numeroHuesos-1) as float) puntos[i].rotation.controller.Orientation_Constraint.controller.appendTarget Helpersitos[Helpersitos.count] (100*(i-1)/(UI_numeroHuesos-1) as float) ) -- ) try(destroyDialog RL_creaCadena)catch() rollout RL_creaCadena "createChain" width:190 height:480 ( group "BONE PROPERTIES" ( --groupBox grp_BoneProperties "BoneProperties" pos:[11,12] width:133 height:108 label UI_SpaceLabelTitulo "" spinner UI_numeroHuesos "Numof Bones" width:96 height:16 range: [2,100,2] type: #integer align: #left spinner UI_Width "Bone Width" width:88 height:16 range:[0.5,100,10] type:#float align: #left spinner UI_Height "Bone Height" width:96 height:16 range:[0.5,100,10] type:#float align: #left colorPicker ColPick_Fr "ColorPicker" width:73 height:18 color:(color 18 255 0) ) group "CONTROL PROPERTIES"( --groupBox grp_SplineProperties "Controls Number" pos:[8,128] width:133 height:70 label UI_SpaceLabel "" spinner UI_cantidadControles "Numb of Ctrls" width:96 height:16 range: [2,100,2] type:#integer align: #left spinner UI_ControlSize "Controls Size" width:96 height:16 range: [1,100,20] type:#float align: #left button UI_crearPuntos "CreateGuides" width:88 height:24 align: #left button UI_CreateBones "CreateBones" width:88 height:24 align: #left button UI_DeleteBones "DeleteBones" width:88 height:24 align: #left checkbox UI_CheckLinks "Parented" ) group "RENAME CHAIN"( label UI_SpaceLabelTitulo2 "" edittext UI_EditText "Prefix:" button UI_Rename "Put Prefix") on UI_crearPuntos pressed do with undo on ( creaPuntos () ) on UI_CreateBones pressed do with undo on ( if UI_CheckLinks.checked then ( creaCadena (UI_numeroHuesos.value) $Punto1 $Punto2 (UI_Width.value) (UI_Height.value) (UI_cantidadControles.value) (UI_ControlSize.value) 0 ColPick_Fr.color ) else ( creaCadena (UI_numeroHuesos.value) $Punto1 $Punto2 (UI_Width.value) (UI_Height.value) (UI_cantidadControles.value) (UI_ControlSize.value) 2 ColPick_Fr.color ) $Punto1.size=5 $Punto2.size=5 ) on UI_DeleteBones pressed do with undo on ( delete $huesoMain_* delete $HelperChain_* --delete $SplineColumna* ) on UI_Rename pressed do with undo on ( for o in selection do o.name = UI_EditText.text+"_" +o.name ) ) createDialog RL_creaCadena