diff options
Diffstat (limited to 'indra/newview/lltexturectrl.h')
-rw-r--r-- | indra/newview/lltexturectrl.h | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 28630d4ac4..08c530314e 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -64,25 +64,34 @@ bool get_is_predefined_texture(LLUUID asset_id); LLUUID get_copy_free_item_by_asset_id(LLUUID image_id, bool no_trans_perm = false); bool get_can_copy_texture(LLUUID image_id); -enum class EPickInventoryType +enum class LLTexPickInventoryType : U32 { - TEXTURE_MATERIAL = 0, - TEXTURE = 1, - MATERIAL = 2, + TEXTURE_MATERIAL = 0, + TEXTURE = 1, + MATERIAL = 2, }; namespace LLInitParam { template<> - struct TypeValues<EPickInventoryType> : public TypeValuesHelper<EPickInventoryType> + struct TypeValues<LLTexPickInventoryType> : public TypeValuesHelper<LLTexPickInventoryType> { static void declareValues(); }; } +enum LLPickerSource +{ + PICKER_INVENTORY, + PICKER_LOCAL, + PICKER_BAKE, + PICKER_UNKNOWN, // on cancel, default ids +}; + ////////////////////////////////////////////////////////////////////////////////////////// // LLTextureCtrl + class LLTextureCtrl : public LLUICtrl { @@ -94,6 +103,12 @@ public: TEXTURE_CANCEL } ETexturePickOp; + // *HACK: Can't forward-declare an enum scoped inside a class. Maybe there's a better way to initialize LLInitParam::TypeValues<LLTexPickInventoryType> that doesn't run into this limitation. + typedef LLTexPickInventoryType EPickInventoryType; + static const EPickInventoryType PICK_TEXTURE_MATERIAL = LLTexPickInventoryType::TEXTURE_MATERIAL; + static const EPickInventoryType PICK_TEXTURE = LLTexPickInventoryType::TEXTURE; + static const EPickInventoryType PICK_MATERIAL = LLTexPickInventoryType::MATERIAL; + public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -118,7 +133,7 @@ public: : image_id("image"), default_image_id("default_image_id"), default_image_name("default_image_name"), - pick_type("pick_type", EPickInventoryType::TEXTURE), + pick_type("pick_type", PICK_TEXTURE), allow_no_texture("allow_no_texture", false), can_apply_immediately("can_apply_immediately"), no_commit_on_selection("no_commit_on_selection", false), @@ -194,8 +209,7 @@ public: void setCanApply(bool can_preview, bool can_apply); - void setImmediateFilterPermMask(PermissionMask mask) - { mImmediateFilterPermMask = mask; } + void setImmediateFilterPermMask(PermissionMask mask); void setDnDFilterPermMask(PermissionMask mask) { mDnDFilterPermMask = mask; } PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; } @@ -203,7 +217,7 @@ public: void closeDependentFloater(); void onFloaterClose(); - void onFloaterCommit(ETexturePickOp op, LLUUID id); + void onFloaterCommit(ETexturePickOp op, LLPickerSource source, const LLUUID& local_id, const LLUUID& inv_id); // This call is returned when a drag is detected. Your callback // should return TRUE if the drag is acceptable. @@ -275,7 +289,7 @@ private: ////////////////////////////////////////////////////////////////////////////////////////// // LLFloaterTexturePicker -typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLUUID id)> floater_commit_callback; +typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLPickerSource source, const LLUUID& asset_id, const LLUUID& inventory_id)> floater_commit_callback; typedef boost::function<void()> floater_close_callback; typedef boost::function<void(const LLUUID& asset_id)> set_image_asset_id_callback; typedef boost::function<void(LLPointer<LLViewerTexture> texture)> set_on_update_image_stats_callback; @@ -309,11 +323,12 @@ public: // LLFloater overrides /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_settings); // New functions void setImageID(const LLUUID& image_asset_id, bool set_selection = true); - void updateImageStats(); + bool updateImageStats(); // true if within limits const LLUUID& getAssetID() { return mImageAssetID; } const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library = FALSE); void setCanApplyImmediately(BOOL b); @@ -325,11 +340,13 @@ public: void stopUsingPipette(); void commitIfImmediateSet(); + void commitCallback(LLTextureCtrl::ETexturePickOp op); void commitCancel(); void onFilterEdit(const std::string& search_string); - void setCanApply(bool can_preview, bool can_apply); + void setCanApply(bool can_preview, bool can_apply, bool inworld_image = true); + void setMinDimentionsLimits(S32 min_dim); void setTextureSelectedCallback(const texture_selected_callback& cb) { mTextureSelectedCallback = cb; } void setOnFloaterCloseCallback(const floater_close_callback& cb) { mOnFloaterCloseCallback = cb; } void setOnFloaterCommitCallback(const floater_commit_callback& cb) { mOnFloaterCommitCallback = cb; } @@ -360,13 +377,16 @@ public: void setLocalTextureEnabled(BOOL enabled); void setBakeTextureEnabled(BOOL enabled); - void setInventoryPickType(EPickInventoryType type); + void setInventoryPickType(LLTextureCtrl::EPickInventoryType type); + void setImmediateFilterPermMask(PermissionMask mask); static void onPickerCallback(const std::vector<std::string>& filenames, LLHandle<LLFloater> handle); protected: + void changeMode(); void refreshLocalList(); void refreshInventoryFilter(); + void setImageIDFromItem(const LLInventoryItem* itemp, bool set_selection = true); LLPointer<LLViewerTexture> mTexturep; LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial; @@ -385,6 +405,7 @@ protected: LLTextBox* mTentativeLabel; LLTextBox* mResolutionLabel; + LLTextBox* mResolutionWarning; std::string mPendingName; BOOL mActive; @@ -401,12 +422,21 @@ protected: LLComboBox* mModeSelector; LLScrollListCtrl* mLocalScrollCtrl; + LLButton* mDefaultBtn; + LLButton* mNoneBtn; + LLButton* mBlankBtn; + LLButton* mPipetteBtn; + LLButton* mSelectBtn; + LLButton* mCancelBtn; private: bool mCanApply; bool mCanPreview; bool mPreviewSettingChanged; - EPickInventoryType mInventoryPickType; + bool mLimitsSet; + S32 mMaxDim; + S32 mMinDim; + LLTextureCtrl::EPickInventoryType mInventoryPickType; texture_selected_callback mTextureSelectedCallback; @@ -416,6 +446,8 @@ private: set_on_update_image_stats_callback mOnUpdateImageStatsCallback; BOOL mBakeTextureEnabled; + + static S32 sLastPickerMode; }; #endif // LL_LLTEXTURECTRL_H |