Hi all, so I have managed to store the initial shaders connection and it is
currently working by using the above example that I have linked where they
are stored as an extra attribute in a locator.
Currently I am stumped in an issue, where should the name of the said geo
be changed, it should also changed the naming in the dict within that extra
attribute.
Example.
One of the elements' naming in the dict:
*'|Stack|model_from_groupA|group_01|roof_grp|roof_geoShape':'brick_shader'*
If the hierarchy is renamed to:
*'|Stack|model_A|group_01|roof_grp|roof_geoShape'*, the model_from_groupA
(second level in the full path) should be named to model_A.
Only that 'particular level' in hierarchy will be touched upon
While it works correctly for 1 object in scene, but if I have 2 or more
objects, the renaming process will works but it is renaming incorrectly to
the wrong objects.
Suppose the current dict values (before any nodes are renamed in scene) is:
cur_keytext_in_dict = {
'|Stack|model_from_groupA|group_01|model_A_roof_grp|model_A_roof_geoShape':
'brick_shader',
'|Stack|model_from_groupB|group_01|model_B_roof_grp|model_B_roof_geoShape':
'brick_shader'}
And if I renamed, model_from_groupA to model_A and model_from_groupB to
model_B, I can get the following results:
'|Stack|model_B|group_01|model_A_roof_grp|model_A_roof_geoShape',
'|Stack|model_A|group_01|model_B_roof_grp|model_B_roof_geoShape'
See that model_B is renamed to the model_A geos and vice verse for model_A
I tried the following code:
cur_keytext_in_dict = {
'|Stack|model_from_groupA|group_01|model_A_roof_grp|model_A_roof_geoShape':
'brick_shader',
'|Stack|model_from_groupB|group_01|model_B_roof_grp|model_B_roof_geoShape':
'brick_shader'}
cur_name_in_scene = [
'|Stack|model_A|group_01|model_A_roof_grp|model_A_roof_geoShape',
'|Stack|model_B|group_01|model_B_roof_grp|model_B_roof_geoShape']
for split_name in cur_name_in_scene:
split_check = split_name.split("|", 4)[4]
# result : model_A_roof_grp|model_A_roof_geoShape,
model_B_roof_grp|model_B_roof_geoShape
But how can I replace the 'front' portion of the correct code after using
the above check?
Hopefully I am making sense?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/00ad98d1-389d-49c0-ab92-a3892e74df0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.