Profile Picture

Python FAQ Tracker

Posted By RobertoColombo 2 Years Ago
You don't have permission to rate!
Author
Message
justaviking
justaviking
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)Distinguished Member (16.4K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 7.9K, Visits: 24.7K
wires (12/27/2018)
justaviking (12/27/2018)
Kelleytoons (12/27/2018)
This isn't the only example but it's typical -- were these samples not tested?

Did you have to ask?
Allow me rephrase the question:  "Why were these not tested?"

Maybe they don't have any testers available. 😁


Of course, that must be it.  Nobody willing to test.  What a shame.  <end sarcasm>





iClone 7... Character Creator... Substance Designer/Painter... Blender... Audacity...
Desktop (homebuilt) - Windows 7, i7-3770k CPU, GTX 1080 GPU (8GB), 16GB RAM, Asus P8Z77-V Pro motherboard, 500 GB SSD, terabytes of disk space, dual  monitors.
Laptop - Windows 10, MSI GS63VR STEALTH-252, 16GB RAM, GTX 1060 (6GB), 256GB SSD and 1TB HDD

Edited
2 Years Ago by justaviking
Zeronimo
Zeronimo
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)

Group: Forum Members
Last Active: 3 hours ago
Posts: 279, Visits: 12.0K
Kelleytoons (12/27/2018)
I'm having just basic issues with even sample code provided.  We have this in the docs:

avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
material_component = avatar.GetMaterialComponent()
mesh_list = avatar.GetMeshNames()
mesh_name = mesh_list[0]
material_list = material_component.GetMaterialNames(mesh_name)
material_name = material_list[0]

and it doesn't work, throwing an error at the last line (
<class 'IndexError'>Wink.  So either I'm completely stupid (always a possibility) or the docs are just wrong (my bet).

This isn't the only example but it's typical -- were these samples not tested?


I tested this same sample, and like you I had the same mistakes. I still have not found why.
But I rewrote the code completely, with some improvements, and it works perfectly.

see attachments
Py file
Log file

Attachments
Mike02.py.txt (10 views, 1.00 KB)
Mike02Log.txt (5 views, 2.00 KB)
Kelleytoons
Kelleytoons
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 6.8K, Visits: 14.1K
No, that doesn't work for me either.

All you really did in your code was ignore the fact there are no materials in the material_list array (IOW, that is wrong -- there ARE materials there, but your code says if it comes back nil then ignore.  The basic issue is still there, which is the code fragment doesn't work because GetMaterialNames doesn't work).



Alienware Aurora R7, Win 10, i7-8700k, 4.7GHz CPU, 32GB RAM, GTX Titan XP (12GB), Samsung 960 Pro 2TB M-2 SSD, TB+ Disk space
Mike "ex-genius" Kelley
Zeronimo
Zeronimo
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)

Group: Forum Members
Last Active: 3 hours ago
Posts: 279, Visits: 12.0K
Kelleytoons (12/27/2018)
No, that doesn't work for me either.

All you really did in your code was ignore the fact there are no materials in the material_list array (IOW, that is wrong -- there ARE materials there, but your code says if it comes back nil then ignore.  The basic issue is still there, which is the code fragment doesn't work because GetMaterialNames doesn't work).



Sorry, I do not see where the problem is, maybe because English is not my language, but when I run this program the console does not report any errors.
- material_list contains an array of materials
- GetMaterialNames returns the name of the material
if you look at the log file you will see that this data is present.
This is my first program in Python, maybe I do not understand everything, it's also possible.

what does IOW mean?
Attachments
Mike02.py.txt (2 views, 1.00 KB)
Mike02Log.txt (2 views, 3.00 KB)
Kelleytoons
Kelleytoons
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 6.8K, Visits: 14.1K
No, you're missing the point but let me try and explain it again.

Your program doesn't produce any errors because it doesn't do anything.  The error that comes up when the sample program is run is because the function to return GetMaterialNames doesn't actually return anything.  It's returning an array of length 0, which is why your loop through isn't even executed once.

However, that call MUST produce at least one material name, which is why in the sample they use the zero index [0].  Try and and you'll see.  You cannot have an object without at least one material, and this function WILL work on the female avatar, just not on the male.  The RL devs have already reported this is a problem and they will fix it.

So, to sum up, you didn't need to rewrite the code -- the sample code I quoted should work fine as it is, but it will not due to an error in the Python API.  Hope you can understand it now.

Opps -- missed the question in your response.  IOW is netspeak for "in other words".  Sorry -- I'm not always up on the abbreviations myself.

Here's something else to prove your code doesn't work -- just alter it to change the opacity of all the materials in an avatar to 0.  Here's the relevant line:

material_component.AddOpacityKey(RLPy.RGlobal.GetTime(), mesh_name, material_name,0)

If your code works, then any avatars in the scene will turn invisible.





Alienware Aurora R7, Win 10, i7-8700k, 4.7GHz CPU, 32GB RAM, GTX Titan XP (12GB), Samsung 960 Pro 2TB M-2 SSD, TB+ Disk space
Mike "ex-genius" Kelley
Edited
2 Years Ago by Kelleytoons
SeanMac
SeanMac
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)Distinguished Member (2.7K reputation)

Group: Forum Members
Last Active: 6 days ago
Posts: 373, Visits: 3.0K
@zeronimo

Thanks for that
Zeronimo
Zeronimo
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)

Group: Forum Members
Last Active: 3 hours ago
Posts: 279, Visits: 12.0K
Kelleytoons (12/28/2018)
No, you're missing the point but let me try and explain it again.

Your program doesn't produce any errors because it doesn't do anything.  The error that comes up when the sample program is run is because the function to return GetMaterialNames doesn't actually return anything.  It's returning an array of length 0, which is why your loop through isn't even executed once.

However, that call MUST produce at least one material name, which is why in the sample they use the zero index [0].  Try and and you'll see.  You cannot have an object without at least one material, and this function WILL work on the female avatar, just not on the male.  The RL devs have already reported this is a problem and they will fix it.

So, to sum up, you didn't need to rewrite the code -- the sample code I quoted should work fine as it is, but it will not due to an error in the Python API.  Hope you can understand it now.

Opps -- missed the question in your response.  IOW is netspeak for "in other words".  Sorry -- I'm not always up on the abbreviations myself.

Here's something else to prove your code doesn't work -- just alter it to change the opacity of all the materials in an avatar to 0.  Here's the relevant line:

material_component.AddOpacityKey(RLPy.RGlobal.GetTime(), mesh_name, material_name,0)

If your code works, then any avatars in the scene will turn invisible.



I introduced the new instruction into the program, and at home all the avatars of the scene become effectively invisible.
for me it works, I do not understand why it does not work for you.





Attachments
Mike02.py.txt (2 views, 1.00 KB)
Kelleytoons
Kelleytoons
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 6.8K, Visits: 14.1K
You tried this on the default male dummy avatar?

Hmmm, that's pretty weird then.  I wonder why Luke would say that it was broken.

Edit: Nope, just tested myself.  Still broken.  I assume you're not testing correctly.  If you get this to work please post a video showing it so we can see what you are doing differently (put the motion dummy_male in a scene and run the code).

(And even on other avatars it is hit and miss -- sometimes it makes them disappear, other times it only removes the skin but not the clothing. Either way, code not working, and the devs agree).



Alienware Aurora R7, Win 10, i7-8700k, 4.7GHz CPU, 32GB RAM, GTX Titan XP (12GB), Samsung 960 Pro 2TB M-2 SSD, TB+ Disk space
Mike "ex-genius" Kelley
Edited
2 Years Ago by Kelleytoons
Kelleytoons
Kelleytoons
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)Distinguished Member (21.8K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 6.8K, Visits: 14.1K
Oh, and note that any avatars this DOES work on would also work with the original code I posted.  Once again, your code does nothing different, only collects them all in a list which may or may not be accurate depending on the avatar.

So, to reiterate, the basic issue is that *some* avatars (and, I guess, some clothing) will return an error when GetMaterial is called.  That's why even a [0] call to the first item in the list can throw an error.  This should *never* happen (because all avatars, as well as all props, have SOME material assigned to them.  If it's only 1 then the [0] call will work).

Your code just confuses the issue and I don't know how to explain it any more clearly than that.  So I won't be revisiting this topic.



Alienware Aurora R7, Win 10, i7-8700k, 4.7GHz CPU, 32GB RAM, GTX Titan XP (12GB), Samsung 960 Pro 2TB M-2 SSD, TB+ Disk space
Mike "ex-genius" Kelley
Edited
2 Years Ago by Kelleytoons
Zeronimo
Zeronimo
Posted 2 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)Distinguished Member (1.9K reputation)

Group: Forum Members
Last Active: 3 hours ago
Posts: 279, Visits: 12.0K
I have to leave for a few hours, but when I come back I will make a video.
I quickly did a test with Motion_dummy_male and actually it does not work with this avatar. on the other hand with Motion_dummy_female it works.



Reading This Topic