Created
April 23, 2011 09:27
-
-
Save iRi-E/938496 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/MMDAI/include/MMDAI/SceneController.h b/MMDAI/include/MMDAI/SceneController.h | |
index 4bfb27b..0ff7be3 100644 | |
--- a/MMDAI/include/MMDAI/SceneController.h | |
+++ b/MMDAI/include/MMDAI/SceneController.h | |
@@ -72,6 +72,7 @@ public: | |
void initializeScreen(int width, int height); | |
PMDObject *allocatePMDObject(); | |
+ PMDObject *getSelectedPMDObject(); | |
PMDObject *findPMDObject(PMDObject *object); | |
PMDObject *findPMDObject(const char *alias); | |
@@ -159,13 +160,10 @@ public: | |
void renderLogger(); | |
inline PMDObject *getPMDObject(int index) const { | |
- if (index < 0 || index > m_numModel) | |
+ if (index < 0 || index >= m_numModel) | |
return NULL; | |
return m_objects[index]; | |
} | |
- inline PMDObject *getSelectedPMDObject() const { | |
- return getPMDObject(m_selectedModel); | |
- } | |
inline const int countPMDObjects() const { | |
return m_numModel; | |
} | |
diff --git a/MMDAI/src/SceneController.cc b/MMDAI/src/SceneController.cc | |
index 061ae4f..0f66dcc 100644 | |
--- a/MMDAI/src/SceneController.cc | |
+++ b/MMDAI/src/SceneController.cc | |
@@ -292,6 +292,15 @@ PMDObject *SceneController::allocatePMDObject() | |
return object; | |
} | |
+PMDObject *SceneController::getSelectedPMDObject() | |
+{ | |
+ PMDObject *object = getPMDObject(m_selectedModel); | |
+ if (object != NULL && object->isEnable()) | |
+ return object; | |
+ else | |
+ return NULL; | |
+} | |
+ | |
PMDObject *SceneController::findPMDObject(PMDObject *object) | |
{ | |
return findPMDObject(object->getAlias()); | |
@@ -553,7 +562,6 @@ bool SceneController::addModel(const char *modelAlias, | |
/* initialize motion manager */ | |
newObject->resetMotionManager(); | |
newObject->setAlias(name); | |
- m_numModel++; | |
/* send event message */ | |
sendEvent1(SceneEventHandler::kModelAddEvent, name); | |
@@ -635,7 +643,6 @@ void SceneController::deleteModel(PMDObject *object) | |
/* set frame from now to disappear */ | |
object->startDisappear(); | |
- m_numModel--; | |
/* send event message */ | |
sendEvent1(SceneEventHandler::kModelDeleteEvent, object->getAlias()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment