Revert "Models.addModel now returns a more accurate modelID"

This reverts commit 150477eea4.
This commit is contained in:
Atlante45 2014-06-06 10:26:08 -07:00
parent 9322e1f71b
commit 4209c1102f
3 changed files with 24 additions and 11 deletions

View file

@ -47,12 +47,6 @@ uint32_t ModelItem::getNextCreatorTokenID() {
return creatorTokenID;
}
uint32_t ModelItem::getNextModelItemID() {
uint32_t modelID = _nextID;
_nextID++;
return modelID;
}
void ModelItem::handleAddModelResponse(const QByteArray& packet) {
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data());
int numBytesPacketHeader = numBytesForPacketHeader(packet);
@ -76,10 +70,31 @@ ModelItem::ModelItem() {
}
ModelItem::ModelItem(const ModelItemID& modelItemID, const ModelItemProperties& properties) {
_id = modelItemID.id;
_creatorTokenID = modelItemID.creatorTokenID;
// init values with defaults before calling setProperties
uint64_t now = usecTimestampNow();
_lastEdited = now;
_lastUpdated = now;
_position = glm::vec3(0,0,0);
_radius = 0;
rgbColor noColor = { 0, 0, 0 };
memcpy(_color, noColor, sizeof(_color));
_shouldDie = false;
_modelURL = MODEL_DEFAULT_MODEL_URL;
_modelRotation = MODEL_DEFAULT_MODEL_ROTATION;
rgbColor defaultColor = { 0, 0, 0 };
init(glm::vec3(), 0.0f, defaultColor, modelItemID.id);
// animation related
_animationURL = MODEL_DEFAULT_ANIMATION_URL;
_animationIsPlaying = false;
_animationFrameIndex = 0.0f;
_animationFPS = MODEL_DEFAULT_ANIMATION_FPS;
_glowLevel = 0.0f;
_jointMappingCompleted = false;
_lastAnimated = now;
setProperties(properties);
}

View file

@ -276,7 +276,6 @@ public:
// these methods allow you to create models, and later edit them.
static uint32_t getIDfromCreatorTokenID(uint32_t creatorTokenID);
static uint32_t getNextCreatorTokenID();
static uint32_t getNextModelItemID();
static void handleAddModelResponse(const QByteArray& packet);
void mapJoints(const QStringList& modelJointNames);

View file

@ -28,9 +28,8 @@ ModelItemID ModelsScriptingInterface::addModel(const ModelItemProperties& proper
// The application will keep track of creatorTokenID
uint32_t creatorTokenID = ModelItem::getNextCreatorTokenID();
uint32_t modelID = ModelItem::getNextModelItemID();
ModelItemID id(modelID, creatorTokenID, false );
ModelItemID id(NEW_MODEL, creatorTokenID, false );
// queue the packet
queueModelMessage(PacketTypeModelAddOrEdit, id, properties);