Jump to content

vojtechcada

Members
  • Posts

    9
  • Joined

Personal Information

  • Country
    Czech Republic

vojtechcada's Achievements

Newbie

Newbie (1/14)

10

Reputation

  1. That's exactly what it does, the average direction of all the faces surrounding a vert is a vertex normal and getNormal gives you that.
  2. Don't reinvent the wheel - for editable mesh, there's already getNormal function, and matrixFromNormal or arbAxis already do what you want (btw. instead of your worldUpVector variable you should use the built-in z_axis one). So, as an example: ( local sourceObj = Box() local obj = convertToMesh (Sphere()) obj.selectedVerts = #{2..4} if isKindOf obj Editable_Mesh do for vert in getVertSelection obj do instance sourceObj transform:(translate (arbAxis (getNormal obj vert)) (getVert obj vert)) ) The different scale is because you're not making your vectors unit lenght (either by dividing by the number of vectors you added together or by normalizing them. Anyway, there's normal align for single object, placement for multiple, fill for edgeloops, scatter to distribute to verts and advanced painter if you want to go advanced - make it an exercise for yourself if you wish but don't spend much time on it instead of learning these tools.
  3. Well, that's exactly the same two lines as in Denis Trofimov's cgsociety post linked above (a few words of credits would be appropriate there, I think).
  4. The fastest way to get rid of it that I'm aware of is mentioned here: http://forums.cgsociety.org/showpost.php?p=7106404&postcount=18
  5. Basically, expression controllers are the oldest implementation, back before MAXScript was a part of the package, and are much faster than anything that uses MAXScript syntax (such as wire controllers or script controllers). However, they also have only a limited set of functions (and are also case sensitive) and you cannot make a scene object a variable and access its properties. For example, in script controller you can assign some object to obj variable and get its world position via obj.transform.pos or its position in parent space via obj.iNode.posInParent, and do advanced matrix transformations, access scene globals and so on. obj.transform.pos is generally safer as obj.transform computes a transformation matrix which includes ALL transforms including constraints. obj.pos should be okay provided you don't use constraints on the node, it functions as a direct property access, so $.pos.z += 10 will change node position, $.transform.pos.z will on the other hand only operate on the returned matrix so in order for it to work you'd have to do something like: nodeTM = obj.transform -- get it nodeTM.pos.z += 10 -- change it obj.transform = nodeTM -- set it
  6. The easiest way to get coords in world space is getting the obj.pos or obj.transform. pos directly - you have to switch to script controller instead of expression controller and add the obj there. In some cases you can also throw in Expose TM helper instead to make things easier Adding wiring just to fix this is unnecessary and only adds another level of complexity, IMHO.
  7. If I get you right, when building the expression you want to insert the values of R and R[i+1] like this: expr = "Rotation * " + (R[i]/R[i+1]) as string paramWire.connect gears[i].controller[#Rotation] gears[i+1].controller[#Rotation] expr Or am I missing something?
  8. Well, cui.RegisterDialogBar will just register a new toolbar, and you can only dock toolbars, not add one to another (and I think you already know how to do the docking). There might be a way to do that using style:#(), resizing the toolbar programmatically and making the rollout dialog its child - but I'm not sure if that's really worth the effort. If you don't need to dynamically add/remove toolbar buttons, would it work for you if you made a toolbar look-alike in a rollout form, added that cui.RegisterDialogBar rolloutName line and treated it as a toolbar?
  9. Something like this should get you there: try destroyDialog sliderTest catch() rollout sliderTest "Test" ( slider sldSwitcher "" pos:[7,5] orient:#vertical ticks:4 range:[1,5,5] type:#integer listBox lbxPresets "" pos:[47,10] width:104 height:5 items:#("320x240", "640x480", "800x600", "1024x768", "1280x960") fn changeRenderSize str = ( local tokens = filterString str "x" renderWidth = tokens[1] as integer renderHeight = tokens[2] as integer ) on sldSwitcher changed index do changeRenderSize lbxPresets.items[1+5-index] ) createDialog sliderTest
×
×
  • Create New...