[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4150] moving to archive

Brendon Murphy meta.androcto1 at gmail.com
Mon Jan 7 01:01:59 CET 2013


Revision: 4150
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4150
Author:   meta-androcto
Date:     2013-01-07 00:01:57 +0000 (Mon, 07 Jan 2013)
Log Message:
-----------
moving to archive 
gyes: broken & unmaintained
fiber: broken & unmaintained

Modified Paths:
--------------
    branches/broken_stuff/README

Added Paths:
-----------
    branches/broken_stuff/mesh_fiber.py

Removed Paths:
-------------
    contrib/py/scripts/addons/gyes/
    contrib/py/scripts/addons/mesh_fiber.py

Modified: branches/broken_stuff/README
===================================================================
--- branches/broken_stuff/README	2013-01-06 22:37:55 UTC (rev 4149)
+++ branches/broken_stuff/README	2013-01-07 00:01:57 UTC (rev 4150)
@@ -1,2 +1,2 @@
-this section is for scripts that are in our svn, either cob=ntrib or trunk/release.
+this section is for scripts that are in our svn, either contrib or trunk/release.
 if they don't work, they go here, if no-one fixes them, they are put back to upload in blender projects.
\ No newline at end of file

Added: branches/broken_stuff/mesh_fiber.py
===================================================================
--- branches/broken_stuff/mesh_fiber.py	                        (rev 0)
+++ branches/broken_stuff/mesh_fiber.py	2013-01-07 00:01:57 UTC (rev 4150)
@@ -0,0 +1,1339 @@
+
+#Fiber Generator V3 - June 5th, 2012
+#Created by Alan Dennis (RipSting)
+#dennisa at onid.orst.edu
+#Updated for 2.6 by Gert De Roost (paleajed)
+#_________________________________________________
+#Special thanks to Alfredo de Greef (Eeshlo) for
+#providing the DyNoise module and the multmat
+#and renormal subroutines!!!
+#Thanks goes out to Peter De Bock for
+#fixing the vertex color problems!!!
+#_________________________________________________
+
+
+
+#--------------I N F O R M A T I O N--------------
+#
+#Go to user preferences->addons and navigate to Mesh category
+#Enable Fiber addon.  Subpanel will appear in Tools panel.
+#
+#You must have at least one mesh object selected.
+#You may select multiple mesh objects for the script
+#to run on.
+
+bl_info = {
+    "name": "Fiber",
+    "author": "Alan Dennis - Gert De Roost",
+    "version": (3, 1, 0),
+    "blender": (2, 64, 0),
+    "location": "View3D > Mesh Tools",
+    "description": "Generates mesh grass or hair",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=32802",
+    "category": "Mesh"}
+
+if "bpy" in locals():
+	import imp
+
+import bpy
+import bmesh
+import os
+
+from math import pow
+import string
+from mathutils import *
+from mathutils.noise import random, hetero_terrain as HTerrain, seed_set as InitNoise
+
+
+
+seed = 1
+CurVersion = "3"
+txtFollowtext = "Follow Normals / Z-Axis"
+
+
+#Get the current .fib filename
+bpy.context.user_preferences.filepaths.use_relative_paths = 0
+a = bpy.data.filepath
+b = os.path.dirname(a)
+a = a.split(os.sep)[len(a.split(os.sep)) -1]
+fname = b + os.sep + str(a.split(".")[0]) + ".fib"
+fname = fname.replace("//", "")
+
+
+
+bpy.types.Scene.txtFile = bpy.props.StringProperty(
+		name="Set file",
+#		attr="custompath",# this a variable that will set or get from the scene
+		description="",
+		maxlen= 1024,
+		subtype='FILE_PATH',
+		default= fname)
+	
+bpy.types.Scene.txtFaces = bpy.props.StringProperty(
+		name="",
+		description="",
+		maxlen= 1024,
+		default= "")
+
+
+bpy.types.Scene.chkPointed = bpy.props.BoolProperty(
+		name = "Pointed", 
+		description = "Pointed?",
+		default = False)
+	
+bpy.types.Scene.chkVCol = bpy.props.BoolProperty(
+		name = "Use VCol", 
+		description = "Use VCol?",
+		default = False)
+	
+bpy.types.Scene.chkWind = bpy.props.BoolProperty(
+		name = "Use Wind", 
+		description = "Use Wind?",
+		default = False)
+	
+bpy.types.Scene.chkGuides = bpy.props.BoolProperty(
+		name = "Use Guides", 
+		description = "Use Guides?",
+		default = False)
+
+
+
+bpy.types.Scene.sldDensity = bpy.props.FloatProperty(
+		name = "Density", 
+		description = "Enter density",
+		default = 5,
+		min = 0,
+		max = 50)
+
+bpy.types.Scene.sldSegments = bpy.props.IntProperty(
+		name = "Segments", 
+		description = "Enter segments",
+		default = 3,
+		min = 1,
+		max = 20)
+
+bpy.types.Scene.sldLength = bpy.props.FloatProperty(
+		name = "Length of Segment", 
+		description = "Enter segment length",
+		default = 5,
+		min = 0,
+		max = 50)
+
+bpy.types.Scene.sldSegRand = bpy.props.FloatProperty(
+		name = "Randomize Length %", 
+		description = "Enter Randomize Length %",
+		default = 0,
+		min = 0,
+		max = 1.0)
+
+bpy.types.Scene.sldWidth = bpy.props.FloatProperty(
+		name = "Width", 
+		description = "Enter Width",
+		default = 3,
+		min = 0,
+		max = 20)
+
+bpy.types.Scene.sldGravity = bpy.props.FloatProperty(
+		name = "Gravity", 
+		description = "Enter Gravity",
+		default = 2,
+		min = 0,
+		max = 20)
+
+bpy.types.Scene.sldInit = bpy.props.FloatProperty(
+		name = "Initial Gravity", 
+		description = "Enter Initial Gravity",
+		default = 0,
+		min = 0,
+		max = 50)
+
+bpy.types.Scene.sldRand = bpy.props.FloatProperty(
+		name = "Randomize Direction", 
+		description = "Enter Randomize Direction",
+		default = 5,
+		min = 0,
+		max = 50)
+
+bpy.types.Scene.sldRloc = bpy.props.FloatProperty(
+		name = "Frizziness", 
+		description = "Enter Frizziness",
+		default = 0,
+		min = 0,
+		max = 50)
+
+bpy.types.Scene.sldFollow = bpy.props.FloatProperty(
+		name = "Normals / Clumpiness", 
+		description = "Enter Normals / Clumpiness",
+		default = 1,
+		min = 0,
+		max = 1)
+
+bpy.types.Scene.sldFalloff = bpy.props.FloatProperty(
+		name = "Clumpiness Falloff", 
+		description = "Enter Clumpiness Falloff",
+		default = 2,
+		min = 0,
+		max = 10)
+
+bpy.types.Scene.sldControl = bpy.props.IntProperty(
+		name = "Fiber Guides", 
+		description = "Enter Fiber Guides",
+		default = 10,
+		min = 3,
+		max = 100)
+
+bpy.types.Scene.sldCtrlSeg = bpy.props.IntProperty(
+		name = "Fiber Guide Segments", 
+		description = "Enter Fiber Guide Segments",
+		default = 4,
+		min = 3,
+		max = 4)
+
+
+class FiberPanel(bpy.types.Panel):
+	bl_label = "Fiber"
+	bl_space_type = "VIEW_3D"
+	bl_region_type = "TOOLS"
+	bl_options = {'DEFAULT_CLOSED'}
+
+	def draw(self, context):
+
+		scn = bpy.context.scene
+		layout = self.layout
+		
+		layout.label("Fiber Generator-	Version " + str(CurVersion), icon = 'PLUGIN')
+	
+		row = layout.row()
+		row.operator("fiber.savepreset", text="Save Preset")
+		row.operator("fiber.loadpreset", text="Load Preset")
+#		row.operator("fiber.exit", text="Exit")
+		layout.prop(scn, "txtFile")
+		
+		layout.prop(scn, "sldDensity")
+		layout.prop(scn, "sldSegments")
+		layout.prop(scn, "sldLength")
+		layout.prop(scn, "sldSegRand")
+		layout.prop(scn, "sldWidth")
+		layout.prop(scn, "sldGravity")
+		layout.prop(scn, "sldInit")
+		layout.prop(scn, "sldRand")
+		layout.prop(scn, "sldRloc")
+		layout.prop(scn, "sldFollow")
+		layout.prop(scn, "sldFalloff")
+		layout.prop(scn, "sldControl")
+	
+		row = layout.split(0.8)
+		row.prop(scn, "sldCtrlSeg")
+		row.operator("fiber.make", text="Make")
+		
+		row = layout.row()
+		row.prop(scn, "chkPointed")
+		row.prop(scn, "chkVCol")
+		row.prop(scn, "chkWind")
+		row.prop(scn, "chkGuides")
+	
+		row = layout.row()
+		row.operator("fiber.estimate", text="Estimate Faces")
+		row.prop(scn, "txtFaces")
+		row.operator("fiber.create", text="Create")
+
+		updatepars()
+
+
+
+class SavePreset(bpy.types.Operator):
+	bl_idname = "fiber.savepreset"
+	bl_label = ""
+	bl_description = "Saves .fib preset"
+
+	def invoke(self, context, event):
+		
+		scn = bpy.context.scene
+		SavePreset(scn.txtFile)
+
+		return {'FINISHED'}
+
+class LoadPreset(bpy.types.Operator):
+	bl_idname = "fiber.loadpreset"
+	bl_label = ""
+	bl_description = "Loads .fib preset"
+
+	def invoke(self, context, event):
+		
+		scn = bpy.context.scene
+		LoadPreset(scn.txtFile)
+
+		return {'FINISHED'}
+
+class Exit(bpy.types.Operator):
+	bl_idname = "fiber.exit"
+	bl_label = ""
+	bl_description = "Exits Fiber"
+
+	def invoke(self, context, event):
+		
+		pass
+
+		return {'FINISHED'}
+
+class Make(bpy.types.Operator):
+	bl_idname = "fiber.make"
+	bl_label = ""
+	bl_description = "Make fiber guide segments"
+
+	def invoke(self, context, event):
+		
+		scn = bpy.context.scene
+		ControlPoints(scn.sldControl, scn.sldCtrlSeg)
+
+		return {'FINISHED'}
+
+class EstimateFaces(bpy.types.Operator):
+	bl_idname = "fiber.estimate"
+	bl_label = ""
+	bl_description = "Estimate # faces"
+
+	def invoke(self, context, event):
+		
+		global tempbm, firstrun
+		
+		scn = bpy.context.scene
+		faces = 0
+		objects = bpy.context.selected_objects
+		mat = adapt(objects[0])
+		tempbm = bmesh.new()
+		for num in range(len(objects)):
+			original = objects[num].data
+			bm = bmesh.new()
+			bm.from_mesh(original)
+			newbm = bmesh.new()
+			for fa in bm.faces:
+				faces += (int(fncArea(fa,mat) * scn.sldDensity))
+		scn.txtFaces = str(faces *2)
+		print (str(faces *2) + " faces predicted")
+
+		return {'FINISHED'}
+
+class Create(bpy.types.Operator):
+	bl_idname = "fiber.create"
+	bl_label = ""
+	bl_description = "Create faces"
+
+	def invoke(self, context, event):
+		
+		RunFiber()
+
+		return {'FINISHED'}
+
+
+
+def register():
+	bpy.utils.register_module(__name__)
+
+
+def unregister():
+	bpy.utils.unregister_module(__name__)
+
+
+if __name__ == "__main__":
+	register()
+
+
+
+
+
+#	elif evt == 72: #Use Wind
+#		if chkWind.val == 1:
+#			try:
+#				Wind = Object.Get("Wind")
+#				test = Wind.LocY
+#			except:
+#				Wind = Object.New(Object.Types.EMPTY)
+#				Wind.name = "Wind"
+#
+#				Wind.LocX = 0.0
+#				Wind.LocY = 0.0
+#				Wind.LocZ = 0.0
+#				Wind.RotX = 0.0
+#				Wind.RotY = 0.0
+#				Wind.RotZ = 0.0
+
+
+def SavePreset(FName):
+
+	FName = FName.replace("//", "")
+	try:
+		f = open(FName,'w')
+	except:
+		message = "unable to save file."
+		return
+	
+	writeln(f,CurVersion)
+	
+	scn = bpy.context.scene
+	writeln(f, scn.sldDensity)
+	writeln(f, scn.sldGravity)
+	writeln(f, scn.sldSegments)
+	writeln(f, scn.sldLength)
+	writeln(f, scn.sldWidth)
+	writeln(f, scn.sldInit)
+	writeln(f, scn.sldRand)
+	writeln(f, scn.sldRloc)
+	writeln(f, scn.sldFollow)
+	writeln(f, scn.sldControl)
+	writeln(f, scn.sldCtrlSeg)
+	writeln(f, scn.sldSegRand)
+	writeln(f, scn.sldFalloff)
+		
+	if scn.chkPointed:
+		writeln(f, "1")
+	else:
+		writeln(f, "0")
+	if scn.chkVCol:
+		writeln(f, "1")
+	else:
+		writeln(f, "0")
+	if scn.chkWind:
+		writeln(f, "1")
+	else:
+		writeln(f, "0")
+	if scn.chkGuides:
+		writeln(f, "1")
+	else:
+		writeln(f, "0")
+	writeln(f,int(random()*1000))
+	writeln(f,1) #First Run
+	objects = bpy.context.selected_objects
+	for z in range(len(objects)):
+		writeln(f,objects[z].name)
+	f.close()
+
+def LoadPreset(FName):
+
+	global FVersion, seed, firstrun, objects
+
+	FName = FName.replace("//", "")
+	try:
+		f = open(FName,'r')
+	except:
+		message = "unable to open preset."
+		return
+	
+	FVersion = readfloat(f)
+	
+	scn = bpy.context.scene
+	scn.sldDensity	= readfloat(f)	
+	scn.sldGravity	= readfloat(f)

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list