mcjSpreadTex

a script that transfers the image texture 
from the surface property named  
"Diffuse Surface"
to the properties named
"Translucency Color"
"Diffuse2 Color"
"Translucency2 Color"


// by mCasual/Jacques

// public domain

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

// THE SOFTWARE.


var node = Scene.getPrimarySelection();

if( node )

  {

  var obj = node.getObject();

  if( obj )

  {

    var shape = obj.getCurrentShape();

    var mats = shape.getAllSelectedMaterials();

    var n = mats.length;

    for( var i = 0; i < n; i++ )

    {

      transferMap( mats[i] );

    }

  }

}


function transferMap( mat )

{

  var prop1 = mat.findProperty( "Diffuse Color" );

  if( !prop1 )

  {

    return;

  }

  var tex = prop1.getMapValue();

  if( !tex )

  {

    return;

  }

  var prop2 = mat.findProperty( "Translucency Color" );

  if( prop2 )

  {

    prop2.setMap( tex );

  }

  var prop3 = mat.findProperty( "Diffuse2 Color" );

  if( prop3 )

  {

    prop3.setMap( tex );

  }

  var prop4 = mat.findProperty( "Translucency2 Color" );

  if( prop4 )

  {

    prop4.setMap( tex );

  }

}


ċ
mcjSpreadTex.dsa
(1k)
mCasual Jacques,
Mar 25, 2015, 12:43 PM
Comments