≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Random vertex color
Posted by:
(you are not logged in)
Enter the missing letter in: "Int?rnational"
(you are not logged in)
Text:
[quote][b]Guest[/b] wrote: I've been messing with making prefabs of simple geometry for use in CC. Basically copying the contents of Unity primitive "blockout" kits for fun and learning. I'm not texturing them because that's not needed for a "blockout/greybox" or whatnot. I like to just slam the vertex-painted shapes together before merging the meshes into one and exporting to another program for texturing. If you're not doing this, I recommend you give it a try. It helps to deconstruct complex objects into simple colored shapes. Least that is what I've found out. That said, one thing I do not like is picking out the vertex color for my shapes. It's tedious when adding a lot of shapes to pick out colors. So to reduce those extra clicks I wrote a little editor plugin to do it for me, and that is what I want to share. [code] // CopperCube editor plugin that applies a random vertex color to a mesh function randomVertexColor() { var meshnode = editorGetSelectedSceneNode(); var bufferCount = ccbGetSceneNodeMeshBufferCount(meshnode); function getColor() { return color = "0x" + Math.random().toString(16).slice(2, 8); } getColor(); if (bufferCount == 0) alert('The selected node has no 3D geometry.'); else { for (var i = 0; i < bufferCount; ++i) { var vertexcount = ccbGetMeshBufferVertexCount(meshnode, i); for (var v = 0; v < vertexcount; ++v) { ccbSetMeshBufferVertexColor(meshnode, i, v, parseInt(Number(color), 10)); } } } } editorRegisterMenuEntry("randomVertexColor()", "Apply random vertex color\tCtrl+P"); [/code] Just copy this code to a text file, save it as "randomVertexColor.js", and put it into you plugins folder. Next time you launch your CC you will be able to press Ctrl + P to apply a random vertex color to your geometry nodes. You can even hold down the keys to watch it run through a bunch of colors. Note: you can change the key combinations by simply replacing this line: editorRegisterMenuEntry("randomVertexColor()", "Apply random vertex color\tCtrl+P"); to something like: editorRegisterMenuEntry("randomVertexColor()", "Apply random vertex color\tCtrl+L"); It will now work with the Ctrl + L next time you open CC or reload the plugins. I recommend looking on Just_In_Case's website for his "Keyboard Shortcuts" plugin to see what other keyboard shortcuts are valid. Here it is, just open and look down at the bottom to see all the combinations you can use: [url]https://neophyte.cf/ccb_plugin_keyboard_shortcuts.html[/url] You are free to do anything you want with this code. I release it to the community. If you do make something else with it, I would personally like to see it posted here for everyone. Maybe your way of doing it is superior than mine. I'm still new to programming but CC has greatly helped me learn and feel comfortable with JS. Cheers, guys.[/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