≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Script Snap to grid
Posted by:
(you are not logged in)
Enter the missing letter in: "Inte?national"
(you are not logged in)
Text:
[quote][b][/b] wrote: Of course it works as plugin as well, you only forgot to wrap your code up into a function to be executed by the menu. Paste this into a file named for example 'snap.js', put it into the plugin directory and restart coppercube, and then it works: [code]function snap(value, gridSize, roundFunction){ if (roundFunction === undefined) roundFunction = Math.round; return gridSize * roundFunction(value / gridSize); } function doSnapSceneNode() { var s = editorGetSelectedSceneNode(); var position = ccbGetSceneNodeProperty(s, "Position"); var moveobjX = snap(position.x,5); var moveobjY = snap(position.y,5); var moveobjZ = snap(position.z,5); ccbSetSceneNodeProperty(s,"Position",moveobjX,moveobjY,moveobjZ); ccbUpdateSceneNodeBoundingBox(s); editorUpdateAllWindows(); } editorRegisterMenuEntry("doSnapSceneNode()", "Snap to grid\tCtrl+M");[/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact