Difference between revisions of "PRIM TYPE SCULPT"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(19 intermediate revisions by 3 users not shown)
Line 3: Line 3:
{{#vardefine:type_sculpt_const|{{LSL Const|PRIM_TYPE_SCULPT|integer|7|c=A parameter of PRIM_TYPE used to make prim into a sculpty and to change specific properties that define it's shape and type.}}}}
{{#vardefine:type_sculpt_const|{{LSL Const|PRIM_TYPE_SCULPT|integer|7|c=A parameter of PRIM_TYPE used to make prim into a sculpty and to change specific properties that define it's shape and type.}}}}


{{LSL_Function/inventory|map|uuid=true|type=texture|{{#ifeq:{{{1|}}}|get|no_caveat=true}}|full={{{remote|}}}}}
{{#if:{{{child|}}}||
{{#vardefine:p_type_desc|PRIM_SCULPT_TYPE_* flag}}
 
{{#vardefine:caveats-before|{{#var:caveats}}{{#vardefine:caveats}}}}
 
{{LSL_Function/inventory|map|uuid=true|type=texture|full={{{remote|}}}|remote={{#ifeq:{{{1|set}}}|get|*}}}}
 
{{#vardefine:p_type_desc|PRIM_SCULPT_TYPE_* flag with optional additional PRIM_SCULPT_FLAG_* flags OR'ed on}}
 
{{#vardefine:caveats-get|{{#var:caveats-get}}
*The value of {{LSLP|map}} is {{LSL Constant/NULL KEY}} when the {{LSLGC|Owner|owner}} does not have {{LSLGC|Permissions/Asset|full permissions}} to the object and the map asset is not in the prim's inventory.
{{#var:caveats}}}}
 
{{#vardefine:caveats|{{#var:caveats-before}}{{#vardefine:caveats-before}}
{{#var:caveats-{{{1|get}}}}}{{#vardefine:caveats-{{{1|get}}}}}}}
 
{{#vardefine:caveats-set|{{#var:caveats-set}}
*While it is possible to use {{#if:<noinclude>1</noinclude>|this|{{#var:type_sculpt_const}}}} to animate an object, it is not recommended. For details see: [[Why UUID Flipping is Bad]]}}
 
}}


}}</onlyinclude>{{#if:
}}</onlyinclude>{{#if:
{{#vardefine:caveats|{{#var:caveats}}
{{#var:caveats-set}}}}


}}{{LSL Constant
}}{{LSL Constant
Line 17: Line 37:
|text=For use with [[llSetPrimitiveParams]] and [[llSetLinkPrimitiveParams]]
|text=For use with [[llSetPrimitiveParams]] and [[llSetLinkPrimitiveParams]]
{{LSL_Constants/PrimitiveParams/sculpt_types|table=*|sortable=*}}
{{LSL_Constants/PrimitiveParams/sculpt_types|table=*|sortable=*}}
{{LSL Const|PRIM_SCULPT_TYPE_MASK|integer|7|c=Used to filter out the PRIM_SCULPT_FLAG_* flags from the type to determine the PRIM_SCULPT_TYPE_* flag}} can be used to filter out the PRIM_SCULPT_FLAG_* flags from the {{LSLP|type}} to determine the PRIM_SCULPT_TYPE_* flag. The main application of this would be when using [[llGetPrimitiveParams]].
|i1_type=string |i1_name=map
|i1_type=string |i1_name=map
|i2_type=integer|i2_name=type
|i2_type=integer|i2_name=type
Line 22: Line 43:
}}
}}
|examples=
|examples=
<lsl>llSetPrimitiveParams([PRIM_TYPE,  
<source lang="lsl2">llSetPrimitiveParams([PRIM_TYPE,  
                         PRIM_TYPE_SCULPT,  
                         PRIM_TYPE_SCULPT,  
                             "d962089b-2197-993c-9ec9-4993eb0a95f2",  // sculpty texture
                             "d962089b-2197-993c-9ec9-4993eb0a95f2",  // sculpty texture
                             PRIM_SCULPT_TYPE_SPHERE                  // type
                             PRIM_SCULPT_TYPE_SPHERE                  // type
                       ]);</lsl>
                            | PRIM_SCULPT_FLAG_MIRROR    // use pipe | to add each flag
<lsl>//Rotates between the different sculpt types.
                       ]);</source>
<source lang="lsl2">//Rotates between the different sculpt types.
default
default
{
{
Line 40: Line 62:
         llSetPrimitiveParams(PRIM_TYPE + llList2List(b, 0, 1) + (type + 1));
         llSetPrimitiveParams(PRIM_TYPE + llList2List(b, 0, 1) + (type + 1));
     }
     }
}</lsl>
}</source>
|examples 2=
 
<lsl>
<source lang="lsl2">//A simple script to setup a prim as a sculpty.
//MathieuBC Noel script creators. My free objects available on www.slexchange.com
default
default
{
{
     state_entry()
     state_entry()
     {
     {
  llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, "your Sculpt map name in the object", PRIM_SCULPT_TYPE_SPHERE,PRIM_TEXTURE, ALL_SIDES, "your texture name in the object", <1,1,1>,<0,0,0> , 0.0]);
        llSetPrimitiveParams([
            PRIM_TYPE, PRIM_TYPE_SCULPT, "your Sculpt map name in the object", PRIM_SCULPT_TYPE_SPHERE
// llSetScale(<0.063,0.199,0.052>); // If you need to have more sculpt map in the object to show in different mesure. This way need less primitives (objects) on a land 
          , PRIM_TEXTURE, ALL_SIDES, "your texture name in the object", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 //comment out if not needed.
 
//         , PRIM_SIZE, <0.63,0.199,0.52> // If you need to change the scale (size) of the object, uncomment this line.
 
        ]);
// <1,1,1> is the RBG  color (Red, Blue, Green
    } // The gray color you see on your sculpt object is the SL no found texture that is gray.
// <0,0,0> is the addition of an another RBG color it's to create different color. So <1,1,1>+<0,0,0>=<.5,.5,.5>
}</source>
 
// 0.0 in the end of the line is the texture rotation
 
}
}</lsl>


|constants=
|constants=
Line 71: Line 87:
{{LSL DefineRow||[[changed]]|}}
{{LSL DefineRow||[[changed]]|}}
|location
|location
|history=
* {{SVN|1053|rev=94734|branch=trunk|date=Tuesday, 19 August 2008}} - PRIM_SCULPT_FLAG_* syntax merged into the Trunk. Support for syntax slated for Client 1.21.0
* {{SVN|758|rev=91966|branch=featurettes-5|date=Thursday, 10 July 2008}} - Introduction of PRIM_SCULPT_FLAG_* extended syntax.
|cat1=Prim
|cat1=Prim
|cat2
|cat2

Latest revision as of 17:04, 23 January 2015

Description

Constant: integer PRIM_TYPE_SCULPT = 7;

The integer constant PRIM_TYPE_SCULPT has the value 7

PRIM_TYPE_SCULPT is a parameter of PRIM_TYPE used to make a prim into a sculpty of specific shape and type.
Sculpted Prims: FAQ

PRIM_TYPE

[ PRIM_TYPE, PRIM_TYPE_SCULPT, string map, integer type ]
• string map a texture in the inventory of the prim this script is in or a UUID of a texture
• integer type PRIM_SCULPT_TYPE_* flag with optional additional PRIM_SCULPT_FLAG_* flags OR'ed on

For use with llSetPrimitiveParams and llSetLinkPrimitiveParams

type Flags Style Description
PRIM_SCULPT_TYPE_SPHERE 1 Sphere Converge top & bottom, stitch left side to right
PRIM_SCULPT_TYPE_TORUS 2 Torus Stitch top to bottom, stitch left side to right
PRIM_SCULPT_TYPE_PLANE 3 Plane No stitching or converging
PRIM_SCULPT_TYPE_CYLINDER 4 Cylinder Stitch left side to right.
PRIM_SCULPT_TYPE_MESH 5 Mesh model See: Mesh
PRIM_SCULPT_FLAG_ZZZZZZZZ 63
PRIM_SCULPT_FLAG_ANIMESH 0x20 Animesh Read-only flag to query Animated mesh status.
PRIM_SCULPT_FLAG_INVERT 0x40 Invert Render inside out (inverts the normals).
PRIM_SCULPT_FLAG_MIRROR 0x80 Mirror Render an X axis mirror of the sculpty.

PRIM_SCULPT_TYPE_MASK can be used to filter out the PRIM_SCULPT_FLAG_* flags from the type to determine the PRIM_SCULPT_TYPE_* flag. The main application of this would be when using llGetPrimitiveParams.

Caveats

  • The value of map is NULL_KEY when the owner does not have full permissions to the object and the map asset is not in the prim's inventory.
  • If map is missing from the prim's inventory and it is not a UUID or it is not a texture then an error is shouted on DEBUG_CHANNEL.
  • If map is a UUID then there are no new asset permissions consequences for the object.
    • The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.
  • While it is possible to use this to animate an object, it is not recommended. For details see: Why UUID Flipping is Bad
All Issues ~ Search JIRA for related Bugs

Related Articles

Constants

•  PRIM_TYPE
•  CHANGED_SHAPE

Functions

•  llSetPrimitiveParams
•  llSetLinkPrimitiveParams
•  llGetPrimitiveParams

Events

•  changed

Examples

llSetPrimitiveParams([PRIM_TYPE, 
                        PRIM_TYPE_SCULPT, 
                            "d962089b-2197-993c-9ec9-4993eb0a95f2",  // sculpty texture
                            PRIM_SCULPT_TYPE_SPHERE                  // type
                            | PRIM_SCULPT_FLAG_MIRROR     // use pipe | to add each flag
                      ]);
//Rotates between the different sculpt types.
default
{
    touch_start(integer a)
    {
        list b = llGetPrimitiveParams([PRIM_TYPE]);
        integer type = llList2Integer(b,2) % 4;
        llSetObjectDesc(llList2String([ "Sphere",
                                        "Torus",
                                        "Plane",
                                        "Cylinder"], type));
        llSetPrimitiveParams(PRIM_TYPE + llList2List(b, 0, 1) + (type + 1));
    }
}
//A simple script to setup a prim as a sculpty.
default
{
    state_entry()
    {
        llSetPrimitiveParams([
            PRIM_TYPE, PRIM_TYPE_SCULPT, "your Sculpt map name in the object", PRIM_SCULPT_TYPE_SPHERE
          , PRIM_TEXTURE, ALL_SIDES, "your texture name in the object", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0 //comment out if not needed.
//          , PRIM_SIZE, <0.63,0.199,0.52> // If you need to change the scale (size) of the object, uncomment this line.
        ]);
    } // The gray color you see on your sculpt object is the SL no found texture that is gray.
}

Deep Notes

History

Search JIRA for related Issues

Signature

integer PRIM_TYPE_SCULPT = 7;