mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:36:45 +02:00
Revert "Models.addModel now returns a more accurate modelID"
This reverts commit 150477eea4
.
This commit is contained in:
parent
9322e1f71b
commit
4209c1102f
3 changed files with 24 additions and 11 deletions
|
@ -47,12 +47,6 @@ uint32_t ModelItem::getNextCreatorTokenID() {
|
||||||
return creatorTokenID;
|
return creatorTokenID;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ModelItem::getNextModelItemID() {
|
|
||||||
uint32_t modelID = _nextID;
|
|
||||||
_nextID++;
|
|
||||||
return modelID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelItem::handleAddModelResponse(const QByteArray& packet) {
|
void ModelItem::handleAddModelResponse(const QByteArray& packet) {
|
||||||
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data());
|
const unsigned char* dataAt = reinterpret_cast<const unsigned char*>(packet.data());
|
||||||
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
||||||
|
@ -76,10 +70,31 @@ ModelItem::ModelItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelItem::ModelItem(const ModelItemID& modelItemID, const ModelItemProperties& properties) {
|
ModelItem::ModelItem(const ModelItemID& modelItemID, const ModelItemProperties& properties) {
|
||||||
|
_id = modelItemID.id;
|
||||||
_creatorTokenID = modelItemID.creatorTokenID;
|
_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 };
|
// animation related
|
||||||
init(glm::vec3(), 0.0f, defaultColor, modelItemID.id);
|
_animationURL = MODEL_DEFAULT_ANIMATION_URL;
|
||||||
|
_animationIsPlaying = false;
|
||||||
|
_animationFrameIndex = 0.0f;
|
||||||
|
_animationFPS = MODEL_DEFAULT_ANIMATION_FPS;
|
||||||
|
_glowLevel = 0.0f;
|
||||||
|
|
||||||
|
_jointMappingCompleted = false;
|
||||||
|
_lastAnimated = now;
|
||||||
|
|
||||||
setProperties(properties);
|
setProperties(properties);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,6 @@ public:
|
||||||
// these methods allow you to create models, and later edit them.
|
// these methods allow you to create models, and later edit them.
|
||||||
static uint32_t getIDfromCreatorTokenID(uint32_t creatorTokenID);
|
static uint32_t getIDfromCreatorTokenID(uint32_t creatorTokenID);
|
||||||
static uint32_t getNextCreatorTokenID();
|
static uint32_t getNextCreatorTokenID();
|
||||||
static uint32_t getNextModelItemID();
|
|
||||||
static void handleAddModelResponse(const QByteArray& packet);
|
static void handleAddModelResponse(const QByteArray& packet);
|
||||||
|
|
||||||
void mapJoints(const QStringList& modelJointNames);
|
void mapJoints(const QStringList& modelJointNames);
|
||||||
|
|
|
@ -28,9 +28,8 @@ ModelItemID ModelsScriptingInterface::addModel(const ModelItemProperties& proper
|
||||||
|
|
||||||
// The application will keep track of creatorTokenID
|
// The application will keep track of creatorTokenID
|
||||||
uint32_t creatorTokenID = ModelItem::getNextCreatorTokenID();
|
uint32_t creatorTokenID = ModelItem::getNextCreatorTokenID();
|
||||||
uint32_t modelID = ModelItem::getNextModelItemID();
|
|
||||||
|
|
||||||
ModelItemID id(modelID, creatorTokenID, false );
|
ModelItemID id(NEW_MODEL, creatorTokenID, false );
|
||||||
|
|
||||||
// queue the packet
|
// queue the packet
|
||||||
queueModelMessage(PacketTypeModelAddOrEdit, id, properties);
|
queueModelMessage(PacketTypeModelAddOrEdit, id, properties);
|
||||||
|
|
Loading…
Reference in a new issue