Sketchfab Forum

Number (instanceID) relevant for api.hide keeps changing


(SRF Studio) #1

Hello,

I'm not sure if I'm doing something wrong but my instance ID numbers keeps changing.

In Sketchfab API I'm successfully using api.hide/api.show to hide/show parts of my model's geometry but there are two problems, one minor and one major:

  1. My object ID numbers are not the same on all browsers (Chrome/Mozilla) so I have to have two different numbers for one object. This problem, however, magically disappears after some time (10/15 days) because ID's keep changing and at some point become the same both on Chrome and Mozilla.

  2. My object ID numbers are changing over time so I have to check every 15 days to see if instance ID's are still the same and rewrite the api.hide/api.show code if they are not.

Am I doing something wrong? Can I use instance names instead of instance numbers somehow, they don't seem to be changing over time?

//////////// Edit

I am using the first ID number from console "(number):Object" (to show/hide geometry) and underneath it marks it's type as a "Group". There are, however, "Children: Array" objects that are marked as "type:RigGeometry" with different number ID's from parent? Should I maybe use them instead of Group object?


(Shaderbytes) #2

your workflow should not assume a permanent instance id , this is your error :slight_smile:

you need to use the object name and lookup the instance id as part of your code. I have coded an API utility for the sketchfab api that handles all this boilerplate code for you .. check it out :


(SRF Studio) #3

Thank you for your help!

I've seen your Sketchfab utility and it seemed to be a great thing but I had some problems using it :frowning: It's not a utility fault but my limited coding ability, I will give it another try.

Thank you again, hopefully you will find some time to reply again if I get everything wrong :slight_smile:


(Shaderbytes) #4

sure , if you get stuck just give me a shout here and I will see where I can help.


(SRF Studio) #5

Thank you so much and, as I expected, I'm already stuck :no_mouth:

This is the link to my test with your new api:
http://uprisegame.byethost33.com/sketchfab/newapi/Test2.html
...and this is the test with old api:
http://uprisegame.byethost33.com/sketchfab/oldapi/orc_old_api.html
Old api test will work only with Chrome ( Edit: it seems to be working with Mozilla also ).

Your new api is finding all of the relevant objects but it seems that only the "EavyBlasta" (lasergun) is being processed as it's expected.

I think the new api is not targeting the right type of object in my case since the only type that I found to be working for my models is "type:Group" :disappointed:

I'm not sure if I can influence the api to search for that specific object type or if I can just write the objects names & type somewhere in the code...?


(Shaderbytes) #6

let me have a look will get back to you


(SRF Studio) #7

That would be great, thank you for all your help!

I removed most of the unnecessary code from my old-api test html and also click/right-click/context-menu blocks so you can access the code easily. If you also need my files I can zip and upload them quickly on my website.


(Shaderbytes) #8

no need i can inspect all i need with your model id. I can already see some things that need attention from my side. Currently i cache matrixtransform nodes as priority. On static models this was a safe route to take to handle sub geometry objects. I do in fact store the entire returned node group as well. I also have another storage that handles mapping geometry nodes to parent matrix transforms for click events. but this doesnt seem to hold fast for rigged models. The matrix transform nodes on your model dont have children , hence why hiding them does nothing currently.

i will add some code in to try meet these differences busy on it right now


(SRF Studio) #9

I hope that the additional functionality will not be too difficult to implement.

Thank you for looking into this problem, I believe that any working solution will be beneficial for all users of your api who are developing animated 3D content.


(SRF Studio) #10

Just wanted to see if there is some progress and to give you more common animated model link.

I was 100% sure that you were right but, at the same time, I was very uncomfortable thinking that maybe method of rigging that I had on Orc ( and some of my other models ) was a cause of the api problems. I had to test it on neutral model.

This is a test of a standard Mixamo model ( Paladin J Nordstrom ) with a more common type of rigging.
http://uprisegame.byethost33.com/sketchfab/paladin/Test3.html
[ Edit ] Model ID: 95ab57eec5644c6c8da786113bb89a0b

Difference between Orc and Paladin rig confirms that you are right because Orc had a laser gun just attached ( by vertex ) to the rig ( laser gun itself was not rigged ) and Paladin had all of it's props ( armor, sword, shield..) as a part of his body ( global rig ).

The thing that I don't get is why an entire model of Paladin ( with 'Armature' selected ) can be hidden and the same thing ( with 'Orc_71643.Shape' ) can't be achieved with Orc :no_mouth:

I am very thankful that you are looking into this problem, hopefully you are not having a terrible time with it :worried: It would be great if show / hide could workout for animated models also :slight_smile:


(Shaderbytes) #11

hey there , Idid make a working edit yesterday sorry for the late reply. But i dont want to commit it to my github until I can investigate this matter further, need to talk to some of the sketchfab devs to make sure about some patterns in the way they build their node graph .. anyway look here :

http://www.shaderbytes.co.za/sketchfab/development/api/examples/example_2b.html

and here

http://www.shaderbytes.co.za/sketchfab/development/api/examples/example_2c.html

Notice in the code that builds the dropdowns it references a different storage for groups.For now just grab this version of the utility from this page ,

http://www.shaderbytes.co.za/sketchfab/development/api/examples/SketchfabAPIUtility.js


(SRF Studio) #12

This is great news, it's working now, everything is functioning as it should :relaxed: :relaxed:
Thank you so much for your time and effort!

I downloaded your new api and also tried it with a few of my other models, successful test every time! It was like unpacking a brand new toy as a kid and finding out that it DOES have that two batteries packed with it :grinning: :grinning:

Thank you again, this is great!


(Shaderbytes) #13

glad it helped , i do still need to give it some attention internally as mentioned before it is updated officially to github. Thanks for trying it out , your efforts were helpful in exposing holes in the system :slight_smile:


(SRF Studio) #14

It really helped a lot, the Sketchfab apis are a part of my (soon to be published) game. The thought that I would have to constantly check when the api stops hiding / showing objects and then re-upload everything because of it was very unsettling :no_mouth:

I was already working on a backup solutions with Unity but it would be much, much less light and elegant than using Sketchfab. I don't know, Sketchfab has something about it, it's like a slick & stylish car versus buffed army jeep: I know I can't go through the woods & up the mountain with it but I still prefer it over the green jeep :smile:

Thank you for mentioning my 'role', I'm positive that it's not really earned, all I did was panic and than put some models online but thank you :slight_smile:

Btw how safe is it to use the new version of api, will it be changed ( by the time you publish it on github ) in a way that this 'forum' version will no longer be functional?