Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bl_info = {
- "name": "Random Word Generator",
- "author": "Darkfall",
- "version": (1, 0),
- "blender": (2, 90, 1),
- "location": "View3D > N > Random Word Gen Tab",
- "description": "Generates a Random Phrase",
- "warning": "",
- "doc_url": "",
- "category": "Add Words",
- }
- import bpy
- from bpy.types import Panel, Operator, PropertyGroup
- from bpy.props import IntProperty, PointerProperty, BoolProperty
- from random import randint
- class RandomWordGenProperties(PropertyGroup):
- list_a = ["A", "Dr", "Mr", "Mrs", "Our", "The"]
- list_b = ["Adorable", "Adventurous", "Agressive", "Agreeable", "Angry", "Annoyed", "Annoying", "Anxious", "Arrogant", "Attractive", "Average", "Awful", "Bad", "Beautiful", "Better", "Bewildered", "Bloody", "Blushing", "Bored", "Brainy", "Brave", "Breakable", "Bright", "Broken", "Bronze", "Busy", "Calm", "Careful", "Cautious", "Charming", "Cheerful", "Clean", "Clear", "Clever", "Cloudy", "Clumsy", "Colorful", "Comfortable", "Condemned", "Confused", "Cooperative", "Courageous", "Crazy", "Creepy", "Crowded", "Cruel", "Curious", "Cute", "Dangerous", "Dark", "Dead", "Defeated", "Defiant", "Delightful", "Depressed", "Determained", "Different", "Difficult", "Disgusted", "Doubtful", "Dull", "Eager", "Easy", "Elated", "Elegant", "Embarrassed", "Enchanting", "Encouraging", "Energetic", "Enthusiastic", "Envious", "Evil", "Excited", "Expensive", "Exuberant", "Faithful", "Famous", "Fancy", "Fantastic", "Fierce", "Filthy", "Fine", "Foolish", "Fragile", "Frail", "Frantic", "Friendly", "Frightened", "Frozen", "Funny", "Gentle", "Gifted", "Glamorous", "Gleaming", "Glorious", "Good", "Gold", "Golden", "Gorgeous", "Graceful", "Greiving", "Grotesque", "Grumpy", "Handsome", "Happy", "Healthy", "Helpful", "Helpless", "Hilarious", "Horrible", "Hungry", "Hurt", "Important", "Impossible", "Industrial", "Inexpensive", "Innocent", "Inquisitive", "Itchy", "Jelous", "Jolly", "Joyous", "Kind", "Lazy", "Light", "Lively", "Lonely", "Long", "Lovely", "Lucky", "Magnificent", "Misty", "Modern", "Motionless", "Muddy", "Mushy", "Mysterious", "Nasty", "Naughty", "Nervous", "Never-ending", "Nice", "Obedient", "Obnoxious", "Odd", "Old", "Old-fashoined", "Open", "Outrageous", "Outstanding", "Perfect", "Plain", "Pleasant", "Poised", "Poor", "Powerful", "Precious", "Proud", "Putrid", "Puzzled", "Quaint", "Real", "Relieved", "Repulsive", "Rich", "Righteous", "Rival", "Rusty", "Secret", "Scary", "Silver", "Silvery", "Selfish", "Shiny", "Shy", "Silly", "Sleepy", "Smiling", "Sore", "Sparkling", "Splendid", "Spotless", "Stalking", "Steady", "Strange", "Stranger", "Stupid", "Subtle", "Successful", "Super", "Talented", "Tame", "Tender", "Tense", "Terrible", "Thankful", "Thoughful", "Thoughtless", "Tired", "Tough", "Troubled", "Ugliest", "Ugly", "Unsightly", "Unusual", "Upset", "Uptight", "Vast", "Victorious", "Wandering", "Weary", "Wicked", "Wild", "Witty", "Worried", "Wrong", "Zelous"]
- list_c = ["Actor", "Anchor", "Antagonist", "Apple", "Angel", "Angle", "Army", "Astronaut", "Ball", "Balloon", "Beach", "Bear", "Beast", "Book", "Brain", "Cake", "Castle", "Coast", "Colony", "Complex", "Conundrum", "Core", "Crowd", "Dancer", "Detective", "Detector", "Devil", "Director", "Diver", "Driver", "Express", "Factory", "Family", "Forest", "Future", "Gamer", "Garden", "Hacker", "Hangman", "History", "House", "Idea", "Island", "Jail", "Jester", "Joker", "King", "Knight", "Lake", "Lighthouse", "Matrix", "Mind", "Monument", "Moon", "Mountain", "Navy", "Nail", "Night", "Office", "Officer", "Operator", "Page", "Park", "Path", "Pickle", "Pizza", "Place", "Planet", "Player", "Picture", "Price", "Prince", "Princess", "Prison", "Program", "Programmer", "Protagonist", "Queen", "Razor", "Rifle", "Ring", "Reptile", "Road", "River", "Science", "Situation", "Society", "Soldier", "Sound", "Steed", "Story", "Surface", "Tavern", "Tower", "Traveler", "Tree", "Undead", "Unicorn", "Vampire", "Warrior", "Wizard", "World", "Wolf", "Zombie"]
- number_1 : IntProperty(default= 0)
- number_2 : IntProperty(default= 0)
- number_3 : IntProperty(default= 0)
- number_4 : IntProperty(default= 1)
- word_count : IntProperty(default= 3, min= 1, max= 3, description= "Select How Many Words to be Generated")
- wc_bool : BoolProperty(default= False, description= "Selecting this Option will randomize the Word Count")
- class RANDOMWORDGEN_PT_main_panel(Panel):
- bl_label = "Random Word Generator"
- bl_idname = "RANDOMWORDGEN_PT_main_panel"
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'UI'
- bl_category = "Random Word Gen"
- def draw(self, context):
- layout = self.layout
- scene = context.scene
- mytool = scene.my_tool
- wc = mytool.word_count
- r_wc = mytool.wc_bool
- if r_wc == False:
- layout.prop(mytool, "word_count", text= "Word Count")
- row = layout.row()
- if wc >= 1:
- row.label(text= mytool.list_a[mytool.number_1])
- if wc >= 2:
- row.label(text= mytool.list_b[mytool.number_2])
- if wc >= 3:
- row.label(text= mytool.list_c[mytool.number_3])
- else:
- row = layout.row()
- if mytool.number_4 >= 1:
- row.label(text= mytool.list_a[mytool.number_1])
- if mytool.number_4 >= 2:
- row.label(text= mytool.list_b[mytool.number_2])
- if mytool.number_4 >= 3:
- row.label(text= mytool.list_c[mytool.number_3])
- layout.prop(mytool, "wc_bool", text= "Randomize Word Count")
- layout.operator("randomwordgen.myop_operator")
- class RANDOMWORDGEN_OT_my_op(Operator):
- bl_label = "Generate Random Words"
- bl_idname = "randomwordgen.myop_operator"
- def execute(self, context):
- scene = context.scene
- mytool = scene.my_tool
- a = 0
- b2 = len(mytool.list_a)
- b = b2 - 1
- c2 = len(mytool.list_b)
- c = c2 - 1
- d2 = len(mytool.list_c)
- d = d2 - 1
- e = 1
- f = 3
- r1 = randint(a, b)
- r2 = randint(a, c)
- r3 = randint(a, d)
- r4 = randint(e, f)
- mytool.number_1 = r1
- mytool.number_2 = r2
- mytool.number_3 = r3
- mytool.number_4 = r4
- return {'FINISHED'}
- classes = [RandomWordGenProperties, RANDOMWORDGEN_PT_main_panel, RANDOMWORDGEN_OT_my_op]
- def register():
- for cls in classes:
- bpy.utils.register_class(cls)
- bpy.types.Scene.my_tool = PointerProperty(type= RandomWordGenProperties)
- def unregister():
- for cls in classes:
- bpy.utils.unregister_class(cls)
- del bpy.types.Scene.my_tool
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement