aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorArmin Weatherwax2010-02-22 17:57:35 +0100
committerJacek Antonelli2010-03-05 14:18:48 -0600
commitd0936606412ccaf05a2e17894d2bc9a3c18506ab (patch)
treefb15bb14014eb9f6cc0512f4f3fbf408de8459e3 /linden
parentFixed some notifications that were ported from 1.2 incorrectly. (diff)
downloadmeta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.zip
meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.gz
meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.bz2
meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.xz
Ported breast physics from Emerald.
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/llcharacter/llcharacter.cpp3
-rw-r--r--linden/indra/llcharacter/llcharacter.h7
-rw-r--r--linden/indra/newview/CMakeLists.txt2
-rw-r--r--linden/indra/newview/app_settings/settings.xml90
-rw-r--r--linden/indra/newview/emeraldboobutils.cpp188
-rw-r--r--linden/indra/newview/emeraldboobutils.h197
-rw-r--r--linden/indra/newview/llagent.cpp11
-rw-r--r--linden/indra/newview/llviewercontrol.cpp52
-rw-r--r--linden/indra/newview/llvoavatar.cpp138
-rw-r--r--linden/indra/newview/llvoavatar.h56
-rw-r--r--linden/indra/newview/llwearable.cpp122
-rw-r--r--linden/indra/newview/llwearable.h6
12 files changed, 846 insertions, 26 deletions
diff --git a/linden/indra/llcharacter/llcharacter.cpp b/linden/indra/llcharacter/llcharacter.cpp
index 6633c65..dcdfe07 100644
--- a/linden/indra/llcharacter/llcharacter.cpp
+++ b/linden/indra/llcharacter/llcharacter.cpp
@@ -55,7 +55,8 @@ LLCharacter::LLCharacter()
55 mPreferredPelvisHeight( 0.f ), 55 mPreferredPelvisHeight( 0.f ),
56 mSex( SEX_FEMALE ), 56 mSex( SEX_FEMALE ),
57 mAppearanceSerialNum( 0 ), 57 mAppearanceSerialNum( 0 ),
58 mSkeletonSerialNum( 0 ) 58 mSkeletonSerialNum( 0 ),
59 mInAppearance( false )
59{ 60{
60 mMotionController.setCharacter( this ); 61 mMotionController.setCharacter( this );
61 sInstances.push_back(this); 62 sInstances.push_back(this);
diff --git a/linden/indra/llcharacter/llcharacter.h b/linden/indra/llcharacter/llcharacter.h
index 0112788..d91124b 100644
--- a/linden/indra/llcharacter/llcharacter.h
+++ b/linden/indra/llcharacter/llcharacter.h
@@ -253,6 +253,11 @@ public:
253 ESex getSex() { return mSex; } 253 ESex getSex() { return mSex; }
254 void setSex( ESex sex ) { mSex = sex; } 254 void setSex( ESex sex ) { mSex = sex; }
255 255
256 // set appearance flag
257 void setAppearanceFlag( bool flag ) { mInAppearance = flag; }
258 bool getAppearanceFlag() { return mInAppearance; }
259
260
256 U32 getAppearanceSerialNum() const { return mAppearanceSerialNum; } 261 U32 getAppearanceSerialNum() const { return mAppearanceSerialNum; }
257 void setAppearanceSerialNum( U32 num ) { mAppearanceSerialNum = num; } 262 void setAppearanceSerialNum( U32 num ) { mAppearanceSerialNum = num; }
258 263
@@ -273,6 +278,8 @@ protected:
273 U32 mSkeletonSerialNum; 278 U32 mSkeletonSerialNum;
274 LLAnimPauseRequest mPauseRequest; 279 LLAnimPauseRequest mPauseRequest;
275 280
281 BOOL mInAppearance;
282
276 283
277private: 284private:
278 // visual parameter stuff 285 // visual parameter stuff
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index f522f44..d4b618f 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -65,6 +65,7 @@ include_directories(
65 ) 65 )
66 66
67set(viewer_SOURCE_FILES 67set(viewer_SOURCE_FILES
68 emeraldboobutils.cpp
68 floaterlogin.cpp 69 floaterlogin.cpp
69 hippoGridManager.cpp 70 hippoGridManager.cpp
70 hippoLimits.cpp 71 hippoLimits.cpp
@@ -485,6 +486,7 @@ endif (LINUX)
485set(viewer_HEADER_FILES 486set(viewer_HEADER_FILES
486 CMakeLists.txt 487 CMakeLists.txt
487 ViewerInstall.cmake 488 ViewerInstall.cmake
489 emeraldboobutils.h
488 floaterlogin.h 490 floaterlogin.h
489 hippoGridManager.h 491 hippoGridManager.h
490 hippoLimits.h 492 hippoLimits.h
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 1cf31d7..29b3bcc 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -3417,6 +3417,96 @@
3417 </map> 3417 </map>
3418 3418
3419 3419
3420 <key>EmeraldBoobMass</key>
3421 <map>
3422 <key>Comment</key>
3423 <string>Mass of boobs.</string>
3424 <key>Persist</key>
3425 <integer>1</integer>
3426 <key>Type</key>
3427 <string>F32</string>
3428 <key>Value</key>
3429 <real>54.0</real>
3430 </map>
3431 <key>EmeraldBoobHardness</key>
3432 <map>
3433 <key>Comment</key>
3434 <string>Hardness (dampening) of boobs.</string>
3435 <key>Persist</key>
3436 <integer>1</integer>
3437 <key>Type</key>
3438 <string>F32</string>
3439 <key>Value</key>
3440 <real>51</real>
3441 </map>
3442 <key>EmeraldBreastPhysicsToggle</key>
3443 <map>
3444 <key>Comment</key>
3445 <string>Enables/Disables breast physics</string>
3446 <key>Persist</key>
3447 <integer>1</integer>
3448 <key>Type</key>
3449 <string>Boolean</string>
3450 <key>Value</key>
3451 <integer>1</integer>
3452 </map>
3453 <key>EmeraldBreastSportsBra</key>
3454 <map>
3455 <key>Comment</key>
3456 <string>allows disabling the physics for 1 av, in case their outfit looks wrong with it on</string>
3457 <key>Persist</key>
3458 <integer>1</integer>
3459 <key>Type</key>
3460 <string>Boolean</string>
3461 <key>Value</key>
3462 <integer>0</integer>
3463 </map>
3464 <key>EmeraldBoobVelMax</key>
3465 <map>
3466 <key>Comment</key>
3467 <string>Max amount of velocity boobs can have</string>
3468 <key>Persist</key>
3469 <integer>1</integer>
3470 <key>Type</key>
3471 <string>F32</string>
3472 <key>Value</key>
3473 <real>64</real>
3474 </map>
3475 <key>EmeraldBoobFriction</key>
3476 <map>
3477 <key>Comment</key>
3478 <string>Internal friction (brings boobs to rest). Shouldn't ever be above 1.</string>
3479 <key>Persist</key>
3480 <integer>1</integer>
3481 <key>Type</key>
3482 <string>F32</string>
3483 <key>Value</key>
3484 <real>80</real>
3485 </map>
3486 <key>EmeraldBoobVelMin</key>
3487 <map>
3488 <key>Comment</key>
3489 <string>Friction Fraction of FPS (used to keep friction uniform through FPS change).</string>
3490 <key>Persist</key>
3491 <integer>1</integer>
3492 <key>Type</key>
3493 <string>F32</string>
3494 <key>Value</key>
3495 <real>24</real>
3496 </map>
3497 <key>EmeraldBoobXYInfluence</key>
3498 <map>
3499 <key>Comment</key>
3500 <string>Amount of influence along the X and Y planes.</string>
3501 <key>Persist</key>
3502 <integer>1</integer>
3503 <key>Type</key>
3504 <string>F32</string>
3505 <key>Value</key>
3506 <real>0.1</real>
3507 </map>
3508
3509
3420 <key>EmeraldTemporaryUpload</key> 3510 <key>EmeraldTemporaryUpload</key>
3421 <map> 3511 <map>
3422 <key>Comment</key> 3512 <key>Comment</key>
diff --git a/linden/indra/newview/emeraldboobutils.cpp b/linden/indra/newview/emeraldboobutils.cpp
new file mode 100644
index 0000000..f68d6a7
--- /dev/null
+++ b/linden/indra/newview/emeraldboobutils.cpp
@@ -0,0 +1,188 @@
1#include "emeraldboobutils.h"
2
3std::ostream &operator<<(std::ostream &os, const EmeraldGlobalBoobConfig &v)
4{
5 os << "EmeraldBoobConfig" << std::endl;
6 os << "enabled: " << v.enabled << std::endl;
7 os << "mass: " << v.mass << std::endl;
8 os << "hardness: " << v.hardness << std::endl;
9 os << "zMax: " << v.zMax << std::endl;
10 os << "velMin: " << v.velMin << std::endl;
11 os << "velMax: " << v.velMax << std::endl;
12 os << "zInfluence: " << v.zInfluence << std::endl;
13 os << "friction: " << v.friction << std::endl;
14 return os;
15}
16
17std::ostream &operator<<(std::ostream &os, const EmeraldAvatarLocalBoobConfig &v)
18{
19 os << "EmeraldAvatarLocalBoobConfig" << std::endl;
20 os << "actualBoobGrav: " << v.actualBoobGrav << std::endl;
21 os << "boobSize: " << v.boobSize << std::endl;
22 return os;
23}
24
25std::ostream &operator<<(std::ostream &os, const EmeraldBoobState &v)
26{
27 os << "EmeraldBoobState" << std::endl;
28 os << "boobGrav: " << v.boobGrav << std::endl;
29 os << "chestPosition: " << v.chestPosition << std::endl;
30 os << "chestRotation: " << v.chestRotation << std::endl;
31 os << "elapsedTime: " << v.elapsedTime << std::endl;
32 os << "frameDuration: " << v.frameDuration << std::endl;
33 os << "chestDisplacement: " << v.chestDisplacement << std::endl;
34 os << "localChestDisplacement: " << v.localChestDisplacement << std::endl;
35 os << "displacementForce: " << v.displacementForce << std::endl;
36 os << "mysteryValue: " << v.mysteryValue << std::endl;
37 os << "Number of bounceStates: " << v.bounceStates.size() << std::endl;
38 return os;
39}
40
41std::ostream &operator<<(std::ostream &os, const EmeraldBoobInputs &v)
42{
43 os << "EmeraldBoobInputs" << std::endl;
44 os << "chestPosition: " << v.chestPosition << std::endl;
45 os << "chestRotation: " << v.chestRotation << std::endl;
46 os << "elapsedTime: " << v.elapsedTime << std::endl;
47 os << "appearanceFlag: " << v.appearanceFlag << std::endl;
48 os << "appearanceAnimating: " << v.appearanceAnimating << std::endl;
49 return os;
50}
51
52std::ostream &operator<<(std::ostream &os, const EmeraldBoobBounceState &v)
53{
54 os << "EmeraldBoobBounceState" << std::endl;
55 os << "bounceStart: " << v.bounceStart << std::endl;
56 os << "bounceStartAmplitude: " << v.bounceStartAmplitude << std::endl;
57 os << "bounceStartFrameDuration: " << v.bounceStartFrameDuration << std::endl;
58 return os;
59}
60
61F32 EmeraldBoobUtils::convertMass(F32 displayMass)
62{ return displayMass/100.f*150.f; };
63
64F32 EmeraldBoobUtils::convertHardness(F32 displayHardness)
65{ return displayHardness/100.f*50; };
66
67F32 EmeraldBoobUtils::convertVelMax(F32 displayVelMax)
68{ return displayVelMax/100.f*0.01f; };
69
70F32 EmeraldBoobUtils::convertFriction(F32 displayFriction)
71{ return displayFriction/100.f*1.0f; };
72
73F32 EmeraldBoobUtils::convertVelMin(F32 displayVelMin)
74{ return displayVelMin/100.f; };
75
76EmeraldBoobState EmeraldBoobUtils::idleUpdate(const EmeraldGlobalBoobConfig &config, const EmeraldAvatarLocalBoobConfig &localConfig, const EmeraldBoobState &oldState, const EmeraldBoobInputs &inputs)
77{
78 EmeraldBoobState newState;
79 F32 avatarLocalMass = 0.0f;
80 F32 partMod = 1.f;
81
82 if(!config.enabled || inputs.appearanceFlag || inputs.appearanceAnimating)
83 return newState;
84
85 if(inputs.type == 0)
86 {
87 newState.boobGrav = localConfig.actualBoobGrav;
88 avatarLocalMass = (llclamp(localConfig.boobSize, 0.0f, 0.5f) / 0.5f);
89 }
90 if(inputs.type == 1)
91 {
92 newState.boobGrav = localConfig.actualButtGrav;
93 partMod = 1.5f;
94 avatarLocalMass = llclamp(localConfig.actualButtGrav, 0.0f, 0.5f) / 0.5f;
95 }
96 if(inputs.type == 2)
97 {
98 newState.boobGrav = localConfig.actualFatGrav;
99 partMod = 1.3f;
100 avatarLocalMass = localConfig.actualFatGrav;
101 }
102
103
104 newState.elapsedTime = inputs.elapsedTime;
105 // seemed to create incorrect amounts of velocity when FPS varied
106 newState.frameDuration = inputs.elapsedTime - oldState.elapsedTime;
107 newState.chestPosition = inputs.chestPosition;
108 newState.chestRotation = inputs.chestRotation;
109 newState.chestDisplacement = inputs.chestPosition - oldState.chestPosition;
110 newState.localChestDisplacement = newState.chestDisplacement * ~inputs.chestRotation;
111
112
113 std::list<EmeraldBoobBounceState> bounceStates = oldState.bounceStates;
114
115 if(fabs(newState.localChestDisplacement.length()) > 0.f)
116 {
117 F32 boobVel = 0.f;
118 boobVel = newState.localChestDisplacement.mV[VZ];
119 boobVel += newState.localChestDisplacement[VX] * config.XYInfluence;
120 boobVel += newState.localChestDisplacement.mV[VY] * config.XYInfluence;
121 boobVel *= newState.frameDuration * 0.3f * 100.f;
122 boobVel = llclamp(boobVel, -config.velMax, config.velMax);
123 if(fabs(boobVel) <= config.velMax * config.velMin * newState.frameDuration * 100.f)
124 boobVel = 0.0f;
125 else
126 {
127 EmeraldBoobBounceState bounceState;
128 bounceState.bounceStart = inputs.elapsedTime;
129 bounceState.bounceStartFrameDuration = newState.frameDuration;
130 bounceState.bounceStartAmplitude = boobVel;
131 bounceState.bounceStartAmplitude *= avatarLocalMass;
132 bounceState.bounceStartAmplitude *= config.mass;
133 bounceStates.push_front(bounceState);
134 }
135 }
136
137 /*if(fabs(newState.localChestDisplacement.length()) >= 0.f) {
138 LLVector3 displacementInfluence = newState.localChestDisplacement;
139 displacementInfluence *= LLVector3(0.3f, 0.3f, 1.0f);
140 F32 clampedDisplacementInfluenceLength = llclamp(displacementInfluence.length(), 0.0f, config.velMax);
141 if(displacementInfluence[VZ]<0.f)
142 clampedDisplacementInfluenceLength= -clampedDisplacementInfluenceLength;
143 EmeraldBoobBounceState bounceState;
144 bounceState.bounceStart = inputs.elapsedTime;
145 bounceState.bounceStartFrameDuration = newState.frameDuration;
146 bounceState.bounceStartAmplitude = clampedDisplacementInfluenceLength;
147 if(fabs(bounceState.bounceStartAmplitude) < config.velMin * config.velMax)
148 bounceState.bounceStartAmplitude = 0.0f;
149 else
150 {
151 bounceState.bounceStartAmplitude *= config.mass;
152 bounceStates.push_front(bounceState);
153 }
154 }
155 */
156
157 F32 totalNewAmplitude = 0.0f;
158 //std::cout << "Beginning bounce State processing at time " << inputs.elapsedTime << std::endl;
159 while(!bounceStates.empty()) {
160 EmeraldBoobBounceState bounceState = bounceStates.front();
161 //std::cout << "Now processing " << bounceState;
162 bounceStates.pop_front();
163 F32 bounceTime = newState.elapsedTime-bounceState.bounceStart;
164 F32 newAmplitude = bounceState.bounceStartAmplitude*pow(60.f*config.friction, -bounceTime)*cos(config.hardness*partMod*bounceTime);
165 if(fabs(newAmplitude) < 0.005f) {
166 newAmplitude = 0.0f;
167 } else {
168 newState.bounceStates.push_front(bounceState);
169 }
170 totalNewAmplitude+=newAmplitude;
171 }
172 //std::cout << "Total new amplitude: " << totalNewAmplitude << std::endl;
173 /*
174 if(inputs.type == 0)
175 newState.boobGrav = localConfig.actualBoobGrav + totalNewAmplitude;
176 if(inputs.type == 1)
177 newState.boobGrav = localConfig.actualButtGrav + totalNewAmplitude;
178 if(inputs.type == 2)
179 newState.boobGrav = localConfig.actualFatGrav + totalNewAmplitude;
180 */
181
182 newState.boobGrav = totalNewAmplitude;
183
184
185 newState.boobGrav = llclamp(newState.boobGrav, -1.5f, 2.0f);
186
187 return newState;
188}
diff --git a/linden/indra/newview/emeraldboobutils.h b/linden/indra/newview/emeraldboobutils.h
new file mode 100644
index 0000000..26008f9
--- /dev/null
+++ b/linden/indra/newview/emeraldboobutils.h
@@ -0,0 +1,197 @@
1#ifndef __emeraldboobutils_h
2#define __emeraldboobutils_h
3
4#include <iostream>
5#include <list>
6
7#include "stdtypes.h"
8#include "v3math.h"
9#include "llquaternion.h"
10
11struct EmeraldGlobalBoobConfig
12{
13 bool enabled;
14 F32 mass;
15 F32 hardness;
16 F32 zMax;
17 F32 velMin;
18 F32 velMax;
19 F32 zInfluence;
20 F32 friction;
21 F32 XYInfluence;
22
23 EmeraldGlobalBoobConfig()
24 : enabled(false),
25 mass(6.4f),
26 hardness(0.67f),
27 zMax(1.29f),
28 velMin(0.0027f*0.017f),
29 velMax(0.0027f),
30 zInfluence(0.0f),
31 friction(0.35f),
32 XYInfluence(0.3f)
33 {
34 }
35
36 bool operator==(const EmeraldGlobalBoobConfig &other) const
37 {
38 return
39 enabled == other.enabled &&
40 mass == other.mass &&
41 zMax == other.zMax &&
42 velMax == other.velMax &&
43 velMin == other.velMin &&
44 zInfluence == other.zInfluence &&
45 XYInfluence == other.XYInfluence &&
46 friction == other.friction;
47 }
48};
49
50std::ostream &operator<<(std::ostream &os, const EmeraldGlobalBoobConfig &v);
51
52struct EmeraldAvatarLocalBoobConfig
53{
54 F32 actualBoobGrav;
55 F32 actualButtGrav;
56 F32 actualFatGrav;
57 F32 boobSize;
58
59 EmeraldAvatarLocalBoobConfig()
60 : actualBoobGrav(0.0f),
61 actualButtGrav(0.0f),
62 actualFatGrav(0.0f),
63 boobSize(0.0f)
64 {
65 }
66
67 bool operator==(const EmeraldAvatarLocalBoobConfig &other) const
68 {
69 return
70 actualBoobGrav == other.actualBoobGrav &&
71 actualButtGrav == other.actualButtGrav &&
72 actualFatGrav == other.actualFatGrav &&
73 boobSize == other.boobSize;
74 }
75
76};
77
78std::ostream &operator<<(std::ostream &os, const EmeraldAvatarLocalBoobConfig &v);
79
80struct EmeraldBoobBounceState;
81
82struct EmeraldBoobState
83{
84 F32 boobGrav;
85 LLVector3 chestPosition;
86 LLQuaternion chestRotation;
87 F32 elapsedTime;
88 F32 frameDuration;
89 LLVector3 chestDisplacement;
90 LLVector3 localChestDisplacement;
91 LLVector3 displacementForce;
92 F32 mysteryValue;
93 std::list<EmeraldBoobBounceState> bounceStates;
94
95 EmeraldBoobState()
96 : boobGrav(0.0f),
97 chestPosition(0.0f,0.0f,0.0f),
98 chestRotation(0.0f,0.0f,0.0f,1.0f),
99 elapsedTime(0.0f),
100 frameDuration(0.0f),
101 chestDisplacement(0.0f,0.0f,0.0f),
102 localChestDisplacement(0.0f,0.0f,0.0f),
103 displacementForce(0.0f,0.0f,0.0f),
104 mysteryValue(0.0f)
105 {
106 }
107
108 bool operator==(const EmeraldBoobState &other) const
109 {
110 return
111 boobGrav == other.boobGrav &&
112 chestPosition == other.chestPosition &&
113 chestRotation == other.chestRotation &&
114 elapsedTime == other.elapsedTime &&
115 frameDuration == other.frameDuration &&
116 chestDisplacement == other.chestDisplacement &&
117 localChestDisplacement == other.localChestDisplacement &&
118 displacementForce == other.displacementForce &&
119 mysteryValue == other.mysteryValue &&
120 bounceStates == other.bounceStates;
121 }
122};
123
124std::ostream &operator<<(std::ostream &os, const EmeraldBoobState &v);
125
126struct EmeraldBoobInputs
127{
128 LLVector3 chestPosition;
129 LLQuaternion chestRotation;
130 F32 elapsedTime;
131 bool appearanceFlag;
132 bool appearanceAnimating;
133 S32 type;
134
135 EmeraldBoobInputs()
136 : chestPosition(0.0f,0.0f,0.0f),
137 chestRotation(0.0f,0.0f,0.0f,1.0f),
138 elapsedTime(0.0f),
139 appearanceFlag(false),
140 appearanceAnimating(false),
141 type(0)
142 {
143 }
144
145 bool operator==(const EmeraldBoobInputs &other) const
146 {
147 return
148 chestPosition == other.chestPosition &&
149 chestRotation == other.chestRotation &&
150 elapsedTime == other.elapsedTime &&
151 appearanceFlag == other.appearanceFlag &&
152 appearanceAnimating == other.appearanceAnimating &&
153 type == other.type;
154 }
155};
156
157std::ostream &operator<<(std::ostream &os, const EmeraldBoobInputs &v);
158
159struct EmeraldBoobBounceState
160{
161 F32 bounceStart;
162 F32 bounceStartAmplitude;
163 F32 bounceStartFrameDuration;
164
165 EmeraldBoobBounceState()
166 : bounceStart(0.0f),
167 bounceStartAmplitude(0.0f),
168 bounceStartFrameDuration(0.0f)
169 {
170 };
171
172 bool operator==(const EmeraldBoobBounceState &other) const
173 {
174 return
175 bounceStart == other.bounceStart &&
176 bounceStartAmplitude == other.bounceStartAmplitude &&
177 bounceStartFrameDuration == other.bounceStartFrameDuration;
178 }
179};
180
181std::ostream &operator<<(std::ostream &os, const EmeraldBoobBounceState &v);
182
183
184struct EmeraldBoobUtils
185{
186public:
187 static EmeraldBoobState idleUpdate(const EmeraldGlobalBoobConfig &config, const EmeraldAvatarLocalBoobConfig &localConfig, const EmeraldBoobState &oldState, const EmeraldBoobInputs &inputs);
188
189 static F32 convertMass(F32 displayMass);
190 static F32 convertHardness(F32 displayHardness);
191 static F32 convertVelMax(F32 displayVelMax);
192 static F32 convertFriction(F32 displayFriction);
193 static F32 convertVelMin(F32 displayVelMin);
194};
195
196
197#endif
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 0b9f646..df3ab18 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -7411,7 +7411,16 @@ void LLAgent::sendAgentSetAppearance()
7411 msg->nextBlockFast(_PREHASH_VisualParam ); 7411 msg->nextBlockFast(_PREHASH_VisualParam );
7412 7412
7413 // We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence. 7413 // We don't send the param ids. Instead, we assume that the receiver has the same params in the same sequence.
7414 const F32 param_value = param->getWeight(); 7414 F32 param_value;
7415 if(param->getID() == 507)
7416 param_value = mAvatarObject->getActualBoobGrav();
7417 else if(param->getID() == 795)
7418 param_value = mAvatarObject->getActualButtGrav();
7419 else if(param->getID() == 157)
7420 param_value = mAvatarObject->getActualFatGrav();
7421 else
7422 param_value = param->getWeight();
7423
7415 const U8 new_weight = F32_to_U8(param_value, param->getMinWeight(), param->getMaxWeight()); 7424 const U8 new_weight = F32_to_U8(param_value, param->getMinWeight(), param->getMaxWeight());
7416 msg->addU8Fast(_PREHASH_ParamValue, new_weight ); 7425 msg->addU8Fast(_PREHASH_ParamValue, new_weight );
7417 transmitted_params++; 7426 transmitted_params++;
diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp
index 6d62db5..8bbef79 100644
--- a/linden/indra/newview/llviewercontrol.cpp
+++ b/linden/indra/newview/llviewercontrol.cpp
@@ -123,6 +123,50 @@ static bool handleSetShaderChanged(const LLSD& newvalue)
123 return true; 123 return true;
124} 124}
125 125
126static bool handleAvatarBoobMassChanged(const LLSD& newvalue)
127{
128 LLVOAvatar::sBoobConfig.mass = EmeraldBoobUtils::convertMass((F32) newvalue.asReal());
129 return true;
130}
131
132static bool handleAvatarBoobHardnessChanged(const LLSD& newvalue)
133{
134 LLVOAvatar::sBoobConfig.hardness = EmeraldBoobUtils::convertHardness((F32) newvalue.asReal());
135 return true;
136}
137
138static bool handleAvatarBoobVelMaxChanged(const LLSD& newvalue)
139{
140 LLVOAvatar::sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax((F32) newvalue.asReal());
141 LLVOAvatar::sBoobConfig.velMin = LLVOAvatar::sBoobConfig.velMin*LLVOAvatar::sBoobConfig.velMax;
142 return true;
143}
144
145static bool handleAvatarBoobFrictionChanged(const LLSD& newvalue)
146{
147 LLVOAvatar::sBoobConfig.friction = EmeraldBoobUtils::convertFriction((F32) newvalue.asReal());
148 return true;
149}
150
151static bool handleAvatarBoobVelMinChanged(const LLSD& newvalue)
152{
153 LLVOAvatar::sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin((F32) newvalue.asReal())*LLVOAvatar::sBoobConfig.velMax;
154 return true;
155}
156
157static bool handleAvatarBoobToggleChanged(const LLSD& newvalue)
158{
159 LLVOAvatar::sBoobConfig.enabled = (BOOL) newvalue.asReal();
160 return true;
161}
162
163static bool handleAvatarBoobXYInfluence(const LLSD& newvalue)
164{
165 LLVOAvatar::sBoobConfig.XYInfluence = (F32) newvalue.asReal();
166 return true;
167}
168
169
126static bool handleSetSelfInvisible( const LLSD& newvalue) 170static bool handleSetSelfInvisible( const LLSD& newvalue)
127{ 171{
128 LLVOAvatar::onChangeSelfInvisible( newvalue.asBoolean() ); 172 LLVOAvatar::onChangeSelfInvisible( newvalue.asBoolean() );
@@ -504,6 +548,14 @@ void settings_setup_listeners()
504 gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1)); 548 gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1));
505 gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1)); 549 gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
506 gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1)); 550 gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
551 gSavedSettings.getControl("EmeraldBoobMass")->getSignal()->connect(boost::bind(&handleAvatarBoobMassChanged, _1));
552 gSavedSettings.getControl("EmeraldBoobHardness")->getSignal()->connect(boost::bind(&handleAvatarBoobHardnessChanged, _1));
553 gSavedSettings.getControl("EmeraldBoobVelMax")->getSignal()->connect(boost::bind(&handleAvatarBoobVelMaxChanged, _1));
554 gSavedSettings.getControl("EmeraldBoobFriction")->getSignal()->connect(boost::bind(&handleAvatarBoobFrictionChanged, _1));
555 gSavedSettings.getControl("EmeraldBoobVelMin")->getSignal()->connect(boost::bind(&handleAvatarBoobVelMinChanged, _1));
556 gSavedSettings.getControl("EmeraldBreastPhysicsToggle")->getSignal()->connect(boost::bind(&handleAvatarBoobToggleChanged, _1));
557 gSavedSettings.getControl("EmeraldBoobXYInfluence")->getSignal()->connect(boost::bind(&handleAvatarBoobXYInfluence, _1));
558
507 gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _1)); 559 gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _1));
508 gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _1)); 560 gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _1));
509 gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _1)); 561 gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _1));
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 3692b1b..10e2ec7 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -706,6 +706,8 @@ F32 LLVOAvatar::sLODFactor = 1.f;
706BOOL LLVOAvatar::sUseImpostors = FALSE; 706BOOL LLVOAvatar::sUseImpostors = FALSE;
707BOOL LLVOAvatar::sJointDebug = FALSE; 707BOOL LLVOAvatar::sJointDebug = FALSE;
708 708
709EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig;
710
709F32 LLVOAvatar::sUnbakedTime = 0.f; 711F32 LLVOAvatar::sUnbakedTime = 0.f;
710F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; 712F32 LLVOAvatar::sUnbakedUpdateTime = 0.f;
711F32 LLVOAvatar::sGreyTime = 0.f; 713F32 LLVOAvatar::sGreyTime = 0.f;
@@ -764,7 +766,10 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
764 mVisibleChat( FALSE ), 766 mVisibleChat( FALSE ),
765 mFullyLoadedInitialized(FALSE), 767 mFullyLoadedInitialized(FALSE),
766 mFullyLoaded(FALSE), 768 mFullyLoaded(FALSE),
767 mHasBakedHair( FALSE ) 769 mHasBakedHair( FALSE ),
770 mFirstSetActualBoobGravRan( false ),
771 mFirstSetActualButtGravRan( false ),
772 mFirstSetActualFatGravRan( false )
768{ 773{
769 LLMemType mt(LLMemType::MTYPE_AVATAR); 774 LLMemType mt(LLMemType::MTYPE_AVATAR);
770 //VTResume(); // VTune 775 //VTResume(); // VTune
@@ -985,6 +990,16 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
985 990
986 } 991 }
987 992
993 // grab the boob savedparams (prob a better place for this)
994 sBoobConfig.mass = EmeraldBoobUtils::convertMass(gSavedSettings.getF32("EmeraldBoobMass"));
995 sBoobConfig.hardness = EmeraldBoobUtils::convertHardness(gSavedSettings.getF32("EmeraldBoobHardness"));
996 sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax(gSavedSettings.getF32("EmeraldBoobVelMax"));
997 sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin"));
998 sBoobConfig.friction = EmeraldBoobUtils::convertFriction(gSavedSettings.getF32("EmeraldBoobFriction"));
999 sBoobConfig.enabled = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle");
1000 sBoobConfig.XYInfluence = gSavedSettings.getF32("EmeraldBoobXYInfluence");
1001
1002
988 if (gNoRender) 1003 if (gNoRender)
989 { 1004 {
990 return; 1005 return;
@@ -2625,7 +2640,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
2625 idleUpdateVoiceVisualizer( voice_enabled ); 2640 idleUpdateVoiceVisualizer( voice_enabled );
2626 idleUpdateMisc( detailed_update ); 2641 idleUpdateMisc( detailed_update );
2627 idleUpdateAppearanceAnimation(); 2642 idleUpdateAppearanceAnimation();
2628 2643 idleUpdateBoobEffect();
2629 idleUpdateLipSync( voice_enabled ); 2644 idleUpdateLipSync( voice_enabled );
2630 idleUpdateLoadingEffect(); 2645 idleUpdateLoadingEffect();
2631 idleUpdateBelowWater(); // wind effect uses this 2646 idleUpdateBelowWater(); // wind effect uses this
@@ -2879,6 +2894,8 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
2879 { 2894 {
2880 if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) 2895 if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
2881 { 2896 {
2897 // so boobs don't go spastic when a shape's changed, but still seems buggy
2898 //if(param->getID() != 507)
2882 param->animate(morph_amt, mAppearanceAnimSetByUser); 2899 param->animate(morph_amt, mAppearanceAnimSetByUser);
2883 } 2900 }
2884 } 2901 }
@@ -2897,6 +2914,107 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
2897 } 2914 }
2898} 2915}
2899 2916
2917// ------------------------------------------------------------
2918// Danny: ZOMG Boob Phsyics go!
2919// ------------------------------------------------------------
2920void LLVOAvatar::idleUpdateBoobEffect()
2921{
2922 if(mFirstSetActualBoobGravRan)
2923 {
2924 // should probably be moved somewhere where it is only called when boobsize changes
2925 LLVisualParam *param;
2926
2927 // BOOBS
2928 param = getVisualParam(105); //boob size
2929 mLocalBoobConfig.boobSize = param->getCurrentWeight();
2930 EmeraldBoobInputs boobInputs;
2931 boobInputs.type = 0;
2932 boobInputs.chestPosition = mChestp->getWorldPosition();
2933 boobInputs.chestRotation = mChestp->getWorldRotation();
2934 boobInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32();
2935 boobInputs.appearanceFlag = getAppearanceFlag();
2936
2937
2938 EmeraldBoobState newBoobState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mBoobState, boobInputs);
2939
2940 if(mBoobState.boobGrav != newBoobState.boobGrav)
2941 {
2942 LLVisualParam *param;
2943 param = getVisualParam(507);
2944
2945 ESex avatar_sex = getSex();
2946
2947 param->stopAnimating(FALSE);
2948 param->setWeight(llclamp(newBoobState.boobGrav+getActualBoobGrav(), -1.5f, 2.f), FALSE);
2949 param->apply(avatar_sex);
2950 updateVisualParams();
2951 }
2952
2953 mBoobState = newBoobState;
2954 }
2955 /*
2956 if(mFirstSetActualButtGravRan)
2957 {
2958 // BUTT
2959 EmeraldBoobInputs buttInputs;
2960 buttInputs.type = 1;
2961 buttInputs.chestPosition = mPelvisp->getWorldPosition();
2962 buttInputs.chestRotation = mPelvisp->getWorldRotation();
2963 buttInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32();
2964 buttInputs.appearanceFlag = getAppearanceFlag();
2965
2966
2967 EmeraldBoobState newButtState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mButtState, buttInputs);
2968
2969 if(mButtState.boobGrav != newButtState.boobGrav)
2970 {
2971 LLVisualParam *param;
2972 param = getVisualParam(795);
2973
2974 ESex avatar_sex = getSex();
2975
2976 param->stopAnimating(FALSE);
2977 param->setWeight(newButtState.boobGrav*0.3f+getActualButtGrav(), FALSE);
2978 param->apply(avatar_sex);
2979 updateVisualParams();
2980 }
2981
2982 mButtState = newButtState;
2983 }
2984
2985 if(mFirstSetActualFatGravRan)
2986 {
2987 // FAT
2988 EmeraldBoobInputs fatInputs;
2989 fatInputs.type = 2;
2990 fatInputs.chestPosition = mPelvisp->getWorldPosition();
2991 fatInputs.chestRotation = mPelvisp->getWorldRotation();
2992 fatInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32();
2993 fatInputs.appearanceFlag = getAppearanceFlag();
2994
2995
2996 EmeraldBoobState newFatState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mFatState, fatInputs);
2997
2998 if(mFatState.boobGrav != newFatState.boobGrav)
2999 {
3000 LLVisualParam *param;
3001 param = getVisualParam(157);
3002
3003 ESex avatar_sex = getSex();
3004
3005 param->stopAnimating(FALSE);
3006 param->setWeight(newFatState.boobGrav*0.3f+getActualFatGrav(), FALSE);
3007 param->apply(avatar_sex);
3008 updateVisualParams();
3009 }
3010
3011 mFatState = newFatState;
3012 }
3013 */
3014
3015}
3016
3017
2900void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) 3018void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
2901{ 3019{
2902 // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync 3020 // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
@@ -8342,6 +8460,22 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
8342 mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); 8460 mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i);
8343 F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); 8461 F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight());
8344 8462
8463 if(param->getID() == 507 && newWeight != getActualBoobGrav())
8464 {
8465 llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl;
8466 setActualBoobGrav(newWeight);
8467 }
8468 if(param->getID() == 795 && newWeight != getActualButtGrav())
8469 {
8470 llwarns << "Butt Grav SET to " << newWeight << " for " << getFullname() << llendl;
8471 setActualButtGrav(newWeight);
8472 }
8473 if(param->getID() == 157 && newWeight != getActualFatGrav())
8474 {
8475 llwarns << "Fat Grav SET to " << newWeight << " for " << getFullname() << llendl;
8476 setActualFatGrav(newWeight);
8477 }
8478
8345 if (is_first_appearance_message || (param->getWeight() != newWeight)) 8479 if (is_first_appearance_message || (param->getWeight() != newWeight))
8346 { 8480 {
8347 //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; 8481 //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl;
diff --git a/linden/indra/newview/llvoavatar.h b/linden/indra/newview/llvoavatar.h
index 33cec69..0bf648a 100644
--- a/linden/indra/newview/llvoavatar.h
+++ b/linden/indra/newview/llvoavatar.h
@@ -49,6 +49,8 @@
49#include "llwearable.h" 49#include "llwearable.h"
50#include "llvoavatardefines.h" 50#include "llvoavatardefines.h"
51 51
52#include "emeraldboobutils.h"
53
52extern const LLUUID ANIM_AGENT_BODY_NOISE; 54extern const LLUUID ANIM_AGENT_BODY_NOISE;
53extern const LLUUID ANIM_AGENT_BREATHE_ROT; 55extern const LLUUID ANIM_AGENT_BREATHE_ROT;
54extern const LLUUID ANIM_AGENT_EDITING; 56extern const LLUUID ANIM_AGENT_EDITING;
@@ -106,6 +108,7 @@ public:
106 void idleUpdateLipSync(bool voice_enabled); 108 void idleUpdateLipSync(bool voice_enabled);
107 void idleUpdateLoadingEffect(); 109 void idleUpdateLoadingEffect();
108 void idleUpdateWindEffect(); 110 void idleUpdateWindEffect();
111 void idleUpdateBoobEffect();
109 void idleUpdateNameTag(const LLVector3& root_pos_last); 112 void idleUpdateNameTag(const LLVector3& root_pos_last);
110 void idleUpdateRenderCost(); 113 void idleUpdateRenderCost();
111 void idleUpdateTractorBeam(); 114 void idleUpdateTractorBeam();
@@ -494,6 +497,59 @@ private:
494 F32 mLastAppearanceBlendTime; 497 F32 mLastAppearanceBlendTime;
495 498
496 //-------------------------------------------------------------------- 499 //--------------------------------------------------------------------
500 // boob bounce stuff
501 //--------------------------------------------------------------------
502
503private:
504 bool mFirstSetActualBoobGravRan;
505 bool mFirstSetActualButtGravRan;
506 bool mFirstSetActualFatGravRan;
507 LLFrameTimer mBoobBounceTimer;
508 EmeraldAvatarLocalBoobConfig mLocalBoobConfig;
509 EmeraldBoobState mBoobState;
510 EmeraldBoobState mButtState;
511 EmeraldBoobState mFatState;
512
513public:
514 //boob
515 F32 getActualBoobGrav() { return mLocalBoobConfig.actualBoobGrav; }
516 void setActualBoobGrav(F32 grav)
517 {
518 mLocalBoobConfig.actualBoobGrav = grav;
519 if(!mFirstSetActualBoobGravRan)
520 {
521 mBoobState.boobGrav = grav;
522 mFirstSetActualBoobGravRan = true;
523 }
524 }
525
526 //butt
527 F32 getActualButtGrav() { return mLocalBoobConfig.actualButtGrav; }
528 void setActualButtGrav(F32 grav)
529 {
530 mLocalBoobConfig.actualButtGrav = grav;
531 if(!mFirstSetActualButtGravRan)
532 {
533 mButtState.boobGrav = grav;
534 mFirstSetActualButtGravRan = true;
535 }
536 }
537
538 //fat
539 F32 getActualFatGrav() { return mLocalBoobConfig.actualFatGrav; }
540 void setActualFatGrav(F32 grav)
541 {
542 mLocalBoobConfig.actualFatGrav = grav;
543 if(!mFirstSetActualFatGravRan)
544 {
545 mFatState.boobGrav = grav;
546 mFirstSetActualFatGravRan = true;
547 }
548 }
549
550 static EmeraldGlobalBoobConfig sBoobConfig;
551
552 //--------------------------------------------------------------------
497 // Attachments 553 // Attachments
498 //-------------------------------------------------------------------- 554 //--------------------------------------------------------------------
499public: 555public:
diff --git a/linden/indra/newview/llwearable.cpp b/linden/indra/newview/llwearable.cpp
index bf5fd4a..087c74c 100644
--- a/linden/indra/newview/llwearable.cpp
+++ b/linden/indra/newview/llwearable.cpp
@@ -152,38 +152,34 @@ EWearableType LLWearable::typeNameToType( const std::string& type_name )
152 } 152 }
153 return WT_INVALID; 153 return WT_INVALID;
154} 154}
155 155std::string terse_F32_to_string( F32 f )
156const char* terse_F32_to_string( F32 f, char s[MAX_STRING] ) /* Flawfinder: ignore */
157{ 156{
158 char* r = s; 157 std::string r = llformat( "%.2f", f );
159 S32 len = snprintf( s, MAX_STRING, "%.2f", f ); /* Flawfinder: ignore */
160
161 // "1.20" -> "1.2" 158 // "1.20" -> "1.2"
162 // "24.00" -> "24." 159 // "24.00" -> "24."
163 while( '0' == r[len - 1] ) 160 S32 len = r.length();
161 while( len > 0 && '0' == r[len - 1] )
164 { 162 {
165 len--; 163 r.erase(len-1, 1);
166 r[len] = '\0'; 164 len--;
167 } 165 }
168 166
169 if( '.' == r[len - 1] ) 167 if( '.' == r[len - 1] )
170 { 168 {
171 // "24." -> "24" 169 // "24." -> "24"
172 len--; 170 r.erase(len-1, 1);
173 r[len] = '\0';
174 } 171 }
175 else 172 else
176 if( ('-' == r[0]) && ('0' == r[1]) ) 173 if( ('-' == r[0]) && ('0' == r[1]) )
177 { 174 {
178 // "-0.59" -> "-.59" 175 // "-0.59" -> "-.59"
179 r++; 176 r.erase(1, 1);
180 r[0] = '-';
181 } 177 }
182 else 178 else
183 if( '0' == r[0] ) 179 if( '0' == r[0] )
184 { 180 {
185 // "0.59" -> ".59" 181 // "0.59" -> ".59"
186 r++; 182 r.erase(0, 1);
187 } 183 }
188 184
189 return r; 185 return r;
@@ -200,13 +196,12 @@ BOOL LLWearable::FileExportParams( FILE* file )
200 S32 num_parameters = mVisualParamMap.size(); 196 S32 num_parameters = mVisualParamMap.size();
201 fprintf( file, "parameters %d\n", num_parameters ); 197 fprintf( file, "parameters %d\n", num_parameters );
202 198
203 char s[ MAX_STRING ]; /* Flawfinder: ignore */
204 for (param_map_t::iterator iter = mVisualParamMap.begin(); 199 for (param_map_t::iterator iter = mVisualParamMap.begin();
205 iter != mVisualParamMap.end(); ++iter) 200 iter != mVisualParamMap.end(); ++iter)
206 { 201 {
207 S32 param_id = iter->first; 202 S32 param_id = iter->first;
208 F32 param_weight = iter->second; 203 F32 param_weight = iter->second;
209 fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight, s ) ); 204 fprintf( file, "%d %s\n", param_id, terse_F32_to_string(param_weight).c_str() );
210 } 205 }
211 206
212 return TRUE; 207 return TRUE;
@@ -280,13 +275,12 @@ BOOL LLWearable::exportFile( LLFILE* file )
280 return FALSE; 275 return FALSE;
281 } 276 }
282 277
283 char s[ MAX_STRING ]; /* Flawfinder: ignore */
284 for (param_map_t::iterator iter = mVisualParamMap.begin(); 278 for (param_map_t::iterator iter = mVisualParamMap.begin();
285 iter != mVisualParamMap.end(); ++iter) 279 iter != mVisualParamMap.end(); ++iter)
286 { 280 {
287 S32 param_id = iter->first; 281 S32 param_id = iter->first;
288 F32 param_weight = iter->second; 282 F32 param_weight = iter->second;
289 if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight, s ) ) < 0 ) 283 if( fprintf( file, "%d %s\n", param_id, terse_F32_to_string( param_weight ).c_str() ) < 0 )
290 { 284 {
291 return FALSE; 285 return FALSE;
292 } 286 }
@@ -597,9 +591,52 @@ BOOL LLWearable::isDirty()
597 weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() ); 591 weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
598 592
599 U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() ); 593 U8 a = F32_to_U8( param->getWeight(), param->getMinWeight(), param->getMaxWeight() );
600 U8 b = F32_to_U8( weight, param->getMinWeight(), param->getMaxWeight() ); 594
595 if(avatar->getAppearanceFlag() == true)
596 {
597 //boob
598 if(param->getID() == 507)
599 {
600 weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualBoobGrav());
601 weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
602 }
603 //butt
604 if(param->getID() == 795)
605 {
606 weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualButtGrav());
607 weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
608 }
609 //fat
610 if(param->getID() == 157)
611 {
612 weight = get_if_there(mVisualParamMap, param->getID(), avatar->getActualFatGrav());
613 weight = llclamp( weight, param->getMinWeight(), param->getMaxWeight() );
614 }
615 }
616 else
617 {
618 //boob
619 if(param->getID() == 507)
620 {
621 a = F32_to_U8( avatar->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() );
622 }
623 //butt
624 if(param->getID() == 795)
625 {
626 a = F32_to_U8( avatar->getActualButtGrav(), param->getMinWeight(), param->getMaxWeight() );
627 }
628 //fat
629 if(param->getID() == 157)
630 {
631 a = F32_to_U8( avatar->getActualFatGrav(), param->getMinWeight(), param->getMaxWeight() );
632 }
633 }
634
635
636 U8 b = F32_to_U8( weight, param->getMinWeight(), param->getMaxWeight() );
601 if( a != b ) 637 if( a != b )
602 { 638 {
639 llwarns << "param ID " << param->getID() << " was changed." << llendl;
603 return TRUE; 640 return TRUE;
604 } 641 }
605 } 642 }
@@ -685,6 +722,16 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
685 { 722 {
686 S32 param_id = param->getID(); 723 S32 param_id = param->getID();
687 F32 weight = get_if_there(mVisualParamMap, param_id, param->getDefaultWeight()); 724 F32 weight = get_if_there(mVisualParamMap, param_id, param->getDefaultWeight());
725
726 //ZOMG: When switching shapes from inventory
727 if(param_id == 507)
728 avatar->setActualBoobGrav(weight);
729 if(param_id == 795)
730 avatar->setActualButtGrav(weight);
731 if(param_id == 157)
732 avatar->setActualFatGrav(weight);
733
734
688 // only animate with user-originated changes 735 // only animate with user-originated changes
689 if (set_by_user) 736 if (set_by_user)
690 { 737 {
@@ -745,7 +792,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user )
745 792
746// if( set_by_user ) 793// if( set_by_user )
747// { 794// {
748// gAgent.sendAgentSetAppearance(); 795 gAgent.sendAgentSetAppearance();
749// } 796// }
750} 797}
751 798
@@ -822,6 +869,22 @@ void LLWearable::readFromAvatar()
822 { 869 {
823 if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) 870 if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
824 { 871 {
872
873 //pretty sure is right
874 if(param->getID() == 507)
875 avatar->setActualBoobGrav(param->getWeight());
876 if(param->getID() == 151)
877 avatar->setActualButtGrav(param->getWeight());
878 if(param->getID() == 157)
879 avatar->setActualFatGrav(param->getWeight());
880
881 //if(param->getID() == 507)
882 //{
883 // llwarns << "current = " << avatar->getActualBoobGrav() << llendl;
884 // llwarns << "param weight = " << param->getWeight() << llendl;
885 //}
886
887
825 mVisualParamMap[param->getID()] = param->getWeight(); 888 mVisualParamMap[param->getID()] = param->getWeight();
826 } 889 }
827 } 890 }
@@ -873,6 +936,27 @@ void LLWearable::copyDataFrom( LLWearable* src )
873 { 936 {
874 S32 id = param->getID(); 937 S32 id = param->getID();
875 F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() ); 938 F32 weight = get_if_there(src->mVisualParamMap, id, param->getDefaultWeight() );
939 //llwarns << "------------------------------" << llendl;
940 //llwarns << "copydatafrom" << llendl;
941 //llwarns << "------------------------------" << llendl;
942
943 //if(id == 507)
944 //{
945 // llwarns << "weight = " << weight << llendl;
946 // llwarns << "actual = " << avatar->getActualBoobGrav() << llendl;
947 // llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl;
948 //}
949
950 //pretty sure right
951 if(id == 507)
952 avatar->setActualBoobGrav(weight);
953 if(id == 795)
954 avatar->setActualButtGrav(weight);
955 if(id == 157)
956 avatar->setActualFatGrav(weight);
957
958
959
876 mVisualParamMap[id] = weight; 960 mVisualParamMap[id] = weight;
877 } 961 }
878 } 962 }
diff --git a/linden/indra/newview/llwearable.h b/linden/indra/newview/llwearable.h
index 6e473c1..81aa61d 100644
--- a/linden/indra/newview/llwearable.h
+++ b/linden/indra/newview/llwearable.h
@@ -105,11 +105,11 @@ public:
105 105
106 friend std::ostream& operator<<(std::ostream &s, const LLWearable &w); 106 friend std::ostream& operator<<(std::ostream &s, const LLWearable &w);
107 107
108private: 108public:
109 // Private constructor used by LLWearableList 109 // -not anymore Private- constructor used by LLWearableList
110 LLWearable(const LLTransactionID& transactionID); 110 LLWearable(const LLTransactionID& transactionID);
111 LLWearable(const LLAssetID& assetID); 111 LLWearable(const LLAssetID& assetID);
112 112private:
113 static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. 113 static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
114 S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. 114 S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
115 std::string mName; 115 std::string mName;