January 28, 2012

dotNet Treeview MultiSelect for MaxScript

Recently I've been working on a MaxScript project that required a dotNet Treeview and the ability to select multiple items. I was really troubled that the default treeview doesn't support multiselect, only ancient looking check boxes. However, I was happy to find that someone else bumped into this problem and made their solution available. Unfortunately, there were no example on how to use it with MaxScript. Here's how to get it working:


  • Step 1 is to download the DLL control from here: http://sourceforge.net/projects/mulsel-treeview/
  • Step 2 is to unzip the DLL to a folder you can remember easily. I chose the UserMacro folder. You can get to it quickly by typing the following into the MaxScript Listener:
shelllaunch "$usermacros" ""
  • Step 3 is to remove the periods from the file name of the DLL or Max won't load it.
  • Step 4 below is an example how to load and use the plugin with MaxScript.



--LOAD THE CUSTOM PLUGIN FIRST
--NOTE THAT THERE ARE NO PERIODS IN THE FILE NAME OF THE DLL
dotnet.loadAssembly ((pathConfig.normalizepath "$usermacros") + "CodersLabWindowsControlsTreeView.dll")

--BASIC MAXSCRIPT ROLLOUT
rollout TreeViewMultiSelect "MultiSelect" width:300 height:200
(
   --THIS IS A BASIC DOTNET TREE VIEW CONTROL
   --dotNetControl tv "system.windows.forms.treeView" height:200 width:300
 
   --USE THIS INSTEAD AFTER YOU INSTALL THE DLL
   dotNetControl treeviewObjectList "CodersLab.Windows.Controls.treeView" height:192 width:292 pos:[4,4]
 
   on TreeViewMultiSelect open do
   (     
       --THIS TELLS THE TREEVIEW TO ENABLE MULTISELECT
       ms = (dotnetclass "CodersLab.Windows.Controls.TreeViewSelectionMode")
       treeviewObjectList.SelectionMode = ms.MultiSelect
     
       --HERE ARE THE OTHER MODES AVAILABLE:
--               .MultiSelect
--               .MultiSelectSameLevel
--               .MultiSelectSameLevelAndRootBranch
--               .MultiSelectSameParent
--               .MultiSelectSameRootBranch
--               .SingleSelect
     
       --LETS ADD SOME NODES TO THE TREE VIEW
       for obj in objects do
       (
           --CREATE A NEW DOTNET TREE NODE
           newNode = (dotNetObject "System.Windows.Forms.TreeNode" obj.name)
         
           --ADD IT TO THE TREEVIEW
           treeviewObjectList.nodes.add newNode
       )
   )
)
--OPEN THE ROLLOUT AS A DIALOG
createDialog TreeViewMultiSelect

  • Step 5 proof that it works!

The only issue I bumped into after replacing the default treeview is that the selectedNode property no longer seems to work. But I replaced it with selectedNodes.item[0]. Note the S in selectedNodes. Leave a comment if this helped!




January 13, 2012

Remove All Wire Parameters MaxScript

RemoveAllWireParametersFromSelection.ms

I'm on a tech-art roll people! This MaxScript for 3ds Max will traverse your selection and disconnect all existing wire parameters, without prejudice! To use it, first um... download it, and then in 3ds Max go to MaxScript | Run Script... Make sure you have your objects selected as well.

January 12, 2012

Skin Mini Tutorial


Situation: You have two skinned objects in 3ds Max, and you need them to be one skinned object. Again, this skin tutorial is written in a general way to easily reproduce when you bump into this situation.

  1. Go into Figure Mode or Skin Pose or Bind Pose, and set the slider to Frame 0.
  2. Select both objects.
  3. Go to Edit | Clone
  4. Pick Copy and click OK.
  5. Select the new copies and convert to edit poly to collapse the modifier stack.
  6. Attach one object to the other.
  7. Select your object and add a Skin Wrap modifier.
  8. Click the Add button in the modify panel and add both of the original objects by clicking on them. (They should still be skinned.)
  9. Change Deformation Engine to Face Deformation.
  10. Check Weight All Points
  11. Click on Convert to Skin.


Optionally, you can skip clicking Convert to Skin and when you update the skinning the two original objects the skin wrap will update as well. If you are exporting to a game engine, you do need to convert to skin though.

January 11, 2012

Reactor Physics Hinge Tutorial


Reactor is the Physics system used in 3ds Max 2011 and earlier. I created this tutorial for a post on Polycount.com, but many people still use older versions of 3ds Max. So I thought I should post it here as well. Please comment and let me know if it works for you. The tutorial is written in a general way so that you can reproduce the steps on your own objects.

Click here to download the completed Max File






Creating the Hinge:
  1. Parent object b (the Small Box) to object a (the Larger Box).
  2. Change the pivot on object b so that rotating the Z axis gives the effect you want.
  3. Hold ALT + Shift and Right click for the reactor menu.
  4. Select Hinge Constraint and click on the ground near your objects.
  5. Select the Hinge object and in the modify panel set object B as the Child.
  6. Check the Parent option and set object A as the parent.
  7. Click on Child Space and Child Body.
  8. Don't worry about the Min and Max Angles, the collisions will take care of that.


Creating the Hinge Solver:

  1. Hold ALT + Shift and Right click for the reactor menu.
  2. Click on Constraint Solver and click on the ground near the objects to create one.
  3. Select the Solver and in the modify panel click on Pick and select the Hinge.
  4. Select object a and b
  5. Hold ALT + Shift and Right click for the reactor menu.
  6. Click on Rigid Body Collection, the selected objects will be added automatically.
  7. Select the Solver and in the modify panel set the RB Collection as the Rigid Body Collection object.


Create the Rigid Body Collection:
  1. Open the Reactor right click menu and click on Open Property Editor
  2. Select object A, and in the Property Editor check Unyielding and set Shell to 0.
  3. (This means it's a hand keyed object that influences physics)
  4. Select object B and give it mass.
  5. (Doesn't matter how much, unless it hits other objects.)
  6. Also and set Shell to 0.


Preview and Bake:
  1. Go to the utility panel and open the Reactor utility.
  2. Click on Preview animation.
  3. You can edit the Timing setting and preview again.
  4. If everything is cool you can click on Create Animation to bake.


January 7, 2012

Autodesk Sketchbook - Copic Edition

I was goofing around with Autodesk Sketchbook - Copic Edition. It's freeware and really fun to use! Download it here: http://copic.jp/en/sketchbook-ce.html



January 5, 2012

You've been SpaceNapped!

Head over to my new SpaceNapped! webcomic. The first two pages are up. I plan on putting up a new page every Saturday. You can subscribe if you are bad at checking for updates.

About SpaceNapped!:
SpaceNapped! is a science fiction webcomic that follows the adventures of Captain West and his unlikely crew as they chase bounties throughout the galaxy.

Click the pages below for a larger preview.

 Pilots Are Hard to Find