diff options
Diffstat (limited to 'indra/newview/lltexturectrl.h')
-rw-r--r-- | indra/newview/lltexturectrl.h | 139 |
1 files changed, 78 insertions, 61 deletions
diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index cb6ce636e0..0361099b27 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -50,7 +50,7 @@ class LLViewerFetchedTexture; class LLFetchedGLTFMaterial; // used for setting drag & drop callbacks. -typedef boost::function<BOOL (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback; +typedef boost::function<bool (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback; typedef boost::function<void (LLInventoryItem*)> texture_selected_callback; // Helper functions for UI that work with picker @@ -64,13 +64,6 @@ 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 LLPickerSource -{ - PICKER_INVENTORY, - PICKER_LOCAL, - PICKER_BAKE, - PICKER_UNKNOWN, // on cancel, default ids -}; typedef enum e_pick_inventory_type { @@ -79,6 +72,23 @@ typedef enum e_pick_inventory_type PICK_MATERIAL = 2, } EPickInventoryType; +namespace LLInitParam +{ + template<> + struct TypeValues<EPickInventoryType> : public TypeValuesHelper<EPickInventoryType> + { + static void declareValues(); + }; +} + +enum LLPickerSource +{ + PICKER_INVENTORY, + PICKER_LOCAL, + PICKER_BAKE, + PICKER_UNKNOWN, // on cancel, default ids +}; + ////////////////////////////////////////////////////////////////////////////////////////// // LLTextureCtrl @@ -100,6 +110,7 @@ public: Optional<LLUUID> image_id; Optional<LLUUID> default_image_id; Optional<std::string> default_image_name; + Optional<EPickInventoryType> pick_type; Optional<bool> allow_no_texture; Optional<bool> can_apply_immediately; Optional<bool> no_commit_on_selection; // alternative mode: commit occurs and the widget gets dirty @@ -117,6 +128,7 @@ public: : image_id("image"), default_image_id("default_image_id"), default_image_name("default_image_name"), + 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), @@ -136,39 +148,41 @@ public: // LLView interface - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, - EAcceptance *accept, - std::string& tooltip_msg); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleUnicodeCharHere(llwchar uni_char); + bool handleMouseDown(S32 x, S32 y, MASK mask) override; + bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, + EAcceptance *accept, + std::string& tooltip_msg) override; + bool handleHover(S32 x, S32 y, MASK mask) override; + bool handleUnicodeCharHere(llwchar uni_char) override; + + void draw() override; + void setVisible( bool visible ) override; + void setEnabled( bool enabled ) override; - virtual void draw(); - virtual void setVisible( BOOL visible ); - virtual void setEnabled( BOOL enabled ); + void onVisibilityChange(bool new_visibility) override; - void setValid(BOOL valid); + void setValid(bool valid); - // LLUICtrl interface - virtual void clear(); + // LLUICtrl interface + void clear() override; - // Takes a UUID, wraps get/setImageAssetID - virtual void setValue(const LLSD& value); - virtual LLSD getValue() const; + // Takes a UUID, wraps get/setImageAssetID + void setValue(const LLSD& value) override; + LLSD getValue() const override; // LLTextureCtrl interface - void showPicker(BOOL take_focus); + void showPicker(bool take_focus); bool isPickerShown() { return !mFloaterHandle.isDead(); } void setLabel(const std::string& label); void setLabelWidth(S32 label_width) {mLabelWidth =label_width;} const std::string& getLabel() const { return mLabel; } - void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; } + void setAllowNoTexture( bool b ) { mAllowNoTexture = b; } bool getAllowNoTexture() const { return mAllowNoTexture; } - void setAllowLocalTexture(BOOL b) { mAllowLocalTexture = b; } - BOOL getAllowLocalTexture() const { return mAllowLocalTexture; } + void setAllowLocalTexture(bool b) { mAllowLocalTexture = b; } + bool getAllowLocalTexture() const { return mAllowLocalTexture; } const LLUUID& getImageItemID() { return mImageItemID; } @@ -188,7 +202,7 @@ public: void setOpenTexPreview(bool open_preview) { mOpenTexPreview = open_preview; } void setCaption(const std::string& caption); - void setCanApplyImmediately(BOOL b); + void setCanApplyImmediately(bool b); void setCanApply(bool can_preview, bool can_apply); @@ -208,10 +222,10 @@ public: const LLUUID& tracking_id); // This call is returned when a drag is detected. Your callback - // should return TRUE if the drag is acceptable. + // should return true if the drag is acceptable. void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; } - // This callback is called when the drop happens. Return TRUE if + // This callback is called when the drop happens. Return true if // the drop happened - resulting in an on commit callback, but not // necessariliy any other change. void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; } @@ -225,7 +239,7 @@ public: */ void setOnTextureSelectedCallback(texture_selected_callback cb); - void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder); + void setShowLoadingPlaceholder(bool showLoadingPlaceholder); LLViewerFetchedTexture* getTexture() { return mTexturep; } @@ -239,8 +253,8 @@ public: LLUUID getLocalTrackingID() { return mLocalTrackingID; } private: - BOOL allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); - BOOL doDrop(LLInventoryItem* item); + bool allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg); + bool doDrop(LLInventoryItem* item); private: drag_n_drop_callback mDragCallback; @@ -250,6 +264,8 @@ private: commit_callback_t mOnCloseCallback; texture_selected_callback mOnTextureSelectedCallback; LLPointer<LLViewerFetchedTexture> mTexturep; + LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial; + LLPointer<LLViewerTexture> mGLTFPreview; LLUIColor mBorderColor; LLUUID mImageItemID; LLUUID mImageAssetID; @@ -262,16 +278,16 @@ private: LLTextBox* mTentativeLabel; LLTextBox* mCaption; std::string mLabel; - BOOL mAllowNoTexture; // If true, the user can select "none" as an option - BOOL mAllowLocalTexture; + bool mAllowNoTexture; // If true, the user can select "none" as an option + bool mAllowLocalTexture; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - BOOL mCanApplyImmediately; - BOOL mCommitOnSelection; - BOOL mNeedsRawImageData; + bool mCanApplyImmediately; + bool mCommitOnSelection; + bool mNeedsRawImageData; LLViewBorder* mBorder; - BOOL mValid; - BOOL mShowLoadingPlaceholder; + bool mValid; + bool mShowLoadingPlaceholder; std::string mLoadingPlaceholderString; S32 mLabelWidth; bool mOpenTexPreview; @@ -294,27 +310,27 @@ public: LLUUID image_asset_id, LLUUID default_image_asset_id, LLUUID blank_image_asset_id, - BOOL tentative, - BOOL allow_no_texture, + bool tentative, + bool allow_no_texture, const std::string& label, PermissionMask immediate_filter_perm_mask, PermissionMask dnd_filter_perm_mask, - BOOL can_apply_immediately, + bool can_apply_immediately, LLUIImagePtr fallback_image_name, EPickInventoryType pick_type); virtual ~LLFloaterTexturePicker(); // LLView overrides - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, EDragAndDropType cargo_type, void *cargo_data, + /*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, + bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); /*virtual*/ void draw(); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ bool handleKeyHere(KEY key, MASK mask); // LLFloater overrides - /*virtual*/ BOOL postBuild(); + /*virtual*/ bool postBuild(); /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_settings); @@ -322,10 +338,10 @@ public: void setImageID(const LLUUID& image_asset_id, bool set_selection = true); 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); + const LLUUID& findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false); + void setCanApplyImmediately(bool b); - void setActive(BOOL active); + void setActive(bool active); LLView* getOwner() const { return mOwner; } void setOwner(LLView* owner) { mOwner = owner; } @@ -354,7 +370,7 @@ public: //static void onBtnRevert( void* userdata ); static void onBtnBlank(void* userdata); static void onBtnNone(void* userdata); - void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); + void onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action); static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata); void onTextureSelect(const LLTextureEntry& te); @@ -366,8 +382,8 @@ public: static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); - void setLocalTextureEnabled(BOOL enabled); - void setBakeTextureEnabled(BOOL enabled); + void setLocalTextureEnabled(bool enabled); + void setBakeTextureEnabled(bool enabled); void setInventoryPickType(EPickInventoryType type); void setImmediateFilterPermMask(PermissionMask mask); @@ -382,14 +398,15 @@ protected: LLPointer<LLViewerTexture> mTexturep; LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial; + LLPointer<LLViewerTexture> mGLTFPreview; LLView* mOwner; LLUUID mImageAssetID; // Currently selected texture LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null. LLUUID mDefaultImageAssetID; LLUUID mBlankImageAssetID; - BOOL mTentative; - BOOL mAllowNoTexture; + bool mTentative; + bool mAllowNoTexture; LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory. LLUUID mOriginalImageAssetID; @@ -400,17 +417,17 @@ protected: LLTextBox* mResolutionWarning; std::string mPendingName; - BOOL mActive; + bool mActive; LLFilterEditor* mFilterEdit; LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; - BOOL mCanApplyImmediately; - BOOL mNoCopyTextureSelected; + bool mCanApplyImmediately; + bool mNoCopyTextureSelected; F32 mContextConeOpacity; LLSaveFolderState mSavedFolderState; - BOOL mSelectedItemPinned; + bool mSelectedItemPinned; LLComboBox* mModeSelector; LLScrollListCtrl* mLocalScrollCtrl; @@ -437,7 +454,7 @@ private: set_image_asset_id_callback mSetImageAssetIDCallback; set_on_update_image_stats_callback mOnUpdateImageStatsCallback; - BOOL mBakeTextureEnabled; + bool mBakeTextureEnabled; static S32 sLastPickerMode; }; |