/* This file downloaded from Highend3d.com '' '' Highend3d.com File Information: '' '' Script Name: create3DText v0.1 '' Author: Kai Stapel '' Last Updated: January 26, 2005 '' Update/Change this file at: '' http://www.highend3d.com/maya/mel/?section=utilities#3353 '' '' Please do not alter any information above this line '' it is generated dynamically by Highend3d.com and will '' be changed automatically on any updates. */ /*************************************************************************************************** *** MEL Script - create3DText() *** *** *** *** Version: 0.2 (second Release) *** *** Author: Kai Stapel *** *** Date: 02-05-2005 *** *** Keywords: Maya, 3D text, text 3D-text, 3-dimensional text, creating text *** *** Developed under Maya 6 Complete (should also work with Maya 5). *** *** Description: Creates a 3-dimensional text of the passed string $str and stores the resulting *** *** objects under a group named "Text_" + $groupName. The Font referenced by $font *** *** is used to create the outlines of the text. (e.g. $font="Arial|h-20|w400|c0|u") *** *** Features: - can handle special characters including german 'Umlaute'(ä,ö,ü) and especially *** *** doesn't crash on colons ":" (try creating a text with Maya's textCurves *** *** including a colon, like this: *** *** `textCurves -ch 0 -f "Arial|h-21|w400|c0|u" -t "colon:test"` *** *** and you'll see what the problem is there) *** *** - can underline the text *** *** - disturbing warnings are suppressed *** *** *** *** Questions, bugs or suggestions: Mail to Prof_NARF@hotmail.com *** *** *** *** E N J O Y ! *** *** *** ***************************************************************************************************/ global proc string create3DText( string $str , string $groupName , string $font) { int $i,$j,$k,$c,$colons[],$underlined; string $temp[]; string $s[]; float $flt[]; // ist text underlined? if(gmatch($font,"*|u*") == 1) { $underlined = 1; } else { $underlined = 0; } // strip whitespaces $str = strip($str); if(size($groupName) == 0) { $groupName = "Text_" + $str; } else { $groupName = "Text_" + $groupName; // create group name } $groupName = `group -n $groupName -em`; // is there a colon in the text? $c = 0; // set counter to zero for($i=1;$i<=size($str);$i++) { if(strcmp(substring($str,$i,$i),":") == 0) { // colon found => save colon in $colons $colons[$c] = $i; $c++; //print("Colon in the string at postition " + $i + ".\n"); } } // are there any colons? if so catch the error if(size($colons) > 0) { catchQuiet( $s = `textCurves -ch 0 -f $font -t $str -n $groupName` ); catchQuiet( `select $s[0]` ); catchQuiet( `pickWalk -d down` ); $c = 0; for($i=1;$i 0) { return 0; } else { $center = `getAttr ($curve1 + ".center")`; $bbmin = `getAttr ($curve2 + ".boundingBoxMin")`; $bbmax = `getAttr ($curve2 + ".boundingBoxMax")`; // is $curve1 inside $curve2 ? if($center[0] >= $bbmin[0] && $center[1] >= $bbmin[1] && $center[2] >= $bbmin[2] && $center[0] <= $bbmax[0] && $center[1] <= $bbmax[1] && $center[2] <= $bbmax[2]) { return 1; } // or is $curve1 outside $curve2 ? else { return -1; } } return 0; }