Free Blender 3D Python Script

I have been working a bit with Python and Blender watching YouTube videos and searching for information on Python Scripting, particularly in Blender. The ability to use Timers could be more intuitive by default. Accessing the Info panels with messages could possibly be easier as well. Here is some information to help others where I have spent some time. There is reason to use built in keyframe system over timers, yet key frames seems a bit heavy in certain cases like if I were to run animation as part of a geometry node (Geometry nodes don’t currently add key frames when using Scene Time node).

I was looking for an alert function, printing text, creating an alert window seems like it should be easier and more intuitive. I found how to create a beep though it seemed to not always play, not always reliable, and can be annoying with speakers set to high volume (like when listening to videos with volume levels at different rates). Less tests can like annoying sounds can be power that is not always fully appreciated.

Thus that is what factored into my creation of the following script:

import bpy
import winsound
import time

def beep():
        duration = 1000 # milliseconds
        freq = 440 # Hzs
        winsound.Beep(freq,duration)
        
counter = 0
        
def update():
    global counter
    counter += 1
    bpy.context.active_object.location.x -= 0.1
    bpy.context.active_object.scale.x += 0.05
    bpy.context.active_object.scale.y += 0.05
    bpy.context.active_object.scale.z += 0.05
    if counter >= 100:
        return None
    return 0.05

class MyOperator(bpy.types.Operator):
    """The Tooltip"""
    bl_idname = "my_operator.test_print"
    bl_label = "Operator Test"
    
    def execute(self, context):
        global counter
        print("Test Operator"+" testString")
        # duration = 1000 # milliseconds
        # freq = 440 # Hzs
        # winsound.Beep(freq,duration)
        # self.report({'WARNING'},"Warning Message")
        self.report({'INFO'},"Information Message")
        
        activeObject = bpy.context.active_object
        
        # start_frame = 1
        # activeObject.keyframe_insert("location", frame=start_frame)
        
        # activeObject.location.x = 5
        # activeObject.location.y = 5
        
        # last_frame = 250
        # activeObject.keyframe_insert("location", frame=last_frame)
        
        #for x in range(10):
         #   activeObject.location.x += 1
            # self.report({'INFO'},"Information Message")
         #   bpy.context.scene.frame_set(1)
            # time.sleep(0.1)
        counter=0
        bpy.app.timers.register(update)
        
        # bpy.ops.transform.translate(value=(0, 1, 0), orient_type='GLOBAL',
        # orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL',
       #   constraint_axis=(False, True, False), mirror=False, use_proportional_edit=False, 
        #  proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False,
        #   use_proportional_projected=False, snap=False, snap_elements={'INCREMENT'}, use_snap_project=False, 
        #   snap_target='CLOSEST', use_snap_self=True, use_snap_edit=True, use_snap_nonedit=True, 
         #  use_snap_selectable=False, release_confirm=True)
        return {'FINISHED'}
    
class MyOperator_Stop(bpy.types.Operator):
    """The Tooltip"""
    bl_idname = "my_operator.stop_timer_animation"
    bl_label = "Operator Test"
    
    def execute(self, context):
        global counter
        counter=101
        return {'FINISHED'}    

class TestPanel(bpy.types.Panel):
   bl_label = "Test Panel"
   bl_idname = "PT_TestPanel"
   bl_space_type = 'VIEW_3D'
   bl_region_type = 'UI'
   bl_category = 'My 1st Addon'
   
   def draw(self, context):
        layout = self.layout        
        row = layout.row()
        # row.operator("mesh.primitive_cube_add",text="Add an object", icon= 'CUBE')
        row.operator("my_operator.test_print",text="Timer Animation", icon= 'CUBE')
        row = layout.row()
        row.operator("my_operator.stop_timer_animation",text="Stop Timer Animation")
        row = layout.row()

        
def register():
    bpy.utils.register_class(TestPanel)
    print('Classes Registered')
    bpy.utils.register_class(MyOperator)
    bpy.utils.register_class(MyOperator_Stop)

def unregister():
    bpy.utils.unregister_class(TestPanel)
    bpy.utils.unregister_class(MyOperator)
    bpy.utils.register_class(MyOperator_Stop)
    
if __name__ == "__main__":
    register()

Tried using time.sleep which seemed to freeze the User Interface, and tried some context.scene.update functions that did not seem to work.

Trying to be helpful, would like to create a live Java Integration to Blender that would allow people to control animations in Blender via a JavaFX User Interface or other methods. Potentially using the updates to Java Native Interface or possibly a UDP packet system (might allow for other systems to utilize). Think there are some Java Python integrations already out there that might be useful.

Might be cool to have a tight integration with exporting and pipeline process – https://www.lwjgl.org/. Workflow that is easy factors into use. Tools like 3D and Artwork will likely become more important as time goes on with Pattern Matching and Artificial Intelligence, potentially allowing things never dreamt of as possible.

Better tools faster factors into more time for projects like Cancer Research. Less War, Less Oppression is the true enabler of Clean Rooms and Fabrication units that don’t burn down, and thus faster processors that factor into a more enabled future.

Animation Tools matter greatly, or they don’t?

Also important to remember that people, Engineers and Companies design, build, deliver the equivalent of 3D Printers and do not always clean up after themselves. Hubris would say I am not from Cambodia, I don’t think like a Cambodian, I could never end up like a Cambodian. A more sober look could say I don’t want to end up like a Cambodian looking down from heaven waiting for others to fall into a bear trap I left with the purpose of protection.

What has the potential to help Cure Cancer also has the potential to lead to more landmines that children fall over. A World more responsible with the Power it is given is far from a given.

Engineering systems require safety valves to operate effectively many times. High Voltage equipment requires High Voltage signs. That is easier to deliver in good financial times, times where the government is not deeply in debt and is subject to greater levels of corruption. Engineers and Designers many times make decisions based on desire to help humanity without factoring in that situations change dynamically and dramatically sometimes. Hard to factor in, does not equal zero need to factor in. 20 years from now will a high voltage sign still stand? Will that High Voltage sign be under less maintenance due to increased financial constraints? This is the kind of stuff we are facing in our country today, at least as far as I can tell, from very limited and obfuscated information.

https://www.usdebtclock.org/ bigger the numbers the less ability to gauge and appreciate in a meaningful way, less meaningful factors into less realism, less realism has potential for dangerous to both Power and the People they represent.

Tools that people rely upon being broken, working less efficiently due to others disabling factors into reduced ability to maintain, and increase time losses. I feel like tools and software systems that make our World run have been effectively protected and maintained in our system? No. Could be much worse does not equal could not be much better. A system that does not value the time and talents of individuals is likely to pay that price in reduced support and maintenance.

Imagine someone is slashing your tires. You could potentially have to go to the emergency room then find out your tires are slashed. Is the key to grow thicker skin, just drive with slashed tires? Or is the better solution to prevent the people from slashing tires in the first place. Heard a sermon today about growing thicker skin, not sure that it is always wise to allow Oppression to manifest and amplify over time with no consequences. Eye for an eye would say slash their tires, yet that is not really ideal, then a third party shows up needs to go to the emergency room and neither person can take them. Wasting time, breaking support is potentially seen as useful until it is not.

Less maintainable and less trustable factors into less ability to trust who is in jail and prison and who is out is delivered and declared for the right, justified reasons. Databases are less than ideally secure, and system has presented in very insecure ways over the past many years. Part of society that is in Jail is likely innocent, or at the very least have had their support, story, and message turned down in very real ways, ways that might be highly probable of leading to crimes in much of the population. Easy to think one self above the tests, never able to fall victim to bad choices. That hubris has potential to lead to what parties people go to, what drugs they allow to be around them. If bad things only happen one out of 20 days, that is much greater chance than winning the lottery. Early divest is power not always fully pondered.

I can handle the problems (that I can’t see and likely won’t know how to fully handle) or go to the library and read where there will be less problems? One might have a thicker skin, one might solve more problems. Acting out of fear is unwise, easy to equate wiser choices, choices that increase risk mitigation and reduce probability to fear. The one that goes to the party might be more likely to run into a burning building to save someone. Burning buildings without proper protective gear might lead to more people in trouble with a still small amount of time to save them. Being a Hero in the right way, potentially not always fully pondered. Not all step up to solve problems, those that do should be rewarded, are many times mistreated based upon the risk they generate. Do those same heroes take time beforehand to think about risk mitigation?

Of course knowing the risk might lead to more heroes divesting in advance. Knowing more reasons to fear always ideal value added? I am not a fire fighter, I am not someone that plants landmines, talking and writing about dangers might lead people to believe things about me that are not true. Trying to have a conversation is a risk, a risk that is not always ideally mitigated.

Conversation is not always rewarded, and is not zero cost. Trying to make a difference has potential for upsold to easier than it is. Oppression is less than ideal value out, Reduced Miscommunication and even self’s Comprehension is less than ideal value in.

Conversation has potential for showing where you are wrong. I might have been able to not have issues with things I thought in the past because I haven’t had real conversation about them? True. Highlighting selves wrongs do not always lead to ideal oppression, max profit of other parties reduced. I feel like God makes up the difference sufficiently? Not really as of late.

Showing where wrong within the right environment has potential to lead to positive challenges and positive change, real conversation. The situation has given feeling, experience of right environment? Not for a long time. Reduced capacity out does not equal ideal value in. People that are pro defense oppressed is a problem not all fully appreciate.

The databases that have the potential to set citizens to Criminal, 100 years have potential for edited and delivered based upon max profit, a known corrupt and insufficient system.

Secure systems, those securing systems more enabled factors into life and death and is currently not being sufficiently delivered at least in part of Texas.

The police always listen to experts that have been in Jail even if removed from record? Removed not removed in by design equals corrupt. Any engineer that presses a delete button and the item doesn’t delete, wouldn’t say hey that system is secure, works properly, is bug free.

Published by techinfodebug

Flex and Java Developer, Christian, Art, Music, Video, and Vlogging

Leave a comment