[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2517] contrib/py/scripts/addons: this is the first commit for gyes , i have added all relevant files and of course the main folder.

james bond thekilon at yahoo.co.uk
Mon Oct 24 08:56:44 CEST 2011


Revision: 2517
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2517
Author:   kilon
Date:     2011-10-24 06:56:40 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
this is the first commit for gyes , i have added all relevant files and of course the main folder. Please see wiki for how to use and what is gyes

Added Paths:
-----------
    contrib/py/scripts/addons/gyes/
    contrib/py/scripts/addons/gyes/__init__.py
    contrib/py/scripts/addons/gyes/random_material_generator.py
    contrib/py/scripts/addons/gyes/random_texture_generator.py

Added: contrib/py/scripts/addons/gyes/__init__.py
===================================================================
--- contrib/py/scripts/addons/gyes/__init__.py	                        (rev 0)
+++ contrib/py/scripts/addons/gyes/__init__.py	2011-10-24 06:56:40 UTC (rev 2517)
@@ -0,0 +1,100 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+
+""" Copyright  Kilon 2011 GPL licence applies"""
+
+bl_info = {
+    "name": "Gyes (A Blender MultiTool)",
+    "description": "Gyes is a collection of scripts, named <tools> that simplify , automate and extend blender",
+    "author": "Kilon",
+    "version": (0,0,7),
+    "blender": (2, 5, 9),
+    "api": 40500,
+    "location": "View3D > Left panel ",
+    "warning": '', # used for warning icon and text in addons panel
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/System/Gyes",
+    "tracker_url": "https://github.com/kilon/Gyes",
+    "category": "System"}
+    
+if "bpy" in locals():
+    import imp
+    imp.reload(random_material_generator)
+    imp.reload(random_texture_generator)
+    #imp.reload(random_landscape_generator)
+else:
+    from gyes import random_material_generator
+    from gyes import random_texture_generator
+    #from gyes import random_landscape_generator
+    
+import bpy
+from bpy.props import *
+
+
+# Choose the tool you want to use
+bpy.types.Scene.tool = EnumProperty(attr='tool', name='Tool', items=(
+('RMG', 'RMG', 'Random Material Generator'),
+('RTG', 'RTG', 'Random Texture Generator'),
+('RLG', 'RLG' , 'Random Landscape Generator'),
+('TARTARA', 'TARTARA', 'An online Library for any kind of blender asset')),default='RMG')
+
+
+rm = random_material_generator.rm
+rt = random_texture_generator.rt                 
+# this the main panel
+class gyes_panel(bpy.types.Panel):
+    bl_label = "Gyes"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "TOOLS"
+    
+    """@classmethod    
+    def poll(self, context):
+        if context.object and context.object.type == 'MESH':                    
+            return len(context.object.data.materials)"""
+        
+    
+    def draw(self, context):
+        layout = self.layout
+        row = layout.row()
+        row.prop(context.scene , "tool" )
+        
+        # check which tool the user has selected (RGM is the default one) and display the appropriate gui
+        
+        if context.scene.tool == 'RMG' :
+            rm.draw_gui(context,self)
+        
+        if context.scene.tool == 'RTG' :
+            rt.draw_gui(context,self,rm)
+ 
+        r = layout.row()
+        if context.scene.tool == 'RLG' :
+            r.label(text="WIP not finished yet")
+        if context.scene.tool == 'TARTARA' :
+            r.label(text="WIP not finished yet")
+
+
+        
+def register():
+    bpy.utils.register_module(__name__)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+ 
+if __name__ == "__main__":
+    register()

Added: contrib/py/scripts/addons/gyes/random_material_generator.py
===================================================================
--- contrib/py/scripts/addons/gyes/random_material_generator.py	                        (rev 0)
+++ contrib/py/scripts/addons/gyes/random_material_generator.py	2011-10-24 06:56:40 UTC (rev 2517)
@@ -0,0 +1,892 @@
+# -*- coding: UTF-8 -*-
+# first we import all the required modules
+
+import bpy ,random , copy 
+from bpy.props import *
+import textwrap
+
+def h_names(self,contex):
+    h_list=list(rm.rm_history)
+    h_list.sort()
+    names=[]
+    for x in h_list:
+        names=names+[(x,x,x)]
+    return names 
+class random_material_class:
+    """ this class contains all fuctions and variables concerning generation of random material """
+    
+    def __init__(self):
+        """ several fuctions can be found here . All options for random generation . The History dictionary and several others."""
+                   
+        # various gui modes (simple, template etc)
+        bpy.types.Scene.gui_mode = EnumProperty(attr='mode', name='Mode', items=(
+('simple', 'Simple', 'The first item'),
+('simple_percentage', 'Simple percentage' , 'here you define individual percentage'),
+('templates', 'Templates', 'The second item'),
+('help', 'Help', 'The third item')), default='simple')
+
+        # Here I define the selective areas that the user can enable or disable for randomisation in simple mode               
+                     
+        bpy.types.Scene.rdiffuse_shader = BoolProperty(name= "Diffuse Shader" ,description = "Enable/Disable Randomisation for the  Diffuse Shader " , default = True)
+        bpy.types.Scene.rdiffuse_color = BoolProperty(name= "Diffuse Color" ,description = "Enable/Disable Randomisation for the Diffuse Color", default = True  )
+        bpy.types.Scene.rdiffuse_intensity = BoolProperty(name= "Diffuse Intensity" ,description = "Enable/Disable Randomisation for the Diffuse Intensity" , default = True )    
+        bpy.types.Scene.rspecular_color = BoolProperty(name= "Specular Color" ,description = "Enable/Disable Randomisation for the Specular Color" , default = True)
+        bpy.types.Scene.rspecular_shader = BoolProperty(name= "Specular Shader" ,description = "Enable/Disable Randomisation for the Specular Shader" , default = True)
+        bpy.types.Scene.rspecular_intensity = BoolProperty(name= "Specular Intensity" ,description = "Enable/Disable Randomisation for the Specular Intensity" , default = True)
+        bpy.types.Scene.rspecular_hardness = BoolProperty(name= "Specular Hardness" ,description = "Enable/Disable Randomisation for the Specular Hardness" , default = True)
+        bpy.types.Scene.rtransparency = BoolProperty(name= "Transparency" ,description = "Use and Randomise Transparency" , default = True)
+        bpy.types.Scene.rtexture = BoolProperty(name= "Texture" ,description = "Use and Randomise Textures" , default = True)
+        
+        # Percentage randomisation
+        bpy.types.Scene.general_percentage = IntProperty(name="General percentage", description = " General percentage of randomisation" , min = 0 , max = 100 , default = 100, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rdiffuse_shader_percentage =  IntProperty(name="Diffuse shader", description = " Diffuse shader percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rdiffuse_color_percentage =  IntProperty(name="Diffuse Color", description = " Diffuse Color percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rdiffuse_intensity_percentage =  IntProperty(name="Diffuse Intensity", description = " Diffuse Intensity percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rspecular_color_percentage =  IntProperty(name="Specular Color", description = " Specular Color percentage of randomisation" , min = 0 , max = 100 , default = 0 , subtype = 'PERCENTAGE')
+        bpy.types.Scene.rspecular_shader_percentage =  IntProperty(name="Specular Shader", description = " Specular Shader percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rspecular_intensity_percentage =  IntProperty(name="Specular Intensity", description = " Specular Intensity percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rspecular_hardness_percentage =  IntProperty(name="Specular Hardness", description = " Specular Hardness percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        bpy.types.Scene.rtransparency_percentage =  IntProperty(name="Transparency", description = " Transparency percentage of randomisation" , min = 0 , max = 100 , default = 0, subtype = 'PERCENTAGE')
+        
+        # this is the dictionary that stores history
+        bpy.types.Scene.history_index = IntProperty(name= "History Index" ,description = "The Number of Random Material Assigned to the Active MAterial of the Selected Object from the history" , default = 1, min = 1 )
+        bpy.types.Scene.filter = StringProperty(name="Filter", description ="Filter text , only if the text matches even partially with the material name will be stored")
+        self.rm_history={"slot 01":{1:{}} , "slot 02":{1:{}} , "slot 03":{1:{}} ,"slot 04":{1:{}} ,"slot 05":{1:{}} ,"slot 06":{1:{}} ,
+                         "slot 07":{1:{}} ,"slot 08":{1:{}} , "slot 09":{1:{}} , "slot 10":{1:{}} ,"slot 11":{1:{}} ,"slot 12":{1:{}} }
+        self.delete_start_index=1
+        bpy.types.Scene.h_selected = EnumProperty(attr='name', name='Name :', items=h_names)
+        
+        
+        # the prop that controls the text wrap in help menu
+        bpy.types.Scene.text_width = IntProperty(name = "Text Width" , description = "The width above which the text wraps" , default = 20 , max = 180 , min = 1)
+        
+        # here is where history dictionary is saved with the blend file
+        # if the backup is already saved with the blend file it is used 
+        # to restory the history dictionary , if not it is created
+        
+        if hasattr(bpy.context.scene , "historybak")==False:
+            bpy.types.Scene.historybak = StringProperty()
+            print("created history backup")
+            
+         # non read only material properties where keyframes can be inserted or removed
+        self.animated_properties=["alpha",
+        "ambient",
+        "darkness",
+        "diffuse_color",
+        "diffuse_fresnel",
+        "diffuse_fresnel_factor",

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list