MASH Forum

MASH Forum

Anonymous
Not applicable
7,746 Views
24 Replies
Message 1 of 25

MASH Forum

Anonymous
Not applicable

Hello,

 

What are the chances of a getting a dedicated Maya sub forum for Motion Graphics? We get asked by people all the time where they should go for MASH questions and I generally direct them to the Area but it would be great to have a forum to cater for people with beards and their top shirt buttons done up 😉 It's all very new to a lot of users so I think it would be beneficial all round to be able to better support those people.

 

Cheers,

Chris

 

Mainframe North (MASH devs)

 

 

 

7,747 Views
24 Replies
Replies (24)
Message 21 of 25

corvidstudios
Enthusiast
Enthusiast

Hey guys,

 

just made a solution to a problem I've experienced a couple times and want to hear if anyone has any other ideas or if you can push my idea further! 

problem: I want to scale (or affect in some way) only 20% of my MASH network, randomly. 

solution: using a python node, loop through each object in the network, and roll a die(dice) for each object. The die has a range from 1-100. If the die rolls under 20, scale the current object being looped on. 

 

Here's the python script (you can download and copy the .txt file I've attached if you don't want to indent the for loop/if statement):

 

import openMASH

import random

#initialise the MASH network data

md = openMASH.MASHData(thisNode)

 

#and this gets the number of objects in the network

count = md.count()

 

#for each object, generate a random number between 0 and 100

#if the result is under 20, scale that object by a random value between #20 and 30

for i in range(count):

rollDice = random.randint(0, 99)

print rollDice

curScale = md.scale[i]

if rollDice < 20:

#multiply current scale by a value between 20 and 30

md.outScale[i] = curScale*random.uniform(20.0,30.0)

 

else:

print "derp"

 

#tell MASH to write the network data

md.setData()

 

 

so that's it! Pretty simply but helpful for me. If anyone takes this to the next level or has an alternative solution to the problem I'd like to hear from you! 

 

0 Likes
Message 22 of 25

corvidstudios
Enthusiast
Enthusiast

edit: was playing with it more and the python node gets re-evaluated every frame, resulting in the scale of the objects changing on each frame. The workaround is to disconnect time. However, if there are nodes earlier in the chain, you also need to disconnect time from them and they can't have any keyframes. I tried fixing it in the script however wasn't able to generate a random value on the first frame and save it for the rest of the framerange. If anyone has a solution I'd love to hear it! Also attached is a less messy version of the script.

0 Likes
Message 23 of 25

joostkonemann
Advocate
Advocate

If you're distribution is already random, you can use the step strength attribute to enable the effect on a specific portion of your points.

 

Or...

Do you need to be really precise about the 20%?

Otherwise, you could use a second MASH network, with less points and some random distribution (e.g. with scatter on a mesh) and use this second MASH network as a falloff object for the random node on the first network.

 

 

--
MacBook Pro 13,3 - 2.7GHz - 16GB - Radeon Pro 460 - macOS Catalina 10.15
Message 24 of 25

corvidstudios
Enthusiast
Enthusiast
Ah I forgot about step strength lol. Cheers!
0 Likes
Message 25 of 25

thomaslisle1309
Advocate
Advocate

brilliant idea.  i was just searching for it   

 

can you help my trees are all ass.  they don't sit on the mesh    they are all centred. yet some above some below  some off the edge    I have distributed by mesh  added a world system and added eth mesh there bit its nor really working properly. very annoying.   any ideas what I can do   thanks thomas from London 

0 Likes