ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Feature requests and bug reports
forum topic indicator request to sven
person icon
guest
Guest
Quote
2025-03-28 23:11:01

also you're welcome for the code. no problemo. emoji icon_grin

person icon
swordmaster
Guest
Quote
2025-03-29 00:19:40

Guest, I found this informations in coppercube javascript reference, and in this partmade me belive is possible to make one script or action that allow to acess the IrrEdit - Irrlicht proprieties of one individual node, at last about the color light change of static and dinamic mesh the comand from coppercube have this information is in '' ccbSetSceneNodeMaterialProperty(sceneNode, materialIndex, propertyName, value) '' ; the extract text from coppercube documentation:

ccbSetSceneNodeMaterialProperty(sceneNode, materialIndex, propertyName, value)

Sets the property of the material of a scene node.
Parameters:

sceneNode: A scene node.
materialIndex: The index of the material. Must be a value greater or equal 0 and smaller than ccbGetSceneNodeMaterialCount().
propertyName: The propertyName in a material. Can be 'Type', 'Texture1', 'Texture2', 'Lighting', 'Backfaceculling'. See below.
value: New value of the material property
Possible material parameters are:

Parameter name Possible values
Type "solid", "lightmap", "lightmap_add", "lightmap_m2", "lightmap_m4", "reflection_2layer", "trans_add", "trans_alphach", "trans_reflection_2layer"
Texture1 A texture for texture layer 1
Texture2 A texture for texture layer 2
Lighting true or false to enable or disable dynamic lighting
Backfaceculling true or false to enable or disable backface culling


Also, if you are writing a plugin for the editor, there are some advanced properties available: "Type", "Ambient", "Diffuse", "Emissive", "Specular", "Shininess", "Param1", "Param2", "Texture1", "Texture2", "Texture3", "Texture4", "Wireframe", "GouraudShading", "Lighting", "ZBuffer", "ZWriteEnable", "BackfaceCulling", "BilinearFilter", "TrilinearFilter", "AnisotropicFilter", "FogEnable", "NormalizeNormals".
Example:

var s = ccbGetSceneNodeFromName("cubeMesh1");
ccbSetSceneNodeMaterialProperty(s, 0, "Lighting", true);

Makes a node with the name 'cubeMesh1' to use dynamic light.
Example 2:

var node = ccbGetSceneNodeFromName("cubeMesh1");
var tex = ccbLoadTexture("example.jpg");
ccbSetSceneNodeMaterialProperty(node, 0, "Texture1", tex);
Loads a texture and sets it as material onto an object name 'cubeMesh1'.


https://www.ambiera.com/coppercube/doc/cnt_javascriptref.htmlmeshediting


All this information aparentaly is associated to IrrEdit - Irrlicht proprieties, give one look and give one opinion.

About the light, I will not say the oposite for you because I didn t find nothing diferent from what you said and the confirmation of explanation come from the '' ccbGetSceneNodeProperty(sceneNode, propertyName) '', the text is:

ccbGetSceneNodeProperty(sceneNode, propertyName)

Gets 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', 'PositionAbs' (absolute position), 'Rotation', 'Scale', 'Visible' are available at least. Please note that the name is case sensitive.

For animated scene nodes, Properties like 'Animation', 'Looping', 'FramesPerSecond' 'AnimationBlending', and 'BlendTimeMs' 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'.
For light nodes, Properties like 'Radius' (for point lights), 'Color', and 'Direction' (for directional lights) a

person icon
swordmaster
Guest
Quote
2025-03-29 00:22:35

The forum don t allow to much big text post, then the other part of message is:

For light nodes, Properties like 'Radius' (for point lights), 'Color', and 'Direction' (for directional lights) are available.
For the root scene node, you can use "FogColor", "Realtime Shadows" (to enable/disable shadow mapping), "AmbientLight", and "BackgroundColor". PostEffect properties are also supported: "Bloom", "Bloom_BlurIterations", "Bloom_Treshold", "Black and White", "Invert", "Blur", "Blur_Iterations", "Colorize", "Colorize_Color", "Vignette", "Vignette_Intensity", "Vignette_RadiusA", "Vignette_RadiusB".
You can also use "Type" which then usually returns something like "mesh", "animatedmesh", "billboard", "camera", "light", "mobile2dinput", "2doverlay", "particlesystem", "path", "sky", "sound", or "water".

https://www.ambiera.com/coppercube/doc/cnt_javascriptref.htmlccbGetSceneNodeProperty

If exist way to acess the IrrEdit proprieties attribute for point or directional light is not described in coppercube javascript reference, maybe only niko will be able to say if possible or not acess these proprieties for light nodes.

person icon
guest
Guest
Quote
2025-03-29 00:41:56

"Also, if you are writing a plugin for the editor, there are some advanced properties available: "Type", "Ambient", "Diffuse", "Emissive", "Specular", "Shininess", "Param1", "Param2", "Texture1", "Texture2", "Texture3", "Texture4", "Wireframe", "GouraudShading", "Lighting", "ZBuffer", "ZWriteEnable", "BackfaceCulling", "BilinearFilter", "TrilinearFilter", "AnisotropicFilter", "FogEnable", "NormalizeNormals"

so you want a plugin for the editor?

person icon
guest
Guest
Quote
2025-03-29 00:44:05

plugins /= actions/behaviors

person icon
swordmaster
Guest
Quote
2025-03-29 01:30:48

No, I don t want one plugin for editor, I want two actions to change proprieties from mesh and light nodes during the runtime game made from coppercube, I posted these information because I think this could be used like base for the creation of the action color material mesh.
The ideias for plugins in coppercube I have but I am concentrate in basic for give more life for my projects.
Again I want two actions: One action to chance the emissive color form one specific material from one specific static or dinamic mesh node; One action to chance the difuse color from one point or directional light node. (I exclude the ambient color from one specific node because this can t be made or no one know how to do this at this moment, the answer about this I really don t know)
The positive thing is I get two actions that make things I want for coppercube, the action set vertex color, and the action info.
Thanks the atention

person icon
guest
Guest
Quote
2025-03-29 16:44:24

i will look at it again today. maybe it's a material property. i don't think i've ever used that before in anything.

person icon
guest_guest
Guest
Quote
2025-03-29 21:06:13

try this out and see if it's what you want.
/*
<action jsname="action_swordmaster" description="swordmaster">
<property name="Node" type="scenenode" />
<property name="SetAllBuffers" type="bool" default="true" />
<property name="BufferToSet" type="int" default="0" />
<property name="Type" type="string" default="solid" />
<property name="AmbientColor" type="color" default="ffffffff" />
<property name="EmissiveColor" type="color" default="ff000000" />
</action>
*/

action_swordmaster = function () {};

action_swordmaster.prototype.execute = function () {
var node = this.Node;
var bufferCount = this.SetAllBuffers
? ccbGetSceneNodeMeshBufferCount(node)
: 1;
var startBuffer = this.SetAllBuffers ? 0 : this.BufferToSet;

var decToRGB = function (color) {
var r = (color & 0xff0000) >> 16;
var g = (color & 0x00ff00) >> 8;
var b = color & 0x0000ff;
return new vector3d(r, g, b);
};

var hexCode = function (rgb) {
var hex = Number(rgb).toString(16);
if (hex.length < 2) {
hex = "0" + hex;
}
return hex;
};

var ambientColor = decToRGB(this.AmbientColor);
var emissiveColor = decToRGB(this.EmissiveColor);

ambientColor =
hexCode(ambientColor.x) +
hexCode(ambientColor.y) +
hexCode(ambientColor.z);
emissiveColor =
hexCode(emissiveColor.x) +
hexCode(emissiveColor.y) +
hexCode(emissiveColor.z);

for (var i = startBuffer; i < startBuffer + bufferCount; i++) {
ccbSetSceneNodeMaterialProperty(node, i, "Type", this.Type);
ccbSetSceneNodeMaterialProperty(node, i, "Ambient", ambientColor);
ccbSetSceneNodeMaterialProperty(node, i, "Emissive", emissiveColor);
}
};


person icon
swordmaster
Guest
Quote
2025-03-29 22:38:00

The action work perfect with static mesh or animated mesh with one material, I tested here, This action is work how I want, but you need to add de number of material slot of one node that will be affect, if you don t add this in one mesh with two or more materials the action only affect the first material of one static or dinamic mesh, for you understand what I am saying I put one example, what is these materials or materials slots that I am saying.
Example: one cube made from coppercube have one material, the animated soldier from coppercube have five materials (in normal materials proprieties from editor you only can see four, in IrrEdit - Irrlitch proprieties in materials you can see all materials in this case five material slots), these proprieties from coppercube have support to affect all materials from one static or dinamic mesh with there is only materials but with more you need specific what material from one static or dinamic mesh will be affected, the materials is that part in normal proprieties from editor of one static or dinamic mesh we have: attributtes, materials and behaviors; in materials we have the slots where we put the textures and selects what type of material will be aplly, in your action you put what type of material will be apply but you didn t put the number of material slot to be apply; in IrrEdit - Irrlitch proprieties is that part where we can see four textures slots, in animated soldier for examples there is the number 1/5, this mean first material slot from five materials solt. If you can add this extra proprietie to change the action will be perfect.
Independent of anything you did the most part what I want for the action, congratulation, I only need you add the number of material or number of material slot that will be affected by the action, or the action will only work with mesh models with one material
thanks the atention

person icon
guest_guest
Guest
Quote
2025-03-29 23:37:56

embedded external image
🔎︎


if i am missing something, explain in as few words as possible. the buffers are the materials?

person icon
guest_guest
Guest
Quote
2025-03-29 23:55:54

embedded external image
🔎︎


person icon
swordmaster
Guest
Quote
2025-03-30 00:26:42

Guest, If you didn t explained I would never discovery the buffer is the part that select what material slot would be affect, I really thought the buffer is some kind of temporary storage of information in temporary memory from pc, one system to avoige the processing would be to much heavy and pc became slow.
Ok I tested here, only one thing is not one problem, only observation, and I let marked the option set all buffer, don t have none effect this function would do something? maybe apply the color for all materials slots?
Two more questions; the buffers from vertex color is the same material slot selection of this last action, because if is will be very interesting apply vertex color in material slot not only in all model? the method the you used to make this action can be use to acess others proprieties from IrrEdit - Irrlicht proprieties? because if is you possible discovery one way to acess one part of mechanism that others user problably didn t discovery to acess.
If set all buffer don t have no real use, the action is perfect, thanks, you did perfect what I want.
Thanks!!!!!

person icon
guest
Guest
Quote
2025-03-30 00:39:35

no there is still a problem, i am trying to work it out. the buffer count only works for static meshes. you will need to input the number of buffers on your end for animated meshes, i guess.

person icon
guest_guest
Guest
Quote
2025-03-30 00:42:47

it comes up 0 for the animated mesh even though it changed it...

embedded external image
🔎︎


person icon
swordmaster
Guest
Quote
2025-03-30 01:03:23

Guest in my tests here, you are right about the set all buffers, this function only works in static mesh.
The action you did is complete and perfect, thanks work perfect like I said. Sorry talk about this and abuse from you but can you make the same thing for lights, one action to access ambient color and difusse color from IrrEdit - Irrlicht proprieties attribute from one point or directional light node?
Thanks again for the both actions: action vertex color mesh node and action dinamic color material mesh node


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |