Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008156opensim[REGION] Script Functionspublic2017-04-23 11:472018-01-22 11:57
ReporterGezebu MindBlue 
Assigned To 
PlatformOperating SystemOperating System Version
Product Version0.9.0 
Target VersionFixed in Version 
DescriptionAny chance to see this implemented soon?

have 2 threads with a lot of time about this, and is important for change materials with scripts.
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineBulletSim
Script Engine
EnvironmentMono / Linux64
Mono VersionOther
Attached Files

- Relationships
related to 0006824closedMata Hari script method to get/set materials textures 
related to 0008282resolvedTyphaineArtez Settings PRIM_NORMAL, PRIM_SPECULAR, PRIM_ALPHA_MODE, not implemented 

-  Notes
UbitUmarov (administrator)
2017-04-23 23:09

[07:08] <cia-opensim> add suport for materials parameters PRIM_NORMAL, PRIM_SPECULAR and PRIM_ALPHA_MODE of llGetPrimitiveParams(). Im sleeping at this time, this can be very wrong
Gezebu MindBlue (reporter)
2017-04-24 03:25

Works, but vector repeats, and vector offsets are in inverted order.
And in PRIM_SPECULAR, specular_color give vector in rgb traditional notation 0-255, and seems need return LSL's color notation 0.000000 > 1.00000

[03:02] GeZ_Kukri_01_Scripted_R: normal:ccb9feab-2d42-4d29-882b-3108aaf7e65b
<0.000000, 0.000000, 0.000000>
<1.000000, 1.000000, 0.000000>
[03:02] GeZ_Kukri_01_Scripted_R: specular:141bd232-3e1b-42b1-a7dd-cbba7c5d4c2f
<0.000000, 0.000000, 0.000000>
<1.000000, 1.000000, 0.000000>
<255.000000, 255.000000, 255.000000>

[ PRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rot ]

[ PRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rot, vector specular_color, integer glossiness, integer environment ]

vector specular_color – specular color, in the range ZERO_VECTOR (black) to <1,1,1> (white)
Gezebu MindBlue (reporter)
2017-04-24 03:37
edited on: 2017-04-24 03:38

and PRIM_SPECULAR not give the rot value

UbitUmarov (administrator)
2017-04-24 03:47

oh well, I said I was sleeping.. in fact im still ...
but plz try again...
UbitUmarov (administrator)
2017-04-24 11:05

this code does not work very well with meshs because of a old bug,
When meshs where introduced, for some odd reason devs assumed that all meshs have 8 faces.
So llGetNumberOfSides() always returns 8, face index checks use 8 faces, etc.
Now hard to fix without having to parse all the mesh assets to fix the information.
Gezebu MindBlue (reporter)
2017-04-24 13:01
edited on: 2017-04-24 13:20

i'm copypasted this from my last offline PM...

about PRIM_NORMAL,SPECULAR,ALPHA_MODE in llGetPrimitiveParams

i think this work fine. well, you can get the PRIM_* values, with for(i = 0; i <= the_known_sides; i++) and with llDetectedTouchFace for get the integer num side. the only one real problem seems (that you say here) that llGetNumberOfSides cant detected the real num sides (or materials) in the mesh.


Gezebu MindBlue (reporter)
2017-04-24 13:03
edited on: 2017-04-24 13:16

// getprimvalues
list prim_diffuse;
list prim_normal;
list prim_specular;
list prim_alphamode;
getprimvalues(integer side_num){
    prim_diffuse = llGetPrimitiveParams([PRIM_TEXTURE,side_num]);
    prim_normal = llGetPrimitiveParams([PRIM_NORMAL,side_num]);
    prim_specular = llGetPrimitiveParams([PRIM_SPECULAR,side_num]);
    prim_alphamode = llGetPrimitiveParams([PRIM_ALPHA_MODE,side_num]);

        llSay(0, "Life is hard");
    touch_start(integer not)
       integer num_detected = llDetectedTouchFace(0);

mewtwo0641 (reporter)
2017-04-24 14:28
edited on: 2017-04-24 14:29

I can't seem to get PRIM_NORMAL or PRIM_SPECULAR to apply the textures via set primitive params on master. I get an error: "llSetLinkPrimitiveParamsFast: Error running rule # 2: arg # 0 - unsupported parameter".

Example code below; I've also tried each one by themselves instead of all 3 at once and also with textures in object inventory and using the texture name instead of the UUID but no luck... Only PRIM_TEXTURE seems to work and the rest fails.

                <2,2,0>, <0,0,0>, 0.0,
                <2,2,0>, <0,0,0>, 0.0,
                <2,2,0>, <0,0,0>, 0.0,
                <1,1,1>, 64, 0

mewtwo0641 (reporter)
2017-04-24 14:45

Whoops... If I hadn't been half asleep myself I would have realized that the recent commits were only for getting and not setting lol.

This appears to work fine for me (getting normal map information)

        list normalMapInfo = llGetLinkPrimitiveParams(LINK_THIS, [PRIM_NORMAL, 0]);
UbitUmarov (administrator)
2017-04-24 15:30

yes this seems to be working
in the meshs case you need to know in advance how many faces they actually have and limit the face parameter (0 to numFaces-1) and not use ALL_SIDES, because as I said current code assumes all meshs have 8 faces.
Don't know how we got here without apparent issues, but testing this materials code made it very obvious, and implementation of the Setting even harder
UbitUmarov (administrator)
2017-04-25 11:05

I added code to fix the number of faces of mesh on new uploads.
This is done creating the base prim with a shape that has the same number of faces as the mesh, this way it is stored and processed almost as any other prim, with little extra code, additionally this complements what I already added in 0.9.x for some viewers LOD math.
mewtwo0641 (reporter)
2017-04-25 14:01

I did some quick testing on a few different simple meshes with varying number of faces on them.

llGetNumberOfSides() and llGetLinkNumberOfSides() both seem to report the correct number of faces for newly uploaded meshes but continue to report 8 for pre-existing meshes.

Reading through the commits I understand that this is to be expected and it simply won't be possible to correctly report number of sides in the case of meshes that were there before these changes?
UbitUmarov (administrator)
2017-04-25 17:52

Information about a mesh faces is on the mesh asset data.
The only point where we look into that data is on the upload, and that was lost.
unless we find something im missing, the only way to recover is reading the asset and decode it to the level where HIGH_LOD is readable and faces countable.
This is not a fast thing to do online.

- Issue History
Date Modified Username Field Change
2017-04-23 11:47 Gezebu MindBlue New Issue
2017-04-23 19:31 UbitUmarov Relationship added related to 0006824
2017-04-23 23:09 UbitUmarov Note Added: 0031795
2017-04-24 03:25 Gezebu MindBlue Note Added: 0031797
2017-04-24 03:37 Gezebu MindBlue Note Added: 0031798
2017-04-24 03:38 Gezebu MindBlue Note Edited: 0031798 View Revisions
2017-04-24 03:47 UbitUmarov Note Added: 0031799
2017-04-24 11:05 UbitUmarov Note Added: 0031800
2017-04-24 13:01 Gezebu MindBlue Note Added: 0031801
2017-04-24 13:03 Gezebu MindBlue Note Added: 0031802
2017-04-24 13:16 Gezebu MindBlue Note Edited: 0031802 View Revisions
2017-04-24 13:20 Gezebu MindBlue Note Edited: 0031801 View Revisions
2017-04-24 14:28 mewtwo0641 Note Added: 0031803
2017-04-24 14:29 mewtwo0641 Note Edited: 0031803 View Revisions
2017-04-24 14:45 mewtwo0641 Note Added: 0031804
2017-04-24 15:30 UbitUmarov Note Added: 0031805
2017-04-25 11:05 UbitUmarov Note Added: 0031806
2017-04-25 14:01 mewtwo0641 Note Added: 0031807
2017-04-25 17:52 UbitUmarov Note Added: 0031808
2018-01-22 11:57 Sheera Khan Relationship added related to 0008282

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker