Itoo Software Forum

Author Topic: Scripts for Forest Pack  (Read 272618 times)

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 3049
Scripts for Forest Pack
« on: May 08, 2015, 03:31:58 PM »
In this sticky topic we encourage you to share any intersting scripts or tools that you've created to make working with Forest Pack even easier.

If you'd like to share your work with the community, just feel free to upload or link to your script with a brief description below.

To download files from our forums you need to be logged in with an account associated with a Pro license.

Many thanks!

Paul

Disclaimer: Any scripts uploaded to this thread by the iToo Software team are not supported officially by iToo, please use at your own risk.
« Last Edit: August 06, 2018, 11:44:02 AM by Paul Roberts »
Paul Roberts
iToo Software

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2678
Re: Scripts for Forest Pack
« Reply #1 on: May 08, 2015, 04:04:37 PM »
Surface Assignment



A simple one for quick base surface reassignment, that can be handy in case of having multiple Forest objects.

Its UI is quite simple. To select the "new" surface please Pick Surface button. You can select Forest object(s) manually or if wanted you can select all Forest object in your scene by Select All Forest objects button. By hitting Assign all selected Forest object will now use the picked surface.

Cheers,

TL1895

  • Sr. Member
  • ****
  • Posts: 398
Re: Scripts for Forest Pack
« Reply #2 on: May 08, 2015, 07:39:42 PM »
Excellent!
thank you

SozoDigital

  • Newbie
  • *
  • Posts: 11
Re: Scripts for Forest Pack
« Reply #3 on: August 10, 2015, 07:14:24 AM »
Very nice! Thank you very much for sharing!

Cheers!

in3des

  • Full Member
  • ***
  • Posts: 100
Re: Scripts for Forest Pack
« Reply #4 on: September 08, 2015, 12:52:12 PM »
= Forest Replace Object =
adding this one also
Carlos made it some time ago
(if I remember this scripts helps to change an object in all forests with new one)

Michal Karmazín

  • iToo Software
  • Hero Member
  • *****
  • Posts: 2678
Re: Scripts for Forest Pack
« Reply #5 on: October 07, 2015, 10:22:27 AM »
ObjectsToForest



This script will automatically add selected items & place them to source object's position. Use the Select Objects to pick all objects that should be inserted into the new "AutoForest" object. Than by clicking the AutoForest button, it'll create a new Forest object with all those objects with transformations corresponding to its "source objects".

Hope, it'll speed-up your work-flow, when this kind of task needs to be performed massively.

Best regards,
« Last Edit: October 07, 2015, 10:27:10 AM by Michal Karmazín »

HM3153

  • Newbie
  • *
  • Posts: 46
Re: Scripts for Forest Pack
« Reply #6 on: February 03, 2016, 11:50:20 PM »
Great!!!

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 3049
Re: Scripts for Forest Pack
« Reply #7 on: May 04, 2016, 10:50:54 AM »
InstancesToForest



This script looks in the scene to find instances of the objects in Forest Pack's item list. When it finds them they're added to FP, matching the position, rotation and scale.

To use this script:
- Create a new FP object
- Add an object/s to Forest Pack's items list, these are the things with instances in the scene that you'd like to convert to FP geometry.
- Change to Tree Editor mode
- With the FP object still selected, press Instance To Forest.

Here's a video of it working



Note that this is an early version. At the moment the Forest Pack object must be at the world origin (the script changes this automatically though). I'd also like to add the ability to append the instances (at the moment it overwrites the current scatter),an option to automatically find instanced objects and add one of them to the items list (great for automatically converting large scenes), and an option to delete the original instances once added to FP.

I hope it's useful for some people.

Many thanks!

Paul.
« Last Edit: May 04, 2016, 10:59:01 AM by Paul Roberts »
Paul Roberts
iToo Software

Haider of Sweden

  • Newbie
  • *
  • Posts: 47
    • Portfolio
Re: Scripts for Forest Pack
« Reply #8 on: June 21, 2016, 09:45:00 AM »
Wish/request

A script that selects all ForestPack nodes, so that I can put them in a separate layer.
//Haider

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 3049
Re: Scripts for Forest Pack
« Reply #9 on: June 21, 2016, 11:40:23 AM »
Hi,

You could use this line of code to select all the object in the scene:

select (for s in geometry where classOf s == Forest_Pro collect s)

Alternatively you could easily  select all the Forest Objects using Forest Lister. To do this:

1 - Hold down Control and click on the boxes in the first column of Forest Lister for all the Forest Objects you wish to select.



2 - Click the Select Objects button.

I hope that helps, please let me know if you have any further questions.

Many Thanks,

Paul
Paul Roberts
iToo Software

Haider of Sweden

  • Newbie
  • *
  • Posts: 47
    • Portfolio
Re: Scripts for Forest Pack
« Reply #10 on: June 24, 2016, 12:54:43 AM »

You could use this line of code to select all the object in the scene:

select (for s in geometry where classOf s == Forest_Pro collect s)

Alternatively you could easily  select all the Forest Objects using Forest Lister.

Both your answer helped me perfectly well.


Wish/request 2

A way to set "Auto Assign to Active View" on all forest items in the scene. I encountered huge difficulties when I was setting up a test-scene with several samples. It ended up being too many items to be renderable. I had to go through the forest objects one by one and set Auto Assign...
//Haider

Screenscene vfx

  • Newbie
  • *
  • Posts: 36
Re: Scripts for Forest Pack
« Reply #11 on: August 02, 2016, 05:56:04 PM »
Hurray!

I was supplied a scene from another post company who'd written an instancer for maya and arnold to do digital set extensions. We'd been given a huge collection of alembic caches, texture files and a single maya file that had point helpers named after the model that should have been scattered on it. I was able to split the objects into layers based on their names and then bastardize your script to create a forest object with a tree matching the position, rotation and scale of each of the point helpers.

Now rather than 33,000+ vray proxies in my scene, I've a forest object for each of the 90 types of objects scattered in the scene and something way more manageable to deal with.

Much appreciated Paul!

Quote

-- Make a forest object to load stuff into

theForestObj = forest_Pro mode:1

-- Quick function in case I want to loop it later

function MakeForestFromSelection theForest theSel =
(
   
   for i = 1 to (theSel.count) do
   (
      
      -- All nicked from Paul roberts instances to forest script - http://forum.itoosoft.com/index.php?topic=2929.0
      
      local itemMatrix = theSel.transform
      local rot = quattoeuler (theSel.transform.rotationpart) order:5
      local newRot = [degtorad(rot.y),degtorad(rot.z),degtorad(rot.x)]
      local itemLocalBoundingBox = nodeGetBoundingBox theSel itemMatrix
      local size = (itemLocalBoundingBox[2] - itemLocalBoundingBox[1]) * itemMatrix.scalePart
      
      -- Add in a forest tree using the transform data of each selection object
      
      theForest.trees.create theSel.pos 1 1 theForest.specidlist[1]
      theForest.trees.setRotation (theForest.trees.count()-1) newrot
      theForest.trees.setSize (theForest.trees.count()-1) size
      theForest.trees.update_ui()
      theForest.trees.update()            
   )
)

-- Fly my pretties

MakeForestFromSelection theForestObj (selection as array)

Paul Roberts

  • iToo Software
  • Hero Member
  • *****
  • Posts: 3049
Re: Scripts for Forest Pack
« Reply #12 on: August 03, 2016, 11:15:41 AM »
Instance lights on Forest Pack items



This script instances any object to match the position and rotation of items scattered with Forest Pack. It can be useful for distributing lights, splines, particle systems or any other non-geometric object that it not able to be scattered directly with Forest Pack

To use this script:
- NOTE: To return correct transform information, Forest Pack object must be scattering custom geometry, not using one of the built in billboard templates.
- Press the "Pick Object to instance" button and choose the object you'd like to instance, for example a light
- Make sure a Forest Object is selected.
- Click "Instances to Forest"

The new instances are created with a combination of the source object and the Forest object's names. To delete these.

- Make sure the source object is chosen using the "Pick Object to instance" button
- Select the FP object
- Click delete instanced objects.

Note: Because the delete function is using the names of the FP object and the source object you should not change their names if you would like to use the delete function.

Here's a video of it working



I hope it's useful for someone.

Many thanks!

Paul.
« Last Edit: August 03, 2016, 01:05:38 PM by Paul Roberts »
Paul Roberts
iToo Software

raistlin

  • Jr. Member
  • **
  • Posts: 60
    • My website
Re: Scripts for Forest Pack
« Reply #13 on: September 07, 2016, 09:51:26 AM »
Hi Itoo

Can you add a little script to "randomize seed" a selection of multiple Forest Pack object in a click, it should be really interesting for scene that we re-use...

Cheers!
La vie est une aventure dangereuse d'où personne n'est jamais sortie vivant.

raistlin

  • Jr. Member
  • **
  • Posts: 60
    • My website
Re: Scripts for Forest Pack
« Reply #14 on: September 07, 2016, 10:11:19 AM »
Hi Itoo

Can you add a little script to "randomize seed" a selection of multiple Forest Pack object in a click, it should be really interesting for scene that we re-use...

Cheers!

I've done a little thing like that :

$.seed = random 1 999999

But it's really limited, because the result is apply in the same time on each forest object...
Damned...
It work, for sure... But i'm pretty sure it could be better...
La vie est une aventure dangereuse d'où personne n'est jamais sortie vivant.