≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Vertex color by material slot
Posted by:
(you are not logged in)
Enter the missing letter in: "Internatio?al"
(you are not logged in)
Text:
[quote][b]Guest[/b] wrote: @blackwater Before I wrote the code above, I wrote this code to display the RGB values to me since CC doesn't do that. This code is also CC0 and given freely to the community. I may return to this code in the future and make the RGB values display all on one menu, but it works for the time being. Thanks for your comment, and you're welcome. [code] // CopperCube editor plugin that displays the RGB values of a mesh's vertices function getVertexColorRGB() { var meshnode = editorGetSelectedSceneNode(); var bufferCount = ccbGetSceneNodeMeshBufferCount(meshnode); var colorArray = []; 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) { colorArray.push(ccbGetMeshBufferVertexColor(meshnode, i, v)); } } function onlyUnique(value, index, self) { return self.indexOf(value) == index; } var unique = colorArray.filter(onlyUnique); alert("Selected node has " + unique.length + " vertex color(s)."); function rgb(value) { var r = (value & 0xff0000) >> 16; var g = (value & 0x00ff00) >> 8; var b = value & 0x0000ff; return r + ", " + g + ", " + b; } for (let c = 0; c < unique.length; c++) { var msg = "RGB[" + (c + 1) + "/" + unique.length + "]: " + rgb(unique[c]); if (confirm(msg)) { // Do nothing } else { break; } } } } editorRegisterMenuEntry( "getVertexColorRGB()", "Get vertex color RGB(s)\tCtrl+Shift+P" ); [/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