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
""" | |
Manual implementation of the SDK chanmod double | |
""" | |
import lx | |
import lxifc | |
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
""" | |
Command to print the component under the mouse using lx api in Foundry Modo | |
To try it out, map the command to a hotkey and execute while mouse is over corresponding component. | |
py.mouse.component type:{vert|edge|poly} | |
You will likely want to use the already existing method |
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 lx | |
def get_command(name: str) -> lx.object.Command: | |
""" Spawn and return the command of given name """ | |
cmd_svc = lx.service.Command() | |
try: | |
tag = cmd_svc.Lookup(name) | |
return cmd_svc.Spawn(tag, name) | |
except RuntimeError as e: |
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
""" | |
Start a timer to call the function "hey" every half second. | |
Have yet to figure out how to kill this... | |
""" | |
import unreal |
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 random | |
import lx | |
import lxu | |
import lxu.attributes | |
import lxifc | |
class SelOp(lxifc.SelectionOperation, lxu.attributes.DynamicAttributes): | |
def __init__(self): |
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 lx | |
host_svc = lx.service.Host() | |
# look over all lx.symbol.a_* constants, | |
for k, v in lx.symbol.__dict__.items(): | |
if k.startswith("a_"): | |
print(f"{k}: {host_svc.NumServers(v)}") |
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 xml.etree.ElementTree as ET | |
import os | |
platform = lx.service.Platform() | |
configs = set() # all unique paths to config files | |
for i in range(platform.ImportPathCount()): | |
directory = platform.ImportPathByIndex(i) | |
for filename in os.listdir(directory): |
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
Shader "Custom/VertexWind" { | |
Properties { | |
_Color ("Color", Color) = (1,1,1,1) | |
_MainTex ("Albedo (RGB)", 2D) = "white" {} | |
_Glossiness("Smoothness", Range(0,1)) = 0.5 | |
_Metallic("Metallic", Range(0,1)) = 0.0 | |
_Normal("Normal Map", 2D) = "bump" {} | |
_CutOff("Alpha Cutoff", Range(0, 1)) = 0.5 |
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
# definitions for hlsl to be used for unreal shaders, usf, ush etc... | |
--langdef=hlsl | |
--map-hlsl=+.ush | |
--map-hlsl=+.usf | |
# for now just catch all functions, | |
# [a-zA-Z2-4]+ should match any type identifier, | |
# [a-zA-Z_]+ should match the function names, | |
# \((([a-zA-Z2-4]+[[:space:]]+[a-zA-Z]+)([[:space:]]*[,]*[[:space:]]*))*\) should match any inputs to functions, | |
# \2 means the second group is the name, |
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 lx | |
import lxu | |
# get the current active scene and a channel read object, | |
scene = lx.object.Scene(lxu.select.SceneSelection().current()) | |
channel_read = lx.object.ChannelRead(scene.Channels(None, 0)) | |
# using the channel read get the workplane position and rotation | |
workplane_position = scene.WorkPlanePosition(channel_read) | |
workplane_rotation = scene.WorkPlaneRotation(channel_read) |