Commit a62e1b21 authored by Dirk Wilden's avatar Dirk Wilden

updated for skinning

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10743 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e04318f5
#include "AddAnimationDialog.hh"
#include <QtGui>
AddAnimationDialog::AddAnimationDialog(QWidget *parent) : QDialog(parent)
{
setupUi(this);
}
#include <ui_addAnimation.hh>
#include <QtGui>
class AddAnimationDialog : public QDialog, public Ui::AddAnimation
{
Q_OBJECT
public:
AddAnimationDialog(QWidget *parent = 0);
};
include (plugin)
openflipper_plugin ()
openflipper_plugin (INSTALLDATA Icons)
This diff is collapsed.
......@@ -52,7 +52,6 @@
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include "AnimationToolbox.hh"
#include "ObjectTypes/Skeleton/SkeletonObjectDataT.hh"
#include "ObjectTypes/Skeleton/Skeleton.hh"
#include "ObjectTypes/Skeleton/PoseT.hh"
#include "ObjectTypes/Skeleton/BaseSkin.hh"
......@@ -109,7 +108,8 @@ public slots:
//@{
int getNumberOfFrames();
bool attachSkin(int skeletonId, int skinId);
bool detachSkin(int skeletonId);
bool detachSkin(int skeletonId, int skinId);
bool clearSkins(int skeletonId);
void setFrame(int _iFrame);
int getFrame();
......@@ -121,7 +121,7 @@ public slots:
void nextFrame();
void prevFrame();
void updateSkin();
void updateSkins();
//@}
void UpdateUI();
......@@ -135,12 +135,13 @@ private slots:
void exit();
void slotBindMesh();
void slotUnbindMesh();
void slotAttachSkin();
void slotClearSkins();
void slotMethodChanged(int _index);
void slotAnimationIndexChanged(int /*_index*/);
void slotFrameChanged(int /*_index*/);
void slotSkipFramesChanged(int _state);
void slotAddAnimation();
void animate();
......@@ -153,15 +154,16 @@ protected:
AnimationHandle currentAnimationHandle();
void UpdateSkin(BaseObjectData *_pSkeletonObject, AnimationHandle &_hAni);
void UpdateSkins(BaseObjectData *_pSkeletonObject, AnimationHandle &_hAni);
private:
/**
* @name Rigging
* @name Skin management
*/
//@{
void rig(BaseObjectData *pSkin, BaseObjectData *pSkeleton);
void unrig(BaseObjectData *_pSkeleton);
void attachSkin(BaseObjectData *pSkin, BaseObjectData *pSkeleton);
void detachSkin(BaseObjectData *pSkin, BaseObjectData *pSkeleton);
void clearSkins(BaseObjectData *_pSkeleton);
//@}
protected:
......
......@@ -48,47 +48,76 @@ void SkeletalAnimationPlugin::setDescriptions(){
QString(tr("SkeletonObjectId,SkinObjectId")).split(","),
QString(tr("id of the skeleton object, id of the skin object")).split(","));
emit setSlotDescription("detachSkin(int)",tr("Removes a skeleton's skin"),
emit setSlotDescription("detachSkin(int,int)",tr("Remove a specific skin from the skeleton"),
QString(tr("SkeletonObjectId,SkinObjectId")).split(","),
QString(tr("id of the skeleton object, id of the skin object")).split(","));
emit setSlotDescription("clearSkins(int)",tr("Remove all skins from a skeleton"),
QStringList(tr("SkeletonObjectId")), QStringList(tr("ID of the skeleton object")));
}
bool SkeletalAnimationPlugin::attachSkin(int /*skeletonId*/, int /*skinId*/) {
// BaseObjectData* skeleton = NULL;
// if (!PluginFunctions::getObject(skeletonId, skeleton)) {
// emit log(LOGERR, "Could not retrieve skeleton");
// return false;
// }
//
// BaseObjectData* skin = NULL;
// if (!PluginFunctions::getObject(skinId, skin)) {
// emit log(LOGERR, "Could not retrieve skin");
// return false;
// }
//
// rig(skin, skeleton);
//
bool SkeletalAnimationPlugin::attachSkin(int skeletonId, int skinId) {
BaseObjectData* skeleton = NULL;
if (!PluginFunctions::getObject(skeletonId, skeleton)) {
emit log(LOGERR, "Could not retrieve skeleton");
return false;
}
BaseObjectData* skin = NULL;
if (!PluginFunctions::getObject(skinId, skin)) {
emit log(LOGERR, "Could not retrieve skin");
return false;
}
attachSkin(skin, skeleton);
return true;
}
bool SkeletalAnimationPlugin::detachSkin(int skeletonId, int skinId) {
BaseObjectData* skeleton = NULL;
if (!PluginFunctions::getObject(skeletonId, skeleton)) {
emit log(LOGERR, "Could not retrieve skeleton");
return false;
}
BaseObjectData* skin = NULL;
if (!PluginFunctions::getObject(skinId, skin)) {
emit log(LOGERR, "Could not retrieve skin");
return false;
}
detachSkin(skin, skeleton);
return true;
}
bool SkeletalAnimationPlugin::detachSkin(int /*skeletonId*/) {
// BaseObjectData* skeleton = NULL;
// if (!PluginFunctions::getObject(skeletonId, skeleton)) {
// emit log(LOGERR, "Could not retrieve skeleton");
// return false;
// }
//
// unrig(skeleton);
//
bool SkeletalAnimationPlugin::clearSkins(int skeletonId) {
BaseObjectData* skeleton = NULL;
if (!PluginFunctions::getObject(skeletonId, skeleton)) {
emit log(LOGERR, "Could not retrieve skeleton");
return false;
}
clearSkins(skeleton);
return true;
}
void SkeletalAnimationPlugin::updateSkin(){
void SkeletalAnimationPlugin::updateSkins(){
// BaseObjectData *pMeshObject = 0, *pSkeletonObject = 0;
// GetSelectedPair(&pMeshObject, &pSkeletonObject);
//
// if (pSkeletonObject != 0){
// AnimationHandle hAni = PluginFunctions::skeletonObject(pSkeletonObject)->skeletonNode()->getActivePose();
// UpdateSkin(pSkeletonObject, hAni);
// }
for (unsigned int i=0; i < activeSkeletons_.size(); i++){
//get active skeleton
BaseObjectData* baseObject = 0;
PluginFunctions::getObject(activeSkeletons_[i], baseObject);
if ( baseObject == 0 )
continue;
SkeletonObject* skeletonObject = dynamic_cast<SkeletonObject*>(baseObject);
AnimationHandle hAni = skeletonObject->skeletonNode()->activePose();
UpdateSkins(skeletonObject, hAni);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddAnimation</class>
<widget class="QDialog" name="AddAnimation">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>105</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Add Animation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Animation Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="animationName">
<property name="text">
<string>Animation01</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Number of Frames:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="frames">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddAnimation</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddAnimation</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>311</width>
<width>315</width>
<height>283</height>
</rect>
</property>
......@@ -58,6 +58,13 @@
<item row="1" column="1">
<widget class="QComboBox" name="cbMethod"/>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="pbAddAnimation">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -192,6 +199,9 @@
</item>
<item>
<widget class="QCheckBox" name="cbSkipFrames">
<property name="toolTip">
<string>&lt;b&gt;Frame Skipping&lt;/b&gt;&lt;br&gt;Skip frames if the deformation is too slow.</string>
</property>
<property name="text">
<string>Frame skipping</string>
</property>
......@@ -233,28 +243,34 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="riggingBox">
<widget class="QGroupBox" name="skinningBox">
<property name="title">
<string>Rigging</string>
<string>Attached Skins</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pbBindMesh">
<widget class="QPushButton" name="pbAttachSkin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;b&gt;Attach mesh(es) to the skeleton&lt;/b&gt;&lt;br&gt;If the mesh is equipped with skin weights, the skeleton controls the deformation afterwards.</string>
</property>
<property name="text">
<string>Connect Skin and Skeleton</string>
<string>Attach Skin to Skeleton</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbUnbindMesh">
<widget class="QPushButton" name="pbClearSkins">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;b&gt;Remove attached skins&lt;/b&gt;&lt;br&gt;Remove all attached skins from the skeleton</string>
</property>
<property name="text">
<string>Unbind</string>
<string>Clear Skins</string>
</property>
</widget>
</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment