Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Where is there a list of properties for each scenenode type

levinemartin63
Registered User
Quote
2014-07-06 04:38:08

var s2 = ccbGetSceneNodeFromName("2DOverlay1");
ccbSetSceneNodeProperty(s2, "Height", "12");


executing from view script the error message is Height not a property.
It works for visible and alpha. It also says Text is not a property.
Is there documentation for what properties exist for each scenene type?


pmax
Registered User
Quote
2014-07-06 08:05:59

Hi levinemartin63
Jump to read the documentation of CopperCube and find what you need.
I am attaching what you need.


ccbSetSceneNodeProperty(sceneNode, propertyName, value)
ccbSetSceneNodeProperty(sceneNode, propertyName, x, y, z)

Sets the property value of a scene node. The propertyName is also the name displayed in the property window of the editor in the left column. Possible names depend on the scene node type, but usually names like 'Name', 'Position', 'Rotation', 'Scale', and 'Visible' are available at least. Please note that the name is case sensitive.

For animated scene nodes, Properties like 'Animation', 'Looping' and 'FramesPerSecond' are available.
For camera nodes, Properties like 'Target', 'UpVector', 'AspectRatio' and 'FieldOfView_Degrees' are available.
For 2D overlay nodes, Properties like the following are available: 'Pos X (percent)', 'Pos Y (percent)', 'Width (percent)', 'Height (percent)', 'Pos X (pixels)', 'Pos Y (pixels)', 'Width (pixels)', 'Height (pixels)', 'Alpha', 'Image', 'Background Color', 'Draw Text', 'TextColor', 'Text'.



levinemartin63
Registered User
Quote
2014-07-06 18:33:16

I read that documentation. Unfortunately I could only get visible and alpha to work. There is an error in the error window saying not a property when I treid the others for 2D overlay.


erik
Registered User
Quote
2014-07-07 07:48:57

Lower and upper case is important, maybe you wrote "visible" instead of "Visible", for example? Just guessing.


levinemartin63
Registered User
Quote
2014-07-07 17:52:18

Visible works and Alpha works those are not the problems!

Can you get any of those properties (fro 2DOverlay) other than alpha and visible to work thru either the scripting window or and action script and if so please send me the code.

"Image" works as a property in the scripting window but not in an action script.


pmax
Registered User
Quote
2014-07-08 16:57:42

Script 1

var node = ccbGetSceneNodeFromName("2DOverlay1");
ccbSetSceneNodeProperty(node,'Draw Text',true);
ccbSetSceneNodeProperty(node,'TextColor',0,0,0);
ccbSetSceneNodeProperty(node,'Text','Hello World!');

script2

var node = ccbGetSceneNodeFromName("2DOverlay1");
ccbSetSceneNodeProperty(node,'Height (pixels)',320);


the first script associated with the push of a button looks for the object (2DOverlay1) and writes the inside (Hello World).
the second script associated with the push of a button looks for the object (2DOverlay1) and enlarge it with pixel values.

PS: translated by Google


levinemartin63
Registered User
Quote
2014-07-09 05:56:22

thanks


levinemartin63
Registered User
Quote
2014-07-12 01:29:31

Only "Height","Text","TextColor","Visible" from an action script that is processed from the cubeMesh1 clicked event: Please provide the proper syntax:

/* <action jsname="action_Test3" description="test3">
</action>
*/
action_Test3= function()
{
};
// called when the action is executed
action_Test3.prototype.execute = function(currentNode)
{

var node = ccbGetSceneNodeFromName("2DOverlay1");
ccbSetSceneNodeProperty(node,'Draw Text',true);
ccbSetSceneNodeProperty(node,'TextColor',120,120,120);
ccbSetSceneNodeProperty(node,'Text','Hello World!');
ccbSetSceneNodeProperty(node,'Height (pixels)',120);
ccbSetSceneNodeProperty(node,'Pos X (pixels)',120);
ccbSetSceneNodeProperty(node,'Image','test.jpg');

}


niko
Moderator
Quote
2014-07-12 06:09:40

Please post the target you are using (WebGL? Windows .exe maybe?), it would help a lot figuring out what the problem might be.
For your last code:
I think the the reason 'TextColor' doesn't work for you that only the first value is being used. You probably get a dark blue text color? 120 is blue, like if represented in hexadecimal, it is 000078 = 120. Here is a function for creating values from RGB:

function createColor(a, r, g, b)
{
a = a & 0xff;
r = r & 0xff;
g = g & 0xff;
b = b & 0xff;

return (a<<24) | (r<<16) | (g<<8) | b;
}



levinemartin63
Registered User
Quote
2014-07-15 02:13:59

webgl firefox abyss webserver,


BMSKiwi
Guest
Quote
2014-07-15 04:00:16

By the way Niko, I notice that arbitrary persistent JS properties can be added to CCB Scene nodes as so:


var node = ccbGetSceneNodeFromName("Node1");
node.customID = 165412;


Which got me thinking,

1 - Why aren't CCB node properties (ie 'Scale') available as simple JS properties so we can manipulate them as any other JS properties. For instance

node.scale = "2,2,2"


...rather than the clumsy functional access currently required.

1 - There needs to be an ability to add custom variables to objects in the editor, so we can add say ID's or other custom data to any given object.


Joeldoslov
Guest
Quote
2020-05-03 19:27:56

@BMS KIWI
I think things don't work that way,atleast in javascript.
Even while using js with html you manipulate html elements with functions because unilike c++ pointers, javascript only stores an instance of the object.
Hence in your code, a custom property in 'a' does not affect the original 'Node1'.
But a change in 'Node1' property will be reflected in the former's usage.
Good luck anyway


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

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