mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
WIP corrections for drag-n-drop handling for cubemap and shape asset types
Added ability to override radio button behavior when selecting items in popup menus Added ability to turn on rotation snapping as a setting, with SHIFT just inverting the rot snap mode Implemented proper asset type filtering, complete with multiple type selection, and listing of active filters in AB footer. Selectable via visibility popup Menu Moved asset preview button generation from code to template GUI file added ability to move asset with drag-n-drop(Image asset only so far) New AB folder icon Properly link image asset fields to material asset if 'AlwaysPresentImageMaps' config setting is active
This commit is contained in:
parent
27ee09e491
commit
b2fcd5e7fb
23 changed files with 851 additions and 475 deletions
|
|
@ -200,10 +200,10 @@ GuiControl* GuiInspectorTypeCubemapAssetPtr::constructEditControl()
|
|||
// Change filespec
|
||||
char szBuffer[512];
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"CubemapAsset\", \"AssetBrowser.changeAsset\", %d, %s);",
|
||||
mInspector->getComponentGroupTargetId(), mCaption);
|
||||
mInspector->getInspectObject(), mCaption);
|
||||
mBrowseButton->setField("Command", szBuffer);
|
||||
|
||||
setDataField(StringTable->insert("ComponentOwner"), NULL, String::ToString(mInspector->getComponentGroupTargetId()).c_str());
|
||||
setDataField(StringTable->insert("object"), NULL, String::ToString(mInspector->getInspectObject()).c_str());
|
||||
|
||||
// Create "Open in ShapeEditor" button
|
||||
mShapeEdButton = new GuiBitmapButtonCtrl();
|
||||
|
|
|
|||
|
|
@ -367,10 +367,12 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
|
|||
// Change filespec
|
||||
char szBuffer[512];
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %d, %s);",
|
||||
mInspector->getComponentGroupTargetId(), mCaption);
|
||||
mInspector->getInspectObject()->getIdString(), mCaption);
|
||||
mBrowseButton->setField("Command", szBuffer);
|
||||
|
||||
setDataField(StringTable->insert("ComponentOwner"), NULL, String::ToString(mInspector->getComponentGroupTargetId()).c_str());
|
||||
const char* id = mInspector->getInspectObject()->getIdString();
|
||||
|
||||
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
|
||||
|
||||
// Create "Open in ShapeEditor" button
|
||||
mShapeEdButton = new GuiBitmapButtonCtrl();
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ PopupMenu::PopupMenu()
|
|||
mTextList = nullptr;
|
||||
|
||||
mIsSubmenu = false;
|
||||
|
||||
mRadioSelection = true;
|
||||
}
|
||||
|
||||
PopupMenu::~PopupMenu()
|
||||
|
|
@ -83,6 +85,7 @@ void PopupMenu::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
|
||||
addField("barTitle", TypeCaseString, Offset(mBarTitle, PopupMenu), "");
|
||||
addField("radioSelection", TypeBool, Offset(mRadioSelection, PopupMenu), "");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -225,7 +228,7 @@ void PopupMenu::checkItem(S32 pos, bool checked)
|
|||
if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0)
|
||||
return;
|
||||
|
||||
if (checked && mMenuItems[pos].mCheckGroup != -1)
|
||||
if (checked && mMenuItems[pos].mCheckGroup != -1 && mRadioSelection)
|
||||
{
|
||||
// first, uncheck everything in the group:
|
||||
for (U32 i = 0; i < mMenuItems.size(); i++)
|
||||
|
|
|
|||
|
|
@ -83,6 +83,9 @@ protected:
|
|||
|
||||
bool mIsSubmenu;
|
||||
|
||||
bool mRadioSelection; ///If true, we treat all the items in the same check group as a radio item, so we uncheck everything else in the group if an item is checked
|
||||
///If false, then we don't clear other selections
|
||||
|
||||
//This is the gui control that renders our popup
|
||||
GuiPopupMenuTextListCtrl *mTextList;
|
||||
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ GizmoProfile::GizmoProfile()
|
|||
rotationSnap = 15.0f;
|
||||
allowSnapScale = true;
|
||||
scaleSnap = 0.1f;
|
||||
forceSnapRotations = false;
|
||||
|
||||
rotateScalar = 0.8f;
|
||||
scaleScalar = 0.8f;
|
||||
|
|
@ -246,6 +247,7 @@ void GizmoProfile::initPersistFields()
|
|||
addField( "rotationSnap", TypeF32, Offset(rotationSnap, GizmoProfile) );
|
||||
addField( "allowSnapScale", TypeBool, Offset(allowSnapScale, GizmoProfile) );
|
||||
addField( "scaleSnap", TypeF32, Offset(scaleSnap, GizmoProfile) );
|
||||
addField( "forceSnapRotations", TypeBool, Offset(forceSnapRotations, GizmoProfile));
|
||||
addField( "renderWhenUsed", TypeBool, Offset(renderWhenUsed, GizmoProfile) );
|
||||
addField( "renderInfoText", TypeBool, Offset(renderInfoText, GizmoProfile) );
|
||||
addField( "renderPlane", TypeBool, Offset(renderPlane, GizmoProfile) );
|
||||
|
|
@ -1083,7 +1085,7 @@ void Gizmo::on3DMouseDragged( const Gui3DMouseEvent & event )
|
|||
angle *= 0.02f; // scale down to not require rotate scalar to be microscopic
|
||||
|
||||
//
|
||||
if( mProfile->allowSnapRotations && event.modifier & SI_SHIFT )
|
||||
if((mProfile->forceSnapRotations && event.modifier | SI_SHIFT) || (mProfile->allowSnapRotations && event.modifier & SI_SHIFT ))
|
||||
angle = mDegToRad( _snapFloat( mRadToDeg( angle ), mProfile->rotationSnap ) );
|
||||
|
||||
mDeltaAngle = angle - mLastAngle;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ public:
|
|||
bool allowSnapScale;
|
||||
F32 rotationSnap;
|
||||
bool allowSnapRotations;
|
||||
bool forceSnapRotations;
|
||||
|
||||
bool renderWhenUsed;
|
||||
bool renderInfoText;
|
||||
|
|
@ -415,4 +416,4 @@ protected:
|
|||
static F32 smProjectDistance;
|
||||
};
|
||||
|
||||
#endif // _GIZMO_H_
|
||||
#endif // _GIZMO_H_
|
||||
|
|
|
|||
|
|
@ -402,6 +402,12 @@ bool TSShapeConstructor::onAdd()
|
|||
if ( !Parent::onAdd() )
|
||||
return false;
|
||||
|
||||
static const U32 bufSize = 512;
|
||||
char* buf = Con::getReturnBuffer(bufSize);
|
||||
Platform::makeFullPathName(mShapePath, buf, bufSize, NULL);
|
||||
|
||||
mShapePath = buf;
|
||||
|
||||
// Prevent multiple objects pointing at the same shape file
|
||||
TSShapeConstructor* tss = findShapeConstructor( mShapePath );
|
||||
if ( tss )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue