Source code for helga.nuke.vincent.face_palm.face_palm

#Globals
#------------------------------------------------------------------

SCALE = 500
COLOR_SKIN = [0.87, 0.69, 0.63]
COLOR_RED = [0.45, 0.17, 0.21]

curve_outline_a = [
    (-1.335319346, -0.4996147416),
    (-1.173402948, -0.3858356509),
    (-0.93271641, -0.2370476093),
    (-0.7795522495, -0.1626535884),
    (-0.6642668405, -0.06942731885),
    (-0.501094087, 0.140983477),
    (-0.3215303772, 0.1497000058),
    (0.06308469148, 0.05737712019),
    ]

curve_outline_b = [
    (0.06975887043, 0.0717439481),
    (0.02793797677, 0.2793344176),
    (0.1089052892, 0.394818166),
    (0.1143536194, 0.5390192733),
    (0.1896090361, 0.7026403292),
    (0.3763937131, 0.8622014895),
    (0.6815444151, 0.8960328214),
    (0.8928630137, 0.7203556202),
    (0.8956398827, 0.386945458),
    (0.7919860928, 0.277805909),
    (0.8197713147, 0.2792048776),
    (0.8689686437, 0.2424946979),
    (0.8187911602, 0.1180959137),
    ]

curve_outline_c = [
    (0.6988548549, 0.03180627774),
    (0.6864907527, -0.006050283457),
    (0.7727349143, -0.100671209),
    (0.90078599, -0.1249304675),
    (1.169043348, -0.335021491),
    (1.326706381, -0.4797795071),
    (1.382590234, -0.5880544731),
    (1.441966828, -0.6474310674),
    (1.438474088, -0.7452278109)
    ]

curve_hand_a = [
    (0.389209898, -0.583393285),
    (0.389209898, -0.6377162322),
    (0.3977872055, -0.6920391794),
    (0.4178009229, -0.7320666142),
    (0.4292373328, -0.7863895615),
    (0.4406737428, -0.8321352012),
    (0.4606874602, -0.883599046),
    (0.4635465626, -0.8807399435),
    (0.4521101527, -0.8292760988),
    (0.4435328452, -0.7921077664),
    (0.4492510502, -0.7320666142),
    (0.4435328452, -0.6806027695),
    (0.4292373328, -0.6119843098),
    (0.4149418204, -0.57767508),
    (0.4749829726, -0.5548022601),
    (0.5121513049, -0.5405067477),
    (0.5550378422, -0.5233521328),
    (0.583628867, -0.5004793129),
    (0.6322336093, -0.471888288),
    (0.6722610441, -0.4518745706),
    (0.7151475814, -0.4290017507),
    (0.7351612988, -0.4089880333),
    (0.7809069386, -0.4861838004),
    (0.8180752709, -0.6062661048),
    (0.8666800132, -0.7320666142),
    (0.9295802678, -0.8607262261),
    ]

curve_hand_b = [
    (0.7265839913, -0.3889743159),
    (0.6470422696, -0.2613557155),
    (0.6465291217, -0.1230777847),
    (0.6179380969, -0.002995480313),
    (0.6065016869, 0.09135490172),
    (0.6236563019, 0.1599733614),
    (0.6667483853, 0.1971416937),
    (0.6293745068, 0.2314509235),
    (0.5521787397, 0.1942825912),
    (0.5311906495, 0.1280917497),
    (0.5264468173, 0.1228050291),
    (0.4692647676, 0.1799870788),
    (0.3722307033, 0.2818289912),
    (0.3062959259, 0.3229422031),
    (0.2354892843, 0.360052062),
    (0.1852392487, 0.3870033361),
    (0.163399275, 0.3349270442),
    (0.1984963722, 0.2882070316),
    (0.2813518709, 0.214354782),
    (0.3484475266, 0.1578381103),
    (0.3879320729, 0.128459218),
    (0.3256387227, 0.1473175997),
    (0.263467862, 0.2087590665),
    (0.1969791109, 0.2757962488),
    (0.1347497768, 0.3286604081),
    (0.07379272512, 0.3612073977),
    (0.05980066497, 0.3079172967),
    (0.1318906743, 0.2257327186),
    (0.1742232378, 0.1711647925),
    (0.2239833157, 0.1314408099),
    (0.2655335545, 0.09622122329),
    (0.2862822085, 0.06848208184),
    (0.2283122914, 0.1058369196),
    (0.1786106869, 0.1346089073),
    (0.1349947556, 0.1700734728),
    (0.08608101847, 0.220930413),
    (0.07184952207, 0.1885643862),
    (0.07756772704, 0.1485369514),
    (0.1233133668, 0.08849579924),
    (0.1484968581, 0.07535562248),
    (0.1757515844, 0.04974618954),
    (0.216753392, 0.01543695971),
    (0.2491138762, -0.0258683002),
    (0.2429752721, -0.03633033731),
    (0.2061688655, -0.00992749437),
    (0.1728924819, 0.01623036971),
    (0.1220474111, 0.05932458477),
    (0.07630177129, 0.1137426471),
    (0.1101468494, 0.0023641495),
    (0.1475472576, -0.05321429209),
    (0.183354519, -0.1202186822),
    (0.2376774663, -0.1545279121),
    (0.2519729787, -0.1802598344),
    (0.2748457986, -0.2288645767),
    (0.2920004135, -0.277469319),
    (0.3549006682, -0.3289331637),
    (0.3777734881, -0.3575241886),
    (0.4035054104, -0.3889743159),
    (0.4178009229, -0.4232835457),
    (0.4235191278, -0.466170083),
    (0.4178009229, -0.4947611079),
    (0.4092236154, -0.5090566203),
    (0.4063645129, -0.5233521328),
    (0.394928103, -0.5462249526),
    ]

curve_wrinkle_01 = [
    (0.1959581268,  0.4716105518),
    (0.2522725577,  0.4422291096),
    (0.3061385352,  0.4152961209),
    (0.342865338,  0.3834662251),
    (0.3942828619,  0.3589816899),
    (0.4530457463,  0.3540847829),
    ]

curve_wrinkle = [
    (0.1739220451, 0.4373322026),
    (0.2302364761, 0.4079507603),
    (0.2841024535, 0.3810177716),
    (0.3208292563, 0.3491878759),
    (0.3735866519, 0.333412507),
    ]

curve_arm_pit = [
    (-0.4373792379, -0.1336460255),
    (-0.4485532459, -0.1839290614),
    (-0.4839376044, -0.2304874279),
    (-0.5118726243, -0.273321125),
    (-0.5323583056, -0.3068431489),
    (-0.5416699789, -0.3515391808),
    (-0.5547063215, -0.4167208939),
    (-0.5733296681, -0.465141595),
    (-0.5938153493, -0.5228739695),
    (-0.6105763613, -0.5824686786),
    (-0.6310620425, -0.6811724156),
    (-0.6440983852, -0.7221437781),
    (-0.6757580744, -0.8059488378),
    (-0.6906567517, -0.8357461924),
    (-0.7036930943, -0.848782535),
    (-0.7092800983, -0.8767175549),
    (-0.7074177636, -0.8823045589),
    (-0.6981060903, -0.8450578657),
    (-0.6701710704, -0.7817384872),
    (-0.6496853891, -0.7426294594),
    (-0.6403737158, -0.7016580969),
    (-0.6403737158, -0.6848970849),
    (-0.6558372655, -0.7153051325),
    (-0.6697451031, -0.7264314026),
    (-0.6982561703, -0.7403392403),
    (-0.7260718457, -0.7528562942),
    (-0.7636230074, -0.7632871724),
    (-0.7900478989, -0.7667641318),
    (-0.8234267093, -0.7751088344),
    (-0.8540239522, -0.7931890234),
    (-0.8818396275, -0.8057060773),
    (-0.8922705058, -0.8210046987),
    (-0.9096553029, -0.8446480228),
    (-0.9263447081, -0.843257239),
    (-0.9638958698, -0.8363033202),
    (-0.9826714506, -0.8439526309),
    (-1.016050261, -0.8585558604),
    (-1.020222612, -0.8773314413),
    (-1.023699572, -0.8835899682)
    ]

curve_cheek = [
    (0.07159408111, 0.06681951528),
    (0.07287667938, 0.01551558443),
    (0.08185486728, -0.06913590148),
    (0.09981124308, -0.1563525839),
    (0.1331587981, -0.2358736768),
    (0.1665063532, -0.2769168214),
    (0.2190928823, -0.2820472145),
    (0.2768098045, -0.279482018),
    (0.2922009838, -0.2717864284),
    ]

curve_chin = [
    (0.1254632085, -0.1268528237),
    (0.1575281653, -0.1371136099),
    (0.1870279255, -0.1550699857),
    (0.2101146944, -0.1678959684),
    (0.231918865, -0.1832871476),
    (0.2434622495, -0.1973957286),
    ]

curve_ear = [
    (0.7118801941, 0.07903843382),
    (0.7053122309, 0.09053236941),
    (0.7151641757, 0.1135202406),
    (0.7283001021, 0.118446213),
    (0.7463620009, 0.134866121),
    (0.7447200101, 0.1578539922),
    (0.7332260745, 0.1709899186),
    (0.7299420929, 0.1906938081),
    (0.7447200101, 0.2103976977),
    (0.7644238997, 0.2235336241),
    (0.7989057064, 0.2284595965),
    (0.8235355684, 0.2301015873),
    (0.8038316788, 0.2021877437),
    (0.7890537616, 0.184125845),
    (0.7808438076, 0.1447180658),
    (0.7644238997, 0.126656167),
    (0.7397940377, 0.1168042222),
    ]












#Import
#------------------------------------------------------------------
import nuke









#Functions
#------------------------------------------------------------------

def rgb_2_dec(r, g, b, a=1.0):
    """
    Floating point to 8bit conversion
[docs] """ r = int(r * 255) g = int(g * 255) b = int(b * 255) a = int(a * 255) return (r << 24) + (g << 16) + (b << 8) + (a) def create_line(line, color): """ Create a line.
[docs] """ first = True for p in line: xPos = p[0] * SCALE yPos = p[1] * -SCALE if first: prevDot = nuke.nodes.Dot( xpos=xPos, ypos=yPos, hide_input=True) first = False else: newDot = nuke.nodes.Dot( xpos=xPos, ypos=yPos) newDot.setInput(0, prevDot) prevDot = newDot prevDot.knob("tile_color").setValue(rgb_2_dec(color[0], color[1], color[2])) def create_face(): """ Create face palm out of dots.
[docs] """ lines = [ (curve_outline_a, COLOR_RED), (curve_outline_b, COLOR_SKIN), (curve_outline_c, COLOR_RED), (curve_hand_a, COLOR_RED), (curve_hand_b, COLOR_SKIN), (curve_wrinkle_01, COLOR_SKIN), (curve_wrinkle, COLOR_SKIN), (curve_arm_pit, COLOR_RED), (curve_cheek, COLOR_SKIN), (curve_chin, COLOR_SKIN), (curve_ear, COLOR_SKIN), ] for line, color in lines: create_line(line, color) def run(): """ Standardized run() method.
[docs] """ #create face create_face() #Test #------------------------------------------------------------------ if (__name__ == '__main__'): #create face
create_face()