Skip to content

fix for alpha-gamma-bypass prototype #2538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

AndrewMeadows
Copy link
Contributor

This PR fixes viewer-side problems in the "alpha-gamma-prototype".

@@ -125,6 +125,8 @@ const LLUUID SCULPT_DEFAULT_TEXTURE("be293869-d0d9-0a69-5989-ad27f1946fd4"); //
// can't be divided by 2. See DEV-19108
const F32 TEXTURE_ROTATION_PACK_FACTOR = ((F32) 0x08000);

constexpr U8 EXTRA_PROPERTY_ALPHA_GAMMA = 0x01;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use EXTRA_PROPERTY_ALPHA_GAMMA for less magic.

LLSelectMgrSendFunctor sendfunc;
// TODO: remove LLSelectMgrAlphaGammaBypassFunctor and instead
// use the normal LLSelectMgrSendFunctor and enhance the server to know when to allow bypass
LLSelectMgrAlphaGammaBypassFunctor sendfunc;
getSelection()->applyToObjects(&sendfunc);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the wrong place to call packAlphaGammaOverride(). By putting it there the viewer would send one message for every object face!

The correct way to do it is to first make ALL of the changes to the local object (if permission rules allow) and only when all changes made: send an update to the server. The server validates the changes and will always send a confirmation or denied update back to the viewer that tried to make the change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted! Thank you!

}
return true;
}
};
Copy link
Contributor Author

@AndrewMeadows AndrewMeadows Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "sendFunc" operator was created for the new message. However, I believe we should remove the new message and just use the old one while updating the sever-side permission logic to check for, and handle, the new "bypass" case.

Edit: I spoke with Rider and he wants to keep the new message. Nevermind.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear - we're sticking with the new message, yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we're sticking with the new message.


// Get the first ID that matches test and whether or not all ids are identical in selected objects.
void getFirst(LLSelectGetFirstTest* test);

public:
static void packAlphaGammaBypass(LLViewerObject* object);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method must be public because it is called by LLSelectMgrAlphaGammaBypassFunctor.

@AndrewMeadows AndrewMeadows requested a review from Geenz September 10, 2024 16:26
Also reduce memory footprint for LLTEContents during pack/unpack
(only allocate room for as many LLTextureEntry's the object has)

// verify we correctly computed data size
llassert(offset == num_bytes);
}
Copy link
Contributor Author

@AndrewMeadows AndrewMeadows Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLTEContents ctor now takes an argument for the number of TEs to expect. This allows it to only allocate as much memory as it actually needs (e.g. 6 for a box) instead of the default (45, which is how many the avatar uses).

Note: we use one big data buffer and compute offsets into that buffer for the various arrays of typed data. This may seem like sketch c-style coding however we were already doing c-style casts when extracting LLUUID data, so it isn't actually "new".

ensure_equals(te_A->getGlow(), te_B->getGlow());
ensure_equals(te_A->getAlphaGamma(), te_B->getAlphaGamma());
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding this unit-test for the TextureEntry pack/unpack logic.

*/

#pragma once

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for the unit-test to work we need a lot of functional stubbery for LLTextureEntry.

LLSelectedTE::getAlphaGamma(alpha_gamma, identical_alpha_gamma);
mComboAlphaGamma->getSelectionInterface()->selectByValue(alpha_gamma);
mComboAlphaGamma->setEnabled(true);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This moved down below so the UI could enabled even when permissions are no-mod.

LLFilenameAndTask(const LLFilenameAndTask& rhs);
const LLFilenameAndTask& operator=(const LLFilenameAndTask& rhs) const;
LLFilenameAndTask(const LLFilenameAndTask& rhs) = delete;
const LLFilenameAndTask& operator=(const LLFilenameAndTask& rhs) = delete;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VisualStudio was warning about these unimplemented methods. It looks like someone wanted to restrict the usage of these normally-default methods so I did it correctly using the delete keyword and the compiler did not complain.

@@ -243,7 +243,8 @@ struct LLTextureMaskData

struct LLAppearanceMessageContents: public LLRefCount
{
LLAppearanceMessageContents():
LLAppearanceMessageContents(U8 num_tes):
mTEContents(num_tes),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LLTEContents now requires "num_textures" argument in its ctor, so LLAppearanceMessage (which has a LLTEContents data member) also requires the same argument so it can pass it over.

color.mV[VALPHA] = F32(255 - colors[i].mV[VALPHA]) / 255.f;

retval |= setTEColor(i, color);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motivation for the DRY pass was to eliminate duplicate unpacking logic. We now have a single method where this is done.

// static
S32 LLPrimitive::parseTEMessage(U8* packed_buffer, U32 data_size, LLTEContents& tec)

bool packTEMessage(LLMessageSystem *mesgsys) const;
bool packTEMessage(LLDataPacker &dp) const;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The packTEMessage() that expected an LLDataPacker& argument has been removed: it was never called anywhere.

@Geenz
Copy link
Collaborator

Geenz commented Sep 18, 2024

This generally looks good to me - I'm willing to accept the de-crustifying of LLPrimitive's TE packing at face value unless someone would like to take up that review. It generally looks good to me on that front. If there's no objections, I'll merge into legacy-alpha-params

If there's no objections by the time I hit my next hotel tomorrow evening, I'll merge it into legacy-alpha-params

@AndrewMeadows AndrewMeadows merged commit 624e8da into geenz/feat/legacy-alpha-params Sep 18, 2024
11 checks passed
@AndrewMeadows AndrewMeadows deleted the leviathan/alpha-gamma branch September 18, 2024 04:56
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants