Learning MEL – Step #8 – Arrays (Part 2)

We already have covered arrays basic points. In this part I go over working with arrays.

When a new thing is introduced, in any place and field, from math to technology, in religion or politics, in CGI or in traditional painting, it comes with associated issues/advantages/components/tools etc. Therefore array also has it own functions and methods. Do not forgot that array is a hero in Computer Programming.

Related Functions:

Functions to be solely used with arrays are:

sort(), size() and clear();

Above three functions are general functions related to arrays. There are many functions used with array that are both complex and far from our point of study, thus I leave them uncovered. Let’s begin explaining our triple functions.

sort(): Use this function simply by placing the array inside the () of the function.

sort($array);

This function would sort the element in an array in “ascending order” and returns a sorted array. However, be aware that the array does not get sorted internally, only returned values from sort() function would sort the output. I return to this point later. Just for now, focus on this example:

string $examples[] = {“hello”, “laugh”, “that man”, “somewhere”, “awful”};
print $examples;

Regularly it outputs based on the order of declaration:

print $examples;
hello
laugh
that man
somewhere
awful

But if you use sort() function, the result is this:

sort($examples);

// Result: awful hello laugh somewhere that man //

However you if you like to keep the result of examples, you have two choices:

1 – Put the result in a new array, like this:

$examples = sort($examples);

Look at the above example. There is not need to use array curly brackets after $example, because MEL already knows it is an array, and you are not going to reintroduce it to MEL, but just what you indeed do is assigning a new set of data.

2- Declare a new array. look at below:

string $sorted_array[] = sort($example);

Look, do not mess up the above $example array with method number 1. The above $example variable is the array unsorted array.

Both of above methods work. Sometime you need only  and only direct printing without keeping the result necessarily in an array. In that specific case, use sort() directly.

size(): Use this function simply by placing the array inside the () of the function.

size($array);

size() is a very very very important function which returns the number of elements in an array. why is it important? Because it dynamically allows you to know about the size of an array whenever you want to. For instance, if you want to print the list of selected nodes, how you would do that? of course you don’t know, since I have not yet covered it, but I will cover it perfectly in next tutorial. title Loops.

Look, this function would return an int number.

clear(): Use this function simply by placing the array inside the () of the function.

This function as its name is explanatory, would clear the array. It does not, however, undeclare it, it just remove every elements in the array , and let you have an empty array without any element.

Therefore, if I do clear our $example array, it will output:

clear ($example);

print ($example);

// Result: //

I wish you learn whatever we do cover here, as these are free tutorials.

Advertisements

Autodesk Mudbox 2014 8K Texture Support

آپلود عکس

Work done by Mostafa Talebi

 

 

Autodesk Mudbox 2014 Now Support 8k Textures

When I work with Mudbox, I mourn why it does not support 8k ( (8 * 1024)2) texture map. For large models, or for close-up shot elements, less than 8k would be a blow. Now I received an email telling that Mudbox 2014 now all generously support 8k size, which further means a great set of improvement. However it ends the report by warning me that only capable Graphic Card are able to handle the computation required for real time 8k texture painting. I have thought about it, and have reached to a certain conclusion regarding such update in an all lovely application as Mudbox.

8k Support – Now Procedural, Now Native

Autodesk Mudbox now supports 8k texture painting. Up to version 2013, it only supported up to 4k textures, which sucks when dealing with production-quality creation. A solution was common among Mudbox modelers,  that they saved a 8k texture in PS, and then imported it as a texture in Mudbox, and eventually got it painted as a MB created texture. This further meant that MB supported 8k, and by its core, it had not put a [commercial] restriction against 8k texture, but yet  it just had not had translated forth onto interface. However I do not fully agree with this statement: Now that MB has announced the coverage of 8k texture, it has grown into all MB parts. When you create a texture, when you export, when you deal with displacement map, when working to export normal maps and further, 8k is counted as a legitimate option. This is of high importance.

Mudbox Understood its Real Deficiency

As a modeling package, MB is a super friendly application for users native of Maya, Max and XSI. Since it has a direct connection for those application, as well as an interface all familiar, unlike nasty [great] ZBrush interface which craves your strength. As a user, I voted for an Update Request at somewhere around Autodesk Site. Now the votes persuaded the officials at Autodesk to inject 8k support into Mudbox.

Brave Texturing

8k Texturing makes you brave. When you become brave that you be able to paint qualified textures. 8k shows every parts in  your texture as it is able to tease you in case of weak-painting.

At the end I thank everyone who in some way incorporated in this update which has made me (and many others) happy. It had been long time ago when I got happy for some updates (I think it was Maya 2008). It really boost the process of texturing since it allows a wider size and more complex details.

Here is a movie related to Autodesk Creation Suit