Jump to content

Explode to Mesh Per Plant


wallworm

Recommended Posts

I would love to see a utility in GrowFX that would allow me to create a snapshot of each plant in a GrowFX node. By plant I would mean the complete mesh for each path up to the top parent.

 

For example, in the image here, there is one GrowFX node. There is one root Point Distributor that then spawns 5 plants from 5 points. Each of the resulting meshes from those 5 root distributions would be turned into a single mesh with its pivot aligned to the transform of that plant.

 

growfx_explode_per_plant.png.578b7b2515158702fe37df7a26324c0b.png

 

It would be nice to have this exposed as both a button in the modify tab as well as exposed to MAXScript.

 

In a MAXScrtip call it would be nice to have:

 

<node> GrowFX2.GetMeshes() returns array of the nodes created from the function.

 

Thanks for the consideration! :) 

 

Link to comment
Share on other sites

  • 4 weeks later...

Awesome. I cannot believe I didn't notice that!

 

I would like to propose an option to make that function have the ability to set the pivot/transform of each object to match the position/orientation of the distributor point that made each object? Right now the pivot matches the pivot of the GFX object, and this isn't ideal for assets exporting into a game.

 

Also, is the method of that button exposed to MAXScript?

Link to comment
Share on other sites

Eduard,

 

In this example, there is one GrowFX object using a Point Distributor. There are three point distributor Points that create the yellow cones. The objects that are created have a pivot that is where the GrowFX node was (world origin in this case). When I moved them away, notice how the pivot is not at the object base, but offset. I'd like the pivots to be where the original distributor spawn was (base of each cone). In the case of a point distributor, I'd like the position and orientation to match that of the point helper that the point distributor used.

 

Hope this makes sense. 

 

image.thumb.png.f10f9d6f4586dbdfc99b26a7d5c59f9b.png

Edited by wallworm
Edited to make more clear.
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

I just tested. The button now operates as expected. Thank you so much! :) 

 

I saw that the GFX interface includes functions for :

 

getNumSequences()
getNumLines()
GenerateOneMesh()
 
I expect that this is the methods that you go through to generate the meshes like in the one in the UI.
 
I propose that the exact method that the UI uses is also exposed as a method as well. It would be nice to have an option:
 
GenerateAllMeshes <asMesh=false> where the return value is an array of new nodes in the scene when asMesh=false and an array of trimeshes if true.
Link to comment
Share on other sites

Hi wallworm,

 

We've added the following maxscript methods:

 

<growfx2>.CreateHierarchyMeshes <is_group_by_pathcolor>

Returns an array of Editable poly nodes of the elements in the hierarchy.

is_group_by_pathcolor : boolean - when true, the algorithm will group adjacent branches if they have the same path color.

 

<growfx2>.CreateHierarchySplines <is_group_by_pathcolor>

Returns an array of Editable spline nodes of the elements in the hierarchy.

is_group_by_pathcolor : boolean - when true, the algorithm will group adjacent branches if they have the same path color.

 

 

I'm already planning to release this update as a new version 2.0.1.

Thanks!

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I tested the new exposed methods and I had an issue.

 

I ran the function and hit undo a couple times. This seemed to be OK. In the MXS listener recording below, I hit undo after the first two times running the $.CreateHierarchyMeshes() method. Then I ran the function to create again but stuffed into variable s. Then I ran delete s. I then assigned s again with another call to the method but got an EXCEPTION_ACCESS_VIOLATION:


 

$.CreateHierarchyMeshes true
#($Editable_Poly:Cupressus_3_001_1_001 @ [257.438660,64.907280,0.000000], $Editable_Poly:Cupressus_3_001_2_001 @ [257.192810,69.849075,114.265289], $Editable_Poly:Cupressus_3_001_3_001 @ [287.182556,18.811779,144.575912], $Editable_Poly:Cupressus_3_001_2_002 @ [258.417938,68.139091,137.432953], $Editable_Poly:Cupressus_3_001_2_003 @ [256.248108,65.852432,160.015427], $Editable_Poly:Cupressus_3_001_3_002 @ [196.211304,65.676514,157.349869], $Editable_Poly:Cupressus_3_001_2_004 @ [253.304810,63.673962,179.984283], $Editable_Poly:Cupressus_3_001_3_003 @ [298.677460,29.907063,190.718811], $Editable_Poly:Cupressus_3_001_2_005 @ [254.182571,64.322510,199.802017], $Editable_Poly:Cupressus_3_001_3_004 @ [255.555679,132.645004,225.532196], $Editable_Poly:Cupressus_3_001_2_006 @ [257.332092,65.911949,219.440674], $Editable_Poly:Cupressus_3_001_3_005 @ [193.613007,-13.574837,249.484070], $Editable_Poly:Cupressus_3_001_2_007 @ [258.979675,66.757721,237.858826], $Editable_Poly:Cupressus_3_001_3_006 @ [298.677948,80.205109,242.760712], $Editable_Poly:Cupressus_3_001_3_007 @ [354.107910,113.332748,239.344101], $Editable_Poly:Cupressus_3_001_2_008 @ [258.659760,69.174309,255.113449], $Editable_Poly:Cupressus_3_001_3_008 @ [196.943237,88.189751,254.227020], $Editable_Poly:Cupressus_3_001_3_009 @ [159.362885,105.001373,246.191406], $Editable_Poly:Cupressus_3_001_2_009 @ [258.801208,70.954430,269.943054], $Editable_Poly:Cupressus_3_001_3_010 @ [279.488220,38.815216,276.179779], ...)
$.CreateHierarchyMeshes false
#($Editable_Poly:Cupressus_3_001_1_001 @ [257.438660,64.907280,0.000000], $Editable_Poly:Cupressus_3_001_2_001 @ [257.192810,69.849075,114.265289], $Editable_Poly:Cupressus_3_001_3_001 @ [287.182556,18.811779,144.575912], $Editable_Poly:Cupressus_3_001_2_002 @ [258.417938,68.139091,137.432953], $Editable_Poly:Cupressus_3_001_2_003 @ [256.248108,65.852432,160.015427], $Editable_Poly:Cupressus_3_001_3_002 @ [196.211304,65.676514,157.349869], $Editable_Poly:Cupressus_3_001_2_004 @ [253.304810,63.673962,179.984283], $Editable_Poly:Cupressus_3_001_3_003 @ [298.677460,29.907063,190.718811], $Editable_Poly:Cupressus_3_001_2_005 @ [254.182571,64.322510,199.802017], $Editable_Poly:Cupressus_3_001_3_004 @ [255.555679,132.645004,225.532196], $Editable_Poly:Cupressus_3_001_2_006 @ [257.332092,65.911949,219.440674], $Editable_Poly:Cupressus_3_001_3_005 @ [193.613007,-13.574837,249.484070], $Editable_Poly:Cupressus_3_001_2_007 @ [258.979675,66.757721,237.858826], $Editable_Poly:Cupressus_3_001_3_006 @ [298.677948,80.205109,242.760712], $Editable_Poly:Cupressus_3_001_3_007 @ [354.107910,113.332748,239.344101], $Editable_Poly:Cupressus_3_001_2_008 @ [258.659760,69.174309,255.113449], $Editable_Poly:Cupressus_3_001_3_008 @ [196.943237,88.189751,254.227020], $Editable_Poly:Cupressus_3_001_3_009 @ [159.362885,105.001373,246.191406], $Editable_Poly:Cupressus_3_001_2_009 @ [258.801208,70.954430,269.943054], $Editable_Poly:Cupressus_3_001_3_010 @ [279.488220,38.815216,276.179779], ...)
s = $.CreateHierarchyMeshes true
#($Editable_Poly:Cupressus_3_001_1_001 @ [257.438660,64.907280,0.000000], $Editable_Poly:Cupressus_3_001_2_001 @ [257.192810,69.849075,114.265289], $Editable_Poly:Cupressus_3_001_3_001 @ [287.182556,18.811779,144.575912], $Editable_Poly:Cupressus_3_001_2_002 @ [258.417938,68.139091,137.432953], $Editable_Poly:Cupressus_3_001_2_003 @ [256.248108,65.852432,160.015427], $Editable_Poly:Cupressus_3_001_3_002 @ [196.211304,65.676514,157.349869], $Editable_Poly:Cupressus_3_001_2_004 @ [253.304810,63.673962,179.984283], $Editable_Poly:Cupressus_3_001_3_003 @ [298.677460,29.907063,190.718811], $Editable_Poly:Cupressus_3_001_2_005 @ [254.182571,64.322510,199.802017], $Editable_Poly:Cupressus_3_001_3_004 @ [255.555679,132.645004,225.532196], $Editable_Poly:Cupressus_3_001_2_006 @ [257.332092,65.911949,219.440674], $Editable_Poly:Cupressus_3_001_3_005 @ [193.613007,-13.574837,249.484070], $Editable_Poly:Cupressus_3_001_2_007 @ [258.979675,66.757721,237.858826], $Editable_Poly:Cupressus_3_001_3_006 @ [298.677948,80.205109,242.760712], $Editable_Poly:Cupressus_3_001_3_007 @ [354.107910,113.332748,239.344101], $Editable_Poly:Cupressus_3_001_2_008 @ [258.659760,69.174309,255.113449], $Editable_Poly:Cupressus_3_001_3_008 @ [196.943237,88.189751,254.227020], $Editable_Poly:Cupressus_3_001_3_009 @ [159.362885,105.001373,246.191406], $Editable_Poly:Cupressus_3_001_2_009 @ [258.801208,70.954430,269.943054], $Editable_Poly:Cupressus_3_001_3_010 @ [279.488220,38.815216,276.179779], ...)
s.count
164
delete s
164
s = $.CreateHierarchyMeshes false
-- Known system exception
-- ########################################################################
-- Address: 0xa348d9dc; nCode: 0x00000000C0000005
-- Desc: EXCEPTION_ACCESS_VIOLATION The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
--       Read of Address: 0x0000000000000000
-- ########################################################################
-- MAXScript callstack:
--    thread data: threadID:14720
--    ------------------------------------------------------
--    [stack level: 0]
--    In top-level
-- ########################################################################
-- C++ callstack:
-- (GrowFX): (filename not available): CanAutoDefer
-- (GrowFX): (filename not available): GetGrowFX2Converter
-- (GrowFX): (filename not available): GetGrowFX2Converter
-- (MAXScrpt): (filename not available): Generic::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): MAXScriptException::ScopedMXSCallstackCaptureDisable::__autoclassinit2
-- (MAXScrpt): (filename not available): Primitive::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): SourceFileWrapper::eval
-- (MAXScrpt): (filename not available): IsMAXScriptListenerInViewport
-- (USER32): (filename not available): GetMenuItemCount
-- (USER32): (filename not available): GetMenuItemCount
-- (USER32): (filename not available): GetMenuItemCount
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): CallWindowProcW
-- (UIControls): (filename not available): (function-name not available)
-- (UIControls): (filename not available): (function-name not available)
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): IsDialogMessageW
-- (3dsmax): (filename not available): XMLAnimTreeEntry::GetUnique
-- (3dsmax): (filename not available): Frustum::operator=
-- (Qt5Core): (filename not available): QObject::qt_static_metacall
-- (Qt5Core): (filename not available): QEventDispatcherWin32::preProcessNativeEvent
-- (Qt5Core): (filename not available): QEventDispatcherWin32::processEvents
-- (qwindows): (filename not available): qt_plugin_query_metadata
-- (Qt5Core): (filename not available): QEventLoop::exec
-- (Qt5Core): (filename not available): QCoreApplication::exec
-- (3dsmax): (filename not available): Frustum::operator=
-- (3dsmax): (filename not available): NodeAndAnims::SetNode
-- (3dsmax): (filename not available): UtilGfx::InitRectIPoint3
-- ########################################################################

 

Link to comment
Share on other sites

  • 1 year later...

@Eduard The updated functions you added a while ago are great.

 

It would be nice to expose to MAXScript the function of the Create Separate Objects button (I could only see exposure to the create Hierarchy of Meshes and Splines) and make it return the results. Also, it would be convenient if you could make two versions of the function: 1) One that matches current button that makes editable poly objects ;  2) a version that returns an array of trimesh() data (not scene nodes).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...