[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4275] contrib/py/scripts/addons/ online_mat_lib/__init__.py: Fix handling of nodegroup names

Peter Cassetta peter at fingertipsoft.com
Fri Feb 15 11:15:04 CET 2013


Revision: 4275
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4275
Author:   petercassetta
Date:     2013-02-15 10:15:04 +0000 (Fri, 15 Feb 2013)
Log Message:
-----------
Fix handling of nodegroup names

Fixed a bug with local nodegroups, and improved handling of nodegroup names.
Something like /home/user/test_group.bcg will now be added as Test Group.

Modified Paths:
--------------
    contrib/py/scripts/addons/online_mat_lib/__init__.py

Modified: contrib/py/scripts/addons/online_mat_lib/__init__.py
===================================================================
--- contrib/py/scripts/addons/online_mat_lib/__init__.py	2013-02-15 08:32:37 UTC (rev 4274)
+++ contrib/py/scripts/addons/online_mat_lib/__init__.py	2013-02-15 10:15:04 UTC (rev 4275)
@@ -4514,11 +4514,16 @@
                     group_filepath = node_data['group'].value[7:]
                     
                     group_name = group_filepath.replace("_", " ")
+                    
+                    if node_data['group'].value[-4:].lower() != ".bcg":
+                        node_message = ['ERROR', "The node group file referenced by this group node is not .bcg."]
+                        return
+                    
                     if os.sep in group_name:
-                        group_name = group_name.split(os.sep)
-                    group_name = group_name.upper()
+                        group_name = group_name.split(os.sep)[-1]
+                    group_name = group_name[:-4].title()
                 elif "http://" in node_data['group'].value and bpy.context.scene.mat_lib_groups_only_trusted == False:
-                    group_name = node_data['group'].value.split("/")[-1][:-4]
+                    group_name = node_data['group'].value.replace("_", " ").split("/")[-1][:-4].title()
                     group_host = node_data['group'].value[7:].split("/")[0]
                     group_location = node_data['group'].value[(7 + len(group_host)):]
                     
@@ -4536,7 +4541,7 @@
                     group_file.close()
                     
                 else:
-                    group_name = node_data['group'].value[:-4]
+                    group_name = node_data['group'].value.replace("_", " ")[:-4].title()
                     
                     if node_data['group'].value[-4:].lower() != ".bcg":
                         node_message = ['ERROR', "The node group file referenced by this group node is not .bcg; not downloading."]



More information about the Bf-extensions-cvs mailing list