tapsteady
Does anyone have a working version of SOUP_ createShatter.py for Maya 2018 or 2019? Using the script on an object creates the transform1, polySurface1 and shatter1_temp1, but doesn't shatter the mesh anymore 🙁

Thanks!
Reply 0 0
tapsteady

Didn't realize I was getting this error.

// Error: line 6368: The source attribute 'shatter1.outGemotry' cannot be found. // 

# Error: RuntimeError: file <maya console> line 57: Error occurred during execution of MEL script
line 6368: The source attribute 'shatter1.outGemotry' cannot be found. #
shatter1: Cooking geometry ...
shatter1: 5 shard(s) created in 0 seconds.

Reply 0 0
pshipkov
Will check and fix tonight.
Please clarify what os and maya version you use ?
Reply 0 0
tapsteady

thanks pshipkov! using Windows 10 pro and Maya 2019.

I discovered it's not auto-updating even with auto-evaluate checked on the shatter node. have to manually switch and click 'bake result' and it'll create a whole new shatter mesh instead of updating the existing shatter mesh.

Reply 0 0
pshipkov
Can you pass me that script please ?
Reply 0 0
tapsteady
#
# Copyright (C) by Adrian Sochacki, 2018. All rights reserved.
#
# Description: Loads the SOuP plugin and creates a shatter
# How to use: Just select an object and run the script
# Restriction: Not more thant 1 object allowed
# Requires: SOuP_Plugin 2016
#
# Tested in Maya 2016, 2017
#
# Version: 1.0.1
#
import maya.cmds as cmds
import maya.mel as mel
import sys
import math
#Creates a default SOuP shatter:
def SOuP_createShatter():
  sel = cmds.ls(sl=True)
  if len(sel) == 0:
    sys.exit("Please select first an object.\n")
  if len(sel) > 1:
    sys.exit("You are not allowed to have more than 1 object selected.\n")
  selType = cmds.filterExpand(selectionMask = 12)
  if selType == None:
    sys.exit("You did not select an polygon object.\n")
  if not cmds.pluginInfo("SOuP", query=True, loaded=True):
    cmds.loadPlugin("SOuP")
  bound = cmds.polyEvaluate(sel, boundingBox=True)
  v1 = [bound[0][0], bound[1][0], bound[2][0]]
  v2 = [bound[0][1], bound[1][1], bound[2][1]]
  v3 = [v2[0]- v1[0], v2[1]-v1[1], v2[2]-v1[2]]
  vLength = math.sqrt(v3[0]**2 + v3[1]**2 + v3[2]**2)
  rounded = math.ceil(vLength) * 1.5
  if rounded < 30:
    rounded = 30
  
  shape = cmds.listRelatives(sel, shapes=True)
  scatter = cmds.createNode("scatter")
  cmds.setAttr(scatter + ".pointDensity", rounded)
  shatter = cmds.createNode("shatter")
  mesh = cmds.createNode("mesh")
  cmds.hyperShade(assign = "initialShadingGroup")
  cmds.connectAttr(shape[0] + ".outMesh", scatter + ".inGeometry", force=True)
  cmds.connectAttr(shape[0] + ".outMesh", shatter + ".inGeometry", force=True)
  cmds.connectAttr(scatter + ".outPositionPP", shatter + ".inPositionPP", force=True)
  cmds.connectAttr(shatter + ".outGeometry", mesh + ".inMesh", force=True)
  newGeo = mel.eval('bake_SHATTER_SOUP("'+ shatter + '.outGemotry");')
  sys.stdout.write("Created a default shatter.\n")
if __name__ == '__main__':
  SOuP_createShatter()
Reply 0 0
pshipkov
There is a syntax error in the 4th line from the bottom:
newGeo = mel.eval('bake_SHATTER_SOUP("'+ shatter + '.outGemotry");')
Notice the attribute is spelled as "outGemotry", while it has to be "outGeometry".
Reply 0 0
tapsteady
Haha, wow. Thanks! That's updating the existing mesh now, but still not auto-updating in 2019. Still have to click the 'bake result' button on the scatter node. The 'auto-evaluate' box is checked. Not the end of the world, but is there a simple way to get that working again? 
Reply 0 0
pshipkov
Apparently something changed in the evaluation model of Maya 2019 and later.
Looking now into how to work around this unexpected issue.
Reply 0 0
pshipkov
I will have to bring this one to Maya's dev team.
Tried hard - unable to work around this new problem with the DG evaluation.
Reply 0 0
tapsteady
That sounds fun 😋 Thanks for trying to get this working! 
Reply 0 0
pshipkov
I got no love from the Maya devs, so had to sit down and figure out a something.
Got lucky and got things working again in Maya 2018, 2019 and later.
Also, along the way i optimized this and that. Now the shatter node is 6 times faster than before.
Check it out: http://www.soup-dev.com/videos/forums/shatter_performance_improvements.mp4
Will push new build over the weekend.
Reply 0 0
Reply