Maybe this suggestion doesn't work for your application, but is there any
reason you can't store it as an attribute on each individual geo node,
instead of building up some huge fullpath set on a locator? If it were
stored on the geo, then you don't have to worry about tracking the
renaming, right? It just travels around with the geo and you can query the
original shader on that given node.

On Fri, Oct 14, 2016 at 2:10 PM likage <dissidia....@gmail.com> wrote:

> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/00ad98d1-389d-49c0-ab92-a3892e74df0e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/00ad98d1-389d-49c0-ab92-a3892e74df0e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1P5%3DQ0_vJ021qXMVTTo0ETF4X3nVOLGFShG-9SkySMSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to