Removes current implement of shadow caching

Also removes EC stuff as it's not ready for prime-time yet
This commit is contained in:
Areloch 2019-12-13 01:14:03 -06:00
parent f007700646
commit 66cc6fb9d1
141 changed files with 67 additions and 19491 deletions

View file

@ -36,7 +36,6 @@
#include "gui/editor/editorFunctions.h"
#endif
#include "console/engineAPI.h"
#include "T3D/entity.h"
IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
@ -3479,22 +3478,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) )
onVirtualParentExpand(item);
//Slightly hacky, but I'm not sure of a better setup until we get major update to the editors
//We check if our object is an entity, and if it is, we call a 'onInspect' function.
//This function is pretty much a special notifier to the entity so if it has any behaviors that do special
//stuff in the editor, it can fire that up
if (item->isInspectorData())
{
Entity* e = dynamic_cast<Entity*>(item->getObject());
if (e)
{
if (item->isExpanded())
e->onInspect();
else
e->onEndInspect();
}
}
mFlags.set( RebuildVisible );
scrollVisible(item);
}
@ -4309,11 +4292,6 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate)
// Go through our items and purge those that have disappeared from
// the set.
//Entities will be a special case here, if we're an entity, skip this step
if (dynamic_cast<Entity*>(srcObj))
return true;
for( Item* ptr = item->mChild; ptr != NULL; )
{
Item* next = ptr->mNext;

View file

@ -29,11 +29,6 @@
#include "gui/containers/guiScrollCtrl.h"
#include "gui/editor/inspector/customField.h"
#include "gui/editor/inspector/entityGroup.h"
#include "gui/editor/inspector/mountingGroup.h"
#include "gui/editor/inspector/componentGroup.h"
#include "T3D/components/component.h"
IMPLEMENT_CONOBJECT(GuiInspector);
ConsoleDocClass( GuiInspector,
@ -591,60 +586,6 @@ void GuiInspector::refresh()
mTargets.first()->onInspect(this);
//Entity inspector group
if (mTargets.first()->getClassRep()->isSubclassOf("Entity"))
{
//Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes
GuiInspectorGroup *gameObject = new GuiInspectorGroup("GameObject", this);
gameObject->registerObject();
mGroups.push_back(gameObject);
addObject(gameObject);
GuiInspectorEntityGroup *components = new GuiInspectorEntityGroup("Components", this);
if (components != NULL)
{
components->registerObject();
mGroups.push_back(components);
addObject(components);
}
Entity* selectedEntity = dynamic_cast<Entity*>(mTargets.first().getObject());
U32 compCount = selectedEntity->getComponentCount();
//Now, add the component groups
for (U32 c = 0; c < compCount; ++c)
{
Component* comp = selectedEntity->getComponent(c);
String compName;
if (comp->getFriendlyName() != StringTable->EmptyString())
compName = comp->getFriendlyName();
else
compName = comp->getComponentName();
StringBuilder captionString;
captionString.format("%s [%i]", compName.c_str(), comp->getId());
GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(captionString.data(), this, comp);
if (compGroup != NULL)
{
compGroup->registerObject();
mGroups.push_back(compGroup);
addObject(compGroup);
}
}
//Mounting group override
GuiInspectorGroup *mounting = new GuiInspectorMountingGroup("Mounting", this);
if (mounting != NULL)
{
mounting->registerObject();
mGroups.push_back(mounting);
addObject(mounting);
}
}
// Create the inspector groups for static fields.
for( TargetVector::iterator iter = mTargets.begin(); iter != mTargets.end(); ++ iter )

View file

@ -1,531 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "gui/buttons/guiIconButtonCtrl.h"
#include "gui/editor/guiInspector.h"
#include "gui/editor/inspector/componentGroup.h"
#include "core/strings/stringUnit.h"
#include "T3D/components/component.h"
#include "gui/editor/inspector/field.h"
#include "console/engineAPI.h"
IMPLEMENT_CONOBJECT(GuiInspectorComponentGroup);
ConsoleDocClass(GuiInspectorComponentGroup,
"@brief Used to inspect an object's FieldDictionary (dynamic fields) instead "
"of regular persistent fields.\n\n"
"Editor use only.\n\n"
"@internal"
);
GuiInspectorComponentGroup::GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr<GuiInspector> parent, Component* targetComponent)
: GuiInspectorGroup(groupName, parent)
{
/*mNeedScroll=false;*/
mTargetComponent = targetComponent;
};
bool GuiInspectorComponentGroup::onAdd()
{
if (!Parent::onAdd())
return false;
return true;
}
//-----------------------------------------------------------------------------
// GuiInspectorComponentGroup - add custom controls
//-----------------------------------------------------------------------------
bool GuiInspectorComponentGroup::createContent()
{
if(!Parent::createContent())
return false;
Con::evaluatef("%d.stack = %d;", this->getId(), mStack->getId());
Con::executef(this, "createContent");
return true;
}
//-----------------------------------------------------------------------------
// GuiInspectorComponentGroup - inspectGroup override
//-----------------------------------------------------------------------------
bool GuiInspectorComponentGroup::inspectGroup()
{
// We can't inspect a group without a target!
if (!mParent || !mParent->getNumInspectObjects())
return false;
clearFields();
// to prevent crazy resizing, we'll just freeze our stack for a sec..
mStack->freeze(true);
bool bNoGroup = false;
bool bNewItems = false;
bool bMakingArray = false;
GuiStackControl *pArrayStack = NULL;
GuiRolloutCtrl *pArrayRollout = NULL;
bool bGrabItems = false;
//if this isn't a component, what are we even doing here?
if (!mTargetComponent)
return false;
mParent->setComponentGroupTargetId(mTargetComponent->getId());
//first, relevent static fields
AbstractClassRep::FieldList& fieldList = mTargetComponent->getClassRep()->mFieldList;
for (AbstractClassRep::FieldList::iterator itr = fieldList.begin();
itr != fieldList.end(); ++itr)
{
AbstractClassRep::Field* field = &(*itr);
if (field->type == AbstractClassRep::StartGroupFieldType)
{
// If we're dealing with general fields, always set grabItems to true (to skip them)
if (bNoGroup == true)
bGrabItems = true;
else if (dStricmp(field->pGroupname, mCaption) == 0)
bGrabItems = true;
continue;
}
else if (field->type == AbstractClassRep::EndGroupFieldType)
{
// If we're dealing with general fields, always set grabItems to false (to grab them)
if (bNoGroup == true)
bGrabItems = false;
else if (dStricmp(field->pGroupname, mCaption) == 0)
bGrabItems = false;
continue;
}
// Skip field if it has the HideInInspectors flag set.
if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors))
continue;
if (field->pFieldname == StringTable->insert("locked") || field->pFieldname == StringTable->insert("class")
|| field->pFieldname == StringTable->insert("internalName"))
continue;
if (/*(bGrabItems == true || (bNoGroup == true && bGrabItems == false)) &&*/ itr->type != AbstractClassRep::DeprecatedFieldType)
{
if (bNoGroup == true && bGrabItems == true)
continue;
if (field->type == AbstractClassRep::StartArrayFieldType)
{
#ifdef DEBUG_SPEW
Platform::outputDebugString("[GuiInspectorGroup] Beginning array '%s'",
field->pFieldname);
#endif
// Starting an array...
// Create a rollout for the Array, give it the array's name.
GuiRolloutCtrl *arrayRollout = new GuiRolloutCtrl();
GuiControlProfile *arrayRolloutProfile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiInspectorRolloutProfile0"));
arrayRollout->setControlProfile(arrayRolloutProfile);
//arrayRollout->mCaption = StringTable->insert( String::ToString( "%s (%i)", field->pGroupname, field->elementCount ) );
arrayRollout->setCaption(field->pGroupname);
//arrayRollout->setMargin( 14, 0, 0, 0 );
arrayRollout->registerObject();
GuiStackControl *arrayStack = new GuiStackControl();
arrayStack->registerObject();
arrayStack->freeze(true);
arrayRollout->addObject(arrayStack);
// Allocate a rollout for each element-count in the array
// Give it the element count name.
for (U32 i = 0; i < field->elementCount; i++)
{
GuiRolloutCtrl *elementRollout = new GuiRolloutCtrl();
GuiControlProfile *elementRolloutProfile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiInspectorRolloutProfile0"));
char buf[256];
dSprintf(buf, 256, " [%i]", i);
elementRollout->setControlProfile(elementRolloutProfile);
elementRollout->setCaption(buf);
//elementRollout->setMargin( 14, 0, 0, 0 );
elementRollout->registerObject();
GuiStackControl *elementStack = new GuiStackControl();
elementStack->registerObject();
elementRollout->addObject(elementStack);
elementRollout->instantCollapse();
arrayStack->addObject(elementRollout);
}
pArrayRollout = arrayRollout;
pArrayStack = arrayStack;
arrayStack->freeze(false);
pArrayRollout->instantCollapse();
mStack->addObject(arrayRollout);
bMakingArray = true;
continue;
}
else if (field->type == AbstractClassRep::EndArrayFieldType)
{
#ifdef DEBUG_SPEW
Platform::outputDebugString("[GuiInspectorGroup] Ending array '%s'",
field->pFieldname);
#endif
bMakingArray = false;
continue;
}
if (bMakingArray)
{
// Add a GuiInspectorField for this field,
// for every element in the array...
for (U32 i = 0; i < pArrayStack->size(); i++)
{
FrameTemp<char> intToStr(64);
dSprintf(intToStr, 64, "%d", i);
// The array stack should have a rollout for each element
// as children...
GuiRolloutCtrl *pRollout = dynamic_cast<GuiRolloutCtrl*>(pArrayStack->at(i));
// And the each of those rollouts should have a stack for
// fields...
GuiStackControl *pStack = dynamic_cast<GuiStackControl*>(pRollout->at(0));
// And we add a new GuiInspectorField to each of those stacks...
GuiInspectorField *fieldGui = constructField(field->type);
if (fieldGui == NULL)
fieldGui = new GuiInspectorField();
fieldGui->init(mParent, this);
StringTableEntry caption = field->pFieldname;
fieldGui->setInspectorField(field, caption, intToStr);
if (fieldGui->registerObject())
{
#ifdef DEBUG_SPEW
Platform::outputDebugString("[GuiInspectorGroup] Adding array element '%s[%i]'",
field->pFieldname, i);
#endif
mChildren.push_back(fieldGui);
pStack->addObject(fieldGui);
}
else
delete fieldGui;
}
continue;
}
// This is weird, but it should work for now. - JDD
// We are going to check to see if this item is an array
// if so, we're going to construct a field for each array element
if (field->elementCount > 1)
{
// Make a rollout control for this array
//
GuiRolloutCtrl *rollout = new GuiRolloutCtrl();
rollout->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorRolloutProfile0");
rollout->setCaption(String::ToString("%s (%i)", field->pFieldname, field->elementCount));
rollout->setMargin(14, 0, 0, 0);
rollout->registerObject();
mArrayCtrls.push_back(rollout);
// Put a stack control within the rollout
//
GuiStackControl *stack = new GuiStackControl();
stack->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorStackProfile");
stack->registerObject();
stack->freeze(true);
rollout->addObject(stack);
mStack->addObject(rollout);
// Create each field and add it to the stack.
//
for (S32 nI = 0; nI < field->elementCount; nI++)
{
FrameTemp<char> intToStr(64);
dSprintf(intToStr, 64, "%d", nI);
// Construct proper ValueName[nI] format which is "ValueName0" for index 0, etc.
String fieldName = String::ToString("%s%d", field->pFieldname, nI);
// If the field already exists, just update it
GuiInspectorField *fieldGui = findField(fieldName);
if (fieldGui != NULL)
{
fieldGui->updateValue();
continue;
}
bNewItems = true;
fieldGui = constructField(field->type);
if (fieldGui == NULL)
fieldGui = new GuiInspectorField();
fieldGui->init(mParent, this);
StringTableEntry caption = StringTable->insert(String::ToString(" [%i]", nI));
fieldGui->setInspectorField(field, caption, intToStr);
fieldGui->setTargetObject(mTargetComponent);
if (fieldGui->registerObject())
{
mChildren.push_back(fieldGui);
stack->addObject(fieldGui);
}
else
delete fieldGui;
}
stack->freeze(false);
stack->updatePanes();
rollout->instantCollapse();
}
else
{
// If the field already exists, just update it
GuiInspectorField *fieldGui = findField(field->pFieldname);
if (fieldGui != NULL)
{
fieldGui->updateValue();
continue;
}
bNewItems = true;
fieldGui = constructField(field->type);
if (fieldGui == NULL)
fieldGui = new GuiInspectorField();
fieldGui->init(mParent, this);
fieldGui->setInspectorField(field);
fieldGui->setTargetObject(mTargetComponent);
if (fieldGui->registerObject())
{
#ifdef DEBUG_SPEW
Platform::outputDebugString("[GuiInspectorGroup] Adding field '%s'",
field->pFieldname);
#endif
fieldGui->setValue(mTargetComponent->getDataField(field->pFieldname, NULL));
mChildren.push_back(fieldGui);
mStack->addObject(fieldGui);
}
else
{
SAFE_DELETE(fieldGui);
}
}
}
}
for (U32 i = 0; i < mTargetComponent->getComponentFieldCount(); i++)
{
ComponentField* field = mTargetComponent->getComponentField(i);
//first and foremost, nab the field type and check if it's a custom field or not.
//If it's not a custom field, proceed below, if it is, hand it off to script to be handled by the component
if (field->mFieldType == -1)
{
Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName);
continue;
}
bNewItems = true;
GuiInspectorField *fieldGui = constructField(field->mFieldType);
if (fieldGui == NULL)
fieldGui = new GuiInspectorField();
fieldGui->init(mParent, this);
fieldGui->setTargetObject(mTargetComponent);
AbstractClassRep::Field *refField = NULL;
//check dynamics
SimFieldDictionary* fieldDictionary = mTargetComponent->getFieldDictionary();
SimFieldDictionaryIterator itr(fieldDictionary);
while (*itr)
{
SimFieldDictionary::Entry* entry = *itr;
if (entry->slotName == field->mFieldName)
{
AbstractClassRep::Field f;
f.pFieldname = StringTable->insert(field->mFieldName);
if (field->mFieldDescription)
f.pFieldDocs = field->mFieldDescription;
f.type = field->mFieldType;
f.offset = -1;
f.elementCount = 1;
f.validator = NULL;
f.flag = 0; //change to be the component type
f.setDataFn = &defaultProtectedSetFn;
f.getDataFn = &defaultProtectedGetFn;
f.writeDataFn = &defaultProtectedWriteFn;
f.pFieldDocs = field->mFieldDescription;
f.pGroupname = "Component Fields";
ConsoleBaseType* conType = ConsoleBaseType::getType(field->mFieldType);
AssertFatal(conType, "ConsoleObject::addField - invalid console type");
f.table = conType->getEnumTable();
tempFields.push_back(f);
refField = &f;
break;
}
++itr;
}
if (!refField)
continue;
fieldGui->setInspectorField(&tempFields[tempFields.size() - 1]);
if (fieldGui->registerObject())
{
#ifdef DEBUG_SPEW
Platform::outputDebugString("[GuiInspectorGroup] Adding field '%s'",
field->pFieldname);
#endif
mChildren.push_back(fieldGui);
mStack->addObject(fieldGui);
}
else
{
SAFE_DELETE(fieldGui);
}
}
mStack->freeze(false);
mStack->updatePanes();
// If we've no new items, there's no need to resize anything!
if (bNewItems == false && !mChildren.empty())
return true;
sizeToContents();
setUpdate();
return true;
}
void GuiInspectorComponentGroup::updateAllFields()
{
// We overload this to just reinspect the group.
inspectGroup();
}
void GuiInspectorComponentGroup::onMouseMove(const GuiEvent &event)
{
//mParent->mOverDivider = false;
}
void GuiInspectorComponentGroup::onRightMouseUp(const GuiEvent &event)
{
//mParent->mOverDivider = false;
if (isMethod("onRightMouseUp"))
Con::executef(this, "onRightMouseUp", event.mousePoint);
}
DefineEngineMethod(GuiInspectorComponentGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.")
{
return object->inspectGroup();
}
void GuiInspectorComponentGroup::clearFields()
{
// delete everything else
mStack->clear();
// clear the mChildren list.
mChildren.clear();
}
SimFieldDictionary::Entry* GuiInspectorComponentGroup::findDynamicFieldInDictionary(StringTableEntry fieldName)
{
SimFieldDictionary * fieldDictionary = mParent->getInspectObject()->getFieldDictionary();
for (SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
{
SimFieldDictionary::Entry * entry = (*ditr);
if (entry->slotName == fieldName)
return entry;
}
return NULL;
}
void GuiInspectorComponentGroup::addDynamicField()
{
}
AbstractClassRep::Field* GuiInspectorComponentGroup::findObjectBehaviorField(Component* target, String fieldName)
{
AbstractClassRep::FieldList& fieldList = target->getClassRep()->mFieldList;
for (AbstractClassRep::FieldList::iterator itr = fieldList.begin();
itr != fieldList.end(); ++itr)
{
AbstractClassRep::Field* field = &(*itr);
String fldNm(field->pFieldname);
if (fldNm == fieldName)
return field;
}
return NULL;
}
DefineEngineMethod(GuiInspectorComponentGroup, addDynamicField, void, (), , "obj.addDynamicField();")
{
object->addDynamicField();
}
DefineEngineMethod(GuiInspectorComponentGroup, removeDynamicField, void, (), , "")
{
}
DefineEngineMethod(GuiInspectorComponentGroup, getComponent, S32, (), , "")
{
return object->getComponent()->getId();
}

View file

@ -1,76 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef GUI_INSPECTOR_COMPONENT_GROUP_H
#define GUI_INSPECTOR_COMPONENT_GROUP_H
#include "gui/editor/inspector/group.h"
#include "console/simFieldDictionary.h"
#include "T3D/components/component.h"
#include "gui/controls/guiPopUpCtrlEx.h"
class GuiInspectorComponentGroup : public GuiInspectorGroup
{
private:
typedef GuiInspectorGroup Parent;
GuiControl* mAddCtrl;
Component* mTargetComponent;
Vector<AbstractClassRep::Field> tempFields;
public:
DECLARE_CONOBJECT(GuiInspectorComponentGroup);
GuiInspectorComponentGroup() { /*mNeedScroll=false;*/ };
GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr<GuiInspector> parent, Component* targetComponent);
//-----------------------------------------------------------------------------
// inspectGroup is overridden in GuiInspectorComponentGroup to inspect an
// objects FieldDictionary (dynamic fields) instead of regular persistent
// fields.
virtual bool onAdd();
bool inspectGroup();
virtual void updateAllFields();
void onMouseMove(const GuiEvent &event);
virtual void onRightMouseUp(const GuiEvent &event);
// For scriptable dynamic field additions
void addDynamicField();
// Clear our fields (delete them)
void clearFields();
// Find an already existent field by name in the dictionary
virtual SimFieldDictionary::Entry* findDynamicFieldInDictionary(StringTableEntry fieldName);
AbstractClassRep::Field* findObjectBehaviorField(Component* target, String fieldName);
Component* getComponent() { return mTargetComponent; }
protected:
// create our inner controls when we add
virtual bool createContent();
};
#endif

View file

@ -26,8 +26,6 @@
#include "gui/editor/inspector/dynamicField.h"
#include "console/engineAPI.h"
#include "T3D/components/component.h"
IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup);
ConsoleDocClass( GuiInspectorDynamicGroup,
@ -124,15 +122,6 @@ bool GuiInspectorDynamicGroup::inspectGroup()
SimFieldDictionary * fieldDictionary = target->getFieldDictionary();
for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
{
if (target->getClassRep()->isSubclassOf("Component"))
{
Component* compTarget = dynamic_cast<Component*>(target);
ComponentField* compField = compTarget->getComponentField((*ditr)->slotName);
if (compField)
continue;
}
if( i == 0 )
{
flist.increment();

View file

@ -1,140 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "gui/buttons/guiIconButtonCtrl.h"
#include "gui/editor/guiInspector.h"
#include "gui/editor/inspector/entityGroup.h"
#include "core/strings/stringUnit.h"
#include "T3D/components/component.h"
#include "console/engineAPI.h"
IMPLEMENT_CONOBJECT(GuiInspectorEntityGroup);
ConsoleDocClass(GuiInspectorEntityGroup,
"@brief Used to inspect an object's FieldDictionary (dynamic fields) instead "
"of regular persistent fields.\n\n"
"Editor use only.\n\n"
"@internal"
);
bool GuiInspectorEntityGroup::onAdd()
{
if (!Parent::onAdd())
return false;
return true;
}
//-----------------------------------------------------------------------------
// GuiInspectorEntityGroup - add custom controls
//-----------------------------------------------------------------------------
bool GuiInspectorEntityGroup::createContent()
{
if(!Parent::createContent())
return false;
Con::evaluatef("%d.stack = %d;", this->getId(), mStack->getId());
Con::executef(this, "createContent");
return true;
}
//-----------------------------------------------------------------------------
// GuiInspectorEntityGroup - inspectGroup override
//-----------------------------------------------------------------------------
bool GuiInspectorEntityGroup::inspectGroup()
{
const U32 numTargets = mParent->getNumInspectObjects();
if (numTargets == 1)
{
Entity* target = dynamic_cast<Entity*>(mParent->getInspectObject(0));
if(target)
Con::executef(this, "inspectObject", target->getIdString());
}
return true;
}
void GuiInspectorEntityGroup::updateAllFields()
{
// We overload this to just reinspect the group.
inspectGroup();
}
void GuiInspectorEntityGroup::onMouseMove(const GuiEvent &event)
{
//mParent->mOverDivider = false;
}
DefineEngineMethod(GuiInspectorEntityGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.")
{
return object->inspectGroup();
}
void GuiInspectorEntityGroup::clearFields()
{
}
SimFieldDictionary::Entry* GuiInspectorEntityGroup::findDynamicFieldInDictionary(StringTableEntry fieldName)
{
SimFieldDictionary * fieldDictionary = mParent->getInspectObject()->getFieldDictionary();
for (SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
{
SimFieldDictionary::Entry * entry = (*ditr);
if (entry->slotName == fieldName)
return entry;
}
return NULL;
}
void GuiInspectorEntityGroup::addDynamicField()
{
}
AbstractClassRep::Field* GuiInspectorEntityGroup::findObjectBehaviorField(Component* target, String fieldName)
{
AbstractClassRep::FieldList& fieldList = target->getClassRep()->mFieldList;
for (AbstractClassRep::FieldList::iterator itr = fieldList.begin();
itr != fieldList.end(); ++itr)
{
AbstractClassRep::Field* field = &(*itr);
String fldNm(field->pFieldname);
if (fldNm == fieldName)
return field;
}
return NULL;
}
DefineEngineMethod(GuiInspectorEntityGroup, addDynamicField, void, (), , "obj.addDynamicField();")
{
object->addDynamicField();
}
DefineEngineMethod(GuiInspectorEntityGroup, removeDynamicField, void, (), , "")
{
}

View file

@ -1,72 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef GUI_INSPECTOR_ENTITY_GROUP_H
#define GUI_INSPECTOR_ENTITY_GROUP_H
#include "gui/editor/inspector/group.h"
#include "console/simFieldDictionary.h"
#include "T3D/components/component.h"
#include "gui/controls/guiPopUpCtrlEx.h"
class GuiInspectorEntityGroup : public GuiInspectorGroup
{
private:
typedef GuiInspectorGroup Parent;
GuiControl* mAddCtrl;
GuiPopUpMenuCtrlEx* mAddBhvrList;
public:
DECLARE_CONOBJECT(GuiInspectorEntityGroup);
GuiInspectorEntityGroup() { /*mNeedScroll=false;*/ };
GuiInspectorEntityGroup(StringTableEntry groupName, SimObjectPtr<GuiInspector> parent)
: GuiInspectorGroup(groupName, parent) { /*mNeedScroll=false;*/
};
//-----------------------------------------------------------------------------
// inspectGroup is overridden in GuiInspectorEntityGroup to inspect an
// objects FieldDictionary (dynamic fields) instead of regular persistent
// fields.
virtual bool onAdd();
bool inspectGroup();
virtual void updateAllFields();
void onMouseMove(const GuiEvent &event);
// For scriptable dynamic field additions
void addDynamicField();
// Clear our fields (delete them)
void clearFields();
// Find an already existent field by name in the dictionary
virtual SimFieldDictionary::Entry* findDynamicFieldInDictionary(StringTableEntry fieldName);
AbstractClassRep::Field* findObjectBehaviorField(Component* target, String fieldName);
protected:
// create our inner controls when we add
virtual bool createContent();
};
#endif

View file

@ -1,505 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "gui/buttons/guiIconButtonCtrl.h"
#include "gui/editor/guiInspector.h"
#include "gui/editor/inspector/mountingGroup.h"
#include "core/strings/stringUnit.h"
#include "T3D/entity.h"
#include "T3D/components/component.h"
//Need this to get node lists
#include "T3D/components/render/renderComponentInterface.h"
IMPLEMENT_CONOBJECT(GuiInspectorMountingGroup);
ConsoleDocClass( GuiInspectorMountingGroup,
"@brief Used to inspect an object's FieldDictionary (dynamic fields) instead "
"of regular persistent fields.\n\n"
"Editor use only.\n\n"
"@internal"
);
//-----------------------------------------------------------------------------
// GuiInspectorMountingGroup - add custom controls
//-----------------------------------------------------------------------------
GuiInspectorMountingGroup::GuiInspectorMountingGroup( StringTableEntry groupName, SimObjectPtr<GuiInspector> parent )
: GuiInspectorGroup( groupName, parent)
{
mParentInspector = parent;
targetMountCtrl = NULL;
mountCtrl = NULL;
};
bool GuiInspectorMountingGroup::createContent()
{
if(!Parent::createContent())
return false;
//give the necessary padding for the nested controls so it looks nice.
setMargin(RectI(4,0,4,4));
return true;
}
GuiControl* GuiInspectorMountingGroup::buildMenuCtrl()
{
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" );
//GuiInspectorTypeMenuBase::_registerEditControl( retCtrl );
char szName[512];
dSprintf( szName, 512, "IE_%s_%d_%s_Field", retCtrl->getClassName(), mParentInspector->getInspectObject()->getId(), mCaption.c_str());
// Register the object
retCtrl->registerObject( szName );
// Configure it to update our value when the popup is closed
char szBuffer[512];
dSprintf( szBuffer, 512, "%d.apply( %d.getText() );", getId(), menu->getId() );
menu->setField("Command", szBuffer );
return menu;
}
bool GuiInspectorMountingGroup::buildList(Entity* ent, GuiPopUpMenuCtrl* menu)
{
RenderComponentInterface* renderInterface = ent->getComponent<RenderComponentInterface>();
if (renderInterface)
{
TSShape* shape = renderInterface->getShape();
S32 nodeCount = shape ? shape->nodes.size() : 0;
for(U32 i=0; i < nodeCount; i++)
{
menu->addEntry(shape->names[i], i);
}
return true;
}
return false;
}
//-----------------------------------------------------------------------------
// GuiInspectorMountingGroup - inspectGroup override
//-----------------------------------------------------------------------------
bool GuiInspectorMountingGroup::inspectGroup()
{
// We can't inspect a group without a target!
if( !mParent->getNumInspectObjects() )
return false;
// to prevent crazy resizing, we'll just freeze our stack for a sec..
mStack->freeze(true);
bool bNoGroup = false;
// Un-grouped fields are all sorted into the 'general' group
if ( dStricmp( mCaption, "General" ) == 0 )
bNoGroup = true;
// Just delete all fields and recreate them (like the dynamicGroup)
// because that makes creating controls for array fields a lot easier
clearFields();
bool bNewItems = false;
bool bGrabItems = false;
AbstractClassRep* commonAncestorClass = findCommonAncestorClass();
AbstractClassRep::FieldList& fieldList = commonAncestorClass->mFieldList;
for( AbstractClassRep::FieldList::iterator itr = fieldList.begin();
itr != fieldList.end(); ++ itr )
{
AbstractClassRep::Field* field = &( *itr );
if( field->type == AbstractClassRep::StartGroupFieldType )
{
// If we're dealing with general fields, always set grabItems to true (to skip them)
if( bNoGroup == true )
bGrabItems = true;
else if( dStricmp( field->pGroupname, mCaption ) == 0 )
bGrabItems = true;
continue;
}
else if ( field->type == AbstractClassRep::EndGroupFieldType )
{
// If we're dealing with general fields, always set grabItems to false (to grab them)
if( bNoGroup == true )
bGrabItems = false;
else if( dStricmp( field->pGroupname, mCaption ) == 0 )
bGrabItems = false;
continue;
}
// Skip field if it has the HideInInspectors flag set.
if( field->flag.test( AbstractClassRep::FIELD_HideInInspectors ) )
continue;
if( ( bGrabItems == true || ( bNoGroup == true && bGrabItems == false ) ) && itr->type != AbstractClassRep::DeprecatedFieldType )
{
if( bNoGroup == true && bGrabItems == true )
continue;
// If the field already exists, just update it
GuiInspectorField *fieldGui = findField( field->pFieldname );
if ( fieldGui != NULL )
{
fieldGui->updateValue();
continue;
}
bNewItems = true;
if(field->pFieldname == StringTable->insert("mountNode"))
{
fieldGui = new GuiInspectorNodeListField();
Entity* e = dynamic_cast<Entity*>(mParent->getInspectObject(0));
if(e)
(dynamic_cast<GuiInspectorNodeListField*>(fieldGui))->setTargetEntity(e);
}
else
{
fieldGui = constructField( field->type );
if ( fieldGui == NULL )
fieldGui = new GuiInspectorField();
}
fieldGui->init( mParent, this );
fieldGui->setInspectorField( field );
if( fieldGui->registerObject() )
{
#ifdef DEBUG_SPEW
Platform::outputDebugString( "[GuiInspectorGroup] Adding field '%s'",
field->pFieldname );
#endif
mChildren.push_back( fieldGui );
mStack->addObject( fieldGui );
}
else
{
SAFE_DELETE( fieldGui );
}
}
}
mStack->freeze(false);
mStack->updatePanes();
// If we've no new items, there's no need to resize anything!
if( bNewItems == false && !mChildren.empty() )
return true;
sizeToContents();
setUpdate();
return true;
}
void GuiInspectorMountingGroup::updateAllFields()
{
// We overload this to just reinspect the group.
inspectGroup();
}
void GuiInspectorMountingGroup::onMouseMove(const GuiEvent &event)
{
//mParent->mOverDivider = false;
}
DefineEngineMethod(GuiInspectorMountingGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.")
{
return object->inspectGroup();
}
void GuiInspectorMountingGroup::clearFields()
{
}
bool GuiInspectorMountingGroup::resize( const Point2I &newPosition, const Point2I &newExtent )
{
if ( !Parent::resize( newPosition, newExtent ) )
return false;
//check if we're set up yet
if(!targetMountCtrl || !mountCtrl)
//no? bail
return false;
targetMountCtrl->setExtent(newExtent.x, 18);
mountCtrl->setExtent(newExtent.x, 18);
S32 dividerPos, dividerMargin;
mParentInspector->getDivider( dividerPos, dividerMargin );
Point2I fieldExtent = Point2I(newExtent.x, 18);
Point2I fieldPos = Point2I(newExtent.x, 18);
S32 editWidth = dividerPos - dividerMargin;
targetMountText->setPosition(0,0);
targetMountText->setExtent(fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y);
targetMountNode->setPosition(fieldExtent.x - dividerPos + dividerMargin, 1);
targetMountNode->setExtent(editWidth, fieldExtent.y - 1);
mountText->setPosition(0,0);
mountText->setExtent(fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y);
mountNode->setPosition(fieldExtent.x - dividerPos + dividerMargin, 1);
mountNode->setExtent(editWidth, fieldExtent.y - 1);
return true;
}
SimFieldDictionary::Entry* GuiInspectorMountingGroup::findDynamicFieldInDictionary( StringTableEntry fieldName )
{
SimFieldDictionary * fieldDictionary = mParent->getInspectObject()->getFieldDictionary();
for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr)
{
SimFieldDictionary::Entry * entry = (*ditr);
if( entry->slotName == fieldName )
return entry;
}
return NULL;
}
void GuiInspectorMountingGroup::addDynamicField()
{
}
AbstractClassRep::Field* GuiInspectorMountingGroup::findObjectComponentField(Component* target, String fieldName)
{
AbstractClassRep::FieldList& fieldList = target->getClassRep()->mFieldList;
for( AbstractClassRep::FieldList::iterator itr = fieldList.begin();
itr != fieldList.end(); ++ itr )
{
AbstractClassRep::Field* field = &( *itr );
String fldNm(field->pFieldname);
if(fldNm == fieldName)
return field;
}
return NULL;
}
DefineEngineMethod(GuiInspectorMountingGroup, addDynamicField, void, (), , "obj.addDynamicField();")
{
object->addDynamicField();
}
DefineEngineMethod(GuiInspectorMountingGroup, removeDynamicField, void, (), , "")
{
}
//
IMPLEMENT_CONOBJECT( GuiInspectorNodeListField );
ConsoleDocClass( GuiInspectorNodeListField,
"@brief A control that allows to edit the custom properties (text) of one or more SimObjects.\n\n"
"Editor use only.\n\n"
"@internal"
);
GuiInspectorNodeListField::GuiInspectorNodeListField( GuiInspector *inspector,
GuiInspectorGroup* parent,
SimFieldDictionary::Entry* field,
SimObjectPtr<Entity> target )
{
mInspector = inspector;
mParent = parent;
setBounds(0,0,100,20);
mTargetEntity = target;
}
GuiInspectorNodeListField::GuiInspectorNodeListField()
{
mInspector = NULL;
mParent = NULL;
}
void GuiInspectorNodeListField::setData( const char* data, bool callbacks )
{
mCustomValue = data;
//We aren't updating any mounting info if we're not mounted already
if(mTargetEntity.getObject())
{
Entity* target = dynamic_cast<Entity*>(mTargetEntity->getObjectMount());
if(target)
{
RenderComponentInterface* renderInterface = target->getComponent<RenderComponentInterface>();
if (renderInterface)
{
if (renderInterface->getShape())
{
S32 nodeIdx = renderInterface->getShape()->findNode(data);
target->mountObject(mTargetEntity, nodeIdx, MatrixF::Identity);
mTargetEntity->setMaskBits(Entity::MountedMask);
}
}
}
}
// Force our edit to update
updateValue();
}
const char* GuiInspectorNodeListField::getData( U32 inspectObjectIndex )
{
return mCustomValue;
}
void GuiInspectorNodeListField::updateValue()
{
mMenu->clear();
//mMenu->addEntry("Origin");
//if(mCustomValue.isEmpty())
if(mTargetEntity.getObject())
{
Entity* target = dynamic_cast<Entity*>(mTargetEntity->getObjectMount());
if(target)
{
mMenu->addEntry("Origin");
mMenu->setActive(true);
RenderComponentInterface* renderInterface = target->getComponent<RenderComponentInterface>();
if (renderInterface)
{
TSShape* shape = renderInterface->getShape();
S32 nodeCount = shape ? shape->nodes.size() : 0;
for(U32 i=0; i < nodeCount; i++)
{
mMenu->addEntry(shape->names[i], i);
}
S32 targetNode = mTargetEntity->getMountNode();
if(targetNode != -1)
{
String name = shape->names[targetNode];
mCustomValue = name;
}
else
{
mCustomValue = String("Origin");
}
setValue( mCustomValue );
return;
}
}
}
setValue("Not Mounted");
mMenu->setActive(false);
}
void GuiInspectorNodeListField::setDoc( const char* doc )
{
mDoc = StringTable->insert( doc, true );
}
void GuiInspectorNodeListField::setToolTip( StringTableEntry data )
{
static StringTableEntry sTooltipProfile = StringTable->insert( "tooltipProfile" );
static StringTableEntry sHoverTime = StringTable->insert( "hovertime" );
static StringTableEntry sTooltip = StringTable->insert( "tooltip" );
mEdit->setDataField( sTooltipProfile, NULL, "GuiToolTipProfile" );
mEdit->setDataField( sHoverTime, NULL, "1000" );
mEdit->setDataField( sTooltip, NULL, data );
}
bool GuiInspectorNodeListField::onAdd()
{
if( !Parent::onAdd() )
return false;
return true;
}
void GuiInspectorNodeListField::setInspectorField( AbstractClassRep::Field *field,
StringTableEntry caption,
const char*arrayIndex )
{
// Override the base just to be sure it doesn't get called.
// We don't use an AbstractClassRep::Field...
mField = field;
mCaption = field->pFieldname;
mDoc = field->pFieldDocs;
}
GuiControl* GuiInspectorNodeListField::constructEditControl()
{
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
mMenu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
static StringTableEntry sProfile = StringTable->insert( "profile" );
retCtrl->setDataField( sProfile, NULL, "ToolsGuiPopUpMenuEditProfile" );
// Register the object
retCtrl->registerObject();
char szBuffer[512];
dSprintf( szBuffer, 512, "%d.apply( %d.getText() );", getId(), mMenu->getId() );
mMenu->setField("Command", szBuffer );
return retCtrl;
}
void GuiInspectorNodeListField::setValue( const char* newValue )
{
GuiPopUpMenuCtrl *ctrl = dynamic_cast<GuiPopUpMenuCtrl*>( mEdit );
if( ctrl != NULL )
ctrl->setText( newValue );
}
void GuiInspectorNodeListField::_executeSelectedCallback()
{
}
void GuiInspectorNodeListField::setTargetEntity(SimObjectPtr<Entity> target)
{
mTargetEntity = target;
}

View file

@ -1,152 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#ifndef GUI_INSPECTOR_MOUNTINGGROUP_H
#define GUI_INSPECTOR_MOUNTINGGROUP_H
#include "gui/editor/inspector/group.h"
#include "console/simFieldDictionary.h"
#include "T3D/components/component.h"
#include "gui/controls/guiPopUpCtrlEx.h"
#ifndef _GUI_INSPECTOR_TYPES_H_
#include "gui/editor/guiInspectorTypes.h"
#endif
#ifndef _ENTITY_H_
#include "T3D/entity.h"
#endif
class GuiInspectorMountingGroup;
class GuiInspectorNodeListField : public GuiInspectorField
{
typedef GuiInspectorField Parent;
friend class GuiInspectorMountingGroup;
public:
GuiInspectorNodeListField( GuiInspector *inspector, GuiInspectorGroup* parent, SimFieldDictionary::Entry* field,
SimObjectPtr<Entity> target );
GuiInspectorNodeListField();
~GuiInspectorNodeListField() {};
DECLARE_CONOBJECT( GuiInspectorNodeListField );
virtual void setData( const char* data, bool callbacks = true );
virtual const char* getData( U32 inspectObjectIndex = 0 );
virtual void updateValue();
virtual StringTableEntry getFieldName() { return StringTable->EmptyString(); }
virtual void setDoc( const char* doc );
virtual void setToolTip( StringTableEntry data );
virtual bool onAdd();
virtual void setInspectorField( AbstractClassRep::Field *field,
StringTableEntry caption = NULL,
const char *arrayIndex = NULL );
virtual GuiControl* constructEditControl();
virtual void setValue( const char* newValue );
void setTargetEntity(SimObjectPtr<Entity> target);
protected:
virtual void _executeSelectedCallback();
protected:
String mCustomValue;
StringTableEntry mDoc;
GuiPopUpMenuCtrl *mMenu;
SimObjectPtr<Entity> mTargetEntity;
};
class GuiInspectorMountingGroup : public GuiInspectorGroup
{
private:
typedef GuiInspectorGroup Parent;
GuiControl* mAddCtrl;
GuiPopUpMenuCtrlEx* mAddBhvrList;
GuiTextCtrl *persistText;
GuiButtonCtrl *reloadFile;
GuiButtonCtrl *saveFile;
GuiButtonCtrl *overwriteFile;
GuiButtonCtrl *mBrowseButton;
GuiControl *filePath;
GuiControl *targetMountCtrl;
GuiTextCtrl *targetMountText;
GuiPopUpMenuCtrl *targetMountNode;
GuiControl *mountCtrl;
GuiTextCtrl *mountText;
GuiPopUpMenuCtrl *mountNode;
GuiInspectorNodeListField* mountNodeList;
GuiInspectorNodeListField* targetMountNodeList;
SimObjectPtr<GuiInspector> mParentInspector;
public:
DECLARE_CONOBJECT(GuiInspectorMountingGroup);
GuiInspectorMountingGroup() { /*mNeedScroll=false;*/ };
GuiInspectorMountingGroup( StringTableEntry groupName, SimObjectPtr<GuiInspector> parent );
//-----------------------------------------------------------------------------
// inspectGroup is overridden in GuiInspectorMountingGroup to inspect an
// objects FieldDictionary (dynamic fields) instead of regular persistent
// fields.
bool inspectGroup();
virtual void updateAllFields();
void onMouseMove(const GuiEvent &event);
// For scriptable dynamic field additions
void addDynamicField();
// Clear our fields (delete them)
void clearFields();
virtual bool resize( const Point2I &newPosition, const Point2I &newExtent );
// Find an already existent field by name in the dictionary
virtual SimFieldDictionary::Entry* findDynamicFieldInDictionary( StringTableEntry fieldName );
AbstractClassRep::Field* findObjectComponentField(Component* target, String fieldName);
protected:
// create our inner controls when we add
virtual bool createContent();
GuiControl* buildMenuCtrl();
bool buildList(Entity* ent, GuiPopUpMenuCtrl* menu);
};
#endif

View file

@ -23,7 +23,6 @@
#include "gui/worldEditor/worldEditorSelection.h"
#include "gui/worldEditor/worldEditor.h"
#include "scene/sceneObject.h"
#include "T3D/entity.h"
IMPLEMENT_CONOBJECT( WorldEditorSelection );
@ -410,34 +409,26 @@ void WorldEditorSelection::rotate(const EulerF & rot, const Point3F & center)
// single selections will rotate around own axis, multiple about world
if(size() == 1)
{
Entity* eO = dynamic_cast< Entity* >(at(0));
if (eO)
SceneObject* object = dynamic_cast<SceneObject*>(at(0));
if (object)
{
eO->setTransform(eO->getPosition(), eO->getRotation() + RotationF(rot));
}
else
{
SceneObject* object = dynamic_cast<SceneObject*>(at(0));
if (object)
{
MatrixF mat = object->getTransform();
MatrixF mat = object->getTransform();
Point3F pos;
mat.getColumn(3, &pos);
Point3F pos;
mat.getColumn(3, &pos);
// get offset in obj space
Point3F offset = pos - center;
MatrixF wMat = object->getWorldTransform();
wMat.mulV(offset);
// get offset in obj space
Point3F offset = pos - center;
MatrixF wMat = object->getWorldTransform();
wMat.mulV(offset);
//
MatrixF transform(EulerF(0, 0, 0), -offset);
transform.mul(MatrixF(rot));
transform.mul(MatrixF(EulerF(0, 0, 0), offset));
mat.mul(transform);
//
MatrixF transform(EulerF(0, 0, 0), -offset);
transform.mul(MatrixF(rot));
transform.mul(MatrixF(EulerF(0, 0, 0), offset));
mat.mul(transform);
object->setTransform(mat);
}
object->setTransform(mat);
}
}
else