Skip to content

Instantly share code, notes, and snippets.

View juliomarcos's full-sized avatar

Julio Marcos Bortolon Rodrigues juliomarcos

View GitHub Profile
@juliomarcos
juliomarcos / align_axis.py
Last active March 27, 2024 13:32
Puts the object on top of the xy grid-floor using an align to axis strategy
# This work comes directly from a tool available on the SideLabs houdini toolset
bl_info = {
"name": "Align object to axis",
"author": "Júlio Rodrigues",
"version": (0, 1),
"blender": (2, 80, 0),
"location": "View3D > Object > Align to Axis",
"description": "Align object to axis. Useful to put an object perfectly on top of the XY floor plane.",
"warning": "",
@juliomarcos
juliomarcos / boundary_from_top_vertice.py
Created February 6, 2020 21:20
Select the boundary loop adjacent to the faces connected to a top/center vertex
import bpy
addon_keymaps = []
def main(context):
bpy.ops.mesh.select_more()
bpy.ops.mesh.region_to_loop()
class BoundaryFromTopVertice(bpy.types.Operator):
"""Boundary loop from top poked faces vertice"""
import bpy
bl_info = {
"name": "FastMaterialAssign",
"author": "Júlio Rodrigues",
"version": (1, 0, 0),
"blender": (2, 80, 0),
"description": "Creates a Pie Menu for fast material assignment",
"category": "Face",
}
@juliomarcos
juliomarcos / clockwise-sort.py
Last active July 15, 2019 19:02
Sort shuffled circle points in clockwise order
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
import numpy as np
import math
import random
def circlePoints(sides, length=1):
angle = 0
angleInc = 2*math.pi / sides
@juliomarcos
juliomarcos / simpleTriToQuadInCircle.mel
Created July 10, 2019 19:44
Cheap trick to convert tris to quads in a pole circle
polyExtrudeVertex -constructionHistory 1 -width 0.5 -length 0 -divisions 1;
$allEdges = `polyListComponentConversion -fv -te`;
$allEdgesList = `ls -fl $allEdges`;
select -cl;
for($edge in $allEdgesList) {
string $tokens[];
tokenize $edge "[]" $tokens;
int $id = (int) $tokens[1];
if ($id % 2 == 0) {
$edgeName = $tokens[0] + "[" + $tokens[1] + "]";
@juliomarcos
juliomarcos / wireframeOnShaded.mel
Last active July 24, 2019 04:43
wireframeOnShaded MEL script
string $currPanel = `getPanel -withFocus`; // gets current panel with focus
string $panelType = `getPanel -to $currPanel`; // gets the panel type
// this is only applicable to the viewport (modelPanel in MEL's terminology)
if ($panelType == "modelPanel")
{
int $wireOn = `modelEditor -q -wireframeOnShaded $currPanel`; // queries wireframeonShaded state
$wireOn = !$wireOn; // toggles the mode
modelEditor -e -wireframeOnShaded $wireOn $currPanel; // finally sets the new mode
} else {
@juliomarcos
juliomarcos / WaveSpawner.cs
Last active July 18, 2018 05:17
Weighted Enemy Picker / Unity.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using System.Linq;
public enum WaveType {
Annihilation,
Timed,
@juliomarcos
juliomarcos / PlayerController.cs
Created July 3, 2018 19:10
Character grid movement using 1 movement input buffering and input filtering delay
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum PlayerState {
Idle,
Moving,
Hit,
Attack,
AttackMove
@juliomarcos
juliomarcos / MovingObject.cs
Created July 3, 2018 17:18
2D Roguelike Unity example project interesting snippets
using UnityEngine;
using System.Collections;
namespace Completed
{
//The abstract keyword enables you to create classes and class members that are incomplete and must be implemented in a derived class.
public abstract class MovingObject : MonoBehaviour
{
public float moveTime = 0.1f; //Time it will take object to move, in seconds.
public LayerMask blockingLayer; //Layer on which collision will be checked.
using CarboLog;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(DropsAnimator))]
public class Arbiter : MonoBehaviour {
const string DROP_TAG = "Drop";