This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the Python Standard and DesignScript Libraries | |
import sys | |
import clr | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
# import doc manager | |
# Use this to access the hidden RVT DB | |
clr.AddReference("RevitServices") | |
import RevitServices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is a class | |
class Crop: | |
#This is how you define an instance of a class. | |
# __init__ is the 'constructor' or the function that is used when you generate a new instance of the class. | |
# notice that one of the arguments in the constructor is self. | |
# When you refer to 'self', you are referring to a property or function stored in the instanced class. | |
# 'self' is always passed as an argument when defining a function within a class - it needs to know its talking about itself! | |
def __init__(self, cropType): | |
# As part of creating an instance of the Crop class, we want to assign a cropType to it. | |
# we are taking the argument passed in the Constructor, and assigning it to a variable called cropType. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from bpy.types import (PropertyGroup) | |
from bpy.props import (StringProperty, PointerProperty, CollectionProperty, BoolProperty) | |
C = bpy.context | |
D = bpy.data | |
class odalysProperties(PropertyGroup): | |
target_collection: PointerProperty( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to Christopher Baumeister on BlenderArtists for the base script. | |
# I have added logic for nested collections. | |
# Original topic: https://blenderartists.org/t/blender-2-8-export-fbx-while-keeping-collections-hierarchy/1142655/5 | |
import bpy | |
sCollection = bpy.context.collection | |
def parentCol(_colParent, _objParent): | |
for col in _colParent.children: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Document} from "@gltf-transform/core"; | |
export default function DedupMaterials(document) { | |
const root = document.getRoot() | |
const root_mats = root.listMaterials() | |
root_mats.forEach((mat) =>{ | |
if (mat.getName() === root_mats[0].getName() && mat !== root_mats[0]){ | |
mat.detach() | |
mat.dispose() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pan | |
if (Input.GetMouseButton(1)) // right click | |
{ | |
// Clamp bounds of *rig* | |
positionZ = Input.GetAxis("Mouse X") * moveSpeed; | |
positionY = -Input.GetAxis("Mouse Y") * moveSpeed; | |
// clamp position | |
newPosition.z += positionZ; | |
newPosition.y += positionY; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Vector3 ClampPosition(Vector3 pos, Bounds bounds) | |
{ | |
// if pos.x > bounds.max.x | |
// pos.x = bounds.min | |
// if pos.x < bounds.min.x | |
// pos.x = bounds.min.x | |
// if pos.y > bounds.max.y | |
// pos.y = bounds.max.y | |
// if pos.y < bounds.min.y | |
// pos.y = bounds.min.y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CameraRigController : MonoBehaviour | |
{ | |
public float moveSpeed; | |
public float moveTime; | |
public float rotationAmount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from random import uniform | |
def random_scale_action(): | |
action = bpy.data.actions.new("RandomScaleAction") | |
data_path = "scale" | |
# (frame, value) for keyframe point | |
for axis in [0, 1, 2]: | |
# new fcurve | |
fc = action.fcurves.new(data_path, index=axis) |