Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 Re: Openspace3D » Change material using script » 21-Nov-2012 20:49:09

I changed the group to "Scene" and that worked.

Thank You

#2 Re: Openspace3D » Change material using script » 21-Nov-2012 19:48:37

I am not using the "abc" parameter at the moment.

As a test I changed the color of "BaseWhite" using a "material color inst" plugIt and have seen the expected color change

#3 Re: Openspace3D » Change material using script » 21-Nov-2012 18:37:59

I have modified the function:

fun TestColor(string)=
    _showconsole;
    let (V3DgetSessionView c3dXsession) -> viewstr in
    let V3DgetDefaultSession viewstr -> sessionstr in
    let SO3SceneGetMaterial (V3DgetSession sessionstr)  "V3DdefaultResources" "BaseWhite" -> mat in
    if mat == nil then
    (
        _fooS "material not found";
        0;
    )
    else
    (
        _fooS "action";
        SO3MaterialSetAmbient mat (make_rgba 0 0 255 0);
        SO3MaterialSetDiffuse mat (make_rgba 0 0 255 0);
        SO3MaterialSetSelfIllumination mat (make_rgba 0 0 255 0);
        0;
    );;

The log shows

> Action : Scene.Test Color.Run with param : abc and reply param : Scene.Key_3

The console shows:

loading tmp/tmp3891288.pkg ...
typechecking
fun TestColor : fun [u0] I
Generating bytescodes for 'TestColor' ...
167 bytes generated (for a total of 15632) 
Loading Complete

> exec: TestColor "abc"

material not found

#4 Openspace3D » Change material using script » 21-Nov-2012 00:06:51

kdkirmse
Replies: 7

I am attempting to change a material color within a addsourcecode script and am having some trouble
getting the handle of a material. What follows is my test code.

fun TestColor(string)=
    let (V3DgetSessionView c3dXsession) -> viewstr in
    let V3DgetDefaultSession viewstr -> sessionstr in
    let SO3SceneGetMaterial (V3DgetSession sessionstr)  "V3DdefaultResources" "BaseWhite" -> mat in
    if mat == nil then nil else
    (
        SO3MaterialSetAmbient mat (make_rgba 0 0 255 0);
        SO3MaterialSetDiffuse mat (make_rgba 0 0 255 0);
        SO3MaterialSetSelfIllumination mat (make_rgba 0 0 255 0);
    );
   0;;

I have been trying to figure out the OS3D structure for this kind of access and have not made a lot of progress.

Board footer

Powered by FluxBB