├── .gitlab-ci.yml ├── .spdev.yaml ├── AEspReticleLocTemplate.mel ├── CHANGES.txt ├── CMakeLists.txt ├── GPURenderer.cpp ├── GPURenderer.h ├── Makefile ├── Makefile.spi ├── OpenGLRenderer.cpp ├── OpenGLRenderer.h ├── README.txt ├── V2Renderer.cpp ├── V2Renderer.h ├── defines.h ├── font.h ├── spReticleLoc.cpp ├── spReticleLoc.h ├── spReticleLoc.mel ├── spReticleLoc.sln ├── spReticleLoc.vcxproj ├── spReticleLoc.vcxproj.filters ├── spReticleLoc.vcxproj.user ├── spReticleLocLinux.mel ├── spReticleLocWindows.mel ├── spreticleloc.spk.yaml └── util.h /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - project: spi/dev/dev-ops/spdev 3 | file: pipelines/default.yaml 4 | -------------------------------------------------------------------------------- /.spdev.yaml: -------------------------------------------------------------------------------- 1 | version: 2.1.0 2 | release_notes: | 3 | * Merged/rebased with external github site: https://github.com/imageworks/spReticle 4 | 5 | toolchain: [] 6 | 7 | components: 8 | # libs: 9 | - kind: SPKPackage 10 | name: maya-spreticleloc 11 | spec_file: spreticleloc.spk.yaml 12 | -------------------------------------------------------------------------------- /AEspReticleLocTemplate.mel: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2009, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | proc int round(float $num) 37 | { 38 | int $rounded = int( $num + 0.5 * sign( $num ) ); 39 | return $rounded; 40 | } 41 | 42 | proc float precision(float $num, int $places) 43 | { 44 | int $base = pow(10,$places); 45 | float $newNum = round($num*$base)/float($base); 46 | return $newNum; 47 | } 48 | 49 | global proc AEspReticleLocUpdateLabel(string $attr, string $fl) 50 | { 51 | float $aspectRatio = getAttr($attr+".aspectRatio"); 52 | // limit label to two decimal digits 53 | $aspectRatio = precision($aspectRatio,2); 54 | frameLayout -edit -label $aspectRatio $fl; 55 | } 56 | 57 | global proc AEspReticleLocNewAspectRatio(string $attr, int $index) 58 | { 59 | $attr += "["+$index+"]"; 60 | setAttr ($attr+".displayMode") 1; 61 | 62 | if ($index != 0) setAttr ($attr+".aspectMaskColor") 1 1 1; 63 | } 64 | 65 | proc drawAspectRatio( string $attr, string $fl ) 66 | { 67 | attrEnumOptionMenuGrp -attribute ($attr+".displayMode") -label "Display Mode"; 68 | attrControlGrp -attribute ($attr+".aspectRatio") -cc ("AEspReticleLocUpdateLabel(\\\""+$attr+"\\\",\\\""+$fl+"\\\");"); 69 | attrColorSliderGrp -attribute ($attr+".aspectMaskColor") -label "Mask Color"; 70 | attrControlGrp -attribute ($attr+".aspectMaskTrans"); 71 | attrColorSliderGrp -attribute ($attr+".aspectLineColor") -label "Line Color"; 72 | attrControlGrp -attribute ($attr+".aspectLineTrans"); 73 | attrControlGrp -attribute ($attr+".aspectDisplaySafeAction") -label "Display Safe Action (90%)"; 74 | attrControlGrp -attribute ($attr+".aspectDisplaySafeTitle") -label "Display Safe Title (80%)"; 75 | button -label "remove aspect ratio" -command ("removeMultiInstance "+$attr); 76 | } 77 | 78 | global proc AEspReticleLocNewText(string $attr, int $index) 79 | { 80 | $attr += "["+$index+"]"; 81 | setAttr ($attr+".textType") 0; 82 | } 83 | 84 | proc drawText( string $attr, string $fl, int $i ) 85 | { 86 | attrEnumOptionMenuGrp -attribute ($attr+".textType") -label "Text Type"; 87 | attrControlGrp -attribute ($attr+".textStr"); 88 | attrEnumOptionMenuGrp -attribute ($attr+".textAlign") -label "Text Alignment"; 89 | attrEnumOptionMenuGrp -attribute ($attr+".textVAlign") -label "Text Vertical Alignment"; 90 | attrFieldGrp -attribute ($attr+".textPos") -label "Text Position"; 91 | attrEnumOptionMenuGrp -attribute ($attr+".textPosRel") -label "Text Position Relative To"; 92 | attrEnumOptionMenuGrp -attribute ($attr+".textLevel") -label "Anchor Text To"; 93 | attrControlGrp -attribute ($attr+".textARLevel") -label "Aspect Ratio Level"; 94 | attrControlGrp -attribute ($attr+".textColor") -label "Text Color"; 95 | attrControlGrp -attribute ($attr+".textTrans") -label "Text Transp."; 96 | attrControlGrp -attribute ($attr+".textBold") -label "Bold font"; 97 | attrControlGrp -attribute ($attr+".textSize") -label "Text Size"; 98 | attrControlGrp -attribute ($attr+".textScale") -label "Auto-scale font size"; 99 | attrControlGrp -attribute ($attr+".textEnabled") -label "Text Enabled"; 100 | button -label "remove text" -command ("removeMultiInstance "+$attr); 101 | } 102 | 103 | proc setSafeActionTitle(string $node, string $format) 104 | { 105 | string $saAttr = "safeAction"; 106 | string $stAttr = "safeTitle"; 107 | 108 | switch ($format) 109 | { 110 | case "35mm" : 111 | setAttr ($node+$saAttr) 0.713 0.535; 112 | setAttr ($node+$stAttr) 0.630 0.475; 113 | break; 114 | } 115 | } 116 | 117 | proc getFilmback( string $node ) 118 | { 119 | string $attr = "filmbackAperture"; 120 | string $sAttr = "soundTrackWidth"; 121 | string $saAttr = "safeAction"; 122 | string $stAttr = "safeTitle"; 123 | string $optionMenu = "AEspReticleLocCameraPresets"; 124 | 125 | global float $spShowCameraHorizFilmAperature; 126 | global float $spShowCameraVertFilmAperature; 127 | float $hfa = precision($spShowCameraHorizFilmAperature,4); 128 | float $vfa = precision($spShowCameraVertFilmAperature,4); 129 | 130 | float $camAp[] = `getAttr ($node+$attr)`; 131 | $camAp[0] = precision($camAp[0],4); 132 | $camAp[1] = precision($camAp[1],4); 133 | 134 | float $stw = `getAttr($node+$sAttr)`; 135 | 136 | if ($camAp[0] == 0.98 && $camAp[1] == 0.735 && $stw == 0.112) 137 | { 138 | optionMenuGrp -edit -select 1 $optionMenu; 139 | AEspReticleLocSetFilmback($node,"Full Aperture"); 140 | return; 141 | } 142 | if ($camAp[0] == 0.864 && $camAp[1] == 0.630 && $stw == 0) 143 | { 144 | optionMenuGrp -edit -select 2 $optionMenu; 145 | AEspReticleLocSetFilmback($node,"Academy Aperture"); 146 | return; 147 | } 148 | if ($camAp[0] == 0.945 && $camAp[1] == 0.569 && $stw == 0) 149 | { 150 | optionMenuGrp -edit -select 3 $optionMenu; 151 | AEspReticleLocSetFilmback($node,"Super 35 1.66"); 152 | return; 153 | } 154 | if ($camAp[0] == 0.945 && $camAp[1] == 0.534 && $stw == 0) 155 | { 156 | optionMenuGrp -edit -select 4 $optionMenu; 157 | AEspReticleLocSetFilmback($node,"Super 35 1.77"); 158 | return; 159 | } 160 | if ($camAp[0] == 0.945 && $camAp[1] == 0.511 && $stw == 0) 161 | { 162 | optionMenuGrp -edit -select 5 $optionMenu; 163 | AEspReticleLocSetFilmback($node,"Super 35 1.85"); 164 | return; 165 | } 166 | if ($camAp[0] == 0.945 && $camAp[1] == 0.394 && $stw == 0) 167 | { 168 | optionMenuGrp -edit -select 6 $optionMenu; 169 | AEspReticleLocSetFilmback($node,"Super 35 2.35"); 170 | return; 171 | } 172 | if ($camAp[0] == $hfa && $camAp[1] == $vfa) 173 | { 174 | optionMenuGrp -edit -select 7 $optionMenu; 175 | AEspReticleLocSetFilmback($node,"Show Filmback"); 176 | return; 177 | } 178 | if ($camAp[0] == -1 && $camAp[1] == -1 ) 179 | { 180 | optionMenuGrp -edit -select 8 $optionMenu; 181 | AEspReticleLocSetFilmback($node,"Use Camera Aperture"); 182 | return; 183 | } 184 | 185 | AEspReticleLocSetFilmback($node,"User Defined"); 186 | optionMenuGrp -edit -select 9 $optionMenu; 187 | } 188 | 189 | global proc AEspReticleLocSetFilmback( string $node, string $setting ) 190 | { 191 | string $attr = "filmbackAperture"; 192 | string $sAttr = "soundTrackWidth"; 193 | string $saAttr = "safeAction"; 194 | string $stAttr = "safeTitle"; 195 | string $pAttr = "usePad"; 196 | string $paAttr = "padAmount"; 197 | 198 | global float $spShowCameraHorizFilmAperature; 199 | global float $spShowCameraVertFilmAperature; 200 | global float $spShowCameraFilmAperaturePad; 201 | 202 | float $hfa = precision(getAttr ($node + "horizontalFilmAperture"),4); 203 | float $vfa = precision(getAttr ($node + "verticalFilmAperture"),4); 204 | float $newHfa = 0; 205 | float $newVfa = 0; 206 | 207 | switch ($setting) 208 | { 209 | case "Full Aperture" : 210 | $newHfa = 0.98; 211 | $newVfa = 0.735; 212 | setAttr ($node+$attr) 0.98 0.735; 213 | setAttr ($node+$sAttr) 0.112; 214 | setAttr ($node+$pAttr) 0; 215 | setAttr ($node+$paAttr) 0.0 0.0; 216 | setSafeActionTitle($node,"35mm"); 217 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 218 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 219 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 220 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 221 | break; 222 | case "Academy Aperture" : 223 | $newHfa = 0.864; 224 | $newVfa = 0.630; 225 | setAttr ($node+$attr) 0.864 0.630; 226 | setAttr ($node+$sAttr) 0.0; 227 | setAttr ($node+$pAttr) 0; 228 | setAttr ($node+$paAttr) 0.0 0.0; 229 | setSafeActionTitle($node,"35mm"); 230 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 231 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 232 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 233 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 234 | break; 235 | case "Super 35 1.66" : 236 | $newHfa = 0.945; 237 | $newVfa = 0.569; 238 | setAttr ($node+$attr) $newHfa $newVfa; 239 | setAttr ($node+$sAttr) 0.0; 240 | setAttr ($node+$pAttr) 0; 241 | setAttr ($node+$paAttr) 0.0 0.0; 242 | setSafeActionTitle($node,"35mm"); 243 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 244 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 245 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 246 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 247 | break; 248 | case "Super 35 1.77" : 249 | $newHfa = 0.945; 250 | $newVfa = 0.534; 251 | setAttr ($node+$attr) $newHfa $newVfa; 252 | setAttr ($node+$sAttr) 0.0; 253 | setAttr ($node+$pAttr) 0; 254 | setAttr ($node+$paAttr) 0.0 0.0; 255 | setSafeActionTitle($node,"35mm"); 256 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 257 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 258 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 259 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 260 | break; 261 | case "Super 35 1.85" : 262 | $newHfa = 0.945; 263 | $newVfa = 0.511; 264 | setAttr ($node+$attr) $newHfa $newVfa; 265 | setAttr ($node+$sAttr) 0.0; 266 | setAttr ($node+$pAttr) 0; 267 | setAttr ($node+$paAttr) 0.0 0.0; 268 | setSafeActionTitle($node,"35mm"); 269 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 270 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 271 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 272 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 273 | break; 274 | case "Super 35 2.35" : 275 | $newHfa = 0.945; 276 | $newVfa = 0.394; 277 | setAttr ($node+$attr) $newHfa $newVfa; 278 | setAttr ($node+$sAttr) 0.0; 279 | setAttr ($node+$pAttr) 0; 280 | setAttr ($node+$paAttr) 0.0 0.0; 281 | setSafeActionTitle($node,"35mm"); 282 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 283 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 284 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 285 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 286 | break; 287 | case "Show Filmback" : 288 | $newHfa = $spShowCameraHorizFilmAperature; 289 | $newVfa = $spShowCameraVertFilmAperature; 290 | setAttr ($node+$attr) $spShowCameraHorizFilmAperature $spShowCameraVertFilmAperature; 291 | setAttr ($node+$sAttr) 0.0; 292 | int $pad = 0; 293 | if (catchQuiet($pad = float($spShowCameraFilmAperaturePad) != 0) || $pad == 0) { 294 | setAttr ($node+$pAttr) 0; 295 | setAttr ($node+$pAttr) 0.0 0.0; 296 | } 297 | else { 298 | setAttr ($node+$pAttr) 1; 299 | setAttr ($node+$paAttr) $spShowCameraFilmAperaturePad $spShowCameraFilmAperaturePad; 300 | } 301 | setSafeActionTitle($node,"35mm"); 302 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 303 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 304 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 305 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 306 | break; 307 | case "Use Camera Aperture" : 308 | setAttr ($node+$attr) -1 -1; 309 | setAttr ($node+$sAttr) 0.0; 310 | setSafeActionTitle($node,"35mm"); 311 | attrFieldGrp -edit -attribute ($node+$attr) -enable 0 ("AEspReticleLoc"+$attr); 312 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 0 ("AEspReticleLoc"+$sAttr); 313 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 0 ("AEspReticleLoc"+$saAttr); 314 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 0 ("AEspReticleLoc"+$stAttr); 315 | break; 316 | case "User Defined" : 317 | attrFieldGrp -edit -attribute ($node+$attr) -enable 1 ("AEspReticleLoc"+$attr); 318 | attrFieldSliderGrp -edit -attribute ($node+$sAttr) -enable 1 ("AEspReticleLoc"+$sAttr); 319 | attrFieldGrp -edit -attribute ($node+$saAttr) -enable 1 ("AEspReticleLoc"+$saAttr); 320 | attrFieldGrp -edit -attribute ($node+$stAttr) -enable 1 ("AEspReticleLoc"+$stAttr); 321 | break; 322 | } 323 | 324 | if (getAttr($node+"driveCameraAperture") == 1) 325 | { 326 | if (($newHfa && $newVfa) && (($newHfa != $hfa) || 327 | ($newVfa != $vfa)) && (about("-batch") == 0)) 328 | { 329 | string $result = `confirmDialog -title "Update cameras?" 330 | -message "Would you like me to update the cameras with the new filmback values?" 331 | -button "Yes" 332 | -button "No"`; 333 | if ($result == "Yes") 334 | { 335 | string $attrs[] = {".cameraAperture",".hfa",".vfa"}; 336 | int $locked[]; 337 | string $cameras[] = ls("-ca"); 338 | for ($camera in $cameras) 339 | { 340 | if (!getAttr($camera+".orthographic")) 341 | { 342 | for ($i = 0; $i < size($attrs); $i++) 343 | { 344 | $locked[$i] = getAttr("-lock",$camera+$attrs[$i]); 345 | if ($locked[$i]) 346 | setAttr -lock 0 ($camera+$attrs[$i]); 347 | } 348 | setAttr ($camera+".cameraAperture") $newHfa $newVfa; 349 | for ($i = 0; $i < size($attrs); $i++) 350 | { 351 | if ($locked[$i]) 352 | setAttr -lock 1 ($camera+$attrs[$i]); 353 | } 354 | } 355 | } 356 | } 357 | } 358 | } 359 | } 360 | 361 | global proc AEspReticleLocUpdateFilmback( string $node ) 362 | { 363 | string $optionMenu = "AEspReticleLocCameraPresets"; 364 | 365 | if (!`optionMenuGrp -exists $optionMenu`) 366 | { 367 | AEspReticleLocDrawFilmback( $node ); 368 | return; 369 | } 370 | 371 | optionMenuGrp -edit -cc ("AEspReticleLocSetFilmback(\""+$node+"\",\"#1\")") $optionMenu; 372 | getFilmback($node); 373 | } 374 | 375 | global proc AEspReticleLocDrawFilmback( string $node ) 376 | { 377 | string $optionMenu = "AEspReticleLocCameraPresets"; 378 | string $attr = "filmbackAperture"; 379 | string $rfbAttr = "relativeFilmback"; 380 | string $lAttr = "lensSqueezeRatio"; 381 | string $sAttr = "soundTrackWidth"; 382 | string $saAttr = "safeAction"; 383 | string $stAttr = "safeTitle"; 384 | 385 | optionMenuGrp -l "Filmback Presets" -cc ("AEspReticleLocSetFilmback(\""+$node+"\",\"#1\")") $optionMenu; 386 | menuItem -label "Full Aperture"; 387 | menuItem -label "Academy Aperture"; 388 | menuItem -label "Super 35 1.66"; 389 | menuItem -label "Super 35 1.77"; 390 | menuItem -label "Super 35 1.85"; 391 | menuItem -label "Super 35 2.35"; 392 | menuItem -label "Show Filmback"; 393 | menuItem -label "Use Camera Aperture"; 394 | menuItem -label "User Defined"; 395 | 396 | attrFieldGrp -label "Filmback Aperture" -attribute ($node+$attr) ("AEspReticleLoc"+$attr); 397 | attrControlGrp -label "Relative Filmback" -attribute ($node+$rfbAttr) ("AEspReticleLoc"+$rfbAttr); 398 | attrFieldSliderGrp -label "Soundtrack Width" -attribute ($node+$sAttr) ("AEspReticleLoc"+$sAttr); 399 | attrFieldGrp -label "Safe Action Area" -attribute ($node+$saAttr) ("AEspReticleLoc"+$saAttr); 400 | attrFieldGrp -label "Safe Title Area" -attribute ($node+$stAttr) ("AEspReticleLoc"+$stAttr); 401 | 402 | getFilmback($node); 403 | } 404 | 405 | proc getProjection( string $node ) 406 | { 407 | string $attr = "projectionGate"; 408 | string $optionMenu = "AEspReticleLocProjectionPresets"; 409 | 410 | float $projGate[] = `getAttr ($node+$attr)`; 411 | $projGate[0] = precision($projGate[0],3); 412 | $projGate[1] = precision($projGate[1],3); 413 | 414 | if ($projGate[0] == 0.825 && $projGate[1] == 0.446) 415 | { 416 | optionMenuGrp -edit -select 1 $optionMenu; 417 | AEspReticleLocSetProjection($node,"1.85 Projection"); 418 | return; 419 | } 420 | if ($projGate[0] == 0.825 && $projGate[1] == 0.471) 421 | { 422 | optionMenuGrp -edit -select 2 $optionMenu; 423 | AEspReticleLocSetProjection($node,"1.75 Projection"); 424 | return; 425 | } 426 | if ($projGate[0] == 0.825 && $projGate[1] == 0.497) 427 | { 428 | optionMenuGrp -edit -select 3 $optionMenu; 429 | AEspReticleLocSetProjection($node,"1.66 Projection"); 430 | return; 431 | } 432 | if ($projGate[0] == 0.825 && $projGate[1] == 0.602) 433 | { 434 | optionMenuGrp -edit -select 4 $optionMenu; 435 | AEspReticleLocSetProjection($node,"1.37 Projection"); 436 | return; 437 | } 438 | if ($projGate[0] == 0.825 && $projGate[1] == 0.690) 439 | { 440 | optionMenuGrp -edit -select 5 $optionMenu; 441 | AEspReticleLocSetProjection($node,"2.39 Anamorphic"); 442 | return; 443 | } 444 | 445 | AEspReticleLocSetProjection($node,"User Defined"); 446 | optionMenuGrp -edit -select 6 $optionMenu; 447 | } 448 | 449 | proc setProjectionGate(string $node, float $projGate[], int $setAR, int $enable) { 450 | string $attr = "projectionGate"; 451 | string $paAttr = "projectionAspect"; 452 | 453 | setAttr ($node+$attr) $projGate[0] $projGate[1]; 454 | 455 | floatFieldGrp -edit -enable $enable ("AEspReticleLoc"+$attr); 456 | floatFieldGrp -edit -enable $enable ("AEspReticleLoc"+$paAttr); 457 | 458 | if ($setAR) { 459 | float $ar = precision($projGate[0]/$projGate[1],3); 460 | floatFieldGrp -edit -value1 $ar ("AEspReticleLoc"+$paAttr); 461 | } 462 | } 463 | 464 | global proc AEspReticleLocSetProjection( string $node, string $setting ) 465 | { 466 | string $attr = "projectionGate"; 467 | string $paAttr = "projectionAspect"; 468 | 469 | float $projGate[]; 470 | 471 | switch ($setting) 472 | { 473 | case "1.85 Projection" : 474 | $projGate = {0.825, 0.446}; 475 | setProjectionGate($node,$projGate,1,0); 476 | break; 477 | case "1.75 Projection" : 478 | $projGate = {0.825,0.471}; 479 | setProjectionGate($node,$projGate,1,0); 480 | break; 481 | case "1.66 Projection" : 482 | $projGate = {0.825,0.497}; 483 | setProjectionGate($node,$projGate,1,0); 484 | break; 485 | case "1.37 Projection" : 486 | $projGate = {0.825,0.602}; 487 | setProjectionGate($node,$projGate,1,0); 488 | break; 489 | case "2.39 Anamorphic" : 490 | $projGate = {0.825,0.690}; 491 | setProjectionGate($node,$projGate,1,0); 492 | break; 493 | case "User Defined" : 494 | floatFieldGrp -edit -enable 1 ("AEspReticleLoc"+$attr); 495 | floatFieldGrp -edit -enable 1 ("AEspReticleLoc"+$paAttr); 496 | break; 497 | case "projGate" : 498 | break; 499 | case "projAR" : 500 | $projGate = `floatFieldGrp -query -value ("AEspReticleLoc"+$attr)`; 501 | float $projAR[] = `floatFieldGrp -query -value ("AEspReticleLoc"+$paAttr)`; 502 | $projGate[0] = precision($projGate[0],3); 503 | $projGate[1] = precision($projGate[0]/$projAR[0],3); 504 | setProjectionGate($node,$projGate,0,1); 505 | } 506 | } 507 | 508 | global proc AEspReticleLocUpdateProjection ( string $attr, string $node ) 509 | { 510 | string $optionMenu = "AEspReticleLocProjectionPresets"; 511 | $attr = "projectionGate"; 512 | string $paAttr = "projectionAspect"; 513 | 514 | if (!`optionMenuGrp -exists $optionMenu`) 515 | { 516 | AEspReticleLocDrawProjection( $attr, $node ); 517 | return; 518 | } 519 | 520 | optionMenuGrp -edit -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"#1\")") $optionMenu; 521 | floatFieldGrp -edit -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"projGate\")") ("AEspReticleLoc"+$attr); 522 | connectControl -index 2 ("AEspReticleLoc"+$attr) ($node+"horizontalProjectionGate"); 523 | connectControl -index 3 ("AEspReticleLoc"+$attr) ($node+"verticalProjectionGate"); 524 | floatFieldGrp -edit -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"projAR\")") ("AEspReticleLoc"+$paAttr); 525 | getProjection($node); 526 | } 527 | 528 | global proc AEspReticleLocDrawProjection( string $attr, string $node ) 529 | { 530 | string $optionMenu = "AEspReticleLocProjectionPresets"; 531 | $attr = "projectionGate"; 532 | string $paAttr = "projectionAspect"; 533 | 534 | optionMenuGrp -l "Proj. Presets" -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"#1\")") $optionMenu; 535 | menuItem -label "1.85 Projection"; 536 | menuItem -label "1.75 Projection"; 537 | menuItem -label "1.66 Projection"; 538 | menuItem -label "1.37 Projection"; 539 | menuItem -label "2.39 Anamorphic"; 540 | menuItem -label "User Defined"; 541 | 542 | floatFieldGrp -label "Proj. Aperture" -nf 2 -pre 3 -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"projGate\")") ("AEspReticleLoc"+$attr); 543 | connectControl -index 2 ("AEspReticleLoc"+$attr) ($node+"horizontalProjectionGate"); 544 | connectControl -index 3 ("AEspReticleLoc"+$attr) ($node+"verticalProjectionGate"); 545 | floatFieldGrp -label "Proj. Aspect Ratio" -nf 1 -pre 3 -cc ("AEspReticleLocSetProjection(\""+$node+"\",\"projAR\")") ("AEspReticleLoc"+$paAttr); 546 | getProjection($node); 547 | } 548 | 549 | global proc AEspReticleLocDrawAspectRatios( string $attr ) 550 | { 551 | string $frameLayout = "AEspReticleLocAspectRatios"; 552 | if (`frameLayout -ex $frameLayout`) 553 | { 554 | deleteUI $frameLayout; 555 | } 556 | 557 | frameLayout -label "Aspect Ratios" $frameLayout; 558 | columnLayout; 559 | 560 | int $numARs = `getAttr -s $attr`; 561 | for ($i = 0; $i < $numARs; $i++) 562 | { 563 | string $fl = `frameLayout ("AEspReticleLocFL"+$i)`; 564 | AEspReticleLocUpdateLabel(($attr+"["+$i+"]") , $fl); 565 | 566 | columnLayout ($fl+"CL"); 567 | drawAspectRatio( ($attr+"["+$i+"]") , $fl); 568 | setParent ..; 569 | setParent ..; 570 | } 571 | button -label "add new aspect ratio" -command ("AEspReticleLocNewAspectRatio(\""+$attr+"\",\""+$numARs+"\");"); 572 | } 573 | 574 | global proc AEspReticleLocDrawText( string $attr ) 575 | { 576 | string $textTypes[] = {"String","Lens","Frame Number","Aspect Ratio","Max. Distance","Proj. Gate"}; 577 | 578 | string $frameLayout = "AEspReticleLocText"; 579 | if (`frameLayout -ex $frameLayout`) 580 | { 581 | deleteUI $frameLayout; 582 | } 583 | 584 | frameLayout -label "Text" $frameLayout; 585 | columnLayout; 586 | 587 | int $numText = `getAttr -s $attr`; 588 | for ($i = 0; $i < $numText; $i++) 589 | { 590 | string $label = getAttr("-asString",($attr+"["+$i+"].textType")); 591 | if ($label == "String") 592 | { 593 | string $str = getAttr($attr+"["+$i+"].textStr"); 594 | if (size($str) > 15) 595 | $str = substring($str,1,15)+"..."; 596 | if (size($str) > 0) 597 | $label += " - " + $str; 598 | } 599 | string $fl = `frameLayout -label ($label) ("AEspReticleLocFL"+$i)`; 600 | columnLayout ($fl+"CL"); 601 | drawText( ($attr+"["+$i+"]") , $fl, $i); 602 | setParent ..; 603 | setParent ..; 604 | } 605 | button -label "add new text" -command ("AEspReticleLocNewText(\""+$attr+"\",\""+$numText+"\");"); 606 | } 607 | 608 | proc excludeAttributes() 609 | { 610 | editorTemplate -beginNoOptimize; 611 | editorTemplate -suppress "drawOverride"; 612 | editorTemplate -suppress "projectionGate"; 613 | editorTemplate -suppress "panScan"; 614 | editorTemplate -suppress "time"; 615 | editorTemplate -suppress "aspectRatios"; 616 | editorTemplate -suppress "filmbackAperture"; 617 | editorTemplate -suppress "relativeFilmback"; 618 | editorTemplate -suppress "soundTrackWidth"; 619 | editorTemplate -suppress "safeAction"; 620 | editorTemplate -suppress "safeTitle"; 621 | editorTemplate -suppress "text"; 622 | editorTemplate -suppress "pad"; 623 | 624 | editorTemplate -suppress "instObjGroups"; 625 | editorTemplate -suppress "useObjectColor"; 626 | editorTemplate -suppress "lodVisibility"; 627 | editorTemplate -suppress "localPosition"; 628 | editorTemplate -suppress "nodeState"; 629 | editorTemplate -suppress "castsShadows"; 630 | editorTemplate -suppress "receiveShadows"; 631 | editorTemplate -suppress "motionBlur"; 632 | editorTemplate -suppress "primaryVisibility"; 633 | editorTemplate -suppress "visibleInReflections"; 634 | editorTemplate -suppress "visibleInRefractions"; 635 | editorTemplate -suppress "doubleSided"; 636 | editorTemplate -suppress "opposite"; 637 | editorTemplate -suppress "geometryAntialiasingOverride"; 638 | editorTemplate -suppress "antialiasingLevel"; 639 | editorTemplate -suppress "shadingSamplesOverride"; 640 | editorTemplate -suppress "shadingSamples"; 641 | editorTemplate -suppress "maxShadingSamples"; 642 | editorTemplate -suppress "volumeSamplesOverride"; 643 | editorTemplate -suppress "volumeSamples"; 644 | editorTemplate -suppress "depthJitter"; 645 | editorTemplate -suppress "maxVisibilitySamplesOverride"; 646 | editorTemplate -suppress "maxVisibilitySamples"; 647 | editorTemplate -suppress "boundingBoxScale"; 648 | editorTemplate -suppress "featureDisplacement"; 649 | editorTemplate -suppress "initialSampleRate"; 650 | editorTemplate -suppress "extraSampleRate"; 651 | editorTemplate -suppress "textureThreshold"; 652 | editorTemplate -suppress "normalThreshold"; 653 | editorTemplate -suppress "ghosting"; 654 | editorTemplate -suppress "ghostingControl"; 655 | editorTemplate -suppress "ghostPreSteps"; 656 | editorTemplate -suppress "ghostPostSteps"; 657 | editorTemplate -suppress "ghostStepSize"; 658 | editorTemplate -suppress "ghostFrames"; 659 | editorTemplate -suppress "ghostRangeStart"; 660 | editorTemplate -suppress "ghostRangeEnd"; 661 | editorTemplate -suppress "ghostDriver"; 662 | editorTemplate -suppress "ghostFrames"; 663 | editorTemplate -suppress "ghostCustomSteps"; 664 | editorTemplate -suppress "drawOverride"; 665 | editorTemplate -suppress "useObjectColor"; 666 | editorTemplate -suppress "objectColor"; 667 | editorTemplate -suppress "center"; 668 | editorTemplate -suppress "matrix"; 669 | editorTemplate -suppress "inverseMatrix"; 670 | editorTemplate -suppress "worldMatrix"; 671 | editorTemplate -suppress "worldInverseMatrix"; 672 | editorTemplate -suppress "parentMatrix"; 673 | editorTemplate -suppress "parentInverseMatrix"; 674 | editorTemplate -suppress "instObjGroups"; 675 | editorTemplate -suppress "renderInfo"; 676 | editorTemplate -suppress "ignoreSelfShadowing"; 677 | editorTemplate -suppress "caching"; 678 | editorTemplate -suppress "intermediateObject"; 679 | editorTemplate -suppress "compInstObjGroups"; 680 | editorTemplate -suppress "localScale"; 681 | editorTemplate -suppress "renderLayerInfo"; 682 | 683 | editorTemplate -endNoOptimize; 684 | } 685 | 686 | global proc AEspReticleLocTemplate( string $nodeName ) 687 | { 688 | AEswatchDisplay $nodeName; 689 | editorTemplate -beginScrollLayout; 690 | editorTemplate -beginNoOptimize; 691 | editorTemplate -addControl "visibility"; 692 | editorTemplate -addControl "drawingEnabled"; 693 | editorTemplate -label "Not Selectable" -addControl "template"; 694 | editorTemplate -addControl "enableTextDrawing"; 695 | editorTemplate -endNoOptimize; 696 | 697 | editorTemplate -beginLayout "Filmback Attributes" -collapse 1; 698 | editorTemplate -addControl "displayFilmGate"; 699 | editorTemplate -callCustom "AEspReticleLocDrawFilmback" "AEspReticleLocUpdateFilmback" ""; 700 | editorTemplate -addControl "filmGateMaskColor"; 701 | editorTemplate -addControl "filmGateMaskTrans"; 702 | editorTemplate -addControl "filmGateLineColor"; 703 | editorTemplate -addControl "filmGateLineTrans"; 704 | editorTemplate -beginNoOptimize; 705 | editorTemplate -addControl "displaySafeAction"; 706 | editorTemplate -addControl "displaySafeTitle"; 707 | editorTemplate -endNoOptimize; 708 | editorTemplate -endLayout; 709 | editorTemplate -beginLayout "Projection Gate Attributes" -collapse 1; 710 | editorTemplate -addControl "displayProjGate"; 711 | editorTemplate -callCustom "AEspReticleLocDrawProjection" "AEspReticleLocUpdateProjection" "projectionGate" ""; 712 | editorTemplate -addControl "projGateMaskColor"; 713 | editorTemplate -addControl "projGateMaskTrans"; 714 | editorTemplate -addControl "projGateLineColor"; 715 | editorTemplate -addControl "projGateLineTrans"; 716 | editorTemplate -endLayout; 717 | editorTemplate -beginLayout "Pan and Scan Attributes" -collapse 1; 718 | editorTemplate -label "Display Mode" -addControl "panScanDisplayMode"; 719 | editorTemplate -label "Aspect Ratio" -addControl "panScanAspectRatio"; 720 | editorTemplate -label "Pan/Scan Aspect Ratio" -addControl "panScanRatio"; 721 | editorTemplate -label "Pan/Scan Offset" -addControl "panScanOffset"; 722 | editorTemplate -label "Mask Color" -addControl "panScanMaskColor"; 723 | editorTemplate -label "Mask Transp." -addControl "panScanMaskTrans"; 724 | editorTemplate -label "Line Color" -addControl "panScanLineColor"; 725 | editorTemplate -label "Line Transp." -addControl "panScanLineTrans"; 726 | editorTemplate -beginNoOptimize; 727 | editorTemplate -label "Display Safe Action (90%)" -addControl "panScanDisplaySafeAction"; 728 | editorTemplate -label "Display Safe Title (80%)" -addControl "panScanDisplaySafeTitle"; 729 | editorTemplate -endNoOptimize; 730 | editorTemplate -endLayout; 731 | editorTemplate -beginLayout "Pad Attributes" -collapse 1; 732 | editorTemplate -label "Use Pad" -addControl "usePad"; 733 | editorTemplate -addControl "padAmount"; 734 | editorTemplate -label "Display Mode" -addControl "padDisplayMode"; 735 | editorTemplate -label "Mask Color" -addControl "padMaskColor"; 736 | editorTemplate -label "Mask Transp." -addControl "padMaskTrans"; 737 | editorTemplate -label "Line Color" -addControl "padLineColor"; 738 | editorTemplate -label "Line Transp." -addControl "padLineTrans"; 739 | editorTemplate -endLayout; 740 | editorTemplate -callCustom "AEspReticleLocDrawAspectRatios" "AEspReticleLocDrawAspectRatios" "aspectRatios"; 741 | editorTemplate -callCustom "AEspReticleLocDrawText" "AEspReticleLocDrawText" "text"; 742 | editorTemplate -beginLayout "Options" -collapse 1; 743 | editorTemplate -addControl "cameraFilterMode"; 744 | editorTemplate -addSeparator; 745 | editorTemplate -label "Text Color" -addControl "miscTextColor"; 746 | editorTemplate -label "Text Transp." -addControl "miscTextTrans"; 747 | editorTemplate -addControl "lineColor"; 748 | editorTemplate -addControl "lineTrans"; 749 | editorTemplate -addSeparator; 750 | editorTemplate -addControl "displayLens"; 751 | editorTemplate -addControl "displayFrame"; 752 | editorTemplate -addControl "displayLineH"; 753 | editorTemplate -addControl "displayLineV"; 754 | editorTemplate -addControl "displayThirdsH"; 755 | editorTemplate -addControl "displayThirdsV"; 756 | editorTemplate -addControl "displayCrosshair"; 757 | editorTemplate -addControl "displayFieldGuide"; 758 | editorTemplate -addControl "displayAspectText"; 759 | editorTemplate -addSeparator; 760 | editorTemplate -addControl "hideLocator"; 761 | editorTemplate -addControl "driveCameraAperture"; 762 | editorTemplate -addControl "useOverscan"; 763 | editorTemplate -addControl "maximumDistance"; 764 | editorTemplate -endLayout; 765 | 766 | // include/call base class/node attributes 767 | //AEdependNodeTemplate $nodeName; 768 | //AElocatorInclude $nodeName; 769 | 770 | //exclude container attributes. This was introduced in Maya 2011 771 | if (exists("AEcontainerNodeSuppress")) 772 | AEcontainerNodeSuppress($nodeName); 773 | 774 | //exclude attributes 775 | excludeAttributes; 776 | 777 | editorTemplate -addExtraControls; 778 | editorTemplate -endScrollLayout; 779 | } 780 | 781 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | ============================= 2 | Download Versions Information 3 | ============================= 4 | 5 | 2.1 (03/08/2024) 6 | Bug fixes and features done at Imageworks from 2014 to 2024: 7 | - Minor bug fixes and code changes to make compile on newer gcc 8 | compilers and Maya versions. 9 | - New "MEL command" and "Python command" text types. 10 | - Changes to make code compile in Visual Studio on Windows. 11 | 12 | 2.0 (11/12/2013) 13 | Major update by Henry Vera to support 14 | - Viewport 2.0, starting with Maya 2013. 15 | - MUIDrawManager starting with Maya 2014. 16 | - Scalable texture mapped font for VP1.0 and VP2.0. 17 | - Absolute filmback sizes. 18 | - Filmback and Projection Gate masks. 19 | - Connected Cameras mode. 20 | - Displaying a Field Guide. 21 | - Some bug-fixes and other minor improvements. 22 | 23 | Camera 2D Pan/Zoom feature (similar to Maya built-in Film gate by 24 | pressing backslash "\") with middle/right mouse). 25 | 26 | 1.3 (01/08/2012) 27 | Fixed Maya 2012 issue with short name for hideLocator attribute. 28 | Minor change to AEspReticleLocTemplate.mel: added driveCameraAperture 29 | check around updating cameras. 30 | 31 | 1.2 (10/11/2010) 32 | New enableTextDrawing option (added by Sveinbjörn J. Tryggvason at sjt@sjt.is). 33 | 34 | 1.1 (08/06/2009) 35 | Fixes in AEspReticleLocTemplate.mel: 36 | - removed spSprintf dependency. 37 | - fixed typo ("foatField" to "floatField"). 38 | - fixed unknown "maskColor" attribute to "aspectMaskColor". 39 | 40 | Fixes in spReticleLoc.mel: 41 | - removed spInclude statement. 42 | 43 | 1.0 (07/29/2009) 44 | Initial release. 45 | 46 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | cmake_policy(SET CMP0074 NEW) # recognize _Root variables 3 | project(spReticleLoc VERSION $ENV{SPDEV_COMPONENT_VERSION}) 4 | 5 | find_package(Maya REQUIRED) 6 | 7 | set(PLUGIN_NAME "spReticleLoc") 8 | 9 | #if (DEFINED ENV{SPK_PKG_VERSION}) 10 | # message(STATUS "SPK_PKG_VERSION: $ENV{SPK_PKG_VERSION}") 11 | # add_definitions(-DPACKAGE_VERSION=$ENV{SPK_PKG_VERSION}) 12 | #endif() 13 | 14 | # Needed by some Maya include files: 15 | #add_definitions(-DLINUX) 16 | 17 | file(GLOB SPRETICLELOC_SOURCES *.cpp) 18 | 19 | add_library( 20 | ${PLUGIN_NAME} 21 | SHARED 22 | ${SPRETICLELOC_SOURCES} 23 | ) 24 | 25 | target_link_libraries( 26 | ${PLUGIN_NAME} 27 | PRIVATE 28 | Maya::OpenMaya 29 | Maya::OpenMayaAnim 30 | Maya::OpenMayaUI 31 | ) 32 | 33 | target_include_directories(${PLUGIN_NAME} PRIVATE ${LIBS_INCLUDE}) 34 | 35 | file(MAKE_DIRECTORY scripts/maya/others) 36 | install(FILES 37 | AEspReticleLocTemplate.mel 38 | DESTINATION scripts/maya/others 39 | ) 40 | 41 | file(MAKE_DIRECTORY scripts/maya/spReticleLoc) 42 | install(FILES 43 | spReticleLoc.mel 44 | spReticleLocWindows.mel 45 | DESTINATION scripts/maya/spReticleLoc 46 | ) 47 | 48 | set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "") 49 | 50 | install(TARGETS ${PLUGIN_NAME} DESTINATION plugins/maya) 51 | 52 | -------------------------------------------------------------------------------- /GPURenderer.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // GPURenderer.cpp 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #include "GPURenderer.h" 43 | 44 | GPURenderer::GPURenderer() 45 | { 46 | } 47 | 48 | 49 | GPURenderer::~GPURenderer() 50 | { 51 | } 52 | 53 | void GPURenderer::setFilmback(Filmback* filmback) 54 | { 55 | this->filmback = filmback; 56 | } 57 | -------------------------------------------------------------------------------- /GPURenderer.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // GPURenderer.h 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #ifndef spReticle_GPURenderer_h 43 | #define spReticle_GPURenderer_h 44 | 45 | #include "util.h" 46 | 47 | class GPURenderer 48 | { 49 | public: 50 | GPURenderer(); 51 | virtual ~GPURenderer() =0; 52 | 53 | virtual void prepareForDraw(float portWidth, float portHeight) {}; 54 | virtual void postDraw() {}; 55 | 56 | // Set the filmback 57 | virtual void setFilmback(Filmback* filmback); 58 | 59 | // Given two Geom instances, this renders the mask area between them. 60 | virtual void drawMask( Geom g1, Geom g2, MColor color, bool sides, bool top=true ) =0; 61 | 62 | // This draws a single line between the specified points. 63 | virtual void drawLine(double x1, double x2, double y1, double y2, 64 | MColor color, bool stipple) =0; 65 | 66 | // Given a Geom instance, this will draw a line connecting the points. 67 | // The argument side determines whether the sides will be drawn (the top 68 | // will always be drawn). The stipple argument specifies whether the line 69 | // should be solid or dashed/stippled. 70 | virtual void drawLines( Geom g, MColor color, bool sides, bool stipple) =0; 71 | 72 | // This function is responsible for rendering text. 73 | virtual void drawText(TextData *td, double tx, double ty) =0; 74 | 75 | // Make sure everything is ready for text drawing 76 | virtual void enableTextRendering() {}; 77 | 78 | // Turn off text rendering 79 | virtual void disableTextRendering() {}; 80 | 81 | protected: 82 | // The filmback of the camera 83 | Filmback *filmback; 84 | }; 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a Maya plugin. 2 | 3 | ################################## 4 | # Platform specific build settings 5 | ################################## 6 | 7 | ARCH = $(shell uname -m) 8 | BUILDDIR = Build/$(ARCH) 9 | 10 | NO_TRANS_LINK = 11 | CFLAGS = -DLINUX -D_BOOL -DREQUIRE_IOSTREAM -DBits64_ -DLINUX_64 -fPIC 12 | 13 | C++FLAGS = $(CFLAGS) -Wno-deprecated -fno-gnu-keywords 14 | 15 | LD = $(CPP) $(NO_TRANS_LINK) $(C++FLAGS) -Wl,-Bsymbolic -shared 16 | 17 | INCLUDES = -I. -I$(MAYA_LOCATION)/include -I/opt/X11/include 18 | LIBS = -L$(MAYA_LOCATION)/lib 19 | 20 | debug: spReticleLoc.o spReticleLoc.so 21 | opt: spReticleLoc.o spReticleLoc.so 22 | 23 | debug: BUILDDIR = Build/$(ARCH)-debug 24 | debug: CFLAGS += -g -gstabs+ 25 | 26 | opt: BUILDDIR = Build/$(ARCH)-opt 27 | opt: CFLAGS += -O3 28 | 29 | .cpp.o: 30 | -mkdir -p $(BUILDDIR) 31 | $(CPP) -c $(INCLUDES) $(C++FLAGS) -o $(BUILDDIR)/$@ $< 32 | 33 | plugins: \ 34 | spReticleLoc.so 35 | 36 | clean: 37 | -rm -f Build/*/*.o 38 | 39 | Clean: 40 | -rm -rf Build 41 | 42 | ################## 43 | # Specific Rules # 44 | ################## 45 | GPURenderer.o : util.h GPURenderer.h GPURenderer.cpp 46 | OpenGLRenderer.o : font.h OpenGLRenderer.h OpenGLRenderer.cpp 47 | V2Renderer.o : V2Renderer.h V2Renderer.cpp 48 | spReticleLoc.o : defines.h util.h spReticleLoc.h spReticleLoc.cpp 49 | 50 | spReticleLoc.so: GPURenderer.o OpenGLRenderer.o V2Renderer.o spReticleLoc.o 51 | -@mkdir -p $(BUILDDIR) 52 | -@rm -f $@ 53 | $(LD) -o $(BUILDDIR)/$@ $(BUILDDIR)/GPURenderer.o $(BUILDDIR)/OpenGLRenderer.o $(BUILDDIR)/V2Renderer.o $(BUILDDIR)/spReticleLoc.o $(LIBS) -lOpenMaya -lOpenMayaRender -lOpenMayaUI 54 | @echo "" 55 | @echo "###################################################" 56 | @echo successfully compiled $@ into $(BUILDDIR) 57 | @echo $(CURDIR)/$(BUILDDIR)/$@ 58 | @echo "" 59 | 60 | -------------------------------------------------------------------------------- /Makefile.spi: -------------------------------------------------------------------------------- 1 | # ***************************************************************************** # 2 | # Copyright (c) 2005 Sony Pictures Imageworks, Inc. 3 | # All rights reserved. 4 | # 5 | # This material contains the confidential and proprietary information 6 | # of Sony Pictures Imageworks, Inc. and may not be disclosed, copied or 7 | # duplicated in any form, electronic or hardcopy, in whole or in part, 8 | # without the express prior written consent of Sony Pictures Imageworks, 9 | # Inc. This copyright notice does not imply publication. 10 | # 11 | # ***************************************************************************** 12 | # 13 | # Makefile for a maya plugin. 14 | 15 | # Type of build: bin, lib, dso or maya (or script) 16 | PROJECT_TYPE = maya 17 | 18 | ifndef MAYA_VERSION 19 | MAYA_VERSION = 2020 20 | endif 21 | 22 | # This will be the root of the plugin name as well as 23 | # the directory name needed for installing any mel 24 | PROJECT = spReticleLoc 25 | 26 | # Lets you tell the install rule which show to install this on. 27 | MAYA_SHOW = spi 28 | 29 | # Lets the install rule know to install in your dev directory on a 30 | # particular show. 31 | MAYA_DEV = dev 32 | 33 | # The extension used on your C++ files 34 | C++SUFFIX=.cpp 35 | 36 | # Any additional C++ and C flags to pass to the compiler 37 | CXXFLAGS = 38 | CFLAGS = 39 | 40 | IPATH = -I/usr/include/freetype2 41 | LPATH = -L$(OPENGLDSO) 42 | 43 | # This variable contains the roots of all file pairs that exist in 44 | # .cpp and .h form. (for instance, "yourClass1" will be expanded 45 | # to yourClass1.cpp and yourClass1.h). Any additional .cpp or .h files 46 | # can go in the CXXFILES and HFILES variables 47 | CLASSES = spReticleLoc GPURenderer OpenGLRenderer V2Renderer 48 | CXXFILES = 49 | CFILES = 50 | HFILES = defines.h font.h util.h 51 | 52 | # This contains all of the mel files that need to be installed for 53 | # this tool to work. A "make install" will place these files in 54 | # the correct mel folder. Place AE templates in MAYA_MELFILES_OTHERS. 55 | # You can use MAYA_MELFILES = $(notdir $(wildcard $(SRCDIR)/*.mel)) 56 | MAYA_MELDIR = 57 | MAYA_MELFILES = 58 | MAYA_MELFILES_OTHERS = AEspReticleLocTemplate.mel 59 | 60 | # Use the SYSLIBS variable to link against Maya libs, for example: 61 | SYSLIBS = -lOpenMaya -lOpenMayaUI -lOpenMayaAnim 62 | SYSLIBS += -lftgl 63 | 64 | # Sibling directories that contain libraries that must 65 | # be compiled as well 66 | COMPONENTS = 67 | 68 | # This sets the optimisation level for the 'opt' target 69 | OPT_LEVEL = 3 70 | 71 | # Essentially, the Make System makes certain 72 | # "intelligent" decisions about what to name libraries. When building 73 | # Maya plug-ins, those decisions are not so great. This lets the 74 | # system know to make a copy of the resulting dso with the name in the 75 | # variable. 76 | POST_LINK_RENAME = $(PROJECT).so 77 | 78 | # Type of compiled code installed when using 79 | # 'make install' and 'make install_local' 80 | INSTALL_TYPE=opt 81 | INSTALL_LOCAL_TYPE=opt 82 | 83 | # IMPORTANT! You need to type in the exact name of this file here! 84 | # There is a make flaw that does not let me know the name of this file 85 | # and since I need to call it recursively, you need to tell me the 86 | # name here. 87 | MAKEFILE = Makefile.spi 88 | 89 | # You should not need to tweak this, it is used for debugging 90 | MAKEFILE_SOURCE=/usr/local/spi/lib/make 91 | 92 | # Don't touch this line - this where the work gets done! 93 | include $(MAKEFILE_SOURCE)/Makefile.unique 94 | -------------------------------------------------------------------------------- /OpenGLRenderer.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // OpenGLRenderer.cpp 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #define GL_GLEXT_PROTOTYPES 43 | 44 | #include 45 | #include 46 | 47 | #include "font.h" 48 | #include "OpenGLRenderer.h" 49 | #ifndef _WIN32 50 | # include "GL/glext.h" 51 | #else 52 | # include "glext.h" 53 | #endif 54 | 55 | OpenGLRenderer::OpenGLRenderer() 56 | { 57 | // Populate fontMap 58 | FontData *fd; 59 | for (int fontIndex = 0; fontIndex < NUM_FONTS; fontIndex++) { 60 | TextureFont *font = fonts[fontIndex]; 61 | int size = int(font->size); 62 | 63 | // Check to see if we already have a font for this size 64 | FontMap::iterator it = fontMap.find(size); 65 | if (it == fontMap.end()) { 66 | fd = new FontData(size); 67 | fontMap[size] = fd; 68 | } 69 | else 70 | fd = fontMap[size]; 71 | 72 | if (font->bold) { 73 | fd->bold = font; 74 | if (!fd->generic) 75 | fd->generic = font; 76 | } 77 | else { 78 | fd->normal = font; 79 | fd->generic = font; 80 | } 81 | 82 | // Populate glyphMap based on wchar_t 83 | for (unsigned int glyphIndex = 0; glyphIndex < font->glyphs_count;glyphIndex++) { 84 | TextureGlyph *glyph = &font->glyphs[glyphIndex]; 85 | font->glyphMap[glyph->charcode] = glyph; 86 | } 87 | } 88 | } 89 | 90 | OpenGLRenderer::~OpenGLRenderer() 91 | { 92 | } 93 | 94 | void OpenGLRenderer::prepareForDraw(float portWidth, float portHeight) 95 | { 96 | // Store all of the openGL attribute settings 97 | glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); 98 | 99 | // Go into 2D ortho mode 100 | glMatrixMode( GL_MODELVIEW ); 101 | glPushMatrix(); 102 | 103 | glMatrixMode( GL_PROJECTION ); 104 | glPushMatrix(); 105 | glLoadIdentity(); 106 | glOrtho( 107 | 0.0, (GLdouble) portWidth, 108 | 0.0, (GLdouble) portHeight, 109 | -1, 1 110 | ); 111 | glMatrixMode( GL_MODELVIEW ); 112 | glLoadIdentity(); 113 | 114 | // Turn on openGL blending for transparency 115 | glEnable(GL_BLEND); 116 | 117 | // Store the current blend types 118 | glGetIntegerv(GL_BLEND_SRC, & blendAttrs[0]); 119 | glGetIntegerv(GL_BLEND_DST, & blendAttrs[1]); 120 | 121 | // Set the blending function 122 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 123 | 124 | // Disable Depth testing 125 | glDisable( GL_DEPTH_TEST ); 126 | glDepthMask( GL_FALSE ); 127 | 128 | #ifndef _WIN32 129 | // Fix multiple light VP 2.0 text issue 130 | // Note: either one works below: 131 | // Note: currently we do not have glext.h (and libftgl.so) on Windows. 132 | glActiveTextureARB( GL_TEXTURE0_ARB ); 133 | //glActiveTextureARB( GL_TEXTURE0 ); 134 | #endif 135 | } 136 | 137 | void OpenGLRenderer::postDraw() 138 | { 139 | // Turn on z-depth test 140 | glDepthMask( GL_TRUE ); 141 | glEnable( GL_DEPTH_TEST ); 142 | 143 | // Turn off blending 144 | glDisable(GL_BLEND); 145 | 146 | // Restore blend settings 147 | glBlendFunc(blendAttrs[0], blendAttrs[1]); 148 | 149 | // Restore matrix 150 | glMatrixMode( GL_PROJECTION ); 151 | glPopMatrix(); 152 | glMatrixMode( GL_MODELVIEW ); 153 | glPopMatrix(); 154 | 155 | // Restore all attributes 156 | glPopAttrib(); 157 | } 158 | 159 | // Given two Geom instances, this calculates the mask area between them. 160 | // 161 | void OpenGLRenderer::drawMask( Geom g1, Geom g2, MColor color, bool sides, bool top=true ) 162 | { 163 | glBegin( GL_QUADS ); 164 | 165 | glColor4f( color.r, color.g, color.b, 1-color.a ); 166 | 167 | if (top) 168 | { 169 | if ( (g2.y1 - g1.y1) > EPSILON ) 170 | { 171 | // Bottom Mask 172 | glVertex2d( g1.x1, g1.y1 ); 173 | glVertex2d( g1.x2, g1.y1 ); 174 | glVertex2d( g2.x2, g2.y1 ); 175 | glVertex2d( g2.x1, g2.y1 ); 176 | } 177 | 178 | if ( (g1.y2 - g2.y2) > EPSILON ) 179 | { 180 | // Top Mask 181 | glVertex2d( g2.x1, g2.y2 ); 182 | glVertex2d( g2.x2, g2.y2 ); 183 | glVertex2d( g1.x2, g1.y2 ); 184 | glVertex2d( g1.x1, g1.y2 ); 185 | } 186 | } 187 | else 188 | { 189 | g1.y1 = g2.y1; 190 | g1.y2 = g2.y2; 191 | } 192 | 193 | if (sides) 194 | { 195 | // Left side mask 196 | if ((g2.x1 - g1.x1) > EPSILON) 197 | { 198 | glVertex2d( g1.x1, g1.y1 ); 199 | glVertex2d( g2.x1, g2.y1 ); 200 | glVertex2d( g2.x1, g2.y2 ); 201 | glVertex2d( g1.x1, g1.y2 ); 202 | } 203 | 204 | // right side mask 205 | if ((g1.x2 - g2.x2) > EPSILON) 206 | { 207 | glVertex2d( g2.x2, g2.y1 ); 208 | glVertex2d( g1.x2, g1.y1 ); 209 | glVertex2d( g1.x2, g1.y2 ); 210 | glVertex2d( g2.x2, g2.y2 ); 211 | } 212 | } 213 | 214 | glEnd(); 215 | } 216 | 217 | // This draws a single line between the specified points. 218 | // 219 | void OpenGLRenderer::drawLine(double x1, double x2, double y1, double y2, 220 | MColor color, bool stipple) 221 | { 222 | if (stipple) 223 | { 224 | glEnable (GL_LINE_STIPPLE); 225 | glLineStipple(2,0x00FF); 226 | } 227 | 228 | glBegin( GL_LINES ); 229 | 230 | glColor4f( color.r, color.g, color.b, 1-color.a ); 231 | 232 | glVertex2d( x1, y1 ); 233 | glVertex2d( x2, y2 ); 234 | 235 | glEnd(); 236 | 237 | if (stipple) 238 | glDisable (GL_LINE_STIPPLE); 239 | 240 | } 241 | 242 | // Given a Geom instance, this will draw a line connecting the points. 243 | // The argument side determines whether the sides will be drawn (the top 244 | // will always be drawn). The stipple argument specifies whether the line 245 | // should be solid or dashed/stippled. 246 | // 247 | void OpenGLRenderer::drawLines( Geom g, MColor color, bool sides, bool stipple) 248 | { 249 | if (stipple) 250 | { 251 | glEnable (GL_LINE_STIPPLE); 252 | glLineStipple(1,0x00FF); 253 | } 254 | 255 | GLenum mode = ( sides ) ? GL_LINE_LOOP : GL_LINES; 256 | 257 | glBegin( mode ); 258 | 259 | glColor4f( color.r, color.g, color.b, 1-color.a ); 260 | 261 | glVertex2d( g.x1, g.y1 ); 262 | glVertex2d( g.x2, g.y1 ); 263 | glVertex2d( g.x2, g.y2 ); 264 | glVertex2d( g.x1, g.y2 ); 265 | 266 | glEnd( ); 267 | 268 | if (stipple) 269 | glDisable (GL_LINE_STIPPLE); 270 | } 271 | 272 | // This function uses a font texture atlas to draw text. 273 | // 274 | void OpenGLRenderer::drawText(TextData *td, double tx, double ty) 275 | { 276 | double screenScaleFactor = (td->textScale) ? filmback->filmbackGeom.x/1280.0f : 1.0f; 277 | double fontScaleFactor = (double(td->textSize) / double(MAXFONT)) * screenScaleFactor; 278 | 279 | // Get the specified font; 280 | TextureFont *font = (td->textBold) ? &font_120pt_bold : &font_120pt; 281 | 282 | // Get wchar pointer to text 283 | const wchar_t *textPtr = td->textStr.asWChar(); 284 | 285 | // Build glyph array to calculate width and then draw 286 | float textWidth = 0.0f; 287 | float textHeight = 0.0f; 288 | int numChars = wcslen(textPtr); 289 | 290 | std::vector glyphs(numChars); 291 | std::vector kerning(numChars, 0.0); 292 | 293 | for (int i = 0; i < numChars; i++) { 294 | GlyphMap::iterator it = font->glyphMap.find(textPtr[i]); 295 | if (it == font->glyphMap.end()) { 296 | std::cout << "Unable to find font character for '" << textPtr[i] << "' for size " << font->size << std::endl; 297 | return; 298 | } 299 | 300 | glyphs[i] = *(it->second); 301 | 302 | textWidth += glyphs[i].advance_x; 303 | textHeight = (std::max)(textHeight,float(glyphs[i].height)); 304 | 305 | if (i > 0 && glyphs[i].kerning_count) { 306 | double kernAmount = 0.0; 307 | for(unsigned int kernIndex = 0; kernIndex < glyphs[i].kerning_count; kernIndex++) { 308 | if (glyphs[i].kerning[kernIndex].charcode == textPtr[i-1] ) { 309 | kernAmount = glyphs[i].kerning[kernIndex].kerning; 310 | break; 311 | } 312 | } 313 | kerning[i] = kernAmount; 314 | textWidth += kerning[i]; 315 | } 316 | else 317 | kerning[i] = 0.0; 318 | } 319 | 320 | // Scale textWidth based upon the fontScaleFactor; 321 | textWidth *= fontScaleFactor; 322 | textHeight *= fontScaleFactor; 323 | 324 | // Adjust tx for text alignment 325 | switch (td->textAlign) { 326 | case 1: 327 | tx -= textWidth / 2.0f; 328 | break; 329 | case 2: 330 | tx -= textWidth; 331 | break; 332 | } 333 | 334 | // Adjust ty for text alignment 335 | switch (td->textVAlign) { 336 | case 1: 337 | ty -= textHeight / 2.0f; 338 | break; 339 | case 2: 340 | ty -= textHeight; 341 | break; 342 | } 343 | 344 | // Adjust text position to account for screen scaling 345 | tx += td->textPosX*screenScaleFactor; 346 | ty += td->textPosY*screenScaleFactor; 347 | 348 | // Actually draw the glyphs 349 | glColor4f( td->textColor.r, td->textColor.g, td->textColor.b, 1-td->textColor.a ); 350 | for( int i=0; i 46 | #include 47 | #include 48 | 49 | #include "defines.h" 50 | #include "font.h" 51 | 52 | #include "GPURenderer.h" 53 | 54 | #if defined(OSMac_MachO_) 55 | # include 56 | #else 57 | # if defined(_WIN32) 58 | # include 59 | # endif 60 | # include 61 | #endif 62 | 63 | // General OpenGL Renderer 64 | class OpenGLRenderer : public GPURenderer 65 | { 66 | public: 67 | OpenGLRenderer(); 68 | virtual ~OpenGLRenderer(); 69 | 70 | virtual void prepareForDraw(float portWidth, float portHeight); 71 | virtual void postDraw(); 72 | 73 | // Given two Geom instances, this renders the mask area between them. 74 | virtual void drawMask( Geom g1, Geom g2, MColor color, bool sides, bool top ); 75 | 76 | // This draws a single line between the specified points. 77 | virtual void drawLine(double x1, double x2, double y1, double y2, 78 | MColor color, bool stipple); 79 | 80 | // Given a Geom instance, this will draw a line connecting the points. 81 | // The argument side determines whether the sides will be drawn (the top 82 | // will always be drawn). The stipple argument specifies whether the line 83 | // should be solid or dashed/stippled. 84 | virtual void drawLines( Geom g, MColor color, bool sides, bool stipple); 85 | 86 | // This function is responsible for rendering text. 87 | virtual void drawText(TextData *td, double tx, double ty); 88 | 89 | // Make sure everything is ready for text drawing 90 | virtual void enableTextRendering(); 91 | 92 | // Turn off text rendering 93 | virtual void disableTextRendering(); 94 | 95 | private: 96 | class FontData 97 | { 98 | public: 99 | int size; 100 | TextureFont *normal; 101 | TextureFont *bold; 102 | TextureFont *generic; 103 | FontData(int fontSize) { 104 | size =fontSize; 105 | normal = NULL; 106 | bold =NULL; 107 | generic =NULL; 108 | } 109 | }; 110 | 111 | typedef std::map FontMap; 112 | FontMap fontMap; 113 | 114 | GLint blendAttrs[2]; 115 | }; 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | ======================================= 2 | spReticle: Build Notes and Instructions 3 | ======================================= 4 | 5 | Originally developed at Sony Pictures Imageworks, imageworks-maya-reticle 6 | (spReticle) is a Maya C++ plugin plus MEL code which creates a reticle for a 7 | camera. It allows for various camera reference masks to be displayed when 8 | looking through the camera, such as filmback, projection gate, and 9 | pan-and-scan attributes. The value of predefined parameters can be displayed 10 | in selectable areas, such as the camera focal length and name, current aspect 11 | ratio; frame number, name of the show and shot, Maya scene file name, current 12 | user name, etc. Finally, arbitrary textual information can be displayed as well. 13 | You can see a short video on how to create a spReticle in Maya and set some of 14 | the parameters here: http://vimeo.com/6186489 15 | spReticle is a camera reticle for Maya. 16 | 17 | Project Home: 18 | ------------- 19 | https://github.com/imageworks/spReticle 20 | 21 | 22 | Files: 23 | ------ 24 | README.txt 25 | CHANGES.txt 26 | Makefile 27 | spReticleLoc - Main classes 28 | GPURenderer - Abstract class for handling GPU Rendering 29 | OpenGLRenderer - Handles OGL renderering for VP1.0 and possibly VP2.0 (default) 30 | V2Renderer - Handles VP2.0 rendering 31 | util.h - Utility classes 32 | defines.h - Defines to drive compilation/options 33 | font.h - Font Texture Atlas used for OGL font rendering 34 | AEspReticleLocTemplate.mel - Attribute Editor Template for spReticle 35 | spReticleLocLinux.mel - MEL code to create a spReticle node on Linux 36 | 37 | Additional files for Windows: 38 | spReticleLoc.vcxproj 39 | spReticleLoc.vcxproj.filters 40 | spReticleLoc.vcxproj.user 41 | spReticleLoc.sln 42 | spReticleLocWindows.mel - MEL code to create a spReticle node on Windows 43 | 44 | Additional SPI internal files which can be ignored: 45 | Makefile.spi 46 | CMakeLists.txt 47 | .gitlab-ci.yml 48 | .spdev.yaml 49 | spreticleloc.spk.yaml 50 | spReticleLoc.mel 51 | 52 | 53 | Configure Options: 54 | ------------------ 55 | 56 | The defines.h file concentrates all of the defines that can be used to 57 | tailor the spReticle to your environment. 58 | 59 | 60 | Compile Information: 61 | -------------------- 62 | 63 | This is how to compile for 64-bit Maya on Linux using g++. For other 64 | architectures and compilers modify Makefile accordingly. 65 | 66 | Define the actual path to your compiler in CPP and the path of your Maya install 67 | directory in MAYA_LOCATION on the command line. For example: 68 | 69 | make opt CPP=/opt/rh/devtoolset-6/root/usr/bin/g++ MAYA_LOCATION=/usr/autodesk/maya2020 70 | 71 | 72 | Usage information: 73 | ------------------ 74 | 75 | In the Maya script editor, do this to create a maya-reticle. Note that 76 | you might have to put in the abolute path to the plugin and MEL files: 77 | 78 | // Load plugin 79 | loadPlugin "spReticleLoc.so"; 80 | 81 | // Load MEL code 82 | source "spReticleLoc.mel"; 83 | 84 | // Load attribute editor template; note that this should not be necessary 85 | // if you installed it in the proper place so Maya finds it and loads it 86 | // automatically when you create a spReticleLoc node. 87 | source "AEspReticleLocTemplate.mel"; 88 | 89 | // Create a spReticleLoc node 90 | spReticleLocCreate; 91 | 92 | 93 | Texture Font Information: 94 | ------------------------- 95 | The freetype-gl library was used to generate most of font.h which contains 96 | a texture font atlas. The original copyright information is contained within 97 | the header of the file. 98 | 99 | -------------------------------------------------------------------------------- /V2Renderer.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // V2Renderer.cpp 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #include 43 | 44 | #if (MAYA_API_VERSION >= 201400) 45 | 46 | #include 47 | 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include "V2Renderer.h" 54 | 55 | V2Renderer::V2Renderer() 56 | { 57 | } 58 | 59 | V2Renderer::~V2Renderer() 60 | { 61 | } 62 | 63 | void V2Renderer::setDrawManager(MHWRender::MUIDrawManager* drawManager) 64 | { 65 | this->drawManager = drawManager; 66 | } 67 | 68 | void V2Renderer::prepareForDraw(float portWidth, float portHeight) 69 | { 70 | drawManager->beginDrawable(); 71 | } 72 | 73 | void V2Renderer::postDraw() 74 | { 75 | drawManager->endDrawable(); 76 | } 77 | 78 | // Given two Geom instances, this calculates the mask area between them. 79 | // 80 | void V2Renderer::drawMask( Geom g1, Geom g2, MColor color, bool sides, bool top=true ) 81 | { 82 | //drawManager->beginDrawable(); 83 | 84 | drawManager->setColor(MColor(color.r, color.g, color.b, 1 - color.a)); 85 | 86 | MUintArray index; 87 | index.append(0); 88 | index.append(1); 89 | index.append(3); 90 | index.append(2); 91 | 92 | if (top) 93 | { 94 | if ( (g2.y1 - g1.y1) > EPSILON ) 95 | { 96 | // Bottom Mask 97 | MPointArray bottomMask; 98 | bottomMask.append(MPoint( g1.x1, g1.y1, 0.0)); 99 | bottomMask.append(MPoint( g1.x2, g1.y1, 0.0)); 100 | bottomMask.append(MPoint( g2.x2, g2.y1, 0.0)); 101 | bottomMask.append(MPoint( g2.x1, g2.y1, 0.0)); 102 | drawManager->mesh2d(MHWRender::MUIDrawManager::kTriStrip,bottomMask,NULL,&index); 103 | } 104 | 105 | if ( (g1.y2 - g2.y2) > EPSILON ) 106 | { 107 | // Top Mask 108 | MPointArray topMask; 109 | topMask.append(MPoint( g2.x1, g2.y2, 0.0)); 110 | topMask.append(MPoint( g2.x2, g2.y2, 0.0)); 111 | topMask.append(MPoint( g1.x2, g1.y2, 0.0)); 112 | topMask.append(MPoint( g1.x1, g1.y2, 0.0)); 113 | drawManager->mesh2d(MHWRender::MUIDrawManager::kTriStrip,topMask,NULL,&index); 114 | } 115 | } 116 | else 117 | { 118 | g1.y1 = g2.y1; 119 | g1.y2 = g2.y2; 120 | } 121 | 122 | if (sides) 123 | { 124 | // Left side mask 125 | if ((g2.x1 - g1.x1) > EPSILON) 126 | { 127 | MPointArray leftMask; 128 | leftMask.append(MPoint( g1.x1, g1.y1, 0.0)); 129 | leftMask.append(MPoint( g2.x1, g2.y1, 0.0)); 130 | leftMask.append(MPoint( g2.x1, g2.y2, 0.0)); 131 | leftMask.append(MPoint( g1.x1, g1.y2, 0.0)); 132 | drawManager->mesh2d(MHWRender::MUIDrawManager::kTriStrip,leftMask,NULL,&index); 133 | } 134 | 135 | // right side mask 136 | if ((g1.x2 - g2.x2) > EPSILON) 137 | { 138 | MPointArray rightMask; 139 | rightMask.append(MPoint( g1.x2, g1.y1, 0.0)); 140 | rightMask.append(MPoint( g2.x2, g2.y1, 0.0)); 141 | rightMask.append(MPoint( g2.x2, g2.y2, 0.0)); 142 | rightMask.append(MPoint( g1.x2, g1.y2, 0.0)); 143 | drawManager->mesh2d(MHWRender::MUIDrawManager::kTriStrip,rightMask,NULL,&index); 144 | } 145 | } 146 | 147 | //drawManager->endDrawable(); 148 | } 149 | 150 | // This draws a single line between the specified points. 151 | // 152 | void V2Renderer::drawLine(double x1, double x2, double y1, double y2, 153 | MColor color, bool stipple) 154 | { 155 | //drawManager->beginDrawable(); 156 | 157 | drawManager->setColor(color); 158 | 159 | if(stipple) 160 | { 161 | drawManager->setLineStyle(2,0x0F0F); 162 | //drawManager->setLineStyle(MHWRender::MUIDrawManager::LineStyle::kDashed); 163 | } 164 | else 165 | { 166 | drawManager->setLineStyle(MHWRender::MUIDrawManager::LineStyle::kSolid); 167 | } 168 | 169 | drawManager->line2d(MPoint(x1,y1),MPoint(x2,y2)); 170 | 171 | //drawManager->endDrawable(); 172 | } 173 | 174 | // Given a Geom instance, this will draw a line connecting the points. 175 | // The argument side determines whether the sides will be drawn (the top 176 | // will always be drawn). The stipple argument specifies whether the line 177 | // should be solid or dashed/stippled. 178 | // 179 | void V2Renderer::drawLines( Geom g, MColor color, bool sides, bool stipple) 180 | { 181 | //drawManager->beginDrawable(); 182 | 183 | drawManager->setColor(MColor(color.r,color.g,color.b,1-color.a)); 184 | 185 | if(stipple) 186 | { 187 | drawManager->setLineStyle(2,0x0F0F); 188 | //drawManager->setLineStyle(MHWRender::MUIDrawManager::LineStyle::kDashed); 189 | } 190 | else 191 | { 192 | drawManager->setLineStyle(MHWRender::MUIDrawManager::LineStyle::kSolid); 193 | } 194 | 195 | if(sides) 196 | { 197 | drawManager->rect2d(MPoint ((g.x1 + g.x2)/2, (g.y1 + g.y2)/2), 198 | MVector(0.0,1.0), 199 | fabs(g.x1-g.x2)/2,fabs(g.y1-g.y2)/2); 200 | } 201 | else 202 | { 203 | drawManager->line2d(MPoint(g.x1,g.y1),MPoint(g.x2,g.y1)); 204 | drawManager->line2d(MPoint(g.x2,g.y2),MPoint(g.x1,g.y2)); 205 | } 206 | 207 | //drawManager->endDrawable(); 208 | } 209 | 210 | // This function uses MUIDrawManager to draw text. 211 | // 212 | void V2Renderer::drawText(TextData *td, double tx, double ty) 213 | { 214 | //drawManager->beginDrawable(); 215 | 216 | double screenScaleFactor = (td->textScale) ? filmback->filmbackGeom.x/1280.0f : 1.0f; 217 | 218 | #if (MAYA_API_VERSION > 201500) 219 | int fontSize = td->textSize * screenScaleFactor * 1.5; 220 | drawManager->setFontSize(fontSize); 221 | drawManager->setFontName("helvetica"); 222 | if (td->textBold) 223 | { 224 | drawManager->setFontWeight(MHWRender::MUIDrawManager::TextWeight::kWeightBold); 225 | } 226 | else 227 | { 228 | drawManager->setFontWeight(MHWRender::MUIDrawManager::TextWeight::kWeightLight); 229 | } 230 | #elif (MAYA_API_VERSION == 201500) 231 | int fontSize = td->textSize * screenScaleFactor * 1.5; 232 | drawManager->setFontSize(fontSize); 233 | if (td->textBold) 234 | { 235 | drawManager->setFontName("Bitstream Vera Sans"); 236 | } 237 | else 238 | { 239 | drawManager->setFontName("PT Sans"); 240 | } 241 | #else 242 | int fontSize = 14; 243 | #endif 244 | 245 | // Adjust ty for text alignment 246 | switch (td->textVAlign) { 247 | case 0: 248 | ty -= (fontSize * 0.35f); 249 | break; 250 | case 1: 251 | ty -= fontSize / 1.5f; 252 | break; 253 | case 2: 254 | ty -= fontSize; 255 | break; 256 | } 257 | 258 | // Adjust text position to account for screen scaling 259 | tx += td->textPosX*screenScaleFactor; 260 | ty += td->textPosY*screenScaleFactor; 261 | 262 | // Note: the tz is slightly negative to make it draw above possible solid masks. 263 | // If set to 0, text might disappear!!! 264 | // 265 | double tz = -0.0001; 266 | 267 | drawManager->setColor(td->textColor); 268 | drawManager->setColor(MColor(td->textColor.r,td->textColor.g,td->textColor.b,1-td->textColor.a)); 269 | drawManager->text2d(MPoint(tx,ty,tz),td->textStr,(MHWRender::MUIDrawManager::TextAlignment)td->textAlign); 270 | 271 | //drawManager->endDrawable(); 272 | } 273 | 274 | #endif 275 | 276 | -------------------------------------------------------------------------------- /V2Renderer.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // V2Renderer.h 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #ifndef spReticle_V2Renderer_h 43 | #define spReticle_V2Renderer_h 44 | 45 | #if (MAYA_API_VERSION >= 201400) 46 | 47 | #include 48 | #include 49 | 50 | #include "defines.h" 51 | 52 | #include "GPURenderer.h" 53 | 54 | // V2 Renderer 55 | class V2Renderer : public GPURenderer 56 | { 57 | public: 58 | V2Renderer(); 59 | virtual ~V2Renderer(); 60 | 61 | // Set the draw manager 62 | void setDrawManager(MHWRender::MUIDrawManager* drawManager); 63 | 64 | void prepareForDraw(float portWidth, float portHeight); 65 | void postDraw(); 66 | 67 | // Given two Geom instances, this renders the mask area between them. 68 | virtual void drawMask( Geom g1, Geom g2, MColor color, bool sides, bool top ); 69 | 70 | // This draws a single line between the specified points. 71 | virtual void drawLine(double x1, double x2, double y1, double y2, 72 | MColor color, bool stipple); 73 | 74 | // Given a Geom instance, this will draw a line connecting the points. 75 | // The argument side determines whether the sides will be drawn (the top 76 | // will always be drawn). The stipple argument specifies whether the line 77 | // should be solid or dashed/stippled. 78 | virtual void drawLines( Geom g, MColor color, bool sides, bool stipple); 79 | 80 | // This function is responsible for rendering text. 81 | virtual void drawText(TextData *td, double tx, double ty); 82 | 83 | private: 84 | MHWRender::MUIDrawManager* drawManager; 85 | }; 86 | 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /defines.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // defines.h 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #ifndef spReticle_defines_h 43 | #define spReticle_defines_h 44 | 45 | #define PLUGIN_VERSION "2.1" 46 | 47 | // Epsilon value to use when testing for equality with floating values 48 | #define EPSILON 0.0000001 49 | 50 | // Define whether to source a MEL script upon instantiation, and if so, which script in the script path 51 | #define SOURCE_MEL_SCRIPT false 52 | #define SOURCE_MEL_SCRIPT_PATH "spReticleLoc.mel" 53 | #define SOURCE_MEL_METHOD "spReticleLocSetDefault" 54 | 55 | // If identifying a camera to display based upon an attribute, use the following attribute 56 | #define CAMERA_ATTR "useSpReticle" 57 | 58 | // Text standard defines 59 | #define SHOW_ENV_VAR "SHOW" 60 | #define SEQ_ENV_VAR "SEQ" 61 | #define SHOT_ENV_VAR "SHOT" 62 | #define FRAME_START_ENV_VAR "FS" 63 | #define FRAME_END_ENV_VAR "FE" 64 | 65 | // Font Defines 66 | #define MINFONT 4 67 | #define MAXFONT 120 68 | 69 | // Field Guide 70 | #define FIELDGUIDE_NUM_LINES 11 71 | 72 | // Specifies whether the VP2.0 MUIDrawManager class should be used for rendering vs OpenGL. 73 | // Currently, it has proper draw-order integration with image planes and support for DX11. 74 | // Cons are that it is slower, fonts are aliased, and line rendering is sometimes occluded by masks. 75 | // This only impacts Viewport 2.0. Viewport 1.0 will use the OpenGLRenderer regardless. 76 | #define USE_MUIDRAWMANAGER true 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /spReticleLoc.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2009, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | #include "defines.h" 36 | #include "util.h" 37 | #include "OpenGLRenderer.h" 38 | 39 | #if(MAYA_API_VERSION>=201400 && USE_MUIDRAWMANAGER) 40 | #include "V2Renderer.h" 41 | #endif 42 | 43 | class spReticleLoc : public MPxLocatorNode 44 | { 45 | public: 46 | spReticleLoc(); 47 | virtual ~spReticleLoc(); 48 | 49 | virtual void draw( M3dView & view, const MDagPath & path, 50 | M3dView::DisplayStyle style, 51 | M3dView::DisplayStatus status ); 52 | 53 | virtual bool setInternalValueInContext( const MPlug &, 54 | const MDataHandle &, 55 | MDGContext &); 56 | 57 | static void *creator(); 58 | static MStatus initialize(); 59 | 60 | virtual bool excludeAsLocator() const; 61 | virtual void postConstructor(); 62 | 63 | virtual bool isTransparent() const {return true;} 64 | virtual bool drawLast() const {return true;} 65 | virtual bool isBounded() const {return false;} 66 | 67 | //virtual MBoundingBox boundingBox() const; 68 | 69 | // Get node ready for drawing 70 | bool prepForDraw(const MObject & thisNode, const MDagPath & path, const MDagPath & cameraPath); 71 | 72 | // Base draw method 73 | void drawBase(int width, int height, GPURenderer* renderer); 74 | 75 | public: 76 | static MTypeId id; 77 | static MString drawDbClassification; 78 | static MString drawRegistrantId; 79 | static MObject DrawingEnabled; 80 | static MObject EnableTextDrawing; // added by sjt@sjt.is (May 2010). 81 | static MObject FilmbackAperture; 82 | static MObject HorizontalFilmAperture; 83 | static MObject VerticalFilmAperture; 84 | static MObject SoundTrackWidth; 85 | static MObject DisplayFilmGate; 86 | static MObject ProjectionGate; 87 | static MObject HorizontalProjectionGate; 88 | static MObject VerticalProjectionGate; 89 | static MObject DisplayProjectionGate; 90 | static MObject SafeAction; 91 | static MObject HorizontalSafeAction; 92 | static MObject VerticalSafeAction; 93 | static MObject DisplaySafeAction; 94 | static MObject SafeTitle; 95 | static MObject HorizontalSafeTitle; 96 | static MObject VerticalSafeTitle; 97 | static MObject DisplaySafeTitle; 98 | static MObject RelativeFilmback; 99 | static MObject AspectRatios; 100 | static MObject AspectRatio; 101 | static MObject DisplayMode; 102 | static MObject AspectMaskColor; 103 | static MObject AspectMaskTrans; 104 | static MObject AspectLineColor; 105 | static MObject AspectLineTrans; 106 | static MObject AspectDisplaySafeAction; 107 | static MObject AspectDisplaySafeTitle; 108 | static MObject PanScanAttr; 109 | static MObject PanScanAspectRatio; 110 | static MObject PanScanDisplayMode; 111 | static MObject PanScanDisplaySafeTitle; 112 | static MObject PanScanDisplaySafeAction; 113 | static MObject PanScanRatio; 114 | static MObject PanScanOffset; 115 | static MObject PanScanMaskColor; 116 | static MObject PanScanMaskTrans; 117 | static MObject PanScanLineColor; 118 | static MObject PanScanLineTrans; 119 | static MObject FilmGateMaskColor; 120 | static MObject FilmGateMaskTrans; 121 | static MObject FilmGateLineColor; 122 | static MObject FilmGateLineTrans; 123 | static MObject ProjGateMaskColor; 124 | static MObject ProjGateMaskTrans; 125 | static MObject ProjGateLineColor; 126 | static MObject ProjGateLineTrans; 127 | static MObject HideLocator; 128 | static MObject CameraFilterMode; 129 | static MObject Cameras; 130 | static MObject DisplayLineH; 131 | static MObject DisplayLineV; 132 | static MObject DisplayThirdsH; 133 | static MObject DisplayThirdsV; 134 | static MObject DisplayCrosshair; 135 | static MObject DisplayFieldGuide; 136 | static MObject MiscTextColor; 137 | static MObject MiscTextTrans; 138 | static MObject LineColor; 139 | static MObject LineTrans; 140 | static MObject Time; 141 | static MObject DriveCameraAperture; 142 | static MObject MaximumDistance; 143 | static MObject UseOverscan; 144 | static MObject Pad; 145 | static MObject UsePad; 146 | static MObject PadAmount; 147 | static MObject PadAmountX; 148 | static MObject PadAmountY; 149 | static MObject PadDisplayMode; 150 | static MObject PadMaskColor; 151 | static MObject PadMaskTrans; 152 | static MObject PadLineColor; 153 | static MObject PadLineTrans; 154 | static MObject Text; 155 | static MObject TextType; 156 | static MObject TextStr; 157 | static MObject TextAlign; 158 | static MObject TextVAlign; 159 | static MObject TextPos; 160 | static MObject TextPosX; 161 | static MObject TextPosY; 162 | static MObject TextPosRel; 163 | static MObject TextLevel; 164 | static MObject TextARLevel; 165 | static MObject TextColor; 166 | static MObject TextTrans; 167 | static MObject TextEnabled; 168 | static MObject TextBold; 169 | static MObject TextSize; 170 | static MObject TextScale; 171 | static MObject Tag; 172 | 173 | private: 174 | MStatus getPadData(); 175 | MStatus getFilmbackData(); 176 | MStatus getProjectionData(); 177 | MStatus getSafeActionData(); 178 | MStatus getSafeTitleData(); 179 | MStatus getAspectRatioChildren ( MPlug arPlug, Aspect_Ratio & ar ); 180 | static bool aspectRatioSortPredicate( const Aspect_Ratio &, const Aspect_Ratio &); 181 | MStatus getAspectRatioData (); 182 | bool needToUpdateAspectRatios(); 183 | MStatus getPanScanData ( PanScan & ps ); 184 | MStatus getTextChildren ( MPlug tPlug, TextData & td ); 185 | MStatus generateTextBuffer(TextData &td); 186 | MStatus getTextData(); 187 | MStatus getOptions(); 188 | 189 | MStatus getColor ( MObject colorObj, MObject transObj, MColor & color ); 190 | MMatrix getMatrix( MString matrixStr ); 191 | void printAspectRatio ( Aspect_Ratio & ar ); 192 | void printPanScan ( PanScan & ps ); 193 | void printText ( TextData & td ); 194 | void printGeom ( Geom & g ); 195 | void printOptions (); 196 | void calcPortGeom(); 197 | void calcFilmbackGeom(); 198 | void calcMaskGeom( Geom & g, double w, double h, Geom & gSrc, double wSrc, double hSrc ); 199 | void calcFilmbackSafeActionGeom(); 200 | void calcFilmbackSafeTitleGeom(); 201 | void calcSafeActionGeom( Aspect_Ratio & ar ); 202 | void calcSafeTitleGeom( Aspect_Ratio & ar ); 203 | void calcAspectGeom( Aspect_Ratio & ar); 204 | void calcPanScanGeom( PanScan & ps ); 205 | bool calcDynamicText(TextData *td, const int i); 206 | bool getTextLevelGeometry(TextData *td, Geom &g, const int i); 207 | bool calcTextPosition(TextData *td, const Geom &g, double &x, double &y, const int i); 208 | 209 | void drawCustomTextElements(GPURenderer* renderer); 210 | 211 | Filmback oFilmback,filmback; 212 | PadOptions pad; 213 | PanScan panScan; 214 | Geom portGeom; 215 | Options options; 216 | 217 | double portWidth; 218 | double portHeight; 219 | double scaleFactor; 220 | double overscan; 221 | double ncp; 222 | MMatrix wim; 223 | MFnCamera camera; 224 | MObject thisNode; 225 | 226 | int numAspectRatios; 227 | bool loadDefault; 228 | double maximumDist; 229 | bool needRefresh; 230 | 231 | std::vector ars; 232 | std::vector text; 233 | 234 | OpenGLRenderer oglRenderer; 235 | }; 236 | 237 | //--------------------------------------------------------------------------- 238 | // Viewport 2.0 override implementation 239 | //--------------------------------------------------------------------------- 240 | #if (MAYA_API_VERSION>=201200) 241 | 242 | class spReticleLocData : public MUserData 243 | { 244 | public: 245 | spReticleLocData() : MUserData(false) {} // don't delete after draw 246 | virtual ~spReticleLocData() {} 247 | 248 | spReticleLoc* reticle; 249 | GPURenderer* renderer; 250 | bool draw; 251 | }; 252 | 253 | class spReticleLocDrawOverride : public MHWRender::MPxDrawOverride 254 | { 255 | public: 256 | static MHWRender::MPxDrawOverride* Creator(const MObject& obj) 257 | { 258 | return new spReticleLocDrawOverride(obj); 259 | } 260 | 261 | virtual ~spReticleLocDrawOverride(); 262 | 263 | #if (MAYA_API_VERSION>=201300) 264 | virtual MHWRender::DrawAPI supportedDrawAPIs() const; 265 | 266 | virtual bool isBounded( 267 | const MDagPath& objPath, 268 | const MDagPath& cameraPath) const; 269 | 270 | virtual bool disableInternalBoundingBoxDraw() const; 271 | #endif 272 | 273 | virtual MBoundingBox boundingBox( 274 | const MDagPath& objPath, 275 | const MDagPath& cameraPath) const; 276 | 277 | #if (MAYA_API_VERSION<201400) 278 | virtual MUserData* prepareForDraw( 279 | const MDagPath& objPath, 280 | const MDagPath& cameraPath, 281 | MUserData* oldData); 282 | #else 283 | virtual MUserData* prepareForDraw( 284 | const MDagPath& objPath, 285 | const MDagPath& cameraPath, 286 | const MHWRender::MFrameContext& frameContext, 287 | MUserData* oldData); 288 | 289 | virtual bool hasUIDrawables() const; 290 | 291 | virtual void addUIDrawables( 292 | const MDagPath& objPath, 293 | MHWRender::MUIDrawManager& drawManager, 294 | const MHWRender::MFrameContext& frameContext, 295 | const MUserData* data); 296 | #endif 297 | 298 | static void draw(const MHWRender::MDrawContext& context, const MUserData* data); 299 | 300 | private: 301 | spReticleLocDrawOverride(const MObject& obj); 302 | spReticleLocData* data; 303 | 304 | #if (MAYA_API_VERSION>=201400 && USE_MUIDRAWMANAGER) 305 | V2Renderer renderer; 306 | #else 307 | OpenGLRenderer renderer; 308 | #endif 309 | }; 310 | 311 | #endif 312 | -------------------------------------------------------------------------------- /spReticleLoc.mel: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) 2014, Sony Pictures Imageworks 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // Neither the name of the organization Sony Pictures Imageworks nor the 15 | // names of its contributors 16 | // may be used to endorse or promote products derived from this software 17 | // without specific prior written permission. 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 21 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER 23 | // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | // SPECIAL, 25 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | if(! `pluginInfo -q -loaded "spReticleLoc.so"`) 34 | { 35 | loadPlugin "spReticleLoc.so"; 36 | } 37 | spInclude ""; 38 | 39 | global proc spReticleLocCreate() 40 | { 41 | //Deleting deprecated spReticuleLoc nodes from scene 42 | /* 43 | string $reticuleLoc[] = `ls -type spReticuleLoc`; 44 | 45 | if(size($reticuleLoc)) 46 | { 47 | print ("Deleting deprecated spReticuleLoc nodes from scene."); 48 | delete $reticuleLoc; 49 | } 50 | */ 51 | 52 | string $reticleLoc[] = `ls -type spReticleLoc`; 53 | 54 | if (size($reticleLoc) == 0) 55 | { 56 | string $reticleTransform = `createNode -n reticle transform`; 57 | string $reticleShape = `createNode -n reticleShape -p $reticleTransform spReticleLoc`; 58 | 59 | print ("Created " + $reticleShape + "\n"); 60 | print ("Setting showSettings defaults for " + $reticleShape + "\n"); 61 | spReticleLocSetDefault($reticleShape,""); 62 | 63 | if (objExists("temp_master")) 64 | { 65 | parent $reticleTransform temp_master; 66 | } 67 | 68 | // Prevent strange clipping of light cone, and possible 69 | // reflections of reticle text in shadows in Viewport 2.0 70 | if (objExists($reticleLoc[0]+".castsShadows")) 71 | { 72 | setAttr ($reticleLoc[0]+".castsShadows") 0; 73 | } 74 | } 75 | else 76 | { 77 | setAttr ($reticleLoc[0]+".drawingEnabled") 1; 78 | } 79 | } 80 | 81 | proc addText(string $node, string $setting, int $index) 82 | { 83 | // Add the specified text setting to the spReticle node 84 | int $text_textType = spSettingGetValueInt($setting + ".TextType", ""); 85 | setAttr ($node+".text[" + $index + "].textType") $text_textType; 86 | 87 | int $text_textAlign = spSettingGetValueInt($setting + ".TextAlign", ""); 88 | setAttr ($node+".text[" + $index + "].textAlign") $text_textAlign; 89 | 90 | int $text_textPosRel = spSettingGetValueInt($setting + ".TextPosRel", ""); 91 | setAttr ($node+".text[" + $index + "].textPosRel") $text_textPosRel; 92 | 93 | int $text_textLevel = spSettingGetValueInt($setting + ".TextLevel", ""); 94 | setAttr ($node+".text[" + $index + "].textLevel") $text_textLevel; 95 | 96 | float $text_textPosX = spSettingGetValueFloat($setting + ".TextPosX", ""); 97 | setAttr ($node+".text[" + $index + "].textPosX") $text_textPosX; 98 | 99 | float $text_textPosY = spSettingGetValueFloat($setting + ".TextPosY", ""); 100 | setAttr ($node+".text[" + $index + "].textPosY") $text_textPosY; 101 | 102 | float $text_textTrans = spSettingGetValueFloat($setting + ".TextTrans", ""); 103 | setAttr ($node+".text[" + $index + "].textTrans") $text_textTrans; 104 | 105 | float $text_textScale = spSettingGetValueFloat($setting + ".TextScale", ""); 106 | setAttr ($node+".text[" + $index + "].textScale") $text_textScale; 107 | 108 | float $text_textSize = spSettingGetValueFloat($setting + ".TextSize", ""); 109 | setAttr ($node+".text[" + $index + "].textSize") $text_textSize; 110 | } 111 | 112 | 113 | global proc spReticleLocSetDefault(string $node, string $tag) 114 | { 115 | if (`objExists $node`) 116 | { 117 | //Filmback Attributes 118 | int $displayFilmGate = spSettingGetValueInt("showSettings.Tools.spReticle.DisplayFilmGate", ""); 119 | setAttr ($node+".displayFilmGate") $displayFilmGate; 120 | float $filmGateMaskColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.FilmGateMaskColor", ""); 121 | setAttr ($node+".filmGateMaskColor") -type double3 $filmGateMaskColor[0] $filmGateMaskColor[1] $filmGateMaskColor[2]; 122 | float $filmGateMaskTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.FilmGateMaskTrans", ""); 123 | setAttr ($node+".filmGateMaskTrans") $filmGateMaskTrans; 124 | float $filmGateLineColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.FilmGateLineColor", ""); 125 | setAttr ($node+".filmGateColor") -type double3 $filmGateLineColor[0] $filmGateLineColor[1] $filmGateLineColor[2]; 126 | float $filmGateLineTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.FilmGateLineTrans", ""); 127 | setAttr ($node+".filmGateTrans") $filmGateLineTrans; 128 | 129 | float $horizFilmAperture = spSettingGetValueFloat("showSettings.Tools.spReticle.HorizFilmAperture", ""); 130 | float $vertFilmAperture = spSettingGetValueFloat("showSettings.Tools.spReticle.VertFilmAperture", ""); 131 | setAttr ($node+".filmbackAperture") $horizFilmAperture $vertFilmAperture; 132 | 133 | //Projection Gate Settings 134 | int $displayProjGate = spSettingGetValueInt("showSettings.Tools.spReticle.DisplayProjGate", ""); 135 | setAttr ($node+".displayProjGate") $displayProjGate; 136 | float $horizontalProjGate = spSettingGetValueFloat("showSettings.Tools.spReticle.HorizProjGate", ""); 137 | setAttr ($node+".horizontalProjectionGate") $horizontalProjGate; 138 | float $verticalProjGate = spSettingGetValueFloat("showSettings.Tools.spReticle.VertProjGate", ""); 139 | setAttr ($node+".verticalProjectionGate") $verticalProjGate; 140 | float $projGateMaskColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.ProjGateMaskColor", ""); 141 | setAttr ($node+".projGateMaskColor") -type double3 $projGateMaskColor[0] $projGateMaskColor[1] $projGateMaskColor[2]; 142 | float $projGateMaskTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.ProjGateMaskTrans", ""); 143 | setAttr ($node+".projGateMaskTrans") $projGateMaskTrans; 144 | float $projGateLineColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.ProjGateLineColor", ""); 145 | setAttr ($node+".projGateLineColor") -type double3 $projGateLineColor[0] $projGateLineColor[1] $projGateLineColor[2]; 146 | float $projGateLineTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.ProjGateLineTrans", ""); 147 | setAttr ($node+".projGateLineTrans") $projGateLineTrans; 148 | 149 | //Aspect Ratio Settings 150 | //Set Aspect ratio [0] 151 | float $aspectRatio = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectRatio", ""); 152 | setAttr ($node+".aspectRatios[0].aspectRatio") $aspectRatio; 153 | 154 | int $aspectDisplayMode = spSettingGetValueInt("showSettings.Tools.spReticle.AspectDisplayMode", ""); 155 | setAttr ($node+".aspectRatios[0].displayMode") $aspectDisplayMode; 156 | 157 | float $aspectMaskColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.AspectMaskColor", ""); 158 | setAttr ($node+".aspectRatios[0].aspectMaskColor") -type double3 $aspectMaskColor[0] $aspectMaskColor[1] $aspectMaskColor[2]; 159 | 160 | float $aspectMaskTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectMaskTrans", ""); 161 | setAttr ($node+".aspectRatios[0].aspectMaskTrans") $aspectMaskTrans; 162 | 163 | float $aspectLineColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.AspectLineColor", ""); 164 | setAttr ($node+".aspectRatios[0].aspectLineColor") -type double3 $aspectLineColor[0] $aspectLineColor[1] $aspectLineColor[2]; 165 | 166 | float $aspectLineTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectLineTrans", ""); 167 | setAttr ($node+".aspectRatios[0].aspectLineTrans") $aspectLineTrans; 168 | 169 | int $aspectDisplaySafeAction = spSettingGetValueInt("showSettings.Tools.spReticle.AspectDisplaySafeAction", ""); 170 | setAttr ($node+".aspectRatios[0].aspectDisplaySafeAction") $aspectDisplaySafeAction; 171 | 172 | //Aspect Ratio Settings 173 | //Set Aspect ratio [1] 174 | int $aspectDisplayMode2 = spSettingGetValueInt("showSettings.Tools.spReticle.AspectDisplayMode2", ""); 175 | 176 | if ( $aspectDisplayMode2 != 0 ) 177 | { 178 | float $aspectRatio2 = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectRatio2", ""); 179 | setAttr ($node+".aspectRatios[1].aspectRatio") $aspectRatio2; 180 | 181 | setAttr ($node+".aspectRatios[1].displayMode") $aspectDisplayMode2; 182 | 183 | float $aspectMaskColor2[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.AspectMaskColor2", ""); 184 | setAttr ($node+".aspectRatios[1].aspectMaskColor") -type double3 $aspectMaskColor2[0] $aspectMaskColor2[1] $aspectMaskColor2[2]; 185 | 186 | float $aspectMaskTrans2 = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectMaskTrans2", ""); 187 | setAttr ($node+".aspectRatios[1].aspectMaskTrans") $aspectMaskTrans2; 188 | 189 | float $aspectLineColor2[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.AspectLineColor2", ""); 190 | setAttr ($node+".aspectRatios[1].aspectLineColor") -type double3 $aspectLineColor2[0] $aspectLineColor2[1] $aspectLineColor2[2]; 191 | 192 | float $aspectLineTrans2 = spSettingGetValueFloat("showSettings.Tools.spReticle.AspectLineTrans2", ""); 193 | setAttr ($node+".aspectRatios[1].aspectLineTrans") $aspectLineTrans2; 194 | 195 | int $aspectDisplaySafeAction2 = spSettingGetValueInt("showSettings.Tools.spReticle.AspectDisplaySafeAction2", ""); 196 | setAttr ($node+".aspectRatios[1].aspectDisplaySafeAction") $aspectDisplaySafeAction2; 197 | } 198 | 199 | //Pan and Scan Settings 200 | int $panScanDisplayMode = spSettingGetValueInt("showSettings.Tools.spReticle.PanScanDisplayMode", ""); 201 | setAttr ($node+".panScanDisplayMode") $panScanDisplayMode; 202 | 203 | float $panScanAspectRatio = spSettingGetValueFloat("showSettings.Tools.spReticle.PanScanAspectRatio", ""); 204 | setAttr ($node+".panScanAspectRatio") $panScanAspectRatio; 205 | 206 | float $panScanRatio = spSettingGetValueFloat("showSettings.Tools.spReticle.PanScanRatio", ""); 207 | setAttr ($node+".panScanRatio") $panScanRatio; 208 | 209 | float $panScanOffset = spSettingGetValueFloat("showSettings.Tools.spReticle.PanScanOffset", ""); 210 | setAttr ($node+".panScanOffset") $panScanOffset; 211 | 212 | float $panScanMaskColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.PanScanMaskColor", ""); 213 | setAttr ($node+".panScanMaskColor") -type double3 $panScanMaskColor[0] $panScanMaskColor[1] $panScanMaskColor[2]; 214 | 215 | float $panScanMaskTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.PanScanMaskTrans", ""); 216 | setAttr ($node+".panScanMaskTrans") $panScanMaskTrans; 217 | 218 | float $panScanLineColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.PanScanLineColor", ""); 219 | setAttr ($node+".panScanLineColor") -type double3 $panScanLineColor[0] $panScanLineColor[1] $panScanLineColor[2]; 220 | 221 | float $panScanLineTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.PanScanLineTrans", ""); 222 | setAttr ($node+".panScanLineTrans") $panScanLineTrans; 223 | 224 | //Pad Settings 225 | int $usePadMask = spSettingGetValueBoolean("showSettings.Tools.spReticle.UsePadMask", ""); 226 | setAttr ($node+".usePad") $usePadMask; 227 | 228 | int $padDisplayMode = spSettingGetValueInt("showSettings.Tools.spReticle.PadDisplayMode", ""); 229 | setAttr ($node+".padDisplayMode") $padDisplayMode; 230 | 231 | float $padAmountX = spSettingGetValueFloat("showSettings.Tools.spReticle.PadAmountX", ""); 232 | setAttr ($node+".padAmountX") $padAmountX; 233 | 234 | float $padAmountY = spSettingGetValueFloat("showSettings.Tools.spReticle.PadAmountY", ""); 235 | setAttr ($node+".padAmountY") $padAmountY; 236 | 237 | float $padMaskColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.PadMaskColor", ""); 238 | setAttr ($node+".padMaskColor") -type double3 $padMaskColor[0] $padMaskColor[1] $padMaskColor[2]; 239 | 240 | float $padMaskTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.PadMaskTrans", ""); 241 | setAttr ($node+".padMaskTrans") $padMaskTrans; 242 | 243 | float $padLineColor[] = spSettingGetValueFloat3("showSettings.Tools.spReticle.PadLineColor", ""); 244 | setAttr ($node+".padLineColor") -type double3 $padLineColor[0] $padLineColor[1] $padLineColor[2]; 245 | 246 | float $padLineTrans = spSettingGetValueFloat("showSettings.Tools.spReticle.PadLineTrans", ""); 247 | setAttr ($node+".padLineTrans") $padLineTrans; 248 | 249 | addText($node, "showSettings.Tools.spReticle.Text", 0); 250 | addText($node, "showSettings.Tools.spReticle.Text1", 1); 251 | 252 | // add text2 which displays active shot name from sequencer for layoutScenes 253 | if (spSettingGetValueString("showSettings.isLayoutScene", "") == "True") 254 | { 255 | addText($node, "showSettings.Tools.spReticle.Text2", 2); 256 | $setShotName = "if(objExists(\""+$node+"\")){$shot = `sequenceManager -q -currentShot`; if(size($shot)) setAttr -type \"string\" "+$node+".text[2].textStr `getAttr ($shot + \".shotName\")`; else setAttr -type \"string\" "+$node+".text[2].textStr \" \";}"; 257 | // update shot name in reticle 258 | eval($setShotName); 259 | // set expression to update shot name on time change 260 | if (!objExists("reticleExpression")) 261 | { 262 | expression -s $setShotName -o $node -ae 1 -uc all -n "reticleExpression"; 263 | } 264 | } 265 | 266 | //Ensure that drawing is enabled 267 | setAttr ($node+".drawingEnabled") 1; 268 | 269 | //Make reticle a template 270 | setAttr ($node+".template") 1; 271 | 272 | //use useSpReticle 273 | int $useSpReticle = spSettingGetValueBoolean("showSettings.Tools.spReticle.UseSpReticle", ""); 274 | setAttr ($node+".useSpReticle") $useSpReticle; 275 | 276 | //Set maxdistance based on circle of goodness settings 277 | float $CircleOfGoodnessCubeHeight = spSettingGetValueFloat("showSettings.Maya.CircleOfGoodnessCubeHeight", ""); 278 | float $CircleOfGoodnessCubeWidth = spSettingGetValueFloat("showSettings.Maya.CircleOfGoodnessCubeWidth", ""); 279 | float $CircleOfGoodnessCubeDepth = spSettingGetValueFloat("showSettings.Maya.CircleOfGoodnessCubeDepth", ""); 280 | 281 | float $maxDistance = 0; 282 | $maxDistance = max($CircleOfGoodnessCubeHeight/2, $maxDistance); 283 | $maxDistance = max($CircleOfGoodnessCubeWidth/2, $maxDistance); 284 | $maxDistance = max($CircleOfGoodnessCubeDepth/2, $maxDistance); 285 | 286 | if ($maxDistance > 0) 287 | setAttr ($node+".maximumDistance") $maxDistance; 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /spReticleLoc.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.852 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spReticleLoc", "spReticleLoc.vcxproj", "{F0250357-71CA-412C-9B94-C38328268552}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F0250357-71CA-412C-9B94-C38328268552}.Debug|x64.ActiveCfg = Release|x64 17 | {F0250357-71CA-412C-9B94-C38328268552}.Debug|x64.Build.0 = Release|x64 18 | {F0250357-71CA-412C-9B94-C38328268552}.Debug|x86.ActiveCfg = Debug|Win32 19 | {F0250357-71CA-412C-9B94-C38328268552}.Debug|x86.Build.0 = Debug|Win32 20 | {F0250357-71CA-412C-9B94-C38328268552}.Release|x64.ActiveCfg = Release|x64 21 | {F0250357-71CA-412C-9B94-C38328268552}.Release|x64.Build.0 = Release|x64 22 | {F0250357-71CA-412C-9B94-C38328268552}.Release|x86.ActiveCfg = Release|Win32 23 | {F0250357-71CA-412C-9B94-C38328268552}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {37E9E286-D11D-44FE-9E07-14330D25A143} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /spReticleLoc.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {F0250357-71CA-412C-9B94-C38328268552} 24 | Win32Proj 25 | 10.0.17763.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v141 32 | 33 | 34 | DynamicLibrary 35 | false 36 | v141 37 | 38 | 39 | DynamicLibrary 40 | true 41 | v141 42 | 43 | 44 | DynamicLibrary 45 | false 46 | v141 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | true 68 | 69 | 70 | true 71 | 72 | 73 | .mll 74 | 75 | 76 | .mll 77 | 78 | 79 | 80 | WIN32;_DEBUG;_WINDOWS;_USRDLL;SPRETICLELOC_EXPORTS;%(PreprocessorDefinitions) 81 | MultiThreadedDebugDLL 82 | Level3 83 | ProgramDatabase 84 | Disabled 85 | 86 | 87 | MachineX86 88 | true 89 | Windows 90 | 91 | 92 | 93 | 94 | WIN32;NDEBUG;_WINDOWS;_USRDLL;SPRETICLELOC_EXPORTS;%(PreprocessorDefinitions) 95 | MultiThreadedDLL 96 | Level3 97 | ProgramDatabase 98 | 99 | 100 | MachineX86 101 | true 102 | Windows 103 | true 104 | true 105 | 106 | 107 | 108 | 109 | 110 | 111 | WIN32; NDEBUG;_DEBUG; _WINDOWS; NT_PLUGIN; REQUIRE_IOSTREAM; _USRDLL; MAYAPLUGIN1_EXPORTS; 112 | "C:\Program Files\Autodesk\Maya2020\include" 113 | 114 | 115 | "C:\Program Files\Autodesk\Maya2020\lib" 116 | $(OutDir)$(ProjectName).mll 117 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies); Foundation.lib; OpenMaya.lib; OpenMayaUI.lib; OpenMayaAnim.lib; OpenMayaFx.lib; OpenMayaRender.lib; Image.lib; opengl32.lib; 118 | /export:initializePlugin /export:uninitializePlugin %(AdditionalOptions) 119 | 120 | 121 | 122 | 123 | "C:\Program Files\Autodesk\Maya2020\include" 124 | WIN32; _WINDOWS; NT_PLUGIN; REQUIRE_IOSTREAM; _USRDLL; MAYAPLUGIN1_EXPORTS; 125 | 126 | 127 | $(OutDir)$(ProjectName).mll 128 | "C:\Program Files\Autodesk\Maya2020\lib" 129 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies); Foundation.lib; OpenMaya.lib; OpenMayaUI.lib; OpenMayaAnim.lib; OpenMayaFx.lib; OpenMayaRender.lib; Image.lib; opengl32.lib; 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /spReticleLoc.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /spReticleLoc.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /spReticleLocLinux.mel: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2009, Sony Pictures Imageworks Inc. 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | if(! `pluginInfo -q -loaded "spReticleLoc.so"`) 37 | { 38 | loadPlugin "spReticleLoc.so"; 39 | } 40 | 41 | global proc spReticleLocCreate() 42 | { 43 | string $reticleLoc[] = `ls -type spReticleLoc`; 44 | 45 | if (size($reticleLoc) == 0) 46 | { 47 | string $reticleTransform = `createNode -n reticle transform`; 48 | createNode -n reticleShape -p $reticleTransform spReticleLoc; 49 | 50 | if (objExists("temp_master")) 51 | { 52 | parent $reticleTransform temp_master; 53 | } 54 | 55 | // Prevent strange clipping of light cone, and possible 56 | // reflections of reticle text in shadows in Viewport 2.0 57 | if (objExists($reticleLoc[0]+".castsShadows")) 58 | { 59 | setAttr ($reticleLoc[0]+".castsShadows") 0; 60 | } 61 | } 62 | else 63 | { 64 | setAttr ($reticleLoc[0]+".drawingEnabled") 1; 65 | } 66 | } 67 | 68 | global proc spReticleLocSetDefault(string $node, string $tag) 69 | { 70 | if (`objExists $node`) 71 | { 72 | // Set first aspect ratio 73 | setAttr ($node+".aspectRatios[0].aspectRatio") 1.85; 74 | setAttr ($node+".aspectRatios[0].displayMode") 2; 75 | 76 | // Turn on projection mask 77 | setAttr ($node+".displayProjGate") 1; 78 | 79 | // Set reticle to template mode 80 | setAttr ($node+".template") 1; 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /spReticleLocWindows.mel: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2009, Sony Pictures Imageworks Inc. 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | 36 | if(! `pluginInfo -q -loaded "spReticleLoc.mll"`) 37 | { 38 | loadPlugin "spReticleLoc.mll"; 39 | } 40 | 41 | global proc spReticleLocCreate() 42 | { 43 | string $reticleLoc[] = `ls -type spReticleLoc`; 44 | 45 | if (size($reticleLoc) == 0) 46 | { 47 | string $reticleTransform = `createNode -n reticle transform`; 48 | createNode -n reticleShape -p $reticleTransform spReticleLoc; 49 | 50 | if (objExists("temp_master")) 51 | { 52 | parent $reticleTransform temp_master; 53 | } 54 | 55 | // Prevent strange clipping of light cone, and possible 56 | // reflections of reticle text in shadows in Viewport 2.0 57 | if (objExists($reticleLoc[0]+".castsShadows")) 58 | { 59 | setAttr ($reticleLoc[0]+".castsShadows") 0; 60 | } 61 | } 62 | else 63 | { 64 | setAttr ($reticleLoc[0]+".drawingEnabled") 1; 65 | } 66 | } 67 | 68 | global proc spReticleLocSetDefault(string $node, string $tag) 69 | { 70 | if (`objExists $node`) 71 | { 72 | // Set first aspect ratio 73 | setAttr ($node+".aspectRatios[0].aspectRatio") 1.85; 74 | setAttr ($node+".aspectRatios[0].displayMode") 2; 75 | 76 | // Turn on projection mask 77 | setAttr ($node+".displayProjGate") 1; 78 | 79 | // Set reticle to template mode 80 | setAttr ($node+".template") 1; 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /spreticleloc.spk.yaml: -------------------------------------------------------------------------------- 1 | pkg: maya-spreticleloc/2.1.0 2 | 3 | build: 4 | options: 5 | - var: arch 6 | - var: os 7 | - var: centos 8 | - pkg: cmake 9 | - pkg: gcc 10 | - pkg: maya2023-platform/1.0 11 | - pkg: maya-vanilla 12 | 13 | variants: 14 | - {maya-vanilla: =2023.0, maya2023-platform: ~2023.1.1.0} 15 | - {maya-vanilla: =2023.0, maya2023-platform: ~2023.10.0.0} 16 | 17 | script: 18 | #- env |sort 19 | - cmake -B build . -G Ninja -DCMAKE_PREFIX_PATH=/spfs -DCMAKE_INSTALL_PREFIX=/spfs 20 | -DCMAKE_MODULE_PATH=$PWD -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release 21 | - cmake --build build --target install 22 | 23 | install: 24 | requirements: 25 | - pkg: gcc 26 | fromBuildEnv: Binary 27 | - pkg: maya 28 | - pkg: maya-vanilla 29 | fromBuildEnv: x 30 | -------------------------------------------------------------------------------- /util.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2013, Sony Pictures Imageworks 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions 8 | // are met: 9 | // 10 | // Redistributions of source code must retain the above copyright 11 | // notice, this list of conditions and the following disclaimer. 12 | // Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the 15 | // distribution. Neither the name of Sony Pictures Imageworks nor the 16 | // names of its contributors may be used to endorse or promote 17 | // products derived from this software without specific prior written 18 | // permission. 19 | // 20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 31 | // OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // 35 | // util.h 36 | // spReticle.1.7 37 | // 38 | // Created by Henry Vera on 4/23/13. 39 | // 40 | // 41 | 42 | #ifndef spReticle_util_h 43 | #define spReticle_util_h 44 | 45 | #include 46 | #include 47 | 48 | class Geom 49 | { 50 | public: 51 | double x1, x2; 52 | double y1, y2; 53 | double x, y; 54 | MColor lineColor; 55 | MColor maskColor; 56 | bool isValid; 57 | }; 58 | 59 | class Aspect_Ratio 60 | { 61 | public: 62 | double aspectRatio; 63 | int displayMode; 64 | int displaySafeAction; 65 | int displaySafeTitle; 66 | 67 | Geom aspectGeom; 68 | Geom safeActionGeom; 69 | Geom safeTitleGeom; 70 | }; 71 | 72 | class PanScan : public Aspect_Ratio 73 | { 74 | public: 75 | double panScanRatio; 76 | double panScanOffset; 77 | }; 78 | 79 | class Filmback 80 | { 81 | public: 82 | double horizontalFilmAperture; 83 | double verticalFilmAperture; 84 | int relativeFilmback; 85 | double soundTrackWidth; 86 | double horizontalImageAperture; 87 | double verticalImageAperture; 88 | int displayFilmGate; 89 | double horizontalProjectionGate; 90 | double verticalProjectionGate; 91 | double horizontalSafeAction; 92 | double verticalSafeAction; 93 | double horizontalSafeTitle; 94 | double verticalSafeTitle; 95 | int displayProjGate; 96 | int displaySafeAction; 97 | int displaySafeTitle; 98 | 99 | Geom filmbackGeom; 100 | Geom imageGeom; 101 | Geom projGeom; 102 | Geom safeActionGeom; 103 | Geom safeTitleGeom; 104 | }; 105 | 106 | class PadOptions 107 | { 108 | public: 109 | bool usePad; 110 | bool isPadded; 111 | double padAmountX; 112 | double padAmountY; 113 | int displayMode; 114 | 115 | Geom padGeom; 116 | }; 117 | 118 | class Options 119 | { 120 | public: 121 | bool drawingEnabled; 122 | bool enableTextDrawing; 123 | short cameraFilterMode; 124 | bool displayLineH; 125 | bool displayLineV; 126 | bool displayThirdsH; 127 | bool displayThirdsV; 128 | bool displayCrosshair; 129 | bool displayFieldGuide; 130 | bool driveCameraAperture; 131 | bool useOverscan; 132 | double maximumDistance; 133 | MColor textColor; 134 | MColor lineColor; 135 | }; 136 | 137 | class TextData 138 | { 139 | public: 140 | int textType; 141 | MString textStr; 142 | int textAlign; 143 | int textVAlign; 144 | double textPosX; 145 | double textPosY; 146 | int textPosRel; 147 | int textLevel; 148 | int textARLevel; 149 | MColor textColor; 150 | bool textEnabled; 151 | int textSize; 152 | bool textBold; 153 | bool textScale; 154 | }; 155 | 156 | #endif 157 | --------------------------------------------------------------------------------